-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GSoC 2019] RetroPlayer: OpenGL back-end for shaders #114
base: feature_shaders_gl
Are you sure you want to change the base?
[GSoC 2019] RetroPlayer: OpenGL back-end for shaders #114
Conversation
e4c7260
to
e6e3dab
Compare
@KostasAndrianos can you cherry-pick these 7 commits? 327d997~7...327d997 |
f5e103b
to
def1361
Compare
|
||
unsigned int numPasses = static_cast<unsigned int>(m_passes.size()); | ||
|
||
for (unsigned shaderIdx = 0; shaderIdx < numPasses; ++shaderIdx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines from here to 267 are copied as-is from D3D and should be moved to common code since they're not backend specific. Probably just a method with the passes as input and the scaled size as output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, will do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there's lots of places where common code can be factored out. The good news is duplication got us this far, and now these places are easy to find.
79b1e74
to
d23157e
Compare
@@ -76,6 +85,8 @@ namespace RETRO | |||
|
|||
virtual void Render(uint8_t alpha); | |||
|
|||
std::map<CRenderBufferOpenGL*, std::unique_ptr<RenderBufferTextures>> m_RBTexturesMap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing the header <memory>
; added in gusandrianos#2
if (it != m_RBTexturesMap.end()) | ||
{ | ||
rbTextures = it->second.get(); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style infraction; fixed in gusandrianos#2
e461396
to
db8f7fc
Compare
namespace KODI | ||
{ | ||
namespace RETRO | ||
{ | ||
class CRenderContext; | ||
class CRenderBufferOpenGL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alphabetize to reduce likelihood of git conflicts
7d3fc5e
to
7368539
Compare
d58a368
to
b80fd1e
Compare
ecb8114
to
b8b6546
Compare
b8b6546
to
f26aa57
Compare
b80fd1e
to
341f52b
Compare
@gusandrianos Hi there. It's been years, but I thought you might be interested to see our fixes to your code. Also any comments would be welcome. Since the code seems well-structured, the changes are mostly small. If you've got any comments on the fixes, you can write it here or in the forum. Thank you. |
@KOPRajs Thanks a lot for taking the time to do these changes! I am extremely rusty on my C++ and OpenGL but the changes look good as far as I can tell. |
Just a note, I rebased shaders again for the Nth time in 7 years, and the work is really a drain. I'm looking to merge shaders into master for v22, even if it's not perfect. Expect a whopper PR with everything shaders in the upcoming future. |
@garbear Could you please try to fix the regression mentioned in the following post before the PR? The NTSC shaders were working fine in RP 19.4 build for Windows. It is a regression introduced in RP 20.0 alpha2. It is likely that it was caused by the move of the shader files to the game.shader.preset addon. It seems that RP is simply trying to find the shader includes in the original location (probably the path needs to be fixed). Unfortunately, I do not have the Windows development environment available anymore. |
Will look into it when I get a chance |
Description
This PR extends the functionality #86 brought to RetroPlayer by introducing support for other platforms through an OpenGL implementation.
The code in this PR is part of this GSoC project
In short, this code adds support for multi-pass shader presets, as defined in the libretro spec, which opens a whole new world of customization to the look and feel of games, through the massive amount of presets available in this format.
While the spec is written with cg shaders in mind, it is also extended to GLSL and slang shaders.
You can read more about the current state of my solution, what works and what doesn't(yet), here.
Motivation and Context
Shaders can be used to:
Of course, the list goes on. Most importantly, shaders can be used to elevate the gameplay experience and make it more immersive. A game can either look like it's being displayed on a CRT or a Gameboy or an LCD monitor or be upscaled and viewed on a 4K monitor, the possibilities are endless.
Regarding the commits in this PR.
I should mention that the last commit that falls under the GSoC umbrella is this one. Anything that follows it should not be considered as part of the GSoC project.
Let's give you some context about each commit.
The first three commits are setting up the relevant parts of code for usage in the next commit.
The fourth commit contains all the work that involves the processing and rendering of the shader presets.
The fifth commit connects the code to RetroPlayer.
How Has This Been Tested?
I took a brute force approach by testing almost every preset in the glsl-shaders repo. It has only been tested on Linux and it is unknown if it works on other platforms that use OpenGL.
To test this code yourself
game.shader.presets
binary add-on/your/kodi/directory/addons/game.shader.presets/resources/libretro/glsl
ShaderPresetsDefault.xml
in the resources directory with this file. This is a temporary workaround, I will update the add-on to choose the correct file depending on the situation.Screenshots (if appropriate):
Here's a video that demonstrates what these changes do.
Types of change
Checklist: