diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index e382982ab..d35d4bb6b 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -202,11 +202,6 @@ void ChangeSize() WriteTrace(TraceResolution, TraceDebug, "Done"); } -void ConfigWrapper() -{ - grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic()); -} - extern int g_width, g_height; int GetTexAddrUMA(int /*tmu*/, int texsize) @@ -906,7 +901,6 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info) char name[21] = "DEFAULT"; g_settings->ReadGameSettings(name); ZLUT_init(); - ConfigWrapper(); gfx = Gfx_Info; @@ -920,7 +914,6 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info) CountCombine(); ZLUT_init(); - grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic()); evoodoo = 1; voodoo.has_2mb_tex_boundary = 0; return TRUE; diff --git a/Source/Project64-video/Renderer/OGLESglitchmain.cpp b/Source/Project64-video/Renderer/OGLESglitchmain.cpp index 7cd04967e..9ab65e505 100644 --- a/Source/Project64-video/Renderer/OGLESglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLESglitchmain.cpp @@ -408,9 +408,9 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)wglGetProcAddress("glGenRenderbuffersEXT"); glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT"); glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT"); - use_fbo = config.fbo && (glFramebufferRenderbufferEXT != NULL); + use_fbo = g_settings->wrpFBO() && (glFramebufferRenderbufferEXT != NULL); #else - use_fbo = config.fbo; + use_fbo = g_settings->wrpFBO(); #endif // _WIN32 //LOGINFO("use_fbo %d\n", use_fbo); @@ -506,25 +506,6 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi init_textures(); init_combiner(); - /* - // Aniso filter check - if (config.anisofilter > 0 ) - glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &largest_supported_anisotropy); - - // ATI hack - certain texture formats are slow on ATI? - // Hmm, perhaps the internal format need to be specified explicitly... - { - GLint ifmt; - glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL); - glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &ifmt); - if (ifmt != GL_RGB5_A1) { - WriteTrace(TraceGlitch, TraceWarning, "ATI SUCKS %x\n", ifmt); - ati_sucks = 1; - } else - ati_sucks = 0; - } - */ - return 1; } @@ -1656,15 +1637,6 @@ FxBool gfxLfbWriteRegion(GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, GrLfbS } /* wrapper-specific glide extensions */ - -void grConfigWrapperExt(FxI32 vram, FxBool fbo, FxBool aniso) -{ - WriteTrace(TraceGlitch, TraceDebug, "-"); - config.vram_size = vram; - config.fbo = fbo; - config.anisofilter = aniso; -} - void gfxLoadGammaTable(FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue) { } @@ -1672,46 +1644,10 @@ void gfxLoadGammaTable(FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue) void gfxGetGammaTableExt(FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue) { return; - //TODO? - /* - LOG("gfxGetGammaTableExt()\r\n"); - FxU16 aGammaRamp[3][256]; - #ifdef _WIN32 - HDC hdc = GetDC(NULL); - if (hdc == NULL) - return; - if (GetDeviceGammaRamp(hdc, aGammaRamp) == TRUE) - { - ReleaseDC(NULL, hdc); - #else - if (SDL_GetGammaRamp(aGammaRamp[0], aGammaRamp[1], aGammaRamp[2]) != -1) - { - #endif - for (int i = 0; i < 256; i++) - { - red[i] = aGammaRamp[0][i] >> 8; - green[i] = aGammaRamp[1][i] >> 8; - blue[i] = aGammaRamp[2][i] >> 8; - } - } - */ } void gfxGammaCorrectionRGB(FxFloat gammaR, FxFloat gammaG, FxFloat gammaB) { - //TODO? - /* - LOG("gfxGammaCorrectionRGB()\r\n"); - if (!fullscreen) - return; - FxU16 aGammaRamp[3][256]; - for (int i = 0; i < 256; i++) - { - aGammaRamp[0][i] = (((FxU16)((pow(i/255.0F, 1.0F/gammaR)) * 255.0F + 0.5F)) << 8) & 0xFFFF; - aGammaRamp[1][i] = (((FxU16)((pow(i/255.0F, 1.0F/gammaG)) * 255.0F + 0.5F)) << 8) & 0xFFFF; - aGammaRamp[2][i] = (((FxU16)((pow(i/255.0F, 1.0F/gammaB)) * 255.0F + 0.5F)) << 8) & 0xFFFF; - } - CorrectGamma(aGammaRamp);*/ } void CHECK_FRAMEBUFFER_STATUS(void) diff --git a/Source/Project64-video/Renderer/OGLglitchmain.cpp b/Source/Project64-video/Renderer/OGLglitchmain.cpp index a2167f596..607c80ca7 100644 --- a/Source/Project64-video/Renderer/OGLglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLglitchmain.cpp @@ -31,6 +31,7 @@ #include "g3ext.h" #include "glitchmain.h" #include +#include #include /* @@ -39,7 +40,6 @@ */ #include -wrapper_config config = { 0, 0, 0 }; int screen_width, screen_height; static inline void opt_glCopyTexImage2D(GLenum target, @@ -483,7 +483,7 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers); #ifdef _WIN32 - TMU_SIZE = (config.vram_size - g_width * g_height * 4 * 3) / 2; + TMU_SIZE = ((g_settings->wrpVRAM() * 1024 * 1024) - g_width * g_height * 4 * 3) / 2; // save screen resolution for hwfbe, after resolution enumeration screen_width = g_width; @@ -646,7 +646,7 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)dummy_glFramebufferRenderbuffer; #endif // _WIN32 - use_fbo = config.fbo && glFramebufferRenderbufferEXT; + use_fbo = g_settings->wrpFBO() && glFramebufferRenderbufferEXT; printf("use_fbo %d\n", use_fbo); @@ -778,8 +778,10 @@ GrContext_t gfxSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origi init_combiner(); // Aniso filter check - if (config.anisofilter > 0) + if (g_settings->wrpAnisotropic()) + { glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &largest_supported_anisotropy); + } // ATI hack - certain texture formats are slow on ATI? // Hmm, perhaps the internal format need to be specified explicitly... @@ -1921,15 +1923,6 @@ FxBool gfxLfbWriteRegion(GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, GrLfbS } /* wrapper-specific glide extensions */ - -void grConfigWrapperExt(FxI32 vram, FxBool fbo, FxBool aniso) -{ - WriteTrace(TraceGlitch, TraceDebug, "-"); - config.vram_size = vram; - config.fbo = fbo; - config.anisofilter = aniso; -} - #ifdef _WIN32 static void CorrectGamma(LPVOID apGammaRamp) { @@ -1987,8 +1980,8 @@ void gfxGetGammaTableExt(FxU32 /*nentries*/, FxU32 *red, FxU32 *green, FxU32 *bl green[i] = aGammaRamp[1][i] >> 8; blue[i] = aGammaRamp[2][i] >> 8; } + } } -} void gfxGammaCorrectionRGB(FxFloat gammaR, FxFloat gammaG, FxFloat gammaB) { @@ -2057,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/glitchmain.h b/Source/Project64-video/Renderer/glitchmain.h index fe607b14f..24316ee59 100644 --- a/Source/Project64-video/Renderer/glitchmain.h +++ b/Source/Project64-video/Renderer/glitchmain.h @@ -27,14 +27,6 @@ extern int dumping; #define zscale 1.0f -typedef struct _wrapper_config -{ - int fbo; - int anisofilter; - int vram_size; -} wrapper_config; -extern wrapper_config config; - // VP added this utility function // returns the bytes per pixel of a given GR texture format int grTexFormatSize(int fmt);