[Videp] Change GrCombineFunction_t to gfxCombineFunction_t

This commit is contained in:
zilmar 2017-07-26 08:43:35 +10:00
parent 5ca20eb95a
commit 372a7ec1f5
12 changed files with 989 additions and 964 deletions

File diff suppressed because one or more lines are too long

View File

@ -45,10 +45,16 @@
typedef struct typedef struct
{ {
uint32_t ccolor; // constant color to set at the end, color and alpha uint32_t ccolor; // constant color to set at the end, color and alpha
uint32_t c_fnc, c_fac, c_loc, c_oth; // gfxColorCombine flags gfxCombineFunction_t c_fnc;
uint32_t a_fnc, a_fac, a_loc, a_oth; // gfxAlphaCombine flags uint32_t c_fac, c_loc, c_oth; // gfxColorCombine flags
uint32_t tex, tmu0_func, tmu0_fac, tmu0_invert, tmu1_func, tmu1_fac, tmu1_invert; gfxCombineFunction_t a_fnc;
uint32_t tmu0_a_func, tmu0_a_fac, tmu0_a_invert, tmu1_a_func, tmu1_a_fac, tmu1_a_invert; gfxCombineFunction_t tmu0_func;
gfxCombineFunction_t tmu1_func;
gfxCombineFunction_t tmu0_a_func;
gfxCombineFunction_t tmu1_a_func;
uint32_t a_fac, a_loc, a_oth; // gfxAlphaCombine flags
uint32_t tex, tmu0_fac, tmu0_invert, tmu1_fac, tmu1_invert;
uint32_t tmu0_a_fac, tmu0_a_invert, tmu1_a_fac, tmu1_a_invert;
int dc0_lodbias, dc1_lodbias; int dc0_lodbias, dc1_lodbias;
uint8_t dc0_detailscale, dc1_detailscale; uint8_t dc0_detailscale, dc1_detailscale;
float dc0_detailmax, dc1_detailmax; float dc0_detailmax, dc1_detailmax;

View File

@ -23,8 +23,8 @@ static gfxChipID_t SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaqu
if (voodoo.tmem_ptr[GFX_TMU0] + texture_size < voodoo.tex_max_addr[0]) if (voodoo.tmem_ptr[GFX_TMU0] + texture_size < voodoo.tex_max_addr[0])
{ {
tmu = GFX_TMU0; tmu = GFX_TMU0;
gfxTexCombine(GFX_TMU1, GR_COMBINE_FUNCTION_NONE, GR_COMBINE_FACTOR_NONE, GR_COMBINE_FUNCTION_NONE, GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); gfxTexCombine(GFX_TMU1, GFX_COMBINE_FUNCTION_NONE, GR_COMBINE_FACTOR_NONE, GFX_COMBINE_FUNCTION_NONE, GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
gfxTexCombine(GFX_TMU0, GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); gfxTexCombine(GFX_TMU0, GFX_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GFX_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
} }
else else
{ {
@ -32,16 +32,16 @@ static gfxChipID_t SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaqu
ClearCache(); ClearCache();
tmu = GFX_TMU1; tmu = GFX_TMU1;
gfxTexCombine(GFX_TMU1, gfxTexCombine(GFX_TMU1,
GR_COMBINE_FUNCTION_LOCAL, GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL, GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE,
FXFALSE); FXFALSE);
gfxTexCombine(GFX_TMU0, gfxTexCombine(GFX_TMU0,
GR_COMBINE_FUNCTION_SCALE_OTHER, GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_FUNCTION_SCALE_OTHER, GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
FXFALSE, FXFALSE,
FXFALSE); FXFALSE);
@ -52,13 +52,13 @@ static gfxChipID_t SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaqu
GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP,
GR_TEXTURECLAMP_CLAMP); GR_TEXTURECLAMP_CLAMP);
// gfxConstantColorValue (0xFFFFFFFF); // gfxConstantColorValue (0xFFFFFFFF);
gfxColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,
// GR_COMBINE_OTHER_CONSTANT, // GR_COMBINE_OTHER_CONSTANT,
FXFALSE); FXFALSE);
gfxAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,
@ -397,7 +397,7 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
uint32_t tex_size = gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info); uint32_t tex_size = gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info);
gfxChipID_t tmu = SetupFBtoScreenCombiner(tex_size*width256*height256, fb_info.opaque); gfxChipID_t tmu = SetupFBtoScreenCombiner(tex_size*width256*height256, fb_info.opaque);
gfxConstantColorValue(rdp.fog_color); gfxConstantColorValue(rdp.fog_color);
gfxColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_CONSTANT, GR_COMBINE_OTHER_CONSTANT,
@ -467,12 +467,12 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
t_info.smallLodLog2 = t_info.largeLodLog2 = LOD; t_info.smallLodLog2 = t_info.largeLodLog2 = LOD;
t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1; t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
gfxConstantColorValue(rdp.fog_color); gfxConstantColorValue(rdp.fog_color);
gfxColorCombine(GR_COMBINE_FUNCTION_LOCAL, gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE, GR_COMBINE_OTHER_NONE,
FXFALSE); FXFALSE);
gfxAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,
@ -485,16 +485,16 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
gfxDepthMask(FXFALSE); gfxDepthMask(FXFALSE);
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GR_CULL_DISABLE);
gfxTexCombine(GFX_TMU1, gfxTexCombine(GFX_TMU1,
GR_COMBINE_FUNCTION_NONE, GFX_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_NONE, GFX_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE,
FXFALSE); FXFALSE);
gfxTexCombine(GFX_TMU0, gfxTexCombine(GFX_TMU0,
GR_COMBINE_FUNCTION_LOCAL, GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL, GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE,
FXFALSE); FXFALSE);
@ -579,7 +579,7 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
gfxChipID_t tmu = SetupFBtoScreenCombiner(gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque); gfxChipID_t tmu = SetupFBtoScreenCombiner(gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
gfxConstantColorValue(rdp.fog_color); gfxConstantColorValue(rdp.fog_color);
gfxColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_CONSTANT, GR_COMBINE_OTHER_CONSTANT,

View File

@ -784,7 +784,7 @@ void writeGLSLColorFactor(int factor, int local, int need_local, int other, int
} }
} }
void gfxColorCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert) void gfxColorCombine(gfxCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert)
{ {
WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert); WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert);
static int last_function = 0; static int last_function = 0;
@ -810,58 +810,58 @@ void gfxColorCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrC
strcpy(fragment_shader_color_combiner, ""); strcpy(fragment_shader_color_combiner, "");
switch (function) switch (function)
{ {
case GR_COMBINE_FUNCTION_ZERO: case GFX_COMBINE_FUNCTION_ZERO:
strcat(fragment_shader_color_combiner, "gl_FragColor = vec4(0.0); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = vec4(0.0); \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL: case GFX_COMBINE_FUNCTION_LOCAL:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_local; \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_local; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_LOCAL_ALPHA:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
strcat(fragment_shader_color_combiner, "gl_FragColor = vec4(color_local.a); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = vec4(color_local.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER: case GFX_COMBINE_FUNCTION_SCALE_OTHER:
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 1, other, 0); writeGLSLColorFactor(factor, local, 1, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other; \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 0, other, 0); writeGLSLColorFactor(factor, local, 0, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other + color_local; \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other + color_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 0, other, 0); writeGLSLColorFactor(factor, local, 0, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other + vec4(color_local.a); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other + vec4(color_local.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 0, other, 0); writeGLSLColorFactor(factor, local, 0, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 0, other, 0); writeGLSLColorFactor(factor, local, 0, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local) + color_local; \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local) + color_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 0, other, 0); writeGLSLColorFactor(factor, local, 0, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local) + vec4(color_local.a); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local) + vec4(color_local.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorFactor(factor, local, 0, other, 1); writeGLSLColorFactor(factor, local, 0, other, 1);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (-color_local) + color_local; \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (-color_local) + color_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorFactor(factor, local, 0, other, 1); writeGLSLColorFactor(factor, local, 0, other, 1);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (-color_local) + vec4(color_local.a); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (-color_local) + vec4(color_local.a); \n");
@ -989,7 +989,7 @@ void writeGLSLAlphaFactor(int factor, int local, int need_local, int other, int
} }
} }
void gfxAlphaCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert) void gfxAlphaCombine(gfxCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert)
{ {
WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert); WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert);
static int last_function = 0; static int last_function = 0;
@ -1016,58 +1016,58 @@ void gfxAlphaCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrC
switch (function) switch (function)
{ {
case GR_COMBINE_FUNCTION_ZERO: case GFX_COMBINE_FUNCTION_ZERO:
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = 0.0; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = 0.0; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL: case GFX_COMBINE_FUNCTION_LOCAL:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_LOCAL_ALPHA:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER: case GFX_COMBINE_FUNCTION_SCALE_OTHER:
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 1, other, 0); writeGLSLAlphaFactor(factor, local, 1, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 0, other, 0); writeGLSLAlphaFactor(factor, local, 0, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other + alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 0, other, 0); writeGLSLAlphaFactor(factor, local, 0, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other + alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 0, other, 0); writeGLSLAlphaFactor(factor, local, 0, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local); \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 0, other, 0); writeGLSLAlphaFactor(factor, local, 0, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local) + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local) + alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 0, other, 0); writeGLSLAlphaFactor(factor, local, 0, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local) + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local) + alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaFactor(factor, local, 0, other, 1); writeGLSLAlphaFactor(factor, local, 0, other, 1);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (-alpha_local) + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (-alpha_local) + alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaFactor(factor, local, 0, other, 1); writeGLSLAlphaFactor(factor, local, 0, other, 1);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (-alpha_local) + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (-alpha_local) + alpha_local; \n");
@ -1218,7 +1218,7 @@ void writeGLSLTextureAlphaFactor(int num_tex, int factor)
} }
} }
void gfxTexCombine(gfxChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, bool rgb_invert, bool alpha_invert) void gfxTexCombine(gfxChipID_t tmu, gfxCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, gfxCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, bool rgb_invert, bool alpha_invert)
{ {
WriteTrace(TraceGlitch, TraceDebug, "tmu: %d rgb_function: %d rgb_factor: %d alpha_function: %d alpha_factor: %d rgb_invert: %d alpha_invert: %d", tmu, rgb_function, rgb_factor, alpha_function, alpha_factor, rgb_invert, alpha_invert); WriteTrace(TraceGlitch, TraceDebug, "tmu: %d rgb_function: %d rgb_factor: %d alpha_function: %d alpha_factor: %d rgb_invert: %d alpha_invert: %d", tmu, rgb_function, rgb_factor, alpha_function, alpha_factor, rgb_invert, alpha_invert);
int num_tex; int num_tex;
@ -1280,74 +1280,74 @@ void gfxTexCombine(gfxChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineF
switch (rgb_function) switch (rgb_function)
{ {
case GR_COMBINE_FUNCTION_ZERO: case GFX_COMBINE_FUNCTION_ZERO:
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = vec4(0.0); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = vec4(0.0); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = vec4(0.0); \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = vec4(0.0); \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL: case GFX_COMBINE_FUNCTION_LOCAL:
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = readtex0; \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = readtex0; \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = readtex1; \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = readtex1; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_LOCAL_ALPHA:
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = vec4(readtex0.a); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = vec4(readtex0.a); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = vec4(readtex1.a); \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = vec4(readtex1.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER: case GFX_COMBINE_FUNCTION_SCALE_OTHER:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0; \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0) + readtex0; \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0) + readtex0; \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0 + readtex1; \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0 + readtex1; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0) + vec4(readtex0.a); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0) + vec4(readtex0.a); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0 + vec4(readtex1.a); \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0 + vec4(readtex1.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1); \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0) + readtex0; \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0) + readtex0; \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1) + readtex1; \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1) + readtex1; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0) + vec4(readtex0.a); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0) + vec4(readtex0.a); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1) + vec4(readtex1.a); \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1) + vec4(readtex1.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (-readtex0) + readtex0; \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (-readtex0) + readtex0; \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (-readtex1) + readtex1; \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (-readtex1) + readtex1; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (-readtex0) + vec4(readtex0.a); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (-readtex0) + vec4(readtex0.a); \n");
@ -1378,68 +1378,68 @@ void gfxTexCombine(gfxChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineF
else else
strcat(fragment_shader_texture1, "ctexture1.a = 0.0; \n"); strcat(fragment_shader_texture1, "ctexture1.a = 0.0; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL: case GFX_COMBINE_FUNCTION_LOCAL:
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_LOCAL_ALPHA:
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER: case GFX_COMBINE_FUNCTION_SCALE_OTHER:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0 + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0 + readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a + readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a + readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0 + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0 + readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a + readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a + readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a); \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a); \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a); \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a) + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a) + readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a) + readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a) + readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a) + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a) + readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a) + readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a) + readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (-readtex0.a) + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (-readtex0.a) + readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (-readtex1.a) + readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (-readtex1.a) + readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (-readtex0.a) + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (-readtex0.a) + readtex0.a; \n");

View File

@ -722,7 +722,7 @@ void writeGLSLColorFactor(int factor, int local, int need_local, int other, int
} }
} }
void gfxColorCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert) void gfxColorCombine(gfxCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert)
{ {
WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert); WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert);
@ -749,58 +749,58 @@ void gfxColorCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrC
strcpy(fragment_shader_color_combiner, ""); strcpy(fragment_shader_color_combiner, "");
switch (function) switch (function)
{ {
case GR_COMBINE_FUNCTION_ZERO: case GFX_COMBINE_FUNCTION_ZERO:
strcat(fragment_shader_color_combiner, "gl_FragColor = vec4(0.0); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = vec4(0.0); \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL: case GFX_COMBINE_FUNCTION_LOCAL:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_local; \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_local; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_LOCAL_ALPHA:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
strcat(fragment_shader_color_combiner, "gl_FragColor = vec4(color_local.a); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = vec4(color_local.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER: case GFX_COMBINE_FUNCTION_SCALE_OTHER:
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 1, other, 0); writeGLSLColorFactor(factor, local, 1, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other; \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 0, other, 0); writeGLSLColorFactor(factor, local, 0, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other + color_local; \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other + color_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 0, other, 0); writeGLSLColorFactor(factor, local, 0, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other + vec4(color_local.a); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * color_other + vec4(color_local.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 0, other, 0); writeGLSLColorFactor(factor, local, 0, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 0, other, 0); writeGLSLColorFactor(factor, local, 0, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local) + color_local; \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local) + color_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorOther(other); writeGLSLColorOther(other);
writeGLSLColorFactor(factor, local, 0, other, 0); writeGLSLColorFactor(factor, local, 0, other, 0);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local) + vec4(color_local.a); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (color_other - color_local) + vec4(color_local.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorFactor(factor, local, 0, other, 1); writeGLSLColorFactor(factor, local, 0, other, 1);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (-color_local) + color_local; \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (-color_local) + color_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLColorLocal(local); writeGLSLColorLocal(local);
writeGLSLColorFactor(factor, local, 0, other, 1); writeGLSLColorFactor(factor, local, 0, other, 1);
strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (-color_local) + vec4(color_local.a); \n"); strcat(fragment_shader_color_combiner, "gl_FragColor = color_factor * (-color_local) + vec4(color_local.a); \n");
@ -926,7 +926,7 @@ void writeGLSLAlphaFactor(int factor, int local, int need_local, int other, int
} }
} }
void gfxAlphaCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert) void gfxAlphaCombine(gfxCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert)
{ {
WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert); WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert);
static int last_function = 0; static int last_function = 0;
@ -953,58 +953,58 @@ void gfxAlphaCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrC
switch (function) switch (function)
{ {
case GR_COMBINE_FUNCTION_ZERO: case GFX_COMBINE_FUNCTION_ZERO:
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = 0.0; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = 0.0; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL: case GFX_COMBINE_FUNCTION_LOCAL:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_LOCAL_ALPHA:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER: case GFX_COMBINE_FUNCTION_SCALE_OTHER:
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 1, other, 0); writeGLSLAlphaFactor(factor, local, 1, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 0, other, 0); writeGLSLAlphaFactor(factor, local, 0, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other + alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 0, other, 0); writeGLSLAlphaFactor(factor, local, 0, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * alpha_other + alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 0, other, 0); writeGLSLAlphaFactor(factor, local, 0, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local); \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 0, other, 0); writeGLSLAlphaFactor(factor, local, 0, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local) + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local) + alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaOther(other); writeGLSLAlphaOther(other);
writeGLSLAlphaFactor(factor, local, 0, other, 0); writeGLSLAlphaFactor(factor, local, 0, other, 0);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local) + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (alpha_other - alpha_local) + alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaFactor(factor, local, 0, other, 1); writeGLSLAlphaFactor(factor, local, 0, other, 1);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (-alpha_local) + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (-alpha_local) + alpha_local; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLAlphaLocal(local); writeGLSLAlphaLocal(local);
writeGLSLAlphaFactor(factor, local, 0, other, 1); writeGLSLAlphaFactor(factor, local, 0, other, 1);
strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (-alpha_local) + alpha_local; \n"); strcat(fragment_shader_alpha_combiner, "gl_FragColor.a = alpha_factor * (-alpha_local) + alpha_local; \n");
@ -1155,7 +1155,7 @@ void writeGLSLTextureAlphaFactor(int num_tex, int factor)
} }
} }
void gfxTexCombine(gfxChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, bool rgb_invert, bool alpha_invert) void gfxTexCombine(gfxChipID_t tmu, gfxCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, gfxCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, bool rgb_invert, bool alpha_invert)
{ {
WriteTrace(TraceGlitch, TraceDebug, "tmu: %d rgb_function: %d rgb_factor: %d alpha_function: %d alpha_factor: %d rgb_invert: %d alpha_invert: %d", tmu, rgb_function, rgb_factor, alpha_function, alpha_factor, rgb_invert, alpha_invert); WriteTrace(TraceGlitch, TraceDebug, "tmu: %d rgb_function: %d rgb_factor: %d alpha_function: %d alpha_factor: %d rgb_invert: %d alpha_invert: %d", tmu, rgb_function, rgb_factor, alpha_function, alpha_factor, rgb_invert, alpha_invert);
int num_tex; int num_tex;
@ -1217,74 +1217,74 @@ void gfxTexCombine(gfxChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineF
switch (rgb_function) switch (rgb_function)
{ {
case GR_COMBINE_FUNCTION_ZERO: case GFX_COMBINE_FUNCTION_ZERO:
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = vec4(0.0); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = vec4(0.0); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = vec4(0.0); \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = vec4(0.0); \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL: case GFX_COMBINE_FUNCTION_LOCAL:
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = readtex0; \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = readtex0; \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = readtex1; \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = readtex1; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_LOCAL_ALPHA:
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = vec4(readtex0.a); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = vec4(readtex0.a); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = vec4(readtex1.a); \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = vec4(readtex1.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER: case GFX_COMBINE_FUNCTION_SCALE_OTHER:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0; \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0) + readtex0; \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0) + readtex0; \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0 + readtex1; \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0 + readtex1; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0) + vec4(readtex0.a); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * vec4(0.0) + vec4(readtex0.a); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0 + vec4(readtex1.a); \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * ctexture0 + vec4(readtex1.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1); \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0) + readtex0; \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0) + readtex0; \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1) + readtex1; \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1) + readtex1; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0) + vec4(readtex0.a); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (vec4(0.0) - readtex0) + vec4(readtex0.a); \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1) + vec4(readtex1.a); \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (ctexture0 - readtex1) + vec4(readtex1.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (-readtex0) + readtex0; \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (-readtex0) + readtex0; \n");
else else
strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (-readtex1) + readtex1; \n"); strcat(fragment_shader_texture1, "vec4 ctexture1 = texture1_color_factor * (-readtex1) + readtex1; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLTextureColorFactor(num_tex, rgb_factor); writeGLSLTextureColorFactor(num_tex, rgb_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (-readtex0) + vec4(readtex0.a); \n"); strcat(fragment_shader_texture0, "vec4 ctexture0 = texture0_color_factor * (-readtex0) + vec4(readtex0.a); \n");
@ -1315,68 +1315,68 @@ void gfxTexCombine(gfxChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineF
else else
strcat(fragment_shader_texture1, "ctexture1.a = 0.0; \n"); strcat(fragment_shader_texture1, "ctexture1.a = 0.0; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL: case GFX_COMBINE_FUNCTION_LOCAL:
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_LOCAL_ALPHA:
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER: case GFX_COMBINE_FUNCTION_SCALE_OTHER:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0 + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0 + readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a + readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a + readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0 + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * 0.0 + readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a + readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * ctexture0.a + readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a); \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a); \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a); \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a); \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a) + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a) + readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a) + readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a) + readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a) + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (0.0 - readtex0.a) + readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a) + readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (ctexture0.a - readtex1.a) + readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (-readtex0.a) + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (-readtex0.a) + readtex0.a; \n");
else else
strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (-readtex1.a) + readtex1.a; \n"); strcat(fragment_shader_texture1, "ctexture1.a = texture1_alpha_factor * (-readtex1.a) + readtex1.a; \n");
break; break;
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: case GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
writeGLSLTextureAlphaFactor(num_tex, alpha_factor); writeGLSLTextureAlphaFactor(num_tex, alpha_factor);
if (num_tex == 0) if (num_tex == 0)
strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (-readtex0.a) + readtex0.a; \n"); strcat(fragment_shader_texture0, "ctexture0.a = texture0_alpha_factor * (-readtex0.a) + readtex0.a; \n");

View File

@ -23,9 +23,9 @@ void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, gfxLOD_t lodmin
uint32_t gfxTexMaxAddress(gfxChipID_t tmu); uint32_t gfxTexMaxAddress(gfxChipID_t tmu);
uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, gfxTexInfo *info); uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, gfxTexInfo *info);
void gfxConstantColorValue(gfxColor_t value); void gfxConstantColorValue(gfxColor_t value);
void gfxColorCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert); void gfxColorCombine(gfxCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert);
void gfxAlphaCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert); void gfxAlphaCombine(gfxCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert);
void gfxTexCombine(gfxChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, bool rgb_invert, bool alpha_invert); void gfxTexCombine(gfxChipID_t tmu, gfxCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, gfxCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, bool rgb_invert, bool alpha_invert);
void gfxAlphaBlendFunction(GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df); void gfxAlphaBlendFunction(GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df);
void gfxAlphaTestReferenceValue(gfxAlpha_t value); void gfxAlphaTestReferenceValue(gfxAlpha_t value);
void gfxAlphaTestFunction(GrCmpFnc_t function); void gfxAlphaTestFunction(GrCmpFnc_t function);

View File

@ -107,6 +107,25 @@ enum gfxAspectRatio_t
GFX_ASPECT_LOG2_1x8 = -3, /* 1W x 8H */ GFX_ASPECT_LOG2_1x8 = -3, /* 1W x 8H */
}; };
enum gfxCombineFunction_t
{
GFX_COMBINE_FUNCTION_ZERO = 0x0,
GFX_COMBINE_FUNCTION_NONE = GFX_COMBINE_FUNCTION_ZERO,
GFX_COMBINE_FUNCTION_LOCAL = 0x1,
GFX_COMBINE_FUNCTION_LOCAL_ALPHA = 0x2,
GFX_COMBINE_FUNCTION_SCALE_OTHER = 0x3,
GFX_COMBINE_FUNCTION_BLEND_OTHER = GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL = 0x4,
GFX_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA = 0x5,
GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL = 0x6,
GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL = 0x7,
GFX_COMBINE_FUNCTION_BLEND = GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
GFX_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA = 0x8,
GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL = 0x9,
GFX_COMBINE_FUNCTION_BLEND_LOCAL = GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL,
GFX_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA = 0x10,
};
enum GFX_CMBX enum GFX_CMBX
{ {
GFX_CMBX_ZERO = 0x00, GFX_CMBX_ZERO = 0x00,

View File

@ -323,13 +323,13 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
static gfxTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE) static gfxTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
{ {
gfxColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,
// GR_COMBINE_OTHER_CONSTANT, // GR_COMBINE_OTHER_CONSTANT,
FXFALSE); FXFALSE);
gfxAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,
@ -345,25 +345,25 @@ static gfxTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GR_CULL_DISABLE);
gfxFogMode(GR_FOG_DISABLE); gfxFogMode(GR_FOG_DISABLE);
gfxTextureFormat_t buf_format = (rdp.tbuff_tex) ? rdp.tbuff_tex->info.format : GFX_TEXFMT_RGB_565; gfxTextureFormat_t buf_format = (rdp.tbuff_tex) ? rdp.tbuff_tex->info.format : GFX_TEXFMT_RGB_565;
GrCombineFunction_t color_source = GR_COMBINE_FUNCTION_LOCAL; gfxCombineFunction_t color_source = GFX_COMBINE_FUNCTION_LOCAL;
if (!force_rgb && rdp.black_ci_index > 0 && rdp.black_ci_index <= rdp.copy_ci_index) if (!force_rgb && rdp.black_ci_index > 0 && rdp.black_ci_index <= rdp.copy_ci_index)
{ {
color_source = GR_COMBINE_FUNCTION_LOCAL_ALPHA; color_source = GFX_COMBINE_FUNCTION_LOCAL_ALPHA;
buf_format = GFX_TEXFMT_ALPHA_INTENSITY_88; buf_format = GFX_TEXFMT_ALPHA_INTENSITY_88;
} }
if (rdp.tbuff_tex->tmu == GFX_TMU0) if (rdp.tbuff_tex->tmu == GFX_TMU0)
{ {
gfxTexCombine(GFX_TMU1, gfxTexCombine(GFX_TMU1,
GR_COMBINE_FUNCTION_NONE, GFX_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_NONE, GFX_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE,
FXFALSE); FXFALSE);
gfxTexCombine(GFX_TMU0, gfxTexCombine(GFX_TMU0,
color_source, color_source,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_ZERO, GFX_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE,
FXTRUE); FXTRUE);
@ -373,14 +373,14 @@ static gfxTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
gfxTexCombine(GFX_TMU1, gfxTexCombine(GFX_TMU1,
color_source, color_source,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_ZERO, GFX_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE,
FXTRUE); FXTRUE);
gfxTexCombine(GFX_TMU0, gfxTexCombine(GFX_TMU0,
GR_COMBINE_FUNCTION_SCALE_OTHER, GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_FUNCTION_SCALE_OTHER, GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
FXFALSE, FXFALSE,
FXFALSE); FXFALSE);

View File

@ -539,7 +539,7 @@ void TexCache()
if (tmu_0_mode == TMUMODE_PASSTHRU) if (tmu_0_mode == TMUMODE_PASSTHRU)
{ {
cmb.tmu0_func = cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER; cmb.tmu0_func = cmb.tmu0_a_func = GFX_COMBINE_FUNCTION_SCALE_OTHER;
cmb.tmu0_fac = cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE; cmb.tmu0_fac = cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE;
if (cmb.tex_cmb_ext_use) if (cmb.tex_cmb_ext_use)
{ {
@ -563,7 +563,7 @@ void TexCache()
} }
else if (tmu_0_mode == TMUMODE_NONE) else if (tmu_0_mode == TMUMODE_NONE)
{ {
cmb.tmu0_func = cmb.tmu0_a_func = GR_COMBINE_FUNCTION_NONE; cmb.tmu0_func = cmb.tmu0_a_func = GFX_COMBINE_FUNCTION_NONE;
cmb.tmu0_fac = cmb.tmu0_a_fac = GR_COMBINE_FACTOR_NONE; cmb.tmu0_fac = cmb.tmu0_a_fac = GR_COMBINE_FACTOR_NONE;
if (cmb.tex_cmb_ext_use) if (cmb.tex_cmb_ext_use)
{ {
@ -587,7 +587,7 @@ void TexCache()
} }
if (tmu_1_mode == TMUMODE_PASSTHRU) if (tmu_1_mode == TMUMODE_PASSTHRU)
{ {
cmb.tmu1_func = cmb.tmu1_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER; cmb.tmu1_func = cmb.tmu1_a_func = GFX_COMBINE_FUNCTION_SCALE_OTHER;
cmb.tmu1_fac = cmb.tmu1_a_fac = GR_COMBINE_FACTOR_ONE; cmb.tmu1_fac = cmb.tmu1_a_fac = GR_COMBINE_FACTOR_ONE;
if (cmb.tex_cmb_ext_use) if (cmb.tex_cmb_ext_use)
{ {
@ -611,7 +611,7 @@ void TexCache()
} }
else if (tmu_1_mode == TMUMODE_NONE) else if (tmu_1_mode == TMUMODE_NONE)
{ {
cmb.tmu1_func = cmb.tmu1_a_func = GR_COMBINE_FUNCTION_NONE; cmb.tmu1_func = cmb.tmu1_a_func = GFX_COMBINE_FUNCTION_NONE;
cmb.tmu1_fac = cmb.tmu1_a_fac = GR_COMBINE_FACTOR_NONE; cmb.tmu1_fac = cmb.tmu1_a_fac = GR_COMBINE_FACTOR_NONE;
if (cmb.tex_cmb_ext_use) if (cmb.tex_cmb_ext_use)
{ {
@ -640,14 +640,14 @@ void TexCache()
{ {
if (rdp.best_tex == 0) if (rdp.best_tex == 0)
{ {
cmb.tmu0_func = cmb.tmu0_a_func = GR_COMBINE_FUNCTION_LOCAL; cmb.tmu0_func = cmb.tmu0_a_func = GFX_COMBINE_FUNCTION_LOCAL;
cmb.tmu0_fac = cmb.tmu0_a_fac = GR_COMBINE_FACTOR_NONE; cmb.tmu0_fac = cmb.tmu0_a_fac = GR_COMBINE_FACTOR_NONE;
tmu_0 = GFX_TMU0; tmu_0 = GFX_TMU0;
tmu_1 = GFX_TMU1; tmu_1 = GFX_TMU1;
} }
else else
{ {
cmb.tmu1_func = cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL; cmb.tmu1_func = cmb.tmu1_a_func = GFX_COMBINE_FUNCTION_LOCAL;
cmb.tmu1_fac = cmb.tmu1_a_fac = GR_COMBINE_FACTOR_NONE; cmb.tmu1_fac = cmb.tmu1_a_fac = GR_COMBINE_FACTOR_NONE;
tmu_1 = GFX_TMU0; tmu_1 = GFX_TMU0;
tmu_0 = GFX_TMU1; tmu_0 = GFX_TMU1;

View File

@ -1952,12 +1952,12 @@ void update()
void set_message_combiner() void set_message_combiner()
{ {
gfxColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,
FXFALSE); FXFALSE);
gfxAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,
@ -1970,15 +1970,15 @@ void set_message_combiner()
gfxStippleMode(GR_STIPPLE_DISABLE); gfxStippleMode(GR_STIPPLE_DISABLE);
gfxTexFilterMode(GFX_TMU0, GR_TEXTUREFILTER_BILINEAR, GR_TEXTUREFILTER_BILINEAR); gfxTexFilterMode(GFX_TMU0, GR_TEXTUREFILTER_BILINEAR, GR_TEXTUREFILTER_BILINEAR);
gfxTexCombine(GFX_TMU1, gfxTexCombine(GFX_TMU1,
GR_COMBINE_FUNCTION_NONE, GFX_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_NONE, GFX_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE); FXFALSE, FXFALSE);
gfxTexCombine(GFX_TMU0, gfxTexCombine(GFX_TMU0,
GR_COMBINE_FUNCTION_LOCAL, GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL, GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE); FXFALSE, FXFALSE);
gfxTexSource(GFX_TMU0, gfxTexSource(GFX_TMU0,

View File

@ -2502,13 +2502,13 @@ void rdp_fillrect()
gfxConstantColorValue(color); gfxConstantColorValue(color);
gfxColorCombine(GR_COMBINE_FUNCTION_LOCAL, gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE, GR_COMBINE_OTHER_NONE,
FXFALSE); FXFALSE);
gfxAlphaCombine(GR_COMBINE_FUNCTION_LOCAL, gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE, GR_COMBINE_OTHER_NONE,
@ -2540,7 +2540,7 @@ void rdp_fillrect()
} }
if ((rdp.othermode_l & 0x4000) && ((rdp.othermode_l >> 16) == 0x0550)) //special blender mode for Bomberman64 if ((rdp.othermode_l & 0x4000) && ((rdp.othermode_l >> 16) == 0x0550)) //special blender mode for Bomberman64
{ {
gfxAlphaCombine(GR_COMBINE_FUNCTION_LOCAL, gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE, GR_COMBINE_OTHER_NONE,
@ -3118,12 +3118,12 @@ void SetWireframeCol()
{ {
//case CSettings::wfmode_NormalColors: // normal colors, don't do anything //case CSettings::wfmode_NormalColors: // normal colors, don't do anything
case CSettings::wfmode_VertexColors: case CSettings::wfmode_VertexColors:
gfxColorCombine(GR_COMBINE_FUNCTION_LOCAL, gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_NONE, GR_COMBINE_OTHER_NONE,
FXFALSE); FXFALSE);
gfxAlphaCombine(GR_COMBINE_FUNCTION_LOCAL, gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_NONE, GR_COMBINE_OTHER_NONE,
@ -3133,25 +3133,25 @@ void SetWireframeCol()
GR_BLEND_ZERO, GR_BLEND_ZERO,
GR_BLEND_ZERO); GR_BLEND_ZERO);
gfxTexCombine(GFX_TMU0, gfxTexCombine(GFX_TMU0,
GR_COMBINE_FUNCTION_ZERO, GFX_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_ZERO, GFX_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE); FXFALSE, FXFALSE);
gfxTexCombine(GFX_TMU1, gfxTexCombine(GFX_TMU1,
GR_COMBINE_FUNCTION_ZERO, GFX_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_ZERO, GFX_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE); FXFALSE, FXFALSE);
break; break;
case CSettings::wfmode_RedOnly: case CSettings::wfmode_RedOnly:
gfxColorCombine(GR_COMBINE_FUNCTION_LOCAL, gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE, GR_COMBINE_OTHER_NONE,
FXFALSE); FXFALSE);
gfxAlphaCombine(GR_COMBINE_FUNCTION_LOCAL, gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE, GR_COMBINE_OTHER_NONE,
@ -3162,15 +3162,15 @@ void SetWireframeCol()
GR_BLEND_ZERO, GR_BLEND_ZERO,
GR_BLEND_ZERO); GR_BLEND_ZERO);
gfxTexCombine(GFX_TMU0, gfxTexCombine(GFX_TMU0,
GR_COMBINE_FUNCTION_ZERO, GFX_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_ZERO, GFX_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE); FXFALSE, FXFALSE);
gfxTexCombine(GFX_TMU1, gfxTexCombine(GFX_TMU1,
GR_COMBINE_FUNCTION_ZERO, GFX_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_ZERO, GFX_COMBINE_FUNCTION_ZERO,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE); FXFALSE, FXFALSE);
break; break;

View File

@ -31,12 +31,12 @@ float set_sprite_combine_mode()
rdp.tex = 1; rdp.tex = 1;
rdp.allow_combine = 0; rdp.allow_combine = 0;
// Now actually combine ! // Now actually combine !
GrCombineFunction_t color_source = GR_COMBINE_FUNCTION_LOCAL; gfxCombineFunction_t color_source = GFX_COMBINE_FUNCTION_LOCAL;
if (rdp.tbuff_tex && rdp.tbuff_tex->info.format == GFX_TEXFMT_ALPHA_INTENSITY_88) if (rdp.tbuff_tex && rdp.tbuff_tex->info.format == GFX_TEXFMT_ALPHA_INTENSITY_88)
color_source = GR_COMBINE_FUNCTION_LOCAL_ALPHA; color_source = GFX_COMBINE_FUNCTION_LOCAL_ALPHA;
cmb.tmu1_func = cmb.tmu0_func = color_source; cmb.tmu1_func = cmb.tmu0_func = color_source;
cmb.tmu1_fac = cmb.tmu0_fac = GR_COMBINE_FACTOR_NONE; cmb.tmu1_fac = cmb.tmu0_fac = GR_COMBINE_FACTOR_NONE;
cmb.tmu1_a_func = cmb.tmu0_a_func = GR_COMBINE_FUNCTION_LOCAL; cmb.tmu1_a_func = cmb.tmu0_a_func = GFX_COMBINE_FUNCTION_LOCAL;
cmb.tmu1_a_fac = cmb.tmu0_a_fac = GR_COMBINE_FACTOR_NONE; cmb.tmu1_a_fac = cmb.tmu0_a_fac = GR_COMBINE_FACTOR_NONE;
cmb.tmu1_invert = cmb.tmu0_invert = FXFALSE; cmb.tmu1_invert = cmb.tmu0_invert = FXFALSE;
cmb.tmu1_a_invert = cmb.tmu0_a_invert = FXFALSE; cmb.tmu1_a_invert = cmb.tmu0_a_invert = FXFALSE;
@ -72,12 +72,12 @@ float set_sprite_combine_mode()
if (rdp.cycle_mode == 2) if (rdp.cycle_mode == 2)
{ {
gfxColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,
FXFALSE); FXFALSE);
gfxAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,
@ -145,25 +145,25 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
GR_MIPMAPLEVELMASK_BOTH, GR_MIPMAPLEVELMASK_BOTH,
&t_info); &t_info);
gfxTexCombine(GFX_TMU1, gfxTexCombine(GFX_TMU1,
GR_COMBINE_FUNCTION_LOCAL, GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL, GFX_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE,
FXFALSE); FXFALSE);
gfxTexCombine(GFX_TMU0, gfxTexCombine(GFX_TMU0,
GR_COMBINE_FUNCTION_SCALE_OTHER, GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_FUNCTION_SCALE_OTHER, GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
FXFALSE, FXFALSE,
FXFALSE); FXFALSE);
gfxColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,
FXFALSE); FXFALSE);
gfxAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER, gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE, GR_COMBINE_OTHER_TEXTURE,