[Video] change gfxSstWinOpen and gfxSstWinClose

This commit is contained in:
zilmar 2017-07-23 12:53:37 +10:00
parent 87efd0c259
commit f14c857bce
4 changed files with 15 additions and 17 deletions

View File

@ -51,7 +51,6 @@ GFX_INFO gfx;
int to_fullscreen = FALSE; int to_fullscreen = FALSE;
int GfxInitDone = FALSE; int GfxInitDone = FALSE;
bool g_romopen = false; bool g_romopen = false;
GrContext_t gfx_context = 0;
int exception = FALSE; int exception = FALSE;
int evoodoo = 0; int evoodoo = 0;
@ -474,8 +473,7 @@ int InitGfx()
#ifndef ANDROID #ifndef ANDROID
SetWindowDisplaySize((HWND)gfx.hWnd); SetWindowDisplaySize((HWND)gfx.hWnd);
#endif #endif
gfx_context = gfxSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1); if (!gfxSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1))
if (!gfx_context)
{ {
g_Notify->DisplayError("Error setting display mode"); g_Notify->DisplayError("Error setting display mode");
return FALSE; return FALSE;
@ -639,7 +637,7 @@ void ReleaseGfx()
} }
// Release graphics // Release graphics
gfxSstWinClose(gfx_context); gfxSstWinClose();
GfxInitDone = FALSE; GfxInitDone = FALSE;
rdp.window_changed = TRUE; rdp.window_changed = TRUE;

View File

@ -319,7 +319,7 @@ int isWglExtensionSupported(const char *extension)
# endif # endif
#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; static int show_warning = 1;
@ -509,10 +509,10 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi
return 1; return 1;
} }
bool gfxSstWinClose(GrContext_t context) bool gfxSstWinClose()
{ {
WriteTrace(TraceGlitch, TraceDebug, "-");
int i, clear_texbuff = use_fbo; int i, clear_texbuff = use_fbo;
WriteTrace(TraceGlitch, TraceDebug, "context: %d", context);
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
tmu_usage[i].min = 0xfffffff; tmu_usage[i].min = 0xfffffff;

View File

@ -451,7 +451,7 @@ int isWglExtensionSupported(const char *extension)
extern HWND g_hwnd_win; extern HWND g_hwnd_win;
#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; static int show_warning = 1;
@ -514,7 +514,7 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi
if ((hGLRC = wglCreateContext(hDC)) == 0) if ((hGLRC = wglCreateContext(hDC)) == 0)
{ {
WriteTrace(TraceGlitch, TraceWarning, "wglCreateContext failed!"); WriteTrace(TraceGlitch, TraceWarning, "wglCreateContext failed!");
gfxSstWinClose(0); gfxSstWinClose();
return FXFALSE; return FXFALSE;
} }
@ -525,7 +525,7 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi
if (!wglMakeCurrent(hDC, hGLRC)) if (!wglMakeCurrent(hDC, hGLRC))
{ {
WriteTrace(TraceGlitch, TraceWarning, "wglMakeCurrent failed!"); WriteTrace(TraceGlitch, TraceWarning, "wglMakeCurrent failed!");
gfxSstWinClose(0); gfxSstWinClose();
return FXFALSE; return FXFALSE;
} }
} }
@ -801,13 +801,13 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi
return 1; return 1;
} }
bool gfxSstWinClose(GrContext_t context) bool gfxSstWinClose()
{ {
WriteTrace(TraceGlitch, TraceDebug, "-");
int i; int i;
#ifndef WIN32 #ifndef WIN32
int clear_texbuff = use_fbo; int clear_texbuff = use_fbo;
#endif #endif
WriteTrace(TraceGlitch, TraceDebug, "context: %d", context);
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
tmu_usage[i].min = 0x0FFFFFFFul; tmu_usage[i].min = 0x0FFFFFFFul;
@ -1194,7 +1194,7 @@ uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params)
if (!nbTextureUnits) if (!nbTextureUnits)
{ {
gfxSstWinOpen(GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1); gfxSstWinOpen(GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
gfxSstWinClose(0); gfxSstWinClose();
} }
#ifdef VOODOO1 #ifdef VOODOO1
params[0] = 1; params[0] = 1;
@ -1980,8 +1980,8 @@ void gfxGetGammaTableExt(uint32_t /*nentries*/, uint32_t *red, uint32_t *green,
green[i] = aGammaRamp[1][i] >> 8; green[i] = aGammaRamp[1][i] >> 8;
blue[i] = aGammaRamp[2][i] >> 8; blue[i] = aGammaRamp[2][i] >> 8;
} }
}
} }
}
void gfxGammaCorrectionRGB(FxFloat gammaR, FxFloat gammaG, FxFloat gammaB) 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); fprintf(stderr, "%s\n%s\n\n", GL_errors[error_index], message);
#endif #endif
return (failure); return (failure);
} }
#endif #endif
void CHECK_FRAMEBUFFER_STATUS() void CHECK_FRAMEBUFFER_STATUS()

View File

@ -18,7 +18,7 @@
void gfxClipWindow(uint32_t minx, uint32_t miny, uint32_t maxx, uint32_t maxy); void gfxClipWindow(uint32_t minx, uint32_t miny, uint32_t maxx, uint32_t maxy);
void gfxColorMask(bool rgb, bool a); void gfxColorMask(bool rgb, bool a);
uint32_t gfxTexMinAddress(gfxChipID_t tmu); 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); 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 gfxTexMaxAddress(gfxChipID_t tmu);
uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, GrTexInfo *info); 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 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);
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); 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 gfxFramebufferCopyExt(int x, int y, int w, int h, int from, int to, int mode); void gfxFramebufferCopyExt(int x, int y, int w, int h, int from, int to, int mode);