From 4229d9e01ec062714f9c784930ba60d0f0967456 Mon Sep 17 00:00:00 2001 From: Nolan Check Date: Sun, 29 Aug 2010 19:34:54 +0000 Subject: [PATCH] Remove a bunch of freshly-obsolete code git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6148 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/VideoCommon/Src/PixelShaderGen.cpp | 119 +++++------------- Source/Core/VideoCommon/Src/PixelShaderGen.h | 4 +- .../VideoCommon/Src/PixelShaderManager.cpp | 55 ++------ .../Core/VideoCommon/Src/PixelShaderManager.h | 2 - .../Plugin_VideoDX11/Src/PixelShaderCache.cpp | 4 +- .../Plugin_VideoDX11/Src/VertexManager.cpp | 1 - .../Plugin_VideoDX9/Src/PixelShaderCache.cpp | 4 +- .../Plugin_VideoDX9/Src/VertexManager.cpp | 1 - .../Plugin_VideoOGL/Src/PixelShaderCache.cpp | 5 +- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 15 --- .../Plugin_VideoOGL/Src/VertexManager.cpp | 3 - 11 files changed, 50 insertions(+), 163 deletions(-) diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 3460fde927..1a12b60772 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -31,7 +31,7 @@ PIXELSHADERUID last_pixel_shader_uid; // a unique identifier, basically containing all the bits. Yup, it's a lot .... // It would likely be a lot more efficient to build this incrementally as the attributes // are set... -void GetPixelShaderId(PIXELSHADERUID *uid, u32 texturemask, u32 dstAlphaEnable) +void GetPixelShaderId(PIXELSHADERUID *uid, u32 dstAlphaEnable) { u32 numstages = bpmem.genMode.numtevstages + 1; u32 projtexcoords = 0; @@ -57,7 +57,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, u32 texturemask, u32 dstAlphaEnable) for (int i = 0; i < 8; i += 2) ((u8*)&uid->values[1])[i / 2] = (bpmem.tevksel[i].hex & 0xf) | ((bpmem.tevksel[i + 1].hex & 0xf) << 4); - uid->values[2] = texturemask; + uid->values[2] = 0; u32 enableZTexture = (!bpmem.zcontrol.zcomploc && bpmem.zmode.testenable && bpmem.zmode.updateenable)?1:0; @@ -147,8 +147,8 @@ void GetPixelShaderId(PIXELSHADERUID *uid, u32 texturemask, u32 dstAlphaEnable) // output is given by .outreg // tevtemp is set according to swapmodetables and -static void WriteStage(char *&p, int n, u32 texture_mask, API_TYPE ApiType); -static void SampleTexture(char *&p, const char *destination, const char *texcoords, const char *texswap, int texmap, u32 texture_mask, API_TYPE ApiType); +static void WriteStage(char *&p, int n, API_TYPE ApiType); +static void SampleTexture(char *&p, const char *destination, const char *texcoords, const char *texswap, int texmap, API_TYPE ApiType); // static void WriteAlphaCompare(char *&p, int num, int comp); static bool WriteAlphaTest(char *&p, API_TYPE ApiType); static void WriteFog(char *&p); @@ -366,7 +366,7 @@ static void BuildSwapModeTable() } } -const char *GeneratePixelShaderCode(u32 texture_mask, bool dstAlphaEnable, API_TYPE ApiType) +const char *GeneratePixelShaderCode(bool dstAlphaEnable, API_TYPE ApiType) { setlocale(LC_NUMERIC, "C"); // Reset locale for compilation text[sizeof(text) - 1] = 0x7C; // canary @@ -392,55 +392,33 @@ const char *GeneratePixelShaderCode(u32 texture_mask, bool dstAlphaEnable, API_T } DepthTextureEnable = bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.zcomploc && bpmem.zmode.testenable && bpmem.zmode.updateenable; // Declare samplers - if (texture_mask && ApiType == API_OPENGL) - { - WRITE(p, "uniform samplerRECT "); - bool bfirst = true; - for (int i = 0; i < 8; ++i) - { - if (texture_mask & (1<> 16) & 0xfff); - fdims[2] = (float)(tc.s.scale_minus_1 + 1)*lastCustomTexScale[texid][0]; - fdims[3] = (float)(tc.t.scale_minus_1 + 1)*lastCustomTexScale[texid][1]; - } - else - { - TCoordInfo& tc = bpmem.texcoords[texid]; - fdims[0] = 1.0f / (float)(lastTexDims[texid] & 0xffff); - fdims[1] = 1.0f / (float)((lastTexDims[texid] >> 16) & 0xfff); - fdims[2] = (float)(tc.s.scale_minus_1 + 1) * lastCustomTexScale[texid][0]; - fdims[3] = (float)(tc.t.scale_minus_1 + 1) * lastCustomTexScale[texid][1]; - } + + TCoordInfo& tc = bpmem.texcoords[texid]; + fdims[0] = 1.0f / (float)(lastTexDims[texid] & 0xffff); + fdims[1] = 1.0f / (float)((lastTexDims[texid] >> 16) & 0xfff); + fdims[2] = (float)(tc.s.scale_minus_1 + 1) * lastCustomTexScale[texid][0]; + fdims[3] = (float)(tc.t.scale_minus_1 + 1) * lastCustomTexScale[texid][1]; PRIM_LOG("texdims%d: %f %f %f %f\n", texid, fdims[0], fdims[1], fdims[2], fdims[3]); SetPSConstant4fv(C_TEXDIMS + texid, fdims); @@ -362,23 +345,6 @@ void PixelShaderManager::SetZTextureTypeChanged() s_bZTextureTypeChanged = true; } -void PixelShaderManager::SetTexturesUsed(u32 nonpow2tex) -{ - if (s_texturemask != nonpow2tex) - { - for (int i = 0; i < 8; ++i) - { - if (nonpow2tex & (0x10101 << i)) - { - // this check was previously implicit, but should it be here? - if (s_nTexDimsChanged) - s_nTexDimsChanged |= 1 << i; - } - } - s_texturemask = nonpow2tex; - } -} - void PixelShaderManager::SetTexCoordChanged(u8 texmapid) { s_nTexDimsChanged |= 1 << texmapid; @@ -399,8 +365,3 @@ void PixelShaderManager::SetColorMatrix(const float* pmatrix, const float* pfCon SetMultiPSConstant4fv(C_COLORMATRIX,4,pmatrix); SetPSConstant4fv(C_COLORMATRIX+4, pfConstAdd); } - -u32 PixelShaderManager::GetTextureMask() -{ - return s_texturemask; -} diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.h b/Source/Core/VideoCommon/Src/PixelShaderManager.h index 48b05d0830..61a3c50662 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.h +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.h @@ -48,12 +48,10 @@ public: static void SetTevKSelChanged(int id); static void SetZTextureTypeChanged(); static void SetIndTexScaleChanged(u8 stagemask); - static void SetTexturesUsed(u32 nonpow2tex); static void SetTexCoordChanged(u8 texmapid); static void SetFogColorChanged(); static void SetFogParamChanged(); static void SetColorMatrix(const float* pmatrix, const float* pfConstAdd); - static u32 GetTextureMask(); }; diff --git a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp index f9ece84176..c876652aa8 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp @@ -218,7 +218,7 @@ void PixelShaderCache::Shutdown() bool PixelShaderCache::SetShader(bool dstAlpha) { PIXELSHADERUID uid; - GetPixelShaderId(&uid, PixelShaderManager::GetTextureMask(), dstAlpha); + GetPixelShaderId(&uid, dstAlpha); // check if the shader is already set if (uid == last_pixel_shader_uid && PixelShaders[uid].frameCount == frameCount) @@ -243,7 +243,7 @@ bool PixelShaderCache::SetShader(bool dstAlpha) } // need to compile a new shader - const char* code = GeneratePixelShaderCode(PixelShaderManager::GetTextureMask(), dstAlpha, API_D3D11); + const char* code = GeneratePixelShaderCode(dstAlpha, API_D3D11); D3DBlob* pbytecode; if (!D3D::CompilePixelShader(code, strlen(code), &pbytecode)) diff --git a/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp index 0286289fa7..49e857ecfe 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp @@ -338,7 +338,6 @@ void Flush() } } } - PixelShaderManager::SetTexturesUsed(0); VertexShaderManager::SetConstants(); PixelShaderManager::SetConstants(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp index bd8d8253f5..05449152d0 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp @@ -277,7 +277,7 @@ void PixelShaderCache::Shutdown() bool PixelShaderCache::SetShader(bool dstAlpha) { PIXELSHADERUID uid; - GetPixelShaderId(&uid, PixelShaderManager::GetTextureMask(), dstAlpha); + GetPixelShaderId(&uid, dstAlpha); // Is the shader already set? if (uid == last_pixel_shader_uid && PixelShaders[uid].frameCount == frameCount) @@ -312,7 +312,7 @@ bool PixelShaderCache::SetShader(bool dstAlpha) } // OK, need to generate and compile it. - const char *code = GeneratePixelShaderCode(PixelShaderManager::GetTextureMask(), dstAlpha, API_D3D9); + const char *code = GeneratePixelShaderCode(dstAlpha, API_D3D9); u32 code_hash = HashAdler32((const u8 *)code, strlen(code)); unique_shaders.insert(code_hash); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index 5719e94f9e..aaacff616f 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -270,7 +270,6 @@ void Flush() } } - PixelShaderManager::SetTexturesUsed(0); // set global constants VertexShaderManager::SetConstants(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp index 5387436d3a..a2ddf6e4ce 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp @@ -164,7 +164,7 @@ FRAGMENTSHADER* PixelShaderCache::GetShader(bool dstAlphaEnable) { DVSTARTPROFILE(); PIXELSHADERUID uid; - GetPixelShaderId(&uid, PixelShaderManager::GetTextureMask(), dstAlphaEnable ? 1 : 0); + GetPixelShaderId(&uid, dstAlphaEnable ? 1 : 0); if (uid == last_pixel_shader_uid && pshaders[uid].frameCount == frameCount) { return pShaderLast; @@ -189,8 +189,7 @@ FRAGMENTSHADER* PixelShaderCache::GetShader(bool dstAlphaEnable) PSCacheEntry& newentry = pshaders[uid]; newentry.frameCount = frameCount; pShaderLast = &newentry.shader; - const char *code = GeneratePixelShaderCode(PixelShaderManager::GetTextureMask(), - dstAlphaEnable,API_OPENGL); + const char *code = GeneratePixelShaderCode(dstAlphaEnable,API_OPENGL); #if defined(_DEBUG) || defined(DEBUGFAST) if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index f6be77499e..baf8d57747 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -191,21 +191,6 @@ static const GLenum glLogicOpCodes[16] = { GL_SET }; -void SetDefaultRectTexParams() -{ - // Set some standard texture filter modes. - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - if (GL_REPORT_ERROR() != GL_NO_ERROR) - { - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP); - GL_REPORT_ERRORD(); - } - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -} - #if defined HAVE_CG && HAVE_CG void HandleCgError(CGcontext ctx, CGerror err, void* appdata) { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index 7a3b839d3b..1289b677a6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -260,7 +260,6 @@ void Flush() if (bpmem.tevind[i].IsActive() && bpmem.tevind[i].bt < bpmem.genMode.numindstages) usedtextures |= 1 << bpmem.tevindref.getTexMap(bpmem.tevind[i].bt); - u32 nonpow2tex = 0; for (int i = 0; i < 8; i++) { if (usedtextures & (1 << i)) @@ -290,8 +289,6 @@ void Flush() } } - PixelShaderManager::SetTexturesUsed(nonpow2tex); - FRAGMENTSHADER* ps = PixelShaderCache::GetShader(false); VERTEXSHADER* vs = VertexShaderCache::GetShader(g_nativeVertexFmt->m_components);