From 7026025a2dcc8951ae4217fae5925323adb11f26 Mon Sep 17 00:00:00 2001 From: nakeee Date: Mon, 8 Sep 2008 07:09:34 +0000 Subject: [PATCH] more warning fixes git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@483 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoOGL/Src/PixelShader.cpp | 6 ++---- .../Plugin_VideoOGL/Src/PixelShaderManager.cpp | 11 ++++++----- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 2 +- Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp | 2 +- .../Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp | 14 +++++++------- .../Plugin_VideoOGL/Src/VertexLoader_TextCoord.h | 2 -- Source/Plugins/Plugin_VideoOGL/Src/rasterfont.cpp | 2 +- 7 files changed, 18 insertions(+), 21 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShader.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShader.cpp index 28b0939faa..1c7f06301e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShader.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShader.cpp @@ -135,7 +135,7 @@ static const char *tevOpTable[] = { // TEV "-", //TEVOP_SUB = 1, }; -static const char *tevCompOpTable[] = { ">", "==" }; +//static const char *tevCompOpTable[] = { ">", "==" }; #define TEVCMP_R8 0 #define TEVCMP_GR16 1 @@ -242,7 +242,7 @@ static const char *alphaRef[2] = I_ALPHA"[0].y" }; -static const char *tevTexFunc[] = { "tex2D", "texRECT" }; +//static const char *tevTexFunc[] = { "tex2D", "texRECT" }; static const char *tevCOutputTable[] = { "prev.rgb", "c0.rgb", "c1.rgb", "c2.rgb" }; static const char *tevAOutputTable[] = { "prev.a", "c0.a", "c1.a", "c2.a" }; @@ -460,7 +460,6 @@ void WriteStage(char *&p, int n, u32 texture_mask) char *rasswap = swapModeTable[bpmem.combiners[n].alphaC.rswap]; char *texswap = swapModeTable[bpmem.combiners[n].alphaC.tswap]; - int colchan = bpmem.tevorders[n/2].getColorChan(n&1); int texcoord = bpmem.tevorders[n/2].getTexCoord(n&1); int texfun = xfregs.texcoords[texcoord].texmtxinfo.projection; @@ -804,7 +803,6 @@ bool WriteAlphaTest(char *&p) break; } - bool bFirst = false; WRITE(p, "discard( "); WriteAlphaCompare(p, 0, bpmem.alphaFunc.comp0); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp index e315f240d0..3dcf743b44 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp @@ -169,7 +169,8 @@ void PixelShaderMngr::Cleanup() bool PixelShaderMngr::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrprogram) { - CGerror cgerr = cgGetError(); + // todo: Should error be checked? + // CGerror cgerr = cgGetError(); char stropt[64]; sprintf(stropt, "MaxLocalParams=32,NumInstructionSlots=%d", s_nMaxPixelInstructions); @@ -237,7 +238,7 @@ void PixelShaderMngr::SetConstants(FRAGMENTSHADER& ps) } u32 newmask = 0; - for(u32 i = 0; i < bpmem.genMode.numtevstages+1; ++i) { + for(u32 i = 0; i < (u32)bpmem.genMode.numtevstages+1; ++i) { if( bpmem.tevorders[i/2].getEnable(i&1) ) { int texmap = bpmem.tevorders[i/2].getTexMap(i&1); maptocoord[texmap] = bpmem.tevorders[i/2].getTexCoord(i&1); @@ -496,7 +497,7 @@ GLuint PixelShaderMngr::GetColorMatrixProgram() void PixelShaderMngr::GetPixelShaderId(PixelShaderMngr::PIXELSHADERUID& uid) { u32 projtexcoords = 0; - for (u32 i = 0; i < bpmem.genMode.numtevstages+1; i++) { + for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages+1; i++) { if( bpmem.tevorders[i/2].getEnable(i&1) ) { int texcoord = bpmem.tevorders[i/2].getTexCoord(i&1); if( xfregs.texcoords[texcoord].texmtxinfo.projection ) @@ -520,7 +521,7 @@ void PixelShaderMngr::GetPixelShaderId(PixelShaderMngr::PIXELSHADERUID& uid) int hdr = 3; u32* pcurvalue = &uid.values[hdr]; - for(u32 i = 0; i < bpmem.genMode.numtevstages+1; ++i) { + for(u32 i = 0; i < (u32)bpmem.genMode.numtevstages+1; ++i) { TevStageCombiner::ColorCombiner &cc = bpmem.combiners[i].colorC; TevStageCombiner::AlphaCombiner &ac = bpmem.combiners[i].alphaC; @@ -534,7 +535,7 @@ void PixelShaderMngr::GetPixelShaderId(PixelShaderMngr::PIXELSHADERUID& uid) pcurvalue+=2; } - for(u32 i = 0; i < (bpmem.genMode.numtevstages+1)/2; ++i) { + for(u32 i = 0; i < ((u32)bpmem.genMode.numtevstages+1)/2; ++i) { u32 val0, val1; if( bpmem.tevorders[i].hex&0x40 ) val0 = bpmem.tevorders[i].hex&0x3ff; else val0 = bpmem.tevorders[i].hex&0x380; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 1a253e0df5..d681128784 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -154,7 +154,7 @@ bool Renderer::Create2() // create the framebuffer targets glGenTextures(ARRAYSIZE(s_RenderTargets), (GLuint *)s_RenderTargets); - for(int i = 0; i < ARRAYSIZE(s_RenderTargets); ++i) { + for(u32 i = 0; i < ARRAYSIZE(s_RenderTargets); ++i) { glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_RenderTargets[i]); // initialize to default glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, nBackbufferWidth, nBackbufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp index 7afd41e4c4..c90efa30ea 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp @@ -205,7 +205,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width if (iter != textures.end()) { TCacheEntry &entry = iter->second; - if( entry.isRenderTarget || ((u32 *)ptr)[entry.hashoffset] == entry.hash && palhash == entry.paletteHash) { //stupid, improve + if((entry.isRenderTarget || ((u32 *)ptr)[entry.hashoffset] == entry.hash) && palhash == entry.paletteHash) { //stupid, improve entry.frameCount = frameCount; //glEnable(entry.isNonPow2?GL_TEXTURE_RECTANGLE_NV:GL_TEXTURE_2D); glBindTexture(entry.isNonPow2?GL_TEXTURE_RECTANGLE_NV:GL_TEXTURE_2D, entry.texture); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp index 6afb5f4e81..899bb07b69 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp @@ -52,7 +52,6 @@ static void (*fnSetupVertexPointers)() = NULL; //these don't need to be saved static float posScale; -static float tcScale[8]; static int colElements[2]; static float tcScaleU[8]; static float tcScaleV[8]; @@ -388,7 +387,6 @@ void VertexLoader::ProcessFormat() // Normals if (m_VtxDesc.Normal != NOT_PRESENT) { VertexLoader_Normal::index3 = m_VtxAttr.NormalIndex3 ? true : false; - unsigned int uSize = VertexLoader_Normal::GetSize(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements); TPipelineFunction pFunc = VertexLoader_Normal::GetFunction(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements); if (pFunc == 0) { @@ -855,7 +853,7 @@ void VertexLoader::RunVertices(int primitive, int count) colIndex = 0; s_texmtxwrite = s_texmtxread = 0; - int pred_size = m_VertexSize; + // int pred_size = m_VertexSize; //int start = GetBufferPosition(); //if (!m_numPipelineStates) @@ -909,12 +907,12 @@ bool VertexManager::Init() s_pBaseBufferPointer = (u8*)AllocateMemoryPages(MAX_BUFFER_SIZE); s_pCurBufferPointer = s_pBaseBufferPointer; - for (int i = 0; i < ARRAYSIZE(shiftLookup); i++) + for (u32 i = 0; i < ARRAYSIZE(shiftLookup); i++) shiftLookup[i] = 1.0f / float(1 << i); s_nCurVBOIndex = 0; glGenBuffers(ARRAYSIZE(s_vboBuffers), s_vboBuffers); - for (int i = 0; i < ARRAYSIZE(s_vboBuffers); ++i) { + for (u32 i = 0; i < ARRAYSIZE(s_vboBuffers); ++i) { glBindBuffer(GL_ARRAY_BUFFER, s_vboBuffers[i]); glBufferData(GL_ARRAY_BUFFER, MAX_BUFFER_SIZE, NULL, GL_STREAM_DRAW); } @@ -970,8 +968,10 @@ void VertexManager::AddVertices(int primitive, int numvertices) ADDSTAT(stats.thisFrame.numPrims, numvertices); s_vStoredPrimitives.push_back(pair(c_primitiveType[primitive], numvertices)); +#ifdef _DEBUG static const char *sprims[8] = {"quads", "nothing", "tris", "tstrip", "tfan", "lines", "lstrip", "points"}; PRIM_LOG("prim: %s, c=%d\n", sprims[primitive], numvertices); +#endif } void VertexManager::Flush() @@ -1023,13 +1023,13 @@ void VertexManager::Flush() DVProfileFunc _pf("VertexManager::Flush:textures"); u32 usedtextures = 0; - for (u32 i = 0; i < bpmem.genMode.numtevstages+1; ++i) { + for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages+1; ++i) { if( bpmem.tevorders[i/2].getEnable(i&1) ) usedtextures |= 1< 0 ) { - for(u32 i = 0; i < bpmem.genMode.numtevstages+1; ++i) { + for(u32 i = 0; i < (u32)bpmem.genMode.numtevstages+1; ++i) { if( bpmem.tevind[i].IsActive() && bpmem.tevind[i].bt < bpmem.genMode.numindstages ) { usedtextures |= 1<