mirror of https://github.com/encounter/SDL.git
Fixed UV texture coordinate scale when using GL_ARB_texture_non_power_of_two
This commit is contained in:
parent
f4d3303c9e
commit
877666e237
|
@ -150,7 +150,7 @@ static const char *shader_source[NUM_SHADERS][2] =
|
||||||
" yuv.x = texture2D(tex0, tcoord).r;\n"
|
" yuv.x = texture2D(tex0, tcoord).r;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" // Get the U and V values \n"
|
" // Get the U and V values \n"
|
||||||
" tcoord *= 0.5;\n"
|
" tcoord *= UVCoordScale;\n"
|
||||||
" yuv.y = texture2D(tex1, tcoord).r;\n"
|
" yuv.y = texture2D(tex1, tcoord).r;\n"
|
||||||
" yuv.z = texture2D(tex2, tcoord).r;\n"
|
" yuv.z = texture2D(tex2, tcoord).r;\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -201,7 +201,7 @@ static const char *shader_source[NUM_SHADERS][2] =
|
||||||
" yuv.x = texture2D(tex0, tcoord).r;\n"
|
" yuv.x = texture2D(tex0, tcoord).r;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" // Get the U and V values \n"
|
" // Get the U and V values \n"
|
||||||
" tcoord *= 0.5;\n"
|
" tcoord *= UVCoordScale;\n"
|
||||||
" yuv.yz = texture2D(tex1, tcoord).ra;\n"
|
" yuv.yz = texture2D(tex1, tcoord).ra;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" // Do the color transform \n"
|
" // Do the color transform \n"
|
||||||
|
@ -251,7 +251,7 @@ static const char *shader_source[NUM_SHADERS][2] =
|
||||||
" yuv.x = texture2D(tex0, tcoord).r;\n"
|
" yuv.x = texture2D(tex0, tcoord).r;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" // Get the U and V values \n"
|
" // Get the U and V values \n"
|
||||||
" tcoord *= 0.5;\n"
|
" tcoord *= UVCoordScale;\n"
|
||||||
" yuv.yz = texture2D(tex1, tcoord).ar;\n"
|
" yuv.yz = texture2D(tex1, tcoord).ar;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" // Do the color transform \n"
|
" // Do the color transform \n"
|
||||||
|
@ -318,7 +318,11 @@ CompileShaderProgram(GL_ShaderContext *ctx, int index, GL_ShaderData *data)
|
||||||
if (ctx->GL_ARB_texture_rectangle_supported) {
|
if (ctx->GL_ARB_texture_rectangle_supported) {
|
||||||
frag_defines =
|
frag_defines =
|
||||||
"#define sampler2D sampler2DRect\n"
|
"#define sampler2D sampler2DRect\n"
|
||||||
"#define texture2D texture2DRect\n";
|
"#define texture2D texture2DRect\n"
|
||||||
|
"#define UVCoordScale 0.5\n";
|
||||||
|
} else {
|
||||||
|
frag_defines =
|
||||||
|
"#define UVCoordScale 1.0\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create one program object to rule them all */
|
/* Create one program object to rule them all */
|
||||||
|
|
Loading…
Reference in New Issue