From 6391393c06dff877efc6ec614ba7221709a63d0c Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sun, 6 Feb 2011 18:43:56 +0000 Subject: [PATCH] D3D9: Fix wireframe rendering. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7095 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 2 ++ Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 20 ++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 0de2daf801..02c0f2f1c2 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -1283,6 +1283,7 @@ void Renderer::RestoreState() // ALWAYS call RestoreAPIState for each ResetAPIState call you're doing void Renderer::ResetAPIState() { + D3D::SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); D3D::SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); @@ -1295,6 +1296,7 @@ void Renderer::ResetAPIState() void Renderer::RestoreAPIState() { // Gets us back into a more game-like state. + D3D::SetRenderState(D3DRS_FILLMODE, g_ActiveConfig.bWireFrame ? D3DFILL_WIREFRAME : D3DFILL_SOLID); D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE); UpdateViewport(); SetScissorRect(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 666063207e..d2ab2e1440 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -840,9 +840,6 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE { ResetAPIState(); - // make sure to disable wireframe when drawing the clear quad - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - GLenum ColorMask = GL_FALSE, AlphaMask = GL_FALSE; if (colorEnable) ColorMask = GL_TRUE; if (alphaEnable) AlphaMask = GL_TRUE; @@ -877,10 +874,6 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE glVertex3f( 1.f, -1.f, 1.f); glEnd(); - // reenable wireframe if necessary - if (g_ActiveConfig.bWireFrame) - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - RestoreAPIState(); } @@ -991,9 +984,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons TargetRectangle dst_rect; ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, true, &dst_rect); - // Make sure that the wireframe setting doesn't screw up the screen copy. - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - // Textured triangles are necessary because of post-processing shaders // Disable all other stages @@ -1128,10 +1118,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); OGL::TextureCache::DisableStage(0); - // Wireframe - if (g_ActiveConfig.bWireFrame) - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - // Save screenshot if (s_bScreenshot) { @@ -1390,6 +1376,9 @@ void Renderer::ResetAPIState() glDisable(GL_BLEND); glDepthMask(GL_FALSE); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + + // make sure to disable wireframe when drawing the clear quad + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } void Renderer::RestoreAPIState() @@ -1403,6 +1392,9 @@ void Renderer::RestoreAPIState() SetBlendMode(true); UpdateViewport(); + if (g_ActiveConfig.bWireFrame) + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + VertexShaderCache::SetCurrentShader(0); PixelShaderCache::SetCurrentShader(0); }