[Video] Change GrCombineLocal_t to gfxCombineLocal_t

This commit is contained in:
zilmar 2017-07-28 05:43:42 +10:00
parent 351e4a74b2
commit 44e77a0eee
11 changed files with 725 additions and 715 deletions

File diff suppressed because it is too large Load Diff

View File

@ -47,9 +47,11 @@ typedef struct
uint32_t ccolor; // constant color to set at the end, color and alpha
gfxCombineFunction_t c_fnc;
gfxCombineFactor_t c_fac;
uint32_t c_loc, c_oth; // gfxColorCombine flags
gfxCombineLocal_t c_loc;
uint32_t c_oth; // gfxColorCombine flags
gfxCombineFunction_t a_fnc;
gfxCombineFactor_t a_fac;
gfxCombineLocal_t a_loc;
gfxCombineFunction_t tmu0_func;
gfxCombineFactor_t tmu0_fac;
gfxCombineFunction_t tmu1_func;
@ -58,7 +60,7 @@ typedef struct
gfxCombineFactor_t tmu0_a_fac;
gfxCombineFunction_t tmu1_a_func;
gfxCombineFactor_t tmu1_a_fac;
uint32_t a_loc, a_oth; // gfxAlphaCombine flags
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

@ -54,13 +54,13 @@ static gfxChipID_t SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaqu
// gfxConstantColorValue (0xFFFFFFFF);
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
// GR_COMBINE_OTHER_CONSTANT,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
if (opaque)
@ -399,7 +399,7 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
gfxConstantColorValue(rdp.fog_color);
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_CONSTANT,
FXFALSE);
uint16_t * src = (uint16_t*)image;
@ -469,12 +469,12 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
gfxConstantColorValue(rdp.fog_color);
gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_SRC_ALPHA,
@ -581,7 +581,7 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
gfxConstantColorValue(rdp.fog_color);
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_CONSTANT,
FXFALSE);
gfxTexDownloadMipMap(tmu, voodoo.tex_min_addr[tmu] + voodoo.tmem_ptr[tmu], GR_MIPMAPLEVELMASK_BOTH, &t_info);

View File

@ -725,10 +725,10 @@ void writeGLSLColorLocal(int local)
{
switch (local)
{
case GR_COMBINE_LOCAL_ITERATED:
case GFX_COMBINE_LOCAL_ITERATED:
strcat(fragment_shader_color_combiner, "vec4 color_local = vFrontColor; \n");
break;
case GR_COMBINE_LOCAL_CONSTANT:
case GFX_COMBINE_LOCAL_CONSTANT:
strcat(fragment_shader_color_combiner, "vec4 color_local = 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, GrCombineLocal_t local, GrCombineOther_t other, bool invert)
void gfxColorCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_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);
static int last_function = 0;
@ -898,10 +898,10 @@ int setLocalAlphaSource(int local)
{
switch(local)
{
case GR_COMBINE_LOCAL_ITERATED:
case GFX_COMBINE_LOCAL_ITERATED:
return GL_PRIMARY_COLOR_ARB;
break;
case GR_COMBINE_LOCAL_CONSTANT:
case GFX_COMBINE_LOCAL_CONSTANT:
return GL_CONSTANT_ARB;
break;
default:
@ -933,10 +933,10 @@ void writeGLSLAlphaLocal(int local)
{
switch (local)
{
case GR_COMBINE_LOCAL_ITERATED:
case GFX_COMBINE_LOCAL_ITERATED:
strcat(fragment_shader_alpha_combiner, "float alpha_local = vFrontColor.a; \n");
break;
case GR_COMBINE_LOCAL_CONSTANT:
case GFX_COMBINE_LOCAL_CONSTANT:
strcat(fragment_shader_alpha_combiner, "float alpha_local = 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, GrCombineLocal_t local, GrCombineOther_t other, bool invert)
void gfxAlphaCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_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);
static int last_function = 0;

View File

@ -629,10 +629,10 @@ int setLocalColorSource(int local)
{
switch (local)
{
case GR_COMBINE_LOCAL_ITERATED:
case GFX_COMBINE_LOCAL_ITERATED:
return GL_PRIMARY_COLOR_ARB;
break;
case GR_COMBINE_LOCAL_CONSTANT:
case GFX_COMBINE_LOCAL_CONSTANT:
return GL_CONSTANT_ARB;
break;
default:
@ -663,10 +663,10 @@ void writeGLSLColorLocal(int local)
{
switch (local)
{
case GR_COMBINE_LOCAL_ITERATED:
case GFX_COMBINE_LOCAL_ITERATED:
strcat(fragment_shader_color_combiner, "vec4 color_local = gl_Color; \n");
break;
case GR_COMBINE_LOCAL_CONSTANT:
case GFX_COMBINE_LOCAL_CONSTANT:
strcat(fragment_shader_color_combiner, "vec4 color_local = 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, GrCombineLocal_t local, GrCombineOther_t other, bool invert)
void gfxColorCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_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);
@ -836,10 +836,10 @@ int setLocalAlphaSource(int local)
{
switch (local)
{
case GR_COMBINE_LOCAL_ITERATED:
case GFX_COMBINE_LOCAL_ITERATED:
return GL_PRIMARY_COLOR_ARB;
break;
case GR_COMBINE_LOCAL_CONSTANT:
case GFX_COMBINE_LOCAL_CONSTANT:
return GL_CONSTANT_ARB;
break;
default:
@ -870,10 +870,10 @@ void writeGLSLAlphaLocal(int local)
{
switch (local)
{
case GR_COMBINE_LOCAL_ITERATED:
case GFX_COMBINE_LOCAL_ITERATED:
strcat(fragment_shader_alpha_combiner, "float alpha_local = gl_Color.a; \n");
break;
case GR_COMBINE_LOCAL_CONSTANT:
case GFX_COMBINE_LOCAL_CONSTANT:
strcat(fragment_shader_alpha_combiner, "float alpha_local = 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, GrCombineLocal_t local, GrCombineOther_t other, bool invert)
void gfxAlphaCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, gfxCombineLocal_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);
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, GrCombineLocal_t local, GrCombineOther_t other, bool invert);
void gfxAlphaCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert);
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 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

@ -146,6 +146,14 @@ enum gfxCombineFactor_t
GFX_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION = 0xd,
};
enum gfxCombineLocal_t
{
GFX_COMBINE_LOCAL_ITERATED = 0x0,
GFX_COMBINE_LOCAL_CONSTANT = 0x1,
GFX_COMBINE_LOCAL_NONE = GFX_COMBINE_LOCAL_CONSTANT,
GFX_COMBINE_LOCAL_DEPTH = 0x2,
};
enum GFX_CMBX
{
GFX_CMBX_ZERO = 0x00,

View File

@ -325,13 +325,13 @@ static gfxTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
{
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
// GR_COMBINE_OTHER_CONSTANT,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
// gfxConstantColorValue (0xFFFFFFFF);

View File

@ -1954,12 +1954,12 @@ void set_message_combiner()
{
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_ONE,

View File

@ -2504,13 +2504,13 @@ void rdp_fillrect()
gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
@ -2542,7 +2542,7 @@ void rdp_fillrect()
{
gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
gfxConstantColorValue((cmb.ccolor & 0xFFFFFF00) | (rdp.fog_color & 0xFF));
@ -3120,12 +3120,12 @@ void SetWireframeCol()
case CSettings::wfmode_VertexColors:
gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_ITERATED,
GFX_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_ITERATED,
GFX_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_ONE,
@ -3148,12 +3148,12 @@ void SetWireframeCol()
case CSettings::wfmode_RedOnly:
gfxColorCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_LOCAL,
GFX_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GFX_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
gfxConstantColorValue(0xFF0000FF);

View File

@ -74,12 +74,12 @@ float set_sprite_combine_mode()
{
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_ONE,
@ -160,12 +160,12 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
FXFALSE);
gfxColorCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaCombine(GFX_COMBINE_FUNCTION_SCALE_OTHER,
GFX_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GFX_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
gfxAlphaBlendFunction(GR_BLEND_ONE,