From f14c857bcec07fea2ac48652e260a84ebfe52e5a Mon Sep 17 00:00:00 2001 From: zilmar Date: Sun, 23 Jul 2017 12:53:37 +1000 Subject: [PATCH] [Video] change gfxSstWinOpen and gfxSstWinClose --- Source/Project64-video/Main.cpp | 6 ++---- .../Project64-video/Renderer/OGLESglitchmain.cpp | 6 +++--- .../Project64-video/Renderer/OGLglitchmain.cpp | 16 ++++++++-------- Source/Project64-video/Renderer/Renderer.h | 4 ++-- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index 73f29033e..9cf398b22 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -51,7 +51,6 @@ GFX_INFO gfx; int to_fullscreen = FALSE; int GfxInitDone = FALSE; bool g_romopen = false; -GrContext_t gfx_context = 0; int exception = FALSE; int evoodoo = 0; @@ -474,8 +473,7 @@ int InitGfx() #ifndef ANDROID SetWindowDisplaySize((HWND)gfx.hWnd); #endif - gfx_context = gfxSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1); - if (!gfx_context) + if (!gfxSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1)) { g_Notify->DisplayError("Error setting display mode"); return FALSE; @@ -639,7 +637,7 @@ void ReleaseGfx() } // Release graphics - gfxSstWinClose(gfx_context); + gfxSstWinClose(); GfxInitDone = FALSE; rdp.window_changed = TRUE; diff --git a/Source/Project64-video/Renderer/OGLESglitchmain.cpp b/Source/Project64-video/Renderer/OGLESglitchmain.cpp index 13b3a8e21..3edaea4c8 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 -GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers) +bool gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers) { static int show_warning = 1; @@ -509,10 +509,10 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi return 1; } -bool gfxSstWinClose(GrContext_t context) +bool gfxSstWinClose() { + WriteTrace(TraceGlitch, TraceDebug, "-"); int i, clear_texbuff = use_fbo; - WriteTrace(TraceGlitch, TraceDebug, "context: %d", context); for (i = 0; i < 2; i++) { tmu_usage[i].min = 0xfffffff; diff --git a/Source/Project64-video/Renderer/OGLglitchmain.cpp b/Source/Project64-video/Renderer/OGLglitchmain.cpp index c42dd166a..6486288a8 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 -GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers) +bool gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers) { static int show_warning = 1; @@ -514,7 +514,7 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi if ((hGLRC = wglCreateContext(hDC)) == 0) { WriteTrace(TraceGlitch, TraceWarning, "wglCreateContext failed!"); - gfxSstWinClose(0); + gfxSstWinClose(); return FXFALSE; } @@ -525,7 +525,7 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi if (!wglMakeCurrent(hDC, hGLRC)) { WriteTrace(TraceGlitch, TraceWarning, "wglMakeCurrent failed!"); - gfxSstWinClose(0); + gfxSstWinClose(); return FXFALSE; } } @@ -801,13 +801,13 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi return 1; } -bool gfxSstWinClose(GrContext_t context) +bool gfxSstWinClose() { + WriteTrace(TraceGlitch, TraceDebug, "-"); int i; #ifndef WIN32 int clear_texbuff = use_fbo; #endif - WriteTrace(TraceGlitch, TraceDebug, "context: %d", context); for (i = 0; i < 2; i++) { tmu_usage[i].min = 0x0FFFFFFFul; @@ -1194,7 +1194,7 @@ uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params) if (!nbTextureUnits) { gfxSstWinOpen(GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1); - gfxSstWinClose(0); + gfxSstWinClose(); } #ifdef VOODOO1 params[0] = 1; @@ -1980,8 +1980,8 @@ void gfxGetGammaTableExt(uint32_t /*nentries*/, uint32_t *red, uint32_t *green, green[i] = aGammaRamp[1][i] >> 8; blue[i] = aGammaRamp[2][i] >> 8; } - } } +} void gfxGammaCorrectionRGB(FxFloat gammaR, FxFloat gammaG, FxFloat gammaB) { @@ -2050,7 +2050,7 @@ int grDisplayGLError(const char* message) fprintf(stderr, "%s\n%s\n\n", GL_errors[error_index], message); #endif return (failure); - } +} #endif void CHECK_FRAMEBUFFER_STATUS() diff --git a/Source/Project64-video/Renderer/Renderer.h b/Source/Project64-video/Renderer/Renderer.h index c4931c48a..260b7eea1 100644 --- a/Source/Project64-video/Renderer/Renderer.h +++ b/Source/Project64-video/Renderer/Renderer.h @@ -18,7 +18,7 @@ void gfxClipWindow(uint32_t minx, uint32_t miny, uint32_t maxx, uint32_t maxy); void gfxColorMask(bool rgb, bool a); uint32_t gfxTexMinAddress(gfxChipID_t tmu); -bool gfxSstWinClose(GrContext_t context); +bool gfxSstWinClose(); void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt, uint32_t evenOdd); uint32_t gfxTexMaxAddress(gfxChipID_t tmu); uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, GrTexInfo *info); @@ -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); -GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers); +bool gfxSstWinOpen(GrColorFormat_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 gfxFramebufferCopyExt(int x, int y, int w, int h, int from, int to, int mode);