[Video] Change GrCombineOther_t to gfxCombineOther_t

This commit is contained in:
zilmar 2017-07-28 21:33:52 +10:00
parent 8c88b25a9e
commit b319feb9be
11 changed files with 746 additions and 738 deletions

File diff suppressed because it is too large Load Diff

View File

@ -48,10 +48,11 @@ typedef struct
gfxCombineFunction_t c_fnc;
gfxCombineFactor_t c_fac;
gfxCombineLocal_t c_loc;
uint32_t c_oth; // gfxColorCombine flags
gfxCombineOther_t c_oth; // grColorCombine flags
gfxCombineFunction_t a_fnc;
gfxCombineFactor_t a_fac;
gfxCombineLocal_t a_loc;
gfxCombineOther_t a_oth; // gfxAlphaCombine flags
gfxCombineFunction_t tmu0_func;
gfxCombineFactor_t tmu0_fac;
gfxCombineFunction_t tmu1_func;
@ -60,7 +61,6 @@ typedef struct
gfxCombineFactor_t tmu0_a_fac;
gfxCombineFunction_t tmu1_a_func;
gfxCombineFactor_t tmu1_a_fac;
uint32_t a_oth; // gfxAlphaCombine flags
uint32_t tex, tmu0_invert, tmu1_invert;
uint32_t tmu0_a_invert, tmu1_a_invert;
int dc0_lodbias, dc1_lodbias;

View File

@ -55,13 +55,13 @@ static gfxChipID_t SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaqu
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
// GR_COMBINE_OTHER_CONSTANT,
GFX_COMBINE_OTHER_TEXTURE,
// GFX_COMBINE_OTHER_CONSTANT,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
GFX_COMBINE_OTHER_TEXTURE,
FXFALSE);
if (opaque)
{
@ -400,7 +400,7 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_CONSTANT,
GFX_COMBINE_OTHER_CONSTANT,
FXFALSE);
uint16_t * src = (uint16_t*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
@ -470,12 +470,12 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
GFX_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
GFX_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_SRC_ALPHA,
GR_BLEND_ONE_MINUS_SRC_ALPHA,
@ -582,7 +582,7 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_CONSTANT,
GFX_COMBINE_OTHER_CONSTANT,
FXFALSE);
gfxTexDownloadMipMap(tmu, voodoo.tex_min_addr[tmu] + voodoo.tmem_ptr[tmu], GR_MIPMAPLEVELMASK_BOTH, &t_info);
gfxTexSource(tmu, voodoo.tex_min_addr[tmu] + voodoo.tmem_ptr[tmu], GR_MIPMAPLEVELMASK_BOTH, &t_info);

View File

@ -364,13 +364,13 @@ void compile_chroma_shader()
switch (chroma_other_alpha)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_chroma, "float alpha = vFrontColor.a; \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_chroma, "float alpha = ctexture1.a; \n");
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
strcat(fragment_shader_chroma, "float alpha = constant_color.a; \n");
break;
default:
@ -379,13 +379,13 @@ void compile_chroma_shader()
switch (chroma_other_color)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_chroma, "vec4 color = vec4(vec3(vFrontColor),alpha); \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_chroma, "vec4 color = vec4(vec3(ctexture1),alpha); \n");
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
strcat(fragment_shader_chroma, "vec4 color = vec4(vec3(constant_color),alpha); \n");
break;
default:
@ -707,13 +707,13 @@ void writeGLSLColorOther(int other)
{
switch (other)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_color_combiner, "vec4 color_other = vFrontColor; \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_color_combiner, "vec4 color_other = ctexture1; \n");
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
strcat(fragment_shader_color_combiner, "vec4 color_other = constant_color; \n");
break;
default:
@ -784,7 +784,7 @@ void writeGLSLColorFactor(int factor, int local, int need_local, int other, int
}
}
void gfxColorCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, GrCombineOther_t other, bool invert)
void gfxColorCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, gfxCombineOther_t other, bool invert)
{
WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert);
static int last_function = 0;
@ -879,13 +879,13 @@ int setOtherAlphaSource(int other)
{
switch(other)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
return GL_PRIMARY_COLOR_ARB;
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
return GL_PREVIOUS_ARB;
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
return GL_CONSTANT_ARB;
break;
default:
@ -915,13 +915,13 @@ void writeGLSLAlphaOther(int other)
{
switch (other)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_alpha_combiner, "float alpha_other = vFrontColor.a; \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_alpha_combiner, "float alpha_other = ctexture1.a; \n");
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
strcat(fragment_shader_alpha_combiner, "float alpha_other = constant_color.a; \n");
break;
default:
@ -989,7 +989,7 @@ void writeGLSLAlphaFactor(int factor, int local, int need_local, int other, int
}
}
void gfxAlphaCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, GrCombineOther_t other, bool invert)
void gfxAlphaCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, gfxCombineOther_t other, bool invert)
{
WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert);
static int last_function = 0;

View File

@ -319,13 +319,13 @@ void compile_chroma_shader()
switch (chroma_other_alpha)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_chroma, "float alpha = gl_Color.a; \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_chroma, "float alpha = ctexture1.a; \n");
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
strcat(fragment_shader_chroma, "float alpha = constant_color.a; \n");
break;
default:
@ -334,13 +334,13 @@ void compile_chroma_shader()
switch (chroma_other_color)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_chroma, "vec4 color = vec4(vec3(gl_Color),alpha); \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_chroma, "vec4 color = vec4(vec3(ctexture1),alpha); \n");
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
strcat(fragment_shader_chroma, "vec4 color = vec4(vec3(constant_color),alpha); \n");
break;
default:
@ -610,13 +610,13 @@ int setOtherColorSource(int other)
{
switch (other)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
return GL_PRIMARY_COLOR_ARB;
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
return GL_PREVIOUS_ARB;
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
return GL_CONSTANT_ARB;
break;
default:
@ -645,13 +645,13 @@ void writeGLSLColorOther(int other)
{
switch (other)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_color_combiner, "vec4 color_other = gl_Color; \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_color_combiner, "vec4 color_other = ctexture1; \n");
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
strcat(fragment_shader_color_combiner, "vec4 color_other = constant_color; \n");
break;
default:
@ -722,7 +722,7 @@ void writeGLSLColorFactor(int factor, int local, int need_local, int other, int
}
}
void gfxColorCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, GrCombineOther_t other, bool invert)
void gfxColorCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, gfxCombineOther_t other, bool invert)
{
WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert);
@ -817,13 +817,13 @@ int setOtherAlphaSource(int other)
{
switch (other)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
return GL_PRIMARY_COLOR_ARB;
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
return GL_PREVIOUS_ARB;
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
return GL_CONSTANT_ARB;
break;
default:
@ -852,13 +852,13 @@ void writeGLSLAlphaOther(int other)
{
switch (other)
{
case GR_COMBINE_OTHER_ITERATED:
case GFX_COMBINE_OTHER_ITERATED:
strcat(fragment_shader_alpha_combiner, "float alpha_other = gl_Color.a; \n");
break;
case GR_COMBINE_OTHER_TEXTURE:
case GFX_COMBINE_OTHER_TEXTURE:
strcat(fragment_shader_alpha_combiner, "float alpha_other = ctexture1.a; \n");
break;
case GR_COMBINE_OTHER_CONSTANT:
case GFX_COMBINE_OTHER_CONSTANT:
strcat(fragment_shader_alpha_combiner, "float alpha_other = constant_color.a; \n");
break;
default:
@ -926,7 +926,7 @@ void writeGLSLAlphaFactor(int factor, int local, int need_local, int other, int
}
}
void gfxAlphaCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, GrCombineOther_t other, bool invert)
void gfxAlphaCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, gfxCombineOther_t other, bool invert)
{
WriteTrace(TraceGlitch, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert);
static int last_function = 0;

View File

@ -23,8 +23,8 @@ void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, gfxLOD_t lodmin
uint32_t gfxTexMaxAddress(gfxChipID_t tmu);
uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, gfxTexInfo *info);
void gfxConstantColorValue(gfxColor_t value);
void gfxColorCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, GrCombineOther_t other, bool invert);
void gfxAlphaCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, GrCombineOther_t other, bool invert);
void gfxColorCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, gfxCombineOther_t other, bool invert);
void gfxAlphaCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_t local, gfxCombineOther_t other, bool invert);
void gfxTexCombine(gfxChipID_t tmu, gfxCombineFunction_t rgb_function, gfxCombineFactor_t rgb_factor, gfxCombineFunction_t alpha_function, gfxCombineFactor_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 gfxAlphaTestReferenceValue(gfxAlpha_t value);

View File

@ -154,6 +154,14 @@ enum gfxCombineLocal_t
GFX_COMBINE_LOCAL_DEPTH = 0x2,
};
enum gfxCombineOther_t
{
GFX_COMBINE_OTHER_ITERATED = 0x0,
GFX_COMBINE_OTHER_TEXTURE = 0x1,
GFX_COMBINE_OTHER_CONSTANT = 0x2,
GFX_COMBINE_OTHER_NONE = GFX_COMBINE_OTHER_CONSTANT,
};
enum GFX_CMBX
{
GFX_CMBX_ZERO = 0x00,

View File

@ -326,13 +326,13 @@ static gfxTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
// GR_COMBINE_OTHER_CONSTANT,
GFX_COMBINE_OTHER_TEXTURE,
// GFX_COMBINE_OTHER_CONSTANT,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
GFX_COMBINE_OTHER_TEXTURE,
FXFALSE);
// gfxConstantColorValue (0xFFFFFFFF);
gfxAlphaBlendFunction(GR_BLEND_ONE, // use alpha compare, but not T0 alpha

View File

@ -1955,12 +1955,12 @@ void set_message_combiner()
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
GFX_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
GFX_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_ONE,
GR_BLEND_ZERO,

View File

@ -2505,13 +2505,13 @@ void rdp_fillrect()
gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
GFX_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
GFX_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
@ -2543,7 +2543,7 @@ void rdp_fillrect()
gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
GFX_COMBINE_OTHER_NONE,
FXFALSE);
gfxConstantColorValue((cmb.ccolor & 0xFFFFFF00) | (rdp.fog_color & 0xFF));
rdp.update |= UPDATE_COMBINE;
@ -3121,12 +3121,12 @@ void SetWireframeCol()
gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GFX_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_NONE,
GFX_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GFX_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_NONE,
GFX_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_ONE,
GR_BLEND_ZERO,
@ -3149,12 +3149,12 @@ void SetWireframeCol()
gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
GFX_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
GFX_COMBINE_OTHER_NONE,
FXFALSE);
gfxConstantColorValue(0xFF0000FF);
gfxAlphaBlendFunction(GR_BLEND_ONE,

View File

@ -75,12 +75,12 @@ float set_sprite_combine_mode()
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
GFX_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
GFX_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_ONE,
GR_BLEND_ZERO,
@ -161,12 +161,12 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
GFX_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
GFX_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_ONE,
GR_BLEND_ZERO,