DX11: Don't apply culling to lines and points. Fixes Metroid Prime beam-charging effects.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7346 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Nolan Check 2011-03-15 03:51:31 +00:00
parent a55e63c697
commit c83e5ee35b
3 changed files with 30 additions and 0 deletions

View File

@ -1276,6 +1276,27 @@ void Renderer::RestoreState()
D3D::stateman->PopRasterizerState();
}
void Renderer::ApplyCullDisable()
{
D3D11_RASTERIZER_DESC rastDesc = gx_state.rastdc;
rastDesc.CullMode = D3D11_CULL_NONE;
ID3D11RasterizerState* raststate;
HRESULT hr = D3D::device->CreateRasterizerState(&rastDesc, &raststate);
if (FAILED(hr)) PanicAlert("Failed to create culling-disabled rasterizer state at %s %d\n", __FILE__, __LINE__);
D3D::SetDebugObjectName((ID3D11DeviceChild*)raststate, "rasterizer state (culling disabled) used to emulate the GX pipeline");
D3D::stateman->PushRasterizerState(raststate);
SAFE_RELEASE(raststate);
D3D::stateman->Apply();
}
void Renderer::RestoreCull()
{
D3D::stateman->PopRasterizerState();
}
void Renderer::SetGenerationMode()
{
// rastdc.FrontCounterClockwise must be false for this to work

View File

@ -28,6 +28,9 @@ public:
void ApplyState(bool bUseDstAlpha);
void RestoreState();
void ApplyCullDisable();
void RestoreCull();
void RenderText(const char* pstr, int left, int top, u32 color);
u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data);

View File

@ -26,6 +26,7 @@
#include "MainBase.h"
#include "PixelShaderManager.h"
#include "RenderBase.h"
#include "Render.h"
#include "Statistics.h"
#include "TextureCacheBase.h"
#include "VertexShaderManager.h"
@ -147,6 +148,9 @@ void VertexManager::Draw(UINT stride)
D3D::context->DrawIndexed(IndexGenerator::GetTriangleindexLen(), m_triangleDrawIndex, 0);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
// Disable culling for lines and points
if (IndexGenerator::GetNumLines() > 0 || IndexGenerator::GetNumPoints() > 0)
((DX11::Renderer*)g_renderer)->ApplyCullDisable();
if (IndexGenerator::GetNumLines() > 0)
{
float lineWidth = float(bpmem.lineptwidth.linesize) / 6.f;
@ -175,6 +179,8 @@ void VertexManager::Draw(UINT stride)
D3D::context->GSSetShader(NULL, NULL, 0);
}
}
if (IndexGenerator::GetNumLines() > 0 || IndexGenerator::GetNumPoints() > 0)
((DX11::Renderer*)g_renderer)->RestoreCull();
}
void VertexManager::vFlush()