mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Fixed per-vertex colors (e.g. spritebatch colors) improperly applying gamma correction when the default shader is used and gamma correction is requested but not supported on OpenGL ES.
This commit is contained in:
@@ -1346,41 +1346,36 @@ int w_getShader(lua_State *L)
|
||||
int w_setDefaultShaderCode(lua_State *L)
|
||||
{
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
luaL_checktype(L, 2, LUA_TTABLE);
|
||||
|
||||
lua_getfield(L, 1, "opengl");
|
||||
lua_rawgeti(L, -1, 1);
|
||||
lua_rawgeti(L, -2, 2);
|
||||
lua_rawgeti(L, -3, 3);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
bool gammacorrect = i > 0;
|
||||
|
||||
Shader::ShaderSource openglcode;
|
||||
openglcode.vertex = luax_checkstring(L, -3);
|
||||
openglcode.pixel = luax_checkstring(L, -2);
|
||||
for (int renderer = 0; renderer < Graphics::RENDERER_MAX_ENUM; renderer++)
|
||||
{
|
||||
const char *lang = renderer == Graphics::RENDERER_OPENGLES ? "glsles" : "glsl";
|
||||
|
||||
Shader::ShaderSource openglVideocode;
|
||||
openglVideocode.vertex = luax_checkstring(L, -3);
|
||||
openglVideocode.pixel = luax_checkstring(L, -1);
|
||||
lua_getfield(L, i + 1, lang);
|
||||
|
||||
lua_pop(L, 4);
|
||||
lua_getfield(L, -1, "vertex");
|
||||
lua_getfield(L, -2, "pixel");
|
||||
lua_getfield(L, -3, "videopixel");
|
||||
|
||||
lua_getfield(L, 1, "opengles");
|
||||
lua_rawgeti(L, -1, 1);
|
||||
lua_rawgeti(L, -2, 2);
|
||||
lua_rawgeti(L, -3, 3);
|
||||
Shader::ShaderSource code;
|
||||
code.vertex = luax_checkstring(L, -3);
|
||||
code.pixel = luax_checkstring(L, -2);
|
||||
|
||||
Shader::ShaderSource openglescode;
|
||||
openglescode.vertex = luax_checkstring(L, -3);
|
||||
openglescode.pixel = luax_checkstring(L, -2);
|
||||
Shader::ShaderSource videocode;
|
||||
videocode.vertex = luax_checkstring(L, -3);
|
||||
videocode.pixel = luax_checkstring(L, -1);
|
||||
|
||||
Shader::ShaderSource openglesVideocode;
|
||||
openglesVideocode.vertex = luax_checkstring(L, -3);
|
||||
openglesVideocode.pixel = luax_checkstring(L, -1);
|
||||
lua_pop(L, 4);
|
||||
|
||||
lua_pop(L, 4);
|
||||
|
||||
Shader::defaultCode[Graphics::RENDERER_OPENGL] = openglcode;
|
||||
Shader::defaultCode[Graphics::RENDERER_OPENGLES] = openglescode;
|
||||
Shader::defaultVideoCode[Graphics::RENDERER_OPENGL] = openglVideocode;
|
||||
Shader::defaultVideoCode[Graphics::RENDERER_OPENGLES] = openglesVideocode;
|
||||
Shader::defaultCode[renderer][i] = code;
|
||||
Shader::defaultVideoCode[renderer][i] = videocode;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user