[Video] Rename GrCmpFnc_t to gfxCmpFnc_t

This commit is contained in:
zilmar 2017-07-31 21:05:29 +10:00
parent c1e6a20fa4
commit 30ca04c2a0
14 changed files with 69 additions and 56 deletions

View File

@ -65,7 +65,7 @@ static gfxChipID_t SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaqu
FXFALSE);
if (opaque)
{
gfxAlphaTestFunction(GR_CMP_ALWAYS);
gfxAlphaTestFunction(GFX_CMP_ALWAYS);
gfxAlphaBlendFunction(GFX_BLEND_ONE,
GFX_BLEND_ZERO,
GFX_BLEND_ONE,
@ -78,7 +78,7 @@ static gfxChipID_t SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaqu
GFX_BLEND_ONE,
GFX_BLEND_ZERO);
}
gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxCullMode(GR_CULL_DISABLE);
gfxDepthMask(FXFALSE);
rdp.update |= UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
@ -481,7 +481,7 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
GFX_BLEND_ONE_MINUS_SRC_ALPHA,
GFX_BLEND_ONE,
GFX_BLEND_ZERO);
gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxDepthMask(FXFALSE);
gfxCullMode(GR_CULL_DISABLE);
gfxTexCombine(GFX_TMU1,

View File

@ -530,7 +530,7 @@ int InitGfx()
}
gfxDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
gfxDepthBufferFunction(GR_CMP_LESS);
gfxDepthBufferFunction(GFX_CMP_LESS);
gfxDepthMask(FXTRUE);
ChangeSize();
@ -540,7 +540,7 @@ int InitGfx()
gfxCullMode(GR_CULL_DISABLE);
gfxDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
gfxColorMask(FXTRUE, FXTRUE);
gfxDepthMask(FXTRUE);
@ -1308,7 +1308,7 @@ void newSwapBuffers()
rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
gfxClipWindow(0, 0, g_scr_res_x, g_scr_res_y);
gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxDepthMask(FXFALSE);
gfxCullMode(GR_CULL_DISABLE);

View File

@ -1539,19 +1539,19 @@ void gfxAlphaTestReferenceValue(gfxAlpha_t value)
gfxAlphaTestFunction(g_alpha_func);
}
void gfxAlphaTestFunction(GrCmpFnc_t function)
void gfxAlphaTestFunction(gfxCmpFnc_t function)
{
WriteTrace(TraceGlitch, TraceDebug, "function: %d", function);
g_alpha_func = function;
switch (function)
{
case GR_CMP_GREATER:
case GFX_CMP_GREATER:
//glAlphaFunc(GL_GREATER, g_alpha_ref/255.0f);
break;
case GR_CMP_GEQUAL:
case GFX_CMP_GEQUAL:
//glAlphaFunc(GL_GEQUAL, g_alpha_ref/255.0f);
break;
case GR_CMP_ALWAYS:
case GFX_CMP_ALWAYS:
//glAlphaFunc(GL_ALWAYS, g_alpha_ref/255.0f);
//glDisable(GL_ALPHA_TEST);
g_alpha_test = false;

View File

@ -240,45 +240,45 @@ void gfxDepthBufferMode(GrDepthBufferMode_t mode)
}
}
void gfxDepthBufferFunction(GrCmpFnc_t function)
void gfxDepthBufferFunction(gfxCmpFnc_t function)
{
WriteTrace(TraceGlitch, TraceDebug, "function: %d", function);
switch (function)
{
case GR_CMP_GEQUAL:
case GFX_CMP_GEQUAL:
if (w_buffer_mode)
glDepthFunc(GL_LEQUAL);
else
glDepthFunc(GL_GEQUAL);
break;
case GR_CMP_LEQUAL:
case GFX_CMP_LEQUAL:
if (w_buffer_mode)
glDepthFunc(GL_GEQUAL);
else
glDepthFunc(GL_LEQUAL);
break;
case GR_CMP_LESS:
case GFX_CMP_LESS:
if (w_buffer_mode)
glDepthFunc(GL_GREATER);
else
glDepthFunc(GL_LESS);
break;
case GR_CMP_ALWAYS:
case GFX_CMP_ALWAYS:
glDepthFunc(GL_ALWAYS);
break;
case GR_CMP_EQUAL:
case GFX_CMP_EQUAL:
glDepthFunc(GL_EQUAL);
break;
case GR_CMP_GREATER:
case GFX_CMP_GREATER:
if (w_buffer_mode)
glDepthFunc(GL_LESS);
else
glDepthFunc(GL_GREATER);
break;
case GR_CMP_NEVER:
case GFX_CMP_NEVER:
glDepthFunc(GL_NEVER);
break;
case GR_CMP_NOTEQUAL:
case GFX_CMP_NOTEQUAL:
glDepthFunc(GL_NOTEQUAL);
break;

View File

@ -28,7 +28,8 @@
static int fct[4], source0[4], operand0[4], source1[4], operand1[4], source2[4], operand2[4];
static int fcta[4], sourcea0[4], operanda0[4], sourcea1[4], operanda1[4], sourcea2[4], operanda2[4];
static int alpha_ref, alpha_func;
static int alpha_ref;
static gfxCmpFnc_t alpha_func;
float texture_env_color[4];
float ccolor0[4];
@ -1481,22 +1482,22 @@ void gfxAlphaTestReferenceValue(gfxAlpha_t value)
gfxAlphaTestFunction(alpha_func);
}
void gfxAlphaTestFunction(GrCmpFnc_t function)
void gfxAlphaTestFunction(gfxCmpFnc_t function)
{
WriteTrace(TraceGlitch, TraceDebug, "function: %d", function);
alpha_func = function;
switch (function)
{
case GR_CMP_GREATER:
case GFX_CMP_GREATER:
glAlphaFunc(GL_GREATER, alpha_ref / 255.0f);
break;
case GR_CMP_GEQUAL:
case GFX_CMP_GEQUAL:
glAlphaFunc(GL_GEQUAL, alpha_ref / 255.0f);
break;
case GR_CMP_ALWAYS:
case GFX_CMP_ALWAYS:
glAlphaFunc(GL_ALWAYS, alpha_ref / 255.0f);
glDisable(GL_ALPHA_TEST);
grDisplayGLError("gfxAlphaTestFunction :: GR_CMP_ALWAYS");
grDisplayGLError("gfxAlphaTestFunction :: GFX_CMP_ALWAYS");
return;
break;
default:

View File

@ -171,45 +171,45 @@ void gfxDepthBufferMode(GrDepthBufferMode_t mode)
grDisplayGLError("gfxDepthBufferMode");
}
void gfxDepthBufferFunction(GrCmpFnc_t function)
void gfxDepthBufferFunction(gfxCmpFnc_t function)
{
WriteTrace(TraceGlitch, TraceDebug, "function: %d", function);
switch (function)
{
case GR_CMP_GEQUAL:
case GFX_CMP_GEQUAL:
if (w_buffer_mode)
glDepthFunc(GL_LEQUAL);
else
glDepthFunc(GL_GEQUAL);
break;
case GR_CMP_LEQUAL:
case GFX_CMP_LEQUAL:
if (w_buffer_mode)
glDepthFunc(GL_GEQUAL);
else
glDepthFunc(GL_LEQUAL);
break;
case GR_CMP_LESS:
case GFX_CMP_LESS:
if (w_buffer_mode)
glDepthFunc(GL_GREATER);
else
glDepthFunc(GL_LESS);
break;
case GR_CMP_ALWAYS:
case GFX_CMP_ALWAYS:
glDepthFunc(GL_ALWAYS);
break;
case GR_CMP_EQUAL:
case GFX_CMP_EQUAL:
glDepthFunc(GL_EQUAL);
break;
case GR_CMP_GREATER:
case GFX_CMP_GREATER:
if (w_buffer_mode)
glDepthFunc(GL_LESS);
else
glDepthFunc(GL_GREATER);
break;
case GR_CMP_NEVER:
case GFX_CMP_NEVER:
glDepthFunc(GL_NEVER);
break;
case GR_CMP_NOTEQUAL:
case GFX_CMP_NOTEQUAL:
glDepthFunc(GL_NOTEQUAL);
break;

View File

@ -28,7 +28,7 @@ void gfxAlphaCombine(gfxCombineFunction_t function, gfxCombineFactor_t factor, g
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(gfxAlphaBlendFnc_t rgb_sf, gfxAlphaBlendFnc_t rgb_df, gfxAlphaBlendFnc_t alpha_sf, gfxAlphaBlendFnc_t alpha_df);
void gfxAlphaTestReferenceValue(gfxAlpha_t value);
void gfxAlphaTestFunction(GrCmpFnc_t function);
void gfxAlphaTestFunction(gfxCmpFnc_t function);
void gfxFogMode(GrFogMode_t mode);
void gfxFogGenerateLinear(float nearZ, float farZ);
void gfxFogColorValue(gfxColor_t fogcolor);
@ -43,7 +43,7 @@ void gfxConstantColorValueExt(gfxChipID_t tmu, gfxColor_t value);
void gfxVertexLayout(uint32_t param, FxI32 offset, uint32_t mode);
void gfxCullMode(GrCullMode_t mode);
void gfxDepthBufferMode(GrDepthBufferMode_t mode);
void gfxDepthBufferFunction(GrCmpFnc_t function);
void gfxDepthBufferFunction(gfxCmpFnc_t function);
void gfxDepthMask(bool mask);
void gfxDrawTriangle(const void *a, const void *b, const void *c);
void gfxDepthBiasLevel(FxI32 level);

View File

@ -185,6 +185,18 @@ enum gfxAlphaBlendFnc_t
GFX_BLEND_PREFOG_COLOR = GFX_BLEND_ALPHA_SATURATE,
};
enum gfxCmpFnc_t
{
GFX_CMP_NEVER = 0x0,
GFX_CMP_LESS = 0x1,
GFX_CMP_EQUAL = 0x2,
GFX_CMP_LEQUAL = 0x3,
GFX_CMP_GREATER = 0x4,
GFX_CMP_NOTEQUAL = 0x5,
GFX_CMP_GEQUAL = 0x6,
GFX_CMP_ALWAYS = 0x7,
};
enum GFX_CMBX
{
GFX_CMBX_ZERO = 0x00,

View File

@ -80,7 +80,7 @@ CSettings::CSettings() :
m_force_calc_sphere(false), //use spheric mapping only, Ridge Racer 64
m_pal230(false), //set special scale for PAL games
m_correct_viewport(false), //correct viewport values
m_zmode_compare_less(false), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
m_zmode_compare_less(false), //force GFX_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
m_old_style_adither(false), //apply alpha dither regardless of alpha_dither_mode
m_n64_z_scale(false), //scale vertex z value before writing to depth buffer, as N64 does.

View File

@ -260,7 +260,7 @@ public:
inline bool force_calc_sphere(void) const { return m_force_calc_sphere; } //use spheric mapping only, Ridge Racer 64
inline bool pal230(void) const { return m_pal230; } //use spheric mapping only, Ridge Racer 64
inline bool correct_viewport(void) const { return m_correct_viewport; } //correct viewport values
inline bool zmode_compare_less(void) const { return m_zmode_compare_less; } //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
inline bool zmode_compare_less(void) const { return m_zmode_compare_less; } //force GFX_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
inline bool old_style_adither(void) const { return m_old_style_adither; } //apply alpha dither regardless of alpha_dither_mode
inline bool n64_z_scale(void) const { return m_n64_z_scale; } //scale vertex z value before writing to depth buffer, as N64 does.

View File

@ -340,7 +340,7 @@ static gfxTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
GFX_BLEND_ONE,
GFX_BLEND_ZERO);
gfxClipWindow(0, 0, g_scr_res_x, g_scr_res_y);
gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxDepthMask(FXFALSE);
gfxCullMode(GR_CULL_DISABLE);
gfxFogMode(GR_FOG_DISABLE);

View File

@ -1752,27 +1752,27 @@ void update()
switch ((rdp.rm & 0xC00) >> 10) {
case 0:
gfxDepthBiasLevel(0);
gfxDepthBufferFunction(g_settings->zmode_compare_less() ? GR_CMP_LESS : GR_CMP_LEQUAL);
gfxDepthBufferFunction(g_settings->zmode_compare_less() ? GFX_CMP_LESS : GFX_CMP_LEQUAL);
break;
case 1:
gfxDepthBiasLevel(-4);
gfxDepthBufferFunction(g_settings->zmode_compare_less() ? GR_CMP_LESS : GR_CMP_LEQUAL);
gfxDepthBufferFunction(g_settings->zmode_compare_less() ? GFX_CMP_LESS : GFX_CMP_LEQUAL);
break;
case 2:
gfxDepthBiasLevel(g_settings->ucode() == CSettings::ucode_PerfectDark ? -4 : 0);
gfxDepthBufferFunction(GR_CMP_LESS);
gfxDepthBufferFunction(GFX_CMP_LESS);
break;
case 3:
// will be set dynamically per polygon
//gfxDepthBiasLevel(-deltaZ);
gfxDepthBufferFunction(GR_CMP_LEQUAL);
gfxDepthBufferFunction(GFX_CMP_LEQUAL);
break;
}
}
else
{
gfxDepthBiasLevel(0);
gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxDepthBufferFunction(GFX_CMP_ALWAYS);
}
if (rdp.flags & ZBUF_UPDATE)
@ -1783,7 +1783,7 @@ void update()
else
{
gfxDepthBiasLevel(0);
gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxDepthMask(FXFALSE);
}
}
@ -1799,7 +1799,7 @@ void update()
if (rdp.acmp == 1 && !(rdp.othermode_l & 0x00002000) && (!(rdp.othermode_l & 0x00004000) || (rdp.blend_color & 0xFF)))
{
uint8_t reference = (uint8_t)(rdp.blend_color & 0xFF);
gfxAlphaTestFunction(reference ? GR_CMP_GEQUAL : GR_CMP_GREATER);
gfxAlphaTestFunction(reference ? GFX_CMP_GEQUAL : GFX_CMP_GREATER);
gfxAlphaTestReferenceValue(reference);
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: blend: %02lx", reference);
}
@ -1809,13 +1809,13 @@ void update()
{
if ((rdp.othermode_l & 0x5000) != 0x5000)
{
gfxAlphaTestFunction(GR_CMP_GEQUAL);
gfxAlphaTestFunction(GFX_CMP_GEQUAL);
gfxAlphaTestReferenceValue(0x20);//0xA0);
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: 0x20");
}
else
{
gfxAlphaTestFunction(GR_CMP_GREATER);
gfxAlphaTestFunction(GFX_CMP_GREATER);
if (rdp.acmp == 3)
{
gfxAlphaTestReferenceValue((uint8_t)(rdp.blend_color & 0xFF));
@ -1830,7 +1830,7 @@ void update()
}
else
{
gfxAlphaTestFunction(GR_CMP_ALWAYS);
gfxAlphaTestFunction(GFX_CMP_ALWAYS);
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: none");
}
}
@ -1966,7 +1966,7 @@ void set_message_combiner()
GFX_BLEND_ZERO,
GFX_BLEND_ZERO,
GFX_BLEND_ZERO);
gfxAlphaTestFunction(GR_CMP_ALWAYS);
gfxAlphaTestFunction(GFX_CMP_ALWAYS);
gfxStippleMode(GR_STIPPLE_DISABLE);
gfxTexFilterMode(GFX_TMU0, GR_TEXTUREFILTER_BILINEAR, GR_TEXTUREFILTER_BILINEAR);
gfxTexCombine(GFX_TMU1,

View File

@ -2516,12 +2516,12 @@ void rdp_fillrect()
gfxAlphaBlendFunction(GFX_BLEND_ONE, GFX_BLEND_ZERO, GFX_BLEND_ONE, GFX_BLEND_ZERO);
gfxAlphaTestFunction(GR_CMP_ALWAYS);
gfxAlphaTestFunction(GFX_CMP_ALWAYS);
gfxStippleMode(GR_STIPPLE_DISABLE);
gfxCullMode(GR_CULL_DISABLE);
gfxFogMode(GR_FOG_DISABLE);
gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxDepthMask(FXFALSE);
rdp.update |= UPDATE_COMBINE | UPDATE_CULL_MODE | UPDATE_FOG_ENABLED | UPDATE_ZBUF_ENABLED;
@ -3176,7 +3176,7 @@ void SetWireframeCol()
break;
}
gfxAlphaTestFunction(GR_CMP_ALWAYS);
gfxAlphaTestFunction(GFX_CMP_ALWAYS);
gfxCullMode(GR_CULL_DISABLE);
rdp.update |= UPDATE_COMBINE | UPDATE_ALPHA_COMPARE;

View File

@ -88,11 +88,11 @@ float set_sprite_combine_mode()
GFX_BLEND_ZERO);
if (rdp.othermode_l & 1)
{
gfxAlphaTestFunction(GR_CMP_GEQUAL);
gfxAlphaTestFunction(GFX_CMP_GEQUAL);
gfxAlphaTestReferenceValue(0x80);
}
else
gfxAlphaTestFunction(GR_CMP_ALWAYS);
gfxAlphaTestFunction(GFX_CMP_ALWAYS);
rdp.update |= UPDATE_ALPHA_COMPARE | UPDATE_COMBINE;
}
return Z;
@ -172,7 +172,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
GFX_BLEND_ZERO,
GFX_BLEND_ONE,
GFX_BLEND_ZERO);
gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxDepthMask(FXFALSE);
gfxLOD_t LOD = g_scr_res_x > 1024 ? GFX_LOD_LOG2_2048 : GFX_LOD_LOG2_1024;