D3D9: Fix wireframe rendering.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7095 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2011-02-06 18:43:56 +00:00
parent 2b2f060cdf
commit 6391393c06
2 changed files with 8 additions and 14 deletions

View File

@ -1283,6 +1283,7 @@ void Renderer::RestoreState()
// ALWAYS call RestoreAPIState for each ResetAPIState call you're doing // ALWAYS call RestoreAPIState for each ResetAPIState call you're doing
void Renderer::ResetAPIState() void Renderer::ResetAPIState()
{ {
D3D::SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
D3D::SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); D3D::SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
@ -1295,6 +1296,7 @@ void Renderer::ResetAPIState()
void Renderer::RestoreAPIState() void Renderer::RestoreAPIState()
{ {
// Gets us back into a more game-like state. // 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); D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
UpdateViewport(); UpdateViewport();
SetScissorRect(); SetScissorRect();

View File

@ -840,9 +840,6 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
{ {
ResetAPIState(); 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; GLenum ColorMask = GL_FALSE, AlphaMask = GL_FALSE;
if (colorEnable) ColorMask = GL_TRUE; if (colorEnable) ColorMask = GL_TRUE;
if (alphaEnable) AlphaMask = 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); glVertex3f( 1.f, -1.f, 1.f);
glEnd(); glEnd();
// reenable wireframe if necessary
if (g_ActiveConfig.bWireFrame)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
RestoreAPIState(); RestoreAPIState();
} }
@ -991,9 +984,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
TargetRectangle dst_rect; TargetRectangle dst_rect;
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, true, &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 // Textured triangles are necessary because of post-processing shaders
// Disable all other stages // 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); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
OGL::TextureCache::DisableStage(0); OGL::TextureCache::DisableStage(0);
// Wireframe
if (g_ActiveConfig.bWireFrame)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// Save screenshot // Save screenshot
if (s_bScreenshot) if (s_bScreenshot)
{ {
@ -1390,6 +1376,9 @@ void Renderer::ResetAPIState()
glDisable(GL_BLEND); glDisable(GL_BLEND);
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 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() void Renderer::RestoreAPIState()
@ -1403,6 +1392,9 @@ void Renderer::RestoreAPIState()
SetBlendMode(true); SetBlendMode(true);
UpdateViewport(); UpdateViewport();
if (g_ActiveConfig.bWireFrame)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
VertexShaderCache::SetCurrentShader(0); VertexShaderCache::SetCurrentShader(0);
PixelShaderCache::SetCurrentShader(0); PixelShaderCache::SetCurrentShader(0);
} }