[Glide64] Replace gl_Color with vFrontColor

This commit is contained in:
zilmar 2017-01-03 20:26:07 +11:00
parent f12484e0ca
commit 572c5d4ded
1 changed files with 41 additions and 42 deletions

View File

@ -76,8 +76,7 @@ static int a_combiner_ext = 0;
#define GLSL_VERSION "100"
#define SHADER_HEADER \
"#version " GLSL_VERSION " \n" \
"#define gl_Color vFrontColor \n"
"#version " GLSL_VERSION " \n"
#define SHADER_VARYING \
"varying highp vec4 vFrontColor; \n" \
@ -383,7 +382,7 @@ void compile_chroma_shader()
switch (chroma_other_alpha)
{
case GR_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_chroma, "float alpha = gl_Color.a; \n");
strcat(fragment_shader_chroma, "float alpha = vFrontColor.a; \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_chroma, "float alpha = ctexture1.a; \n");
@ -398,7 +397,7 @@ void compile_chroma_shader()
switch (chroma_other_color)
{
case GR_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_chroma, "vec4 color = vec4(vec3(gl_Color),alpha); \n");
strcat(fragment_shader_chroma, "vec4 color = vec4(vec3(vFrontColor),alpha); \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_chroma, "vec4 color = vec4(vec3(ctexture1),alpha); \n");
@ -685,7 +684,7 @@ void writeGLSLColorOther(int other)
switch (other)
{
case GR_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_color_combiner, "vec4 color_other = gl_Color; \n");
strcat(fragment_shader_color_combiner, "vec4 color_other = vFrontColor; \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_color_combiner, "vec4 color_other = ctexture1; \n");
@ -703,7 +702,7 @@ void writeGLSLColorLocal(int local)
switch (local)
{
case GR_COMBINE_LOCAL_ITERATED:
strcat(fragment_shader_color_combiner, "vec4 color_local = gl_Color; \n");
strcat(fragment_shader_color_combiner, "vec4 color_local = vFrontColor; \n");
break;
case GR_COMBINE_LOCAL_CONSTANT:
strcat(fragment_shader_color_combiner, "vec4 color_local = constant_color; \n");
@ -897,7 +896,7 @@ void writeGLSLAlphaOther(int other)
switch (other)
{
case GR_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_alpha_combiner, "float alpha_other = gl_Color.a; \n");
strcat(fragment_shader_alpha_combiner, "float alpha_other = vFrontColor.a; \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_alpha_combiner, "float alpha_other = ctexture1.a; \n");
@ -915,7 +914,7 @@ void writeGLSLAlphaLocal(int local)
switch (local)
{
case GR_COMBINE_LOCAL_ITERATED:
strcat(fragment_shader_alpha_combiner, "float alpha_local = gl_Color.a; \n");
strcat(fragment_shader_alpha_combiner, "float alpha_local = vFrontColor.a; \n");
break;
case GR_COMBINE_LOCAL_CONSTANT:
strcat(fragment_shader_alpha_combiner, "float alpha_local = constant_color.a; \n");
@ -1805,10 +1804,10 @@ FxU32 shift, FxBool invert)
strcat(fragment_shader_color_combiner, "vec4 cs_a = constant_color; \n");
break;
case GR_CMBX_ITALPHA:
strcat(fragment_shader_color_combiner, "vec4 cs_a = vec4(gl_Color.a); \n");
strcat(fragment_shader_color_combiner, "vec4 cs_a = vec4(vFrontColor.a); \n");
break;
case GR_CMBX_ITRGB:
strcat(fragment_shader_color_combiner, "vec4 cs_a = gl_Color; \n");
strcat(fragment_shader_color_combiner, "vec4 cs_a = vFrontColor; \n");
break;
case GR_CMBX_TEXTURE_RGB:
strcat(fragment_shader_color_combiner, "vec4 cs_a = ctexture1; \n");
@ -1852,10 +1851,10 @@ FxU32 shift, FxBool invert)
strcat(fragment_shader_color_combiner, "vec4 cs_b = constant_color; \n");
break;
case GR_CMBX_ITALPHA:
strcat(fragment_shader_color_combiner, "vec4 cs_b = vec4(gl_Color.a); \n");
strcat(fragment_shader_color_combiner, "vec4 cs_b = vec4(vFrontColor.a); \n");
break;
case GR_CMBX_ITRGB:
strcat(fragment_shader_color_combiner, "vec4 cs_b = gl_Color; \n");
strcat(fragment_shader_color_combiner, "vec4 cs_b = vFrontColor; \n");
break;
case GR_CMBX_TEXTURE_RGB:
strcat(fragment_shader_color_combiner, "vec4 cs_b = ctexture1; \n");
@ -1908,10 +1907,10 @@ FxU32 shift, FxBool invert)
strcat(fragment_shader_color_combiner, "vec4 c_c = constant_color; \n");
break;
case GR_CMBX_ITALPHA:
strcat(fragment_shader_color_combiner, "vec4 c_c = vec4(gl_Color.a); \n");
strcat(fragment_shader_color_combiner, "vec4 c_c = vec4(vFrontColor.a); \n");
break;
case GR_CMBX_ITRGB:
strcat(fragment_shader_color_combiner, "vec4 c_c = gl_Color; \n");
strcat(fragment_shader_color_combiner, "vec4 c_c = vFrontColor; \n");
break;
case GR_CMBX_TEXTURE_RGB:
strcat(fragment_shader_color_combiner, "vec4 c_c = ctexture1; \n");
@ -1939,7 +1938,7 @@ FxU32 shift, FxBool invert)
strcat(fragment_shader_color_combiner, "vec4 c_d = ctexture1; \n");
break;
case GR_CMBX_ITRGB:
strcat(fragment_shader_color_combiner, "vec4 c_d = gl_Color; \n");
strcat(fragment_shader_color_combiner, "vec4 c_d = vFrontColor; \n");
break;
default:
WriteTrace(TraceGlitch, TraceWarning, "grColorCombineExt : d = %x", d);
@ -1984,7 +1983,7 @@ FxU32 shift, FxBool invert)
strcat(fragment_shader_alpha_combiner, "float as_a = constant_color.a; \n");
break;
case GR_CMBX_ITALPHA:
strcat(fragment_shader_alpha_combiner, "float as_a = gl_Color.a; \n");
strcat(fragment_shader_alpha_combiner, "float as_a = vFrontColor.a; \n");
break;
default:
WriteTrace(TraceGlitch, TraceWarning, "grAlphaCombineExt : a = %x", a);
@ -2022,7 +2021,7 @@ FxU32 shift, FxBool invert)
strcat(fragment_shader_alpha_combiner, "float as_b = constant_color.a; \n");
break;
case GR_CMBX_ITALPHA:
strcat(fragment_shader_alpha_combiner, "float as_b = gl_Color.a; \n");
strcat(fragment_shader_alpha_combiner, "float as_b = vFrontColor.a; \n");
break;
default:
WriteTrace(TraceGlitch, TraceWarning, "grAlphaCombineExt : b = %x", b);
@ -2069,7 +2068,7 @@ FxU32 shift, FxBool invert)
strcat(fragment_shader_alpha_combiner, "float a_c = constant_color.a; \n");
break;
case GR_CMBX_ITALPHA:
strcat(fragment_shader_alpha_combiner, "float a_c = gl_Color.a; \n");
strcat(fragment_shader_alpha_combiner, "float a_c = vFrontColor.a; \n");
break;
default:
WriteTrace(TraceGlitch, TraceWarning, "grAlphaCombineExt : c = %x", c);
@ -2152,15 +2151,15 @@ FxU32 shift, FxBool invert)
break;
case GR_CMBX_ITALPHA:
if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctex0s_a = vec4(gl_Color.a); \n");
strcat(fragment_shader_texture0, "vec4 ctex0s_a = vec4(vFrontColor.a); \n");
else
strcat(fragment_shader_texture1, "vec4 ctex1s_a = vec4(gl_Color.a); \n");
strcat(fragment_shader_texture1, "vec4 ctex1s_a = vec4(vFrontColor.a); \n");
break;
case GR_CMBX_ITRGB:
if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctex0s_a = gl_Color; \n");
strcat(fragment_shader_texture0, "vec4 ctex0s_a = vFrontColor; \n");
else
strcat(fragment_shader_texture1, "vec4 ctex1s_a = gl_Color; \n");
strcat(fragment_shader_texture1, "vec4 ctex1s_a = vFrontColor; \n");
break;
case GR_CMBX_LOCAL_TEXTURE_ALPHA:
if (num_tex == 0)
@ -2250,15 +2249,15 @@ FxU32 shift, FxBool invert)
break;
case GR_CMBX_ITALPHA:
if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctex0s_b = vec4(gl_Color.a); \n");
strcat(fragment_shader_texture0, "vec4 ctex0s_b = vec4(vFrontColor.a); \n");
else
strcat(fragment_shader_texture1, "vec4 ctex1s_b = vec4(gl_Color.a); \n");
strcat(fragment_shader_texture1, "vec4 ctex1s_b = vec4(vFrontColor.a); \n");
break;
case GR_CMBX_ITRGB:
if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctex0s_b = gl_Color; \n");
strcat(fragment_shader_texture0, "vec4 ctex0s_b = vFrontColor; \n");
else
strcat(fragment_shader_texture1, "vec4 ctex1s_b = gl_Color; \n");
strcat(fragment_shader_texture1, "vec4 ctex1s_b = vFrontColor; \n");
break;
case GR_CMBX_LOCAL_TEXTURE_ALPHA:
if (num_tex == 0)
@ -2360,15 +2359,15 @@ FxU32 shift, FxBool invert)
break;
case GR_CMBX_ITRGB:
if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctex0_c = gl_Color; \n");
strcat(fragment_shader_texture0, "vec4 ctex0_c = vFrontColor; \n");
else
strcat(fragment_shader_texture1, "vec4 ctex1_c = gl_Color; \n");
strcat(fragment_shader_texture1, "vec4 ctex1_c = vFrontColor; \n");
break;
case GR_CMBX_ITALPHA:
if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctex0_c = vec4(gl_Color.a); \n");
strcat(fragment_shader_texture0, "vec4 ctex0_c = vec4(vFrontColor.a); \n");
else
strcat(fragment_shader_texture1, "vec4 ctex1_c = vec4(gl_Color.a); \n");
strcat(fragment_shader_texture1, "vec4 ctex1_c = vec4(vFrontColor.a); \n");
break;
case GR_CMBX_LOCAL_TEXTURE_ALPHA:
if (num_tex == 0)
@ -2438,9 +2437,9 @@ FxU32 shift, FxBool invert)
break;
case GR_CMBX_ITRGB:
if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctex0_d = gl_Color; \n");
strcat(fragment_shader_texture0, "vec4 ctex0_d = vFrontColor; \n");
else
strcat(fragment_shader_texture1, "vec4 ctex1_d = gl_Color; \n");
strcat(fragment_shader_texture1, "vec4 ctex1_d = vFrontColor; \n");
break;
case GR_CMBX_LOCAL_TEXTURE_ALPHA:
if (num_tex == 0)
@ -2507,9 +2506,9 @@ FxU32 shift, FxBool invert)
{
case GR_CMBX_ITALPHA:
if (num_tex == 0)
strcat(fragment_shader_texture0, "ctex0s_a.a = gl_Color.a; \n");
strcat(fragment_shader_texture0, "ctex0s_a.a = vFrontColor.a; \n");
else
strcat(fragment_shader_texture1, "ctex1s_a.a = gl_Color.a; \n");
strcat(fragment_shader_texture1, "ctex1s_a.a = vFrontColor.a; \n");
break;
case GR_CMBX_LOCAL_TEXTURE_ALPHA:
if (num_tex == 0)
@ -2575,9 +2574,9 @@ FxU32 shift, FxBool invert)
{
case GR_CMBX_ITALPHA:
if (num_tex == 0)
strcat(fragment_shader_texture0, "ctex0s_b.a = gl_Color.a; \n");
strcat(fragment_shader_texture0, "ctex0s_b.a = vFrontColor.a; \n");
else
strcat(fragment_shader_texture1, "ctex1s_b.a = gl_Color.a; \n");
strcat(fragment_shader_texture1, "ctex1s_b.a = vFrontColor.a; \n");
break;
case GR_CMBX_LOCAL_TEXTURE_ALPHA:
if (num_tex == 0)
@ -2661,9 +2660,9 @@ FxU32 shift, FxBool invert)
break;
case GR_CMBX_ITALPHA:
if (num_tex == 0)
strcat(fragment_shader_texture0, "ctex0_c.a = gl_Color.a; \n");
strcat(fragment_shader_texture0, "ctex0_c.a = vFrontColor.a; \n");
else
strcat(fragment_shader_texture1, "ctex1_c.a = gl_Color.a; \n");
strcat(fragment_shader_texture1, "ctex1_c.a = vFrontColor.a; \n");
break;
case GR_CMBX_LOCAL_TEXTURE_ALPHA:
if (num_tex == 0)
@ -2715,15 +2714,15 @@ FxU32 shift, FxBool invert)
break;
case GR_CMBX_ITALPHA:
if (num_tex == 0)
strcat(fragment_shader_texture0, "ctex0_d.a = gl_Color.a; \n");
strcat(fragment_shader_texture0, "ctex0_d.a = vFrontColor.a; \n");
else
strcat(fragment_shader_texture1, "ctex1_d.a = gl_Color.a; \n");
strcat(fragment_shader_texture1, "ctex1_d.a = vFrontColor.a; \n");
break;
case GR_CMBX_ITRGB:
if (num_tex == 0)
strcat(fragment_shader_texture0, "ctex0_d.a = gl_Color.a; \n");
strcat(fragment_shader_texture0, "ctex0_d.a = vFrontColor.a; \n");
else
strcat(fragment_shader_texture1, "ctex1_d.a = gl_Color.a; \n");
strcat(fragment_shader_texture1, "ctex1_d.a = vFrontColor.a; \n");
break;
case GR_CMBX_LOCAL_TEXTURE_ALPHA:
if (num_tex == 0)