From ebf6f18ac5c18bbc4bf7876c452e923221ac16b9 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 4 Aug 2017 08:00:04 +1000 Subject: [PATCH] [Video] Change GrColorFormat_t to gfxColorFormat_t --- Source/Project64-video/Main.cpp | 2 +- .../Project64-video/Renderer/OGLEScombiner.cpp | 16 ++++++++-------- .../Project64-video/Renderer/OGLESglitchmain.cpp | 6 +++--- Source/Project64-video/Renderer/OGLcombiner.cpp | 16 ++++++++-------- .../Project64-video/Renderer/OGLglitchmain.cpp | 8 ++++---- Source/Project64-video/Renderer/Renderer.h | 2 +- Source/Project64-video/Renderer/types.h | 8 ++++++++ 7 files changed, 33 insertions(+), 25 deletions(-) diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index b3f8a04d7..2c12fcab7 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -473,7 +473,7 @@ int InitGfx() #ifndef ANDROID SetWindowDisplaySize((HWND)gfx.hWnd); #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"); return FALSE; diff --git a/Source/Project64-video/Renderer/OGLEScombiner.cpp b/Source/Project64-video/Renderer/OGLEScombiner.cpp index ad5b3d455..93afaaf43 100644 --- a/Source/Project64-video/Renderer/OGLEScombiner.cpp +++ b/Source/Project64-video/Renderer/OGLEScombiner.cpp @@ -681,13 +681,13 @@ void gfxConstantColorValue(gfxColor_t value) WriteTrace(TraceGlitch, TraceDebug, "value: %d", value); 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[0] = ((value >> 16) & 0xFF) / 255.0f; g_texture_env_color[1] = ((value >> 8) & 0xFF) / 255.0f; g_texture_env_color[2] = (value & 0xFF) / 255.0f; break; - case GR_COLORFORMAT_RGBA: + case GFX_COLORFORMAT_RGBA: g_texture_env_color[0] = ((value >> 24) & 0xFF) / 255.0f; g_texture_env_color[1] = ((value >> 16) & 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) { - case GR_COLORFORMAT_ARGB: + case GFX_COLORFORMAT_ARGB: fogColor[3] = ((fogcolor >> 24) & 0xFF) / 255.0f; fogColor[0] = ((fogcolor >> 16) & 0xFF) / 255.0f; fogColor[1] = ((fogcolor >> 8) & 0xFF) / 255.0f; fogColor[2] = (fogcolor & 0xFF) / 255.0f; break; - case GR_COLORFORMAT_RGBA: + case GFX_COLORFORMAT_RGBA: fogColor[0] = ((fogcolor >> 24) & 0xFF) / 255.0f; fogColor[1] = ((fogcolor >> 16) & 0xFF) / 255.0f; fogColor[2] = ((fogcolor >> 8) & 0xFF) / 255.0f; @@ -1646,13 +1646,13 @@ void gfxChromakeyValue(gfxColor_t value) 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[0] = ((value >> 16) & 0xFF) / 255.0f; g_chroma_color[1] = ((value >> 8) & 0xFF) / 255.0f; g_chroma_color[2] = (value & 0xFF) / 255.0f; break; - case GR_COLORFORMAT_RGBA: + case GFX_COLORFORMAT_RGBA: g_chroma_color[0] = ((value >> 24) & 0xFF) / 255.0f; g_chroma_color[1] = ((value >> 16) & 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) { - case GR_COLORFORMAT_ARGB: + case GFX_COLORFORMAT_ARGB: if (num_tex == 0) { 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; } break; - case GR_COLORFORMAT_RGBA: + case GFX_COLORFORMAT_RGBA: if (num_tex == 0) { g_ccolor0[0] = ((value >> 24) & 0xFF) / 255.0f; diff --git a/Source/Project64-video/Renderer/OGLESglitchmain.cpp b/Source/Project64-video/Renderer/OGLESglitchmain.cpp index 119c02928..52811e6d9 100644 --- a/Source/Project64-video/Renderer/OGLESglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLESglitchmain.cpp @@ -319,7 +319,7 @@ int isWglExtensionSupported(const char *extension) # 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; @@ -1264,13 +1264,13 @@ void gfxBufferClear(gfxColor_t color, gfxAlpha_t alpha, uint32_t depth) vbo_draw(); switch (lfb_color_fmt) { - case GR_COLORFORMAT_ARGB: + case GFX_COLORFORMAT_ARGB: glClearColor(((color >> 16) & 0xFF) / 255.0f, ((color >> 8) & 0xFF) / 255.0f, (color & 0xFF) / 255.0f, alpha / 255.0f); break; - case GR_COLORFORMAT_RGBA: + case GFX_COLORFORMAT_RGBA: glClearColor(((color >> 24) & 0xFF) / 255.0f, ((color >> 16) & 0xFF) / 255.0f, (color & 0xFF) / 255.0f, diff --git a/Source/Project64-video/Renderer/OGLcombiner.cpp b/Source/Project64-video/Renderer/OGLcombiner.cpp index 81887c125..86ba9b898 100644 --- a/Source/Project64-video/Renderer/OGLcombiner.cpp +++ b/Source/Project64-video/Renderer/OGLcombiner.cpp @@ -584,13 +584,13 @@ void gfxConstantColorValue(gfxColor_t value) WriteTrace(TraceGlitch, TraceDebug, "value: %d", value); switch (lfb_color_fmt) { - case GR_COLORFORMAT_ARGB: + case GFX_COLORFORMAT_ARGB: texture_env_color[3] = ((value >> 24) & 0xFF) / 255.0f; texture_env_color[0] = ((value >> 16) & 0xFF) / 255.0f; texture_env_color[1] = ((value >> 8) & 0xFF) / 255.0f; texture_env_color[2] = (value & 0xFF) / 255.0f; break; - case GR_COLORFORMAT_RGBA: + case GFX_COLORFORMAT_RGBA: texture_env_color[0] = ((value >> 24) & 0xFF) / 255.0f; texture_env_color[1] = ((value >> 16) & 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) { - case GR_COLORFORMAT_ARGB: + case GFX_COLORFORMAT_ARGB: color[3] = ((fogcolor >> 24) & 0xFF) / 255.0f; color[0] = ((fogcolor >> 16) & 0xFF) / 255.0f; color[1] = ((fogcolor >> 8) & 0xFF) / 255.0f; color[2] = (fogcolor & 0xFF) / 255.0f; break; - case GR_COLORFORMAT_RGBA: + case GFX_COLORFORMAT_RGBA: color[0] = ((fogcolor >> 24) & 0xFF) / 255.0f; color[1] = ((fogcolor >> 16) & 0xFF) / 255.0f; color[2] = ((fogcolor >> 8) & 0xFF) / 255.0f; @@ -1600,13 +1600,13 @@ void gfxChromakeyValue(gfxColor_t value) switch (lfb_color_fmt) { - case GR_COLORFORMAT_ARGB: + case GFX_COLORFORMAT_ARGB: chroma_color[3] = 1.0;//((value >> 24) & 0xFF) / 255.0f; chroma_color[0] = ((value >> 16) & 0xFF) / 255.0f; chroma_color[1] = ((value >> 8) & 0xFF) / 255.0f; chroma_color[2] = (value & 0xFF) / 255.0f; break; - case GR_COLORFORMAT_RGBA: + case GFX_COLORFORMAT_RGBA: chroma_color[0] = ((value >> 24) & 0xFF) / 255.0f; chroma_color[1] = ((value >> 16) & 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) { - case GR_COLORFORMAT_ARGB: + case GFX_COLORFORMAT_ARGB: if (num_tex == 0) { 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; } break; - case GR_COLORFORMAT_RGBA: + case GFX_COLORFORMAT_RGBA: if (num_tex == 0) { ccolor0[0] = ((value >> 24) & 0xFF) / 255.0f; diff --git a/Source/Project64-video/Renderer/OGLglitchmain.cpp b/Source/Project64-video/Renderer/OGLglitchmain.cpp index e7c203332..73825e83c 100644 --- a/Source/Project64-video/Renderer/OGLglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLglitchmain.cpp @@ -451,7 +451,7 @@ int isWglExtensionSupported(const char *extension) extern HWND g_hwnd_win; #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; @@ -1193,7 +1193,7 @@ uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params) if (plength < 4 || params == NULL) return 0; if (!nbTextureUnits) { - gfxSstWinOpen(GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1); + gfxSstWinOpen(GFX_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1); gfxSstWinClose(); } #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); switch (lfb_color_fmt) { - case GR_COLORFORMAT_ARGB: + case GFX_COLORFORMAT_ARGB: glClearColor(((color >> 16) & 0xFF) / 255.0f, ((color >> 8) & 0xFF) / 255.0f, (color & 0xFF) / 255.0f, alpha / 255.0f); break; - case GR_COLORFORMAT_RGBA: + case GFX_COLORFORMAT_RGBA: glClearColor(((color >> 24) & 0xFF) / 255.0f, ((color >> 16) & 0xFF) / 255.0f, (color & 0xFF) / 255.0f, diff --git a/Source/Project64-video/Renderer/Renderer.h b/Source/Project64-video/Renderer/Renderer.h index 3136f1783..5e03e8011 100644 --- a/Source/Project64-video/Renderer/Renderer.h +++ b/Source/Project64-video/Renderer/Renderer.h @@ -51,7 +51,7 @@ void gfxDrawLine(const void *a, const void *b); void gfxDrawVertexArray(uint32_t mode, uint32_t Count, void *pointers2); 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); uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params); void gfxRenderBuffer(GrBuffer_t buffer); diff --git a/Source/Project64-video/Renderer/types.h b/Source/Project64-video/Renderer/types.h index 646627e73..0fcca65ac 100644 --- a/Source/Project64-video/Renderer/types.h +++ b/Source/Project64-video/Renderer/types.h @@ -255,6 +255,14 @@ enum gfxDepthBufferMode_t 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 { GFX_CHROMAKEY_DISABLE = 0x0,