[Video] Change GrColorFormat_t to gfxColorFormat_t

This commit is contained in:
zilmar 2017-08-04 08:00:04 +10:00
parent e1fe202999
commit ebf6f18ac5
7 changed files with 33 additions and 25 deletions

View File

@ -473,7 +473,7 @@ int InitGfx()
#ifndef ANDROID #ifndef ANDROID
SetWindowDisplaySize((HWND)gfx.hWnd); SetWindowDisplaySize((HWND)gfx.hWnd);
#endif #endif
if (!gfxSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1)) if (!gfxSstWinOpen(GFX_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1))
{ {
g_Notify->DisplayError("Error setting display mode"); g_Notify->DisplayError("Error setting display mode");
return FALSE; return FALSE;

View File

@ -681,13 +681,13 @@ void gfxConstantColorValue(gfxColor_t value)
WriteTrace(TraceGlitch, TraceDebug, "value: %d", value); WriteTrace(TraceGlitch, TraceDebug, "value: %d", value);
switch (lfb_color_fmt) switch (lfb_color_fmt)
{ {
case GR_COLORFORMAT_ARGB: case GFX_COLORFORMAT_ARGB:
g_texture_env_color[3] = ((value >> 24) & 0xFF) / 255.0f; g_texture_env_color[3] = ((value >> 24) & 0xFF) / 255.0f;
g_texture_env_color[0] = ((value >> 16) & 0xFF) / 255.0f; g_texture_env_color[0] = ((value >> 16) & 0xFF) / 255.0f;
g_texture_env_color[1] = ((value >> 8) & 0xFF) / 255.0f; g_texture_env_color[1] = ((value >> 8) & 0xFF) / 255.0f;
g_texture_env_color[2] = (value & 0xFF) / 255.0f; g_texture_env_color[2] = (value & 0xFF) / 255.0f;
break; break;
case GR_COLORFORMAT_RGBA: case GFX_COLORFORMAT_RGBA:
g_texture_env_color[0] = ((value >> 24) & 0xFF) / 255.0f; g_texture_env_color[0] = ((value >> 24) & 0xFF) / 255.0f;
g_texture_env_color[1] = ((value >> 16) & 0xFF) / 255.0f; g_texture_env_color[1] = ((value >> 16) & 0xFF) / 255.0f;
g_texture_env_color[2] = ((value >> 8) & 0xFF) / 255.0f; g_texture_env_color[2] = ((value >> 8) & 0xFF) / 255.0f;
@ -1604,13 +1604,13 @@ void gfxFogColorValue(gfxColor_t fogcolor)
switch (lfb_color_fmt) switch (lfb_color_fmt)
{ {
case GR_COLORFORMAT_ARGB: case GFX_COLORFORMAT_ARGB:
fogColor[3] = ((fogcolor >> 24) & 0xFF) / 255.0f; fogColor[3] = ((fogcolor >> 24) & 0xFF) / 255.0f;
fogColor[0] = ((fogcolor >> 16) & 0xFF) / 255.0f; fogColor[0] = ((fogcolor >> 16) & 0xFF) / 255.0f;
fogColor[1] = ((fogcolor >> 8) & 0xFF) / 255.0f; fogColor[1] = ((fogcolor >> 8) & 0xFF) / 255.0f;
fogColor[2] = (fogcolor & 0xFF) / 255.0f; fogColor[2] = (fogcolor & 0xFF) / 255.0f;
break; break;
case GR_COLORFORMAT_RGBA: case GFX_COLORFORMAT_RGBA:
fogColor[0] = ((fogcolor >> 24) & 0xFF) / 255.0f; fogColor[0] = ((fogcolor >> 24) & 0xFF) / 255.0f;
fogColor[1] = ((fogcolor >> 16) & 0xFF) / 255.0f; fogColor[1] = ((fogcolor >> 16) & 0xFF) / 255.0f;
fogColor[2] = ((fogcolor >> 8) & 0xFF) / 255.0f; fogColor[2] = ((fogcolor >> 8) & 0xFF) / 255.0f;
@ -1646,13 +1646,13 @@ void gfxChromakeyValue(gfxColor_t value)
switch (lfb_color_fmt) switch (lfb_color_fmt)
{ {
case GR_COLORFORMAT_ARGB: case GFX_COLORFORMAT_ARGB:
g_chroma_color[3] = 1.0;//((value >> 24) & 0xFF) / 255.0f; g_chroma_color[3] = 1.0;//((value >> 24) & 0xFF) / 255.0f;
g_chroma_color[0] = ((value >> 16) & 0xFF) / 255.0f; g_chroma_color[0] = ((value >> 16) & 0xFF) / 255.0f;
g_chroma_color[1] = ((value >> 8) & 0xFF) / 255.0f; g_chroma_color[1] = ((value >> 8) & 0xFF) / 255.0f;
g_chroma_color[2] = (value & 0xFF) / 255.0f; g_chroma_color[2] = (value & 0xFF) / 255.0f;
break; break;
case GR_COLORFORMAT_RGBA: case GFX_COLORFORMAT_RGBA:
g_chroma_color[0] = ((value >> 24) & 0xFF) / 255.0f; g_chroma_color[0] = ((value >> 24) & 0xFF) / 255.0f;
g_chroma_color[1] = ((value >> 16) & 0xFF) / 255.0f; g_chroma_color[1] = ((value >> 16) & 0xFF) / 255.0f;
g_chroma_color[2] = ((value >> 8) & 0xFF) / 255.0f; g_chroma_color[2] = ((value >> 8) & 0xFF) / 255.0f;
@ -2698,7 +2698,7 @@ void gfxConstantColorValueExt(gfxChipID_t tmu, gfxColor_t value)
switch (lfb_color_fmt) switch (lfb_color_fmt)
{ {
case GR_COLORFORMAT_ARGB: case GFX_COLORFORMAT_ARGB:
if (num_tex == 0) if (num_tex == 0)
{ {
g_ccolor0[3] = ((value >> 24) & 0xFF) / 255.0f; g_ccolor0[3] = ((value >> 24) & 0xFF) / 255.0f;
@ -2714,7 +2714,7 @@ void gfxConstantColorValueExt(gfxChipID_t tmu, gfxColor_t value)
g_ccolor1[2] = (value & 0xFF) / 255.0f; g_ccolor1[2] = (value & 0xFF) / 255.0f;
} }
break; break;
case GR_COLORFORMAT_RGBA: case GFX_COLORFORMAT_RGBA:
if (num_tex == 0) if (num_tex == 0)
{ {
g_ccolor0[0] = ((value >> 24) & 0xFF) / 255.0f; g_ccolor0[0] = ((value >> 24) & 0xFF) / 255.0f;

View File

@ -319,7 +319,7 @@ int isWglExtensionSupported(const char *extension)
# endif # endif
#endif #endif
bool gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers) bool gfxSstWinOpen(gfxColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers)
{ {
static int show_warning = 1; static int show_warning = 1;
@ -1264,13 +1264,13 @@ void gfxBufferClear(gfxColor_t color, gfxAlpha_t alpha, uint32_t depth)
vbo_draw(); vbo_draw();
switch (lfb_color_fmt) switch (lfb_color_fmt)
{ {
case GR_COLORFORMAT_ARGB: case GFX_COLORFORMAT_ARGB:
glClearColor(((color >> 16) & 0xFF) / 255.0f, glClearColor(((color >> 16) & 0xFF) / 255.0f,
((color >> 8) & 0xFF) / 255.0f, ((color >> 8) & 0xFF) / 255.0f,
(color & 0xFF) / 255.0f, (color & 0xFF) / 255.0f,
alpha / 255.0f); alpha / 255.0f);
break; break;
case GR_COLORFORMAT_RGBA: case GFX_COLORFORMAT_RGBA:
glClearColor(((color >> 24) & 0xFF) / 255.0f, glClearColor(((color >> 24) & 0xFF) / 255.0f,
((color >> 16) & 0xFF) / 255.0f, ((color >> 16) & 0xFF) / 255.0f,
(color & 0xFF) / 255.0f, (color & 0xFF) / 255.0f,

View File

@ -584,13 +584,13 @@ void gfxConstantColorValue(gfxColor_t value)
WriteTrace(TraceGlitch, TraceDebug, "value: %d", value); WriteTrace(TraceGlitch, TraceDebug, "value: %d", value);
switch (lfb_color_fmt) switch (lfb_color_fmt)
{ {
case GR_COLORFORMAT_ARGB: case GFX_COLORFORMAT_ARGB:
texture_env_color[3] = ((value >> 24) & 0xFF) / 255.0f; texture_env_color[3] = ((value >> 24) & 0xFF) / 255.0f;
texture_env_color[0] = ((value >> 16) & 0xFF) / 255.0f; texture_env_color[0] = ((value >> 16) & 0xFF) / 255.0f;
texture_env_color[1] = ((value >> 8) & 0xFF) / 255.0f; texture_env_color[1] = ((value >> 8) & 0xFF) / 255.0f;
texture_env_color[2] = (value & 0xFF) / 255.0f; texture_env_color[2] = (value & 0xFF) / 255.0f;
break; break;
case GR_COLORFORMAT_RGBA: case GFX_COLORFORMAT_RGBA:
texture_env_color[0] = ((value >> 24) & 0xFF) / 255.0f; texture_env_color[0] = ((value >> 24) & 0xFF) / 255.0f;
texture_env_color[1] = ((value >> 16) & 0xFF) / 255.0f; texture_env_color[1] = ((value >> 16) & 0xFF) / 255.0f;
texture_env_color[2] = ((value >> 8) & 0xFF) / 255.0f; texture_env_color[2] = ((value >> 8) & 0xFF) / 255.0f;
@ -1555,13 +1555,13 @@ void gfxFogColorValue(gfxColor_t fogcolor)
switch (lfb_color_fmt) switch (lfb_color_fmt)
{ {
case GR_COLORFORMAT_ARGB: case GFX_COLORFORMAT_ARGB:
color[3] = ((fogcolor >> 24) & 0xFF) / 255.0f; color[3] = ((fogcolor >> 24) & 0xFF) / 255.0f;
color[0] = ((fogcolor >> 16) & 0xFF) / 255.0f; color[0] = ((fogcolor >> 16) & 0xFF) / 255.0f;
color[1] = ((fogcolor >> 8) & 0xFF) / 255.0f; color[1] = ((fogcolor >> 8) & 0xFF) / 255.0f;
color[2] = (fogcolor & 0xFF) / 255.0f; color[2] = (fogcolor & 0xFF) / 255.0f;
break; break;
case GR_COLORFORMAT_RGBA: case GFX_COLORFORMAT_RGBA:
color[0] = ((fogcolor >> 24) & 0xFF) / 255.0f; color[0] = ((fogcolor >> 24) & 0xFF) / 255.0f;
color[1] = ((fogcolor >> 16) & 0xFF) / 255.0f; color[1] = ((fogcolor >> 16) & 0xFF) / 255.0f;
color[2] = ((fogcolor >> 8) & 0xFF) / 255.0f; color[2] = ((fogcolor >> 8) & 0xFF) / 255.0f;
@ -1600,13 +1600,13 @@ void gfxChromakeyValue(gfxColor_t value)
switch (lfb_color_fmt) switch (lfb_color_fmt)
{ {
case GR_COLORFORMAT_ARGB: case GFX_COLORFORMAT_ARGB:
chroma_color[3] = 1.0;//((value >> 24) & 0xFF) / 255.0f; chroma_color[3] = 1.0;//((value >> 24) & 0xFF) / 255.0f;
chroma_color[0] = ((value >> 16) & 0xFF) / 255.0f; chroma_color[0] = ((value >> 16) & 0xFF) / 255.0f;
chroma_color[1] = ((value >> 8) & 0xFF) / 255.0f; chroma_color[1] = ((value >> 8) & 0xFF) / 255.0f;
chroma_color[2] = (value & 0xFF) / 255.0f; chroma_color[2] = (value & 0xFF) / 255.0f;
break; break;
case GR_COLORFORMAT_RGBA: case GFX_COLORFORMAT_RGBA:
chroma_color[0] = ((value >> 24) & 0xFF) / 255.0f; chroma_color[0] = ((value >> 24) & 0xFF) / 255.0f;
chroma_color[1] = ((value >> 16) & 0xFF) / 255.0f; chroma_color[1] = ((value >> 16) & 0xFF) / 255.0f;
chroma_color[2] = ((value >> 8) & 0xFF) / 255.0f; chroma_color[2] = ((value >> 8) & 0xFF) / 255.0f;
@ -2662,7 +2662,7 @@ void gfxConstantColorValueExt(gfxChipID_t tmu, gfxColor_t value)
switch (lfb_color_fmt) switch (lfb_color_fmt)
{ {
case GR_COLORFORMAT_ARGB: case GFX_COLORFORMAT_ARGB:
if (num_tex == 0) if (num_tex == 0)
{ {
ccolor0[3] = ((value >> 24) & 0xFF) / 255.0f; ccolor0[3] = ((value >> 24) & 0xFF) / 255.0f;
@ -2678,7 +2678,7 @@ void gfxConstantColorValueExt(gfxChipID_t tmu, gfxColor_t value)
ccolor1[2] = (value & 0xFF) / 255.0f; ccolor1[2] = (value & 0xFF) / 255.0f;
} }
break; break;
case GR_COLORFORMAT_RGBA: case GFX_COLORFORMAT_RGBA:
if (num_tex == 0) if (num_tex == 0)
{ {
ccolor0[0] = ((value >> 24) & 0xFF) / 255.0f; ccolor0[0] = ((value >> 24) & 0xFF) / 255.0f;

View File

@ -451,7 +451,7 @@ int isWglExtensionSupported(const char *extension)
extern HWND g_hwnd_win; extern HWND g_hwnd_win;
#endif #endif
bool gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers) bool gfxSstWinOpen(gfxColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers)
{ {
static int show_warning = 1; static int show_warning = 1;
@ -1193,7 +1193,7 @@ uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params)
if (plength < 4 || params == NULL) return 0; if (plength < 4 || params == NULL) return 0;
if (!nbTextureUnits) if (!nbTextureUnits)
{ {
gfxSstWinOpen(GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1); gfxSstWinOpen(GFX_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
gfxSstWinClose(); gfxSstWinClose();
} }
#ifdef VOODOO1 #ifdef VOODOO1
@ -1555,13 +1555,13 @@ void gfxBufferClear(gfxColor_t color, gfxAlpha_t alpha, uint32_t depth)
WriteTrace(TraceGlitch, TraceDebug, "color: %X alpha: %X depth: %X", color, alpha, depth); WriteTrace(TraceGlitch, TraceDebug, "color: %X alpha: %X depth: %X", color, alpha, depth);
switch (lfb_color_fmt) switch (lfb_color_fmt)
{ {
case GR_COLORFORMAT_ARGB: case GFX_COLORFORMAT_ARGB:
glClearColor(((color >> 16) & 0xFF) / 255.0f, glClearColor(((color >> 16) & 0xFF) / 255.0f,
((color >> 8) & 0xFF) / 255.0f, ((color >> 8) & 0xFF) / 255.0f,
(color & 0xFF) / 255.0f, (color & 0xFF) / 255.0f,
alpha / 255.0f); alpha / 255.0f);
break; break;
case GR_COLORFORMAT_RGBA: case GFX_COLORFORMAT_RGBA:
glClearColor(((color >> 24) & 0xFF) / 255.0f, glClearColor(((color >> 24) & 0xFF) / 255.0f,
((color >> 16) & 0xFF) / 255.0f, ((color >> 16) & 0xFF) / 255.0f,
(color & 0xFF) / 255.0f, (color & 0xFF) / 255.0f,

View File

@ -51,7 +51,7 @@ void gfxDrawLine(const void *a, const void *b);
void gfxDrawVertexArray(uint32_t mode, uint32_t Count, void *pointers2); void gfxDrawVertexArray(uint32_t mode, uint32_t Count, void *pointers2);
void gfxDrawVertexArrayContiguous(uint32_t mode, uint32_t Count, void *pointers, uint32_t stride); void gfxDrawVertexArrayContiguous(uint32_t mode, uint32_t Count, void *pointers, uint32_t stride);
bool gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers); bool gfxSstWinOpen(gfxColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers);
void gfxAuxBufferExt(GrBuffer_t buffer); void gfxAuxBufferExt(GrBuffer_t buffer);
uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params); uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params);
void gfxRenderBuffer(GrBuffer_t buffer); void gfxRenderBuffer(GrBuffer_t buffer);

View File

@ -255,6 +255,14 @@ enum gfxDepthBufferMode_t
GFX_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS = 0x4, GFX_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS = 0x4,
}; };
enum gfxColorFormat_t
{
GFX_COLORFORMAT_ARGB = 0x0,
GFX_COLORFORMAT_ABGR = 0x1,
GFX_COLORFORMAT_RGBA = 0x2,
GFX_COLORFORMAT_BGRA = 0x3,
};
enum gfxChromakeyMode_t enum gfxChromakeyMode_t
{ {
GFX_CHROMAKEY_DISABLE = 0x0, GFX_CHROMAKEY_DISABLE = 0x0,