![]() |
GLSL shader fun! | ![]() |
Sam Lantinga
![]() |
![]() |
I just added GLSL shaders to the OpenGL rendering implementation!
You can disable them by setting the SDL_HINT_RENDER_OPENGL_SHADERS hint in your application, or the SDL_RENDER_OPENGL_SHADERS environment variable. On my hardware this ends up being about a 200-400 FPS increase in testsprite2: SDL_RENDER_OPENGL_SHADERS=0 ./testsprite2 OpenGL shaders: DISABLED 3051.84 frames per second ./testsprite2 OpenGL shaders: ENABLED 3428.22 frames per second Woot! :) I also noticed there's not a single example of using shaders with SDL that has full source code, so I added one: http://hg.libsdl.org/SDL/file/default/test/testshader.c See ya! -- -Sam Lantinga, Founder and CEO, Galaxy Gameworks _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||
|
![]() |
GLSL shader fun! | ![]() |
Paulo Pinto
Guest
![]() |
![]() |
Great work Sam! Congratulations!
What do you think about adding OpenCL support as well? In environments where OpenCL hardware is available, SDL can get better optimizations than using processor vector extensions, most likely. -- Paulo On Wed, Feb 9, 2011 at 7:39 AM, Sam Lantinga wrote:
|
||||||||||||
|
![]() |
GLSL shader fun! | ![]() |
Sam Lantinga
![]() |
![]() |
I'm not planning on doing it myself, but I'm happy to accept patches. :)
On Tue, Feb 8, 2011 at 11:53 PM, Paulo Pinto wrote:
-- -Sam Lantinga, Founder and CEO, Galaxy Gameworks |
||||||||||||||
|
![]() |
GLSL shader fun! | ![]() |
Sam Lantinga
![]() |
![]() |
I got a modest speed up with testsprite (using the 1.2 API) as well:
SDL_RENDER_OPENGL_SHADERS=0 ./testsprite 1329.16 frames per second SDL_RENDER_OPENGL_SHADERS=1 ./testsprite 1354.20 frames per second On Tue, Feb 8, 2011 at 10:39 PM, Sam Lantinga wrote:
-- -Sam Lantinga, Founder and CEO, Galaxy Gameworks |
||||||||||||
|
![]() |
GLSL shader fun! | ![]() |
Paulo Pinto
Guest
![]() |
![]() |
I might try to have a look at it.
It is always a good excuse to learn OpenCL :) On Wed, Feb 9, 2011 at 10:42 AM, Sam Lantinga wrote:
|
||||||||||||||||
|
![]() |
GLSL shader fun! | ![]() |
Mason Wheeler
Guest
![]() |
![]() |
Hmm? Doesn't SDL already use shaders internally for GL rendering? I see plenty of references to them in sdl_renderer_gl.
Interesting example, but once you do that how do you get an SDL_Texture out of it? _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||||||||||
|
![]() |
GLSL shader fun! | ![]() |
Andreas Schiffler
Guest
![]() |
![]() |
Cool!
Shouldn't/couldn't this code be in some common (SDL1.3) helper function? /* Check for shader support */ --Andreas On 2/8/11 10:39 PM, Sam Lantinga wrote:
_______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
GLSL shader fun! | ![]() |
Sam Lantinga
![]() |
![]() |
SDL used to use ARB shaders, and I've pulled them out and updated them with a more powerful GLSL framework.
SDL's internal shader support is just that - it's not intended to be used outside of the API. If you're using shaders directly, you shouldn't be using the rendering API. On Wed, Feb 9, 2011 at 6:03 AM, Mason Wheeler wrote:
-- -Sam Lantinga, Founder and CEO, Galaxy Gameworks |
||||||||||||||||||||
|
![]() |
GLSL shader fun! | ![]() |
Sam Lantinga
![]() |
![]() |
Seriously, if you keep trying to use the rendering API and mixing it with your own OpenGL, you're going to be frustrated. Just don't do it. :)
On Wed, Feb 9, 2011 at 10:04 AM, Sam Lantinga wrote:
-- -Sam Lantinga, Founder and CEO, Galaxy Gameworks |
||||||||||||||||||||||
|
![]() |
GLSL shader fun! | ![]() |
Mason Wheeler
Guest
![]() |
![]() |
Same thing as the rotation thing I was talking about earlier. The vast majority of my textures won't require any special shading, but there are some specific cases where I will require certain effects, particularly HSL transforms, that can't be done without the use of a shader. I'd really prefer not to have to throw out a very good, simple solution for the 99% case (the SDL rendering API) just to be able to support the 1% case.
From: Sam Lantinga Subject: Re: [SDL] GLSL shader fun! Seriously, if you keep trying to use the rendering API and mixing it with your own OpenGL, you're going to be frustrated. Just don't do it. :) On Wed, Feb 9, 2011 at 10:04 AM, Sam Lantinga wrote:
-- -Sam Lantinga, Founder and CEO, Galaxy Gameworks |
||||||||||||||||||||||
|
![]() |
GLSL shader fun! | ![]() |
Sam Lantinga
![]() |
![]() |
Okay, fair enough. :)
On Wed, Feb 9, 2011 at 11:08 AM, Mason Wheeler wrote:
-- -Sam Lantinga, Founder and CEO, Galaxy Gameworks |
||||||||||||||||||||||||
|