Page 2 of 2

Re: Pixel Effect

Posted: Tue Jun 25, 2013 8:00 pm
by raidho36
'm not really sure what you mean by this
Shader should alter incoming data rather than generate it. Specifically with löve2d, fragment shader is definitely the wrong place to generate render data. It may be good for some sort of demoscene though, where doing such things is the whole point. But this is not what you do in games.

Re: Pixel Effect

Posted: Tue Jun 25, 2013 8:12 pm
by slime
raidho36 wrote:
'm not really sure what you mean by this
Shader should alter incoming data rather than generate it. Specifically with löve2d, fragment shader is definitely the wrong place to generate render data. It may be good for some sort of demoscene though, where doing such things is the whole point. But this is not what you do in games.
But why? As I said earlier, all a pixel shader does in the first place is generate a color (or a few colors, if you have multiple render targets) based on some code and inputs. You're 'generating data' regardless of what you do.

Now, if you have a very complex / arithmetic-heavy shader you'll likely run into performance problems, and in that case it would be beneficial to move things into textures or uniforms so you can be less ALU-bound, but that's not really related to what you're outputting from the shader.

Re: Pixel Effect

Posted: Tue Jun 25, 2013 9:10 pm
by raidho36
I propose that doing it by default is the right thing to do.

Re: Pixel Effect

Posted: Wed Jun 26, 2013 4:41 am
by batatinha
How can i know if the shade code is 1.0, 2.0 or 3.0?
Love recognize if the shader is above the requested version?

Re: Pixel Effect

Posted: Wed Jun 26, 2013 8:32 pm
by RedHot
Love2D is currently stuck with glsl 1.2 (that's OpenGL 2.1). You can recompile it to support other versions.

Glsl 1.2 isn't much but you should be ok with it for starters.

Re: Pixel Effect

Posted: Wed Jun 26, 2013 9:45 pm
by slime
RedHot wrote:Love2D is currently stuck with glsl 1.2 (that's OpenGL 2.1). You can recompile it to support other versions.

Glsl 1.2 isn't much but you should be ok with it for starters.
Well, there are only a few things in pixel shaders you can do in later versions that you can't do with GLSL 1.20 - and many of them also require additional CPU-side OpenGL code. :)

You can overwrite the love.graphics._effectCodeToGLSL function (love.graphics._shaderCodeToGLSL in 0.9.0) in Lua to use a later version, but I don't recommend it. You can also use GLSL extensions such as EXT_gpu_shader4 to enable some additional functionality on systems which support it, but you really need to know what you're doing for that.