[Video] Change GrCullMode_t to gfxCullMode_t

This commit is contained in:
zilmar 2017-08-03 07:48:55 +10:00
parent cf0b8f2b6b
commit f88d27af14
12 changed files with 37 additions and 116 deletions

View File

@ -79,7 +79,7 @@ static gfxChipID_t SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaqu
GFX_BLEND_ZERO); GFX_BLEND_ZERO);
} }
gfxDepthBufferFunction(GFX_CMP_ALWAYS); gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
gfxDepthMask(FXFALSE); gfxDepthMask(FXFALSE);
rdp.update |= UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE; rdp.update |= UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
return tmu; return tmu;
@ -483,7 +483,7 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
GFX_BLEND_ZERO); GFX_BLEND_ZERO);
gfxDepthBufferFunction(GFX_CMP_ALWAYS); gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxDepthMask(FXFALSE); gfxDepthMask(FXFALSE);
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
gfxTexCombine(GFX_TMU1, gfxTexCombine(GFX_TMU1,
GFX_COMBINE_FUNCTION_NONE, GFX_COMBINE_FUNCTION_NONE,
GFX_COMBINE_FACTOR_NONE, GFX_COMBINE_FACTOR_NONE,

View File

@ -521,7 +521,7 @@ int InitGfx()
gfxVertexLayout(GR_PARAM_ST1, offsetof(VERTEX, coord[2]), GR_PARAM_ENABLE); gfxVertexLayout(GR_PARAM_ST1, offsetof(VERTEX, coord[2]), GR_PARAM_ENABLE);
gfxVertexLayout(GR_PARAM_PARGB, offsetof(VERTEX, b), GR_PARAM_ENABLE); gfxVertexLayout(GR_PARAM_PARGB, offsetof(VERTEX, b), GR_PARAM_ENABLE);
gfxCullMode(GR_CULL_NEGATIVE); gfxCullMode(GFX_CULL_NEGATIVE);
if (g_settings->fog()) //"FOGCOORD" extension if (g_settings->fog()) //"FOGCOORD" extension
{ {
@ -538,7 +538,7 @@ int InitGfx()
guLoadTextures(); guLoadTextures();
ClearCache(); ClearCache();
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
gfxDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER); gfxDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
gfxDepthBufferFunction(GFX_CMP_ALWAYS); gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxRenderBuffer(GFX_BUFFER_BACKBUFFER); gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
@ -1310,7 +1310,7 @@ void newSwapBuffers()
gfxClipWindow(0, 0, g_scr_res_x, g_scr_res_y); gfxClipWindow(0, 0, g_scr_res_x, g_scr_res_y);
gfxDepthBufferFunction(GFX_CMP_ALWAYS); gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxDepthMask(FXFALSE); gfxDepthMask(FXFALSE);
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
if (g_capture_screen) if (g_capture_screen)
{ {

View File

@ -42,7 +42,7 @@ static int fog_ext_en;
int w_buffer_mode; int w_buffer_mode;
int inverted_culling; int inverted_culling;
int culling_mode; gfxCullMode_t culling_mode;
#define VERTEX_BUFFER_SIZE 1500 //Max amount of vertices to buffer, this seems large enough. #define VERTEX_BUFFER_SIZE 1500 //Max amount of vertices to buffer, this seems large enough.
static VERTEX vertex_buffer[VERTEX_BUFFER_SIZE]; static VERTEX vertex_buffer[VERTEX_BUFFER_SIZE];
@ -181,7 +181,7 @@ void gfxVertexLayout(uint32_t param, FxI32 offset, uint32_t mode)
} }
} }
void gfxCullMode(GrCullMode_t mode) void gfxCullMode(gfxCullMode_t mode)
{ {
WriteTrace(TraceGlitch, TraceDebug, "mode: %d", mode); WriteTrace(TraceGlitch, TraceDebug, "mode: %d", mode);
static int oldmode = -1, oldinv = -1; static int oldmode = -1, oldinv = -1;
@ -192,17 +192,17 @@ void gfxCullMode(GrCullMode_t mode)
oldinv = inverted_culling; oldinv = inverted_culling;
switch (mode) switch (mode)
{ {
case GR_CULL_DISABLE: case GFX_CULL_DISABLE:
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
break; break;
case GR_CULL_NEGATIVE: case GFX_CULL_NEGATIVE:
if (!inverted_culling) if (!inverted_culling)
glCullFace(GL_FRONT); glCullFace(GL_FRONT);
else else
glCullFace(GL_BACK); glCullFace(GL_BACK);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
break; break;
case GR_CULL_POSITIVE: case GFX_CULL_POSITIVE:
if (!inverted_culling) if (!inverted_culling)
glCullFace(GL_BACK); glCullFace(GL_BACK);
else else

View File

@ -39,7 +39,7 @@ static int fog_ext_en;
int w_buffer_mode; int w_buffer_mode;
int inverted_culling; int inverted_culling;
int culling_mode; gfxCullMode_t culling_mode;
extern int fog_enabled; extern int fog_enabled;
inline float ZCALC(const float & z, const float & q) { inline float ZCALC(const float & z, const float & q) {
@ -111,7 +111,7 @@ void gfxVertexLayout(uint32_t param, FxI32 offset, uint32_t mode)
} }
} }
void gfxCullMode(GrCullMode_t mode) void gfxCullMode(gfxCullMode_t mode)
{ {
WriteTrace(TraceGlitch, TraceDebug, "mode: %d", mode); WriteTrace(TraceGlitch, TraceDebug, "mode: %d", mode);
static int oldmode = -1, oldinv = -1; static int oldmode = -1, oldinv = -1;
@ -122,17 +122,17 @@ void gfxCullMode(GrCullMode_t mode)
oldinv = inverted_culling; oldinv = inverted_culling;
switch (mode) switch (mode)
{ {
case GR_CULL_DISABLE: case GFX_CULL_DISABLE:
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
break; break;
case GR_CULL_NEGATIVE: case GFX_CULL_NEGATIVE:
if (!inverted_culling) if (!inverted_culling)
glCullFace(GL_FRONT); glCullFace(GL_FRONT);
else else
glCullFace(GL_BACK); glCullFace(GL_BACK);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
break; break;
case GR_CULL_POSITIVE: case GFX_CULL_POSITIVE:
if (!inverted_culling) if (!inverted_culling)
glCullFace(GL_BACK); glCullFace(GL_BACK);
else else

View File

@ -41,7 +41,7 @@ void gfxTexColorCombineExt(gfxChipID_t tmu, gfxTCCUColor_t a, gfxCombineMode_t a
void gfxTexAlphaCombineExt(gfxChipID_t tmu, gfxTACUColor_t a, gfxCombineMode_t a_mode, gfxTACUColor_t b, gfxCombineMode_t b_mode, gfxTACUColor_t c, bool c_invert, gfxTACUColor_t d, bool d_invert, uint32_t shift, bool invert); void gfxTexAlphaCombineExt(gfxChipID_t tmu, gfxTACUColor_t a, gfxCombineMode_t a_mode, gfxTACUColor_t b, gfxCombineMode_t b_mode, gfxTACUColor_t c, bool c_invert, gfxTACUColor_t d, bool d_invert, uint32_t shift, bool invert);
void gfxConstantColorValueExt(gfxChipID_t tmu, gfxColor_t value); void gfxConstantColorValueExt(gfxChipID_t tmu, gfxColor_t value);
void gfxVertexLayout(uint32_t param, FxI32 offset, uint32_t mode); void gfxVertexLayout(uint32_t param, FxI32 offset, uint32_t mode);
void gfxCullMode(GrCullMode_t mode); void gfxCullMode(gfxCullMode_t mode);
void gfxDepthBufferMode(GrDepthBufferMode_t mode); void gfxDepthBufferMode(GrDepthBufferMode_t mode);
void gfxDepthBufferFunction(gfxCmpFnc_t function); void gfxDepthBufferFunction(gfxCmpFnc_t function);
void gfxDepthMask(bool mask); void gfxDepthMask(bool mask);

View File

@ -145,7 +145,7 @@ extern float lambda;
extern int need_lambda[2]; extern int need_lambda[2];
extern float lambda_color[2][4]; extern float lambda_color[2][4];
extern int inverted_culling; extern int inverted_culling;
extern int culling_mode; extern gfxCullMode_t culling_mode;
extern int render_to_texture; extern int render_to_texture;
extern int lfb_color_fmt; extern int lfb_color_fmt;
extern int need_to_compile; extern int need_to_compile;
@ -155,16 +155,11 @@ extern int TMU_SIZE;
extern int blend_func_separate_support; extern int blend_func_separate_support;
extern int fog_coord_support; extern int fog_coord_support;
//extern int pbuffer_support;
extern int glsl_support; extern int glsl_support;
extern unsigned int pBufferAddress; extern unsigned int pBufferAddress;
extern int viewport_width, viewport_height, g_viewport_offset, nvidia_viewport_hack; extern int viewport_width, viewport_height, g_viewport_offset, nvidia_viewport_hack;
extern int UMAmode; extern int UMAmode;
void grChromaRangeExt(GrColor_t color0, GrColor_t color1, FxU32 mode);
void grChromaRangeModeExt(GrChromakeyMode_t mode);
void grTexChromaRangeExt(GrChipID_t tmu, GrColor_t color0, GrColor_t color1, GrTexChromakeyMode_t mode);
void grTexChromaModeExt(GrChipID_t tmu, GrChromakeyMode_t mode);
void updateTexture(); void updateTexture();
void reloadTexture(); void reloadTexture();
void free_combiners(); void free_combiners();
@ -174,92 +169,11 @@ void set_copy_shader();
void disable_textureSizes(); void disable_textureSizes();
void ExitFullScreen(); void ExitFullScreen();
// config functions
void grConfigWrapperExt(FxI32,FxBool,FxBool);
uint32_t grWrapperFullScreenResolutionExt(uint32_t * width, uint32_t * height);
char ** grQueryResolutionsExt(int32_t*);
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key);
FX_ENTRY void FX_CALL grGetGammaTableExt(FxU32, FxU32*, FxU32*, FxU32*);
int getFullScreenWidth();
int getFullScreenHeight();
// ZIGGY framebuffer copy extension // ZIGGY framebuffer copy extension
// allow to copy the depth or color buffer from back/front to front/back // allow to copy the depth or color buffer from back/front to front/back
#define GR_FBCOPY_MODE_DEPTH 0 #define GR_FBCOPY_MODE_DEPTH 0
#define GR_FBCOPY_MODE_COLOR 1 #define GR_FBCOPY_MODE_COLOR 1
#define GR_FBCOPY_BUFFER_BACK 0 #define GR_FBCOPY_BUFFER_BACK 0
#define GR_FBCOPY_BUFFER_FRONT 1 #define GR_FBCOPY_BUFFER_FRONT 1
FX_ENTRY void FX_CALL grFramebufferCopyExt(int x, int y, int w, int h,
int buffer_from, int buffer_to, int mode);
// COMBINE extension
typedef FxU32 GrCCUColor_t;
typedef FxU32 GrACUColor_t;
typedef FxU32 GrTCCUColor_t;
typedef FxU32 GrTACUColor_t;
typedef FxU32 GrCombineMode_t;
#define GR_FUNC_MODE_ZERO 0x00
#define GR_FUNC_MODE_X 0x01
#define GR_FUNC_MODE_ONE_MINUS_X 0x02
#define GR_FUNC_MODE_NEGATIVE_X 0x03
#define GR_FUNC_MODE_X_MINUS_HALF 0x04
#define GR_CMBX_ZERO 0x00
#define GR_CMBX_TEXTURE_ALPHA 0x01
#define GR_CMBX_ALOCAL 0x02
#define GR_CMBX_AOTHER 0x03
#define GR_CMBX_B 0x04
#define GR_CMBX_CONSTANT_ALPHA 0x05
#define GR_CMBX_CONSTANT_COLOR 0x06
#define GR_CMBX_DETAIL_FACTOR 0x07
#define GR_CMBX_ITALPHA 0x08
#define GR_CMBX_ITRGB 0x09
#define GR_CMBX_LOCAL_TEXTURE_ALPHA 0x0a
#define GR_CMBX_LOCAL_TEXTURE_RGB 0x0b
#define GR_CMBX_LOD_FRAC 0x0c
#define GR_CMBX_OTHER_TEXTURE_ALPHA 0x0d
#define GR_CMBX_OTHER_TEXTURE_RGB 0x0e
#define GR_CMBX_TEXTURE_RGB 0x0f
#define GR_CMBX_TMU_CALPHA 0x10
#define GR_CMBX_TMU_CCOLOR 0x11
FX_ENTRY void FX_CALL
grColorCombineExt(GrCCUColor_t a, GrCombineMode_t a_mode,
GrCCUColor_t b, GrCombineMode_t b_mode,
GrCCUColor_t c, FxBool c_invert,
GrCCUColor_t d, FxBool d_invert,
FxU32 shift, FxBool invert);
FX_ENTRY void FX_CALL
grAlphaCombineExt(GrACUColor_t a, GrCombineMode_t a_mode,
GrACUColor_t b, GrCombineMode_t b_mode,
GrACUColor_t c, FxBool c_invert,
GrACUColor_t d, FxBool d_invert,
FxU32 shift, FxBool invert);
FX_ENTRY void FX_CALL
grTexColorCombineExt(GrChipID_t tmu,
GrTCCUColor_t a, GrCombineMode_t a_mode,
GrTCCUColor_t b, GrCombineMode_t b_mode,
GrTCCUColor_t c, FxBool c_invert,
GrTCCUColor_t d, FxBool d_invert,
FxU32 shift, FxBool invert);
FX_ENTRY void FX_CALL
grTexAlphaCombineExt(GrChipID_t tmu,
GrTACUColor_t a, GrCombineMode_t a_mode,
GrTACUColor_t b, GrCombineMode_t b_mode,
GrTACUColor_t c, FxBool c_invert,
GrTACUColor_t d, FxBool d_invert,
FxU32 shift, FxBool invert);
FX_ENTRY void FX_CALL
grConstantColorValueExt(GrChipID_t tmu,
GrColor_t value);
void CHECK_FRAMEBUFFER_STATUS(void); void CHECK_FRAMEBUFFER_STATUS(void);

View File

@ -159,6 +159,13 @@ enum gfxCombineFactor_t
GFX_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION = 0xd, GFX_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION = 0xd,
}; };
enum gfxCullMode_t
{
GFX_CULL_DISABLE = 0x0,
GFX_CULL_NEGATIVE = 0x1,
GFX_CULL_POSITIVE = 0x2,
};
enum gfxCombineLocal_t enum gfxCombineLocal_t
{ {
GFX_COMBINE_LOCAL_ITERATED = 0x0, GFX_COMBINE_LOCAL_ITERATED = 0x0,

View File

@ -342,7 +342,7 @@ static gfxTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
gfxClipWindow(0, 0, g_scr_res_x, g_scr_res_y); gfxClipWindow(0, 0, g_scr_res_x, g_scr_res_y);
gfxDepthBufferFunction(GFX_CMP_ALWAYS); gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxDepthMask(FXFALSE); gfxDepthMask(FXFALSE);
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
gfxFogMode(GFX_FOG_DISABLE); gfxFogMode(GFX_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;
gfxCombineFunction_t color_source = GFX_COMBINE_FUNCTION_LOCAL; gfxCombineFunction_t color_source = GFX_COMBINE_FUNCTION_LOCAL;

View File

@ -1862,15 +1862,15 @@ void update()
{ {
case 0: // cull none case 0: // cull none
case 3: // cull both case 3: // cull both
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
break; break;
case 1: // cull front case 1: // cull front
// gfxCullMode(GR_CULL_POSITIVE); // gfxCullMode(GFX_CULL_POSITIVE);
gfxCullMode(GR_CULL_NEGATIVE); gfxCullMode(GFX_CULL_NEGATIVE);
break; break;
case 2: // cull back case 2: // cull back
// gfxCullMode (GR_CULL_NEGATIVE); // gfxCullMode (GFX_CULL_NEGATIVE);
gfxCullMode(GR_CULL_POSITIVE); gfxCullMode(GFX_CULL_POSITIVE);
break; break;
} }
} }

View File

@ -2519,7 +2519,7 @@ void rdp_fillrect()
gfxAlphaTestFunction(GFX_CMP_ALWAYS); gfxAlphaTestFunction(GFX_CMP_ALWAYS);
gfxStippleMode(GR_STIPPLE_DISABLE); gfxStippleMode(GR_STIPPLE_DISABLE);
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
gfxFogMode(GFX_FOG_DISABLE); gfxFogMode(GFX_FOG_DISABLE);
gfxDepthBufferFunction(GFX_CMP_ALWAYS); gfxDepthBufferFunction(GFX_CMP_ALWAYS);
gfxDepthMask(FXFALSE); gfxDepthMask(FXFALSE);
@ -3177,7 +3177,7 @@ void SetWireframeCol()
} }
gfxAlphaTestFunction(GFX_CMP_ALWAYS); gfxAlphaTestFunction(GFX_CMP_ALWAYS);
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
rdp.update |= UPDATE_COMBINE | UPDATE_ALPHA_COMPARE; rdp.update |= UPDATE_COMBINE | UPDATE_ALPHA_COMPARE;
} }
@ -3948,7 +3948,7 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer,
apply_shade_mods(v); apply_shade_mods(v);
} }
ConvertCoordsConvert(vtxbuf, nbVtxs); ConvertCoordsConvert(vtxbuf, nbVtxs);
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
gfxDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, nbVtxs - 1, vtxbuf, sizeof(VERTEX)); gfxDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, nbVtxs - 1, vtxbuf, sizeof(VERTEX));
} }

View File

@ -204,17 +204,17 @@ void uc5_tridma()
if (flags & 0x40) { // no cull if (flags & 0x40) { // no cull
rdp.flags &= ~CULLMASK; rdp.flags &= ~CULLMASK;
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
} }
else { // front cull else { // front cull
rdp.flags &= ~CULLMASK; rdp.flags &= ~CULLMASK;
if (rdp.view_scale[0] < 0) { if (rdp.view_scale[0] < 0) {
rdp.flags |= CULL_BACK; // agh, backwards culling rdp.flags |= CULL_BACK; // agh, backwards culling
gfxCullMode(GR_CULL_POSITIVE); gfxCullMode(GFX_CULL_POSITIVE);
} }
else { else {
rdp.flags |= CULL_FRONT; rdp.flags |= CULL_FRONT;
gfxCullMode(GR_CULL_NEGATIVE); gfxCullMode(GFX_CULL_NEGATIVE);
} }
} }
start += 4; start += 4;

View File

@ -66,7 +66,7 @@ float set_sprite_combine_mode()
WriteTrace(TraceRDP, TraceDebug, "z compare not used, using 0"); WriteTrace(TraceRDP, TraceDebug, "z compare not used, using 0");
} }
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GFX_CULL_DISABLE);
gfxFogMode(GFX_FOG_DISABLE); gfxFogMode(GFX_FOG_DISABLE);
rdp.update |= UPDATE_CULL_MODE | UPDATE_FOG_ENABLED; rdp.update |= UPDATE_CULL_MODE | UPDATE_FOG_ENABLED;