D3D: Set the geometry shader before every draw call.
And refactor the VertexManager draw call.
This commit is contained in:
parent
7e8f96f0d3
commit
3d9dfad6a2
|
@ -350,6 +350,7 @@ int CD3DFont::DrawTextScaled(float x, float y, float size, float spacing, u32 dw
|
|||
|
||||
D3D::stateman->SetPixelShader(m_pshader);
|
||||
D3D::stateman->SetVertexShader(m_vshader);
|
||||
D3D::stateman->SetGeometryShader(nullptr);
|
||||
|
||||
D3D::stateman->SetInputLayout(m_InputLayout);
|
||||
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
|
|
|
@ -1084,6 +1084,7 @@ size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat,
|
|||
#endif
|
||||
{
|
||||
D3D::stateman->SetVertexShader(m_vShader);
|
||||
D3D::stateman->SetGeometryShader(nullptr);
|
||||
|
||||
D3D::stateman->PushBlendState(m_efbEncodeBlendState);
|
||||
D3D::stateman->PushDepthState(m_efbEncodeDepthState);
|
||||
|
|
|
@ -1105,13 +1105,14 @@ void Renderer::ApplyState(bool bUseDstAlpha)
|
|||
}
|
||||
|
||||
ID3D11Buffer* vertexConstants = VertexShaderCache::GetConstantBuffer();
|
||||
ID3D11Buffer* pixelConstants = PixelShaderCache::GetConstantBuffer();
|
||||
|
||||
D3D::stateman->SetPixelConstants(pixelConstants, g_ActiveConfig.bEnablePixelLighting ? vertexConstants : nullptr);
|
||||
D3D::stateman->SetPixelConstants(PixelShaderCache::GetConstantBuffer(), g_ActiveConfig.bEnablePixelLighting ? vertexConstants : nullptr);
|
||||
D3D::stateman->SetVertexConstants(vertexConstants);
|
||||
D3D::stateman->SetGeometryConstants(GeometryShaderCache::GetConstantBuffer());
|
||||
|
||||
D3D::stateman->SetPixelShader(PixelShaderCache::GetActiveShader());
|
||||
D3D::stateman->SetVertexShader(VertexShaderCache::GetActiveShader());
|
||||
D3D::stateman->SetGeometryShader(GeometryShaderCache::GetActiveShader());
|
||||
}
|
||||
|
||||
void Renderer::RestoreState()
|
||||
|
|
|
@ -126,49 +126,28 @@ void VertexManager::Draw(u32 stride)
|
|||
u32 baseVertex = m_vertexDrawOffset / stride;
|
||||
u32 startIndex = m_indexDrawOffset / sizeof(u16);
|
||||
|
||||
if (current_primitive_type == PRIMITIVE_TRIANGLES)
|
||||
switch (current_primitive_type)
|
||||
{
|
||||
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
D3D::stateman->SetGeometryConstants(GeometryShaderCache::GetConstantBuffer());
|
||||
D3D::stateman->SetGeometryShader(GeometryShaderCache::GetActiveShader());
|
||||
|
||||
D3D::stateman->Apply();
|
||||
D3D::context->DrawIndexed(indices, startIndex, baseVertex);
|
||||
|
||||
INCSTAT(stats.thisFrame.numDrawCalls);
|
||||
|
||||
D3D::stateman->SetGeometryShader(nullptr);
|
||||
case PRIMITIVE_POINTS:
|
||||
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
|
||||
((DX11::Renderer*)g_renderer)->ApplyCullDisable();
|
||||
break;
|
||||
case PRIMITIVE_LINES:
|
||||
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
|
||||
((DX11::Renderer*)g_renderer)->ApplyCullDisable();
|
||||
break;
|
||||
case PRIMITIVE_TRIANGLES:
|
||||
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
break;
|
||||
}
|
||||
else if (current_primitive_type == PRIMITIVE_LINES)
|
||||
{
|
||||
((DX11::Renderer*)g_renderer)->ApplyCullDisable();
|
||||
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
|
||||
D3D::stateman->SetGeometryConstants(GeometryShaderCache::GetConstantBuffer());
|
||||
D3D::stateman->SetGeometryShader(GeometryShaderCache::GetActiveShader());
|
||||
|
||||
D3D::stateman->Apply();
|
||||
D3D::context->DrawIndexed(indices, startIndex, baseVertex);
|
||||
D3D::stateman->Apply();
|
||||
D3D::context->DrawIndexed(indices, startIndex, baseVertex);
|
||||
|
||||
INCSTAT(stats.thisFrame.numDrawCalls);
|
||||
INCSTAT(stats.thisFrame.numDrawCalls);
|
||||
|
||||
D3D::stateman->SetGeometryShader(nullptr);
|
||||
if (current_primitive_type != PRIMITIVE_TRIANGLES)
|
||||
((DX11::Renderer*)g_renderer)->RestoreCull();
|
||||
}
|
||||
else //if (current_primitive_type == PRIMITIVE_POINTS)
|
||||
{
|
||||
((DX11::Renderer*)g_renderer)->ApplyCullDisable();
|
||||
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
|
||||
D3D::stateman->SetGeometryConstants(GeometryShaderCache::GetConstantBuffer());
|
||||
D3D::stateman->SetGeometryShader(GeometryShaderCache::GetActiveShader());
|
||||
|
||||
D3D::stateman->Apply();
|
||||
D3D::context->DrawIndexed(indices, startIndex, baseVertex);
|
||||
|
||||
INCSTAT(stats.thisFrame.numDrawCalls);
|
||||
|
||||
D3D::stateman->SetGeometryShader(nullptr);
|
||||
((DX11::Renderer*)g_renderer)->RestoreCull();
|
||||
}
|
||||
}
|
||||
|
||||
void VertexManager::vFlush(bool useDstAlpha)
|
||||
|
|
|
@ -282,6 +282,7 @@ void XFBEncoder::Encode(u8* dst, u32 width, u32 height, const EFBRectangle& srcR
|
|||
|
||||
D3D::stateman->SetPixelShader(m_pShader);
|
||||
D3D::stateman->SetVertexShader(m_vShader);
|
||||
D3D::stateman->SetGeometryShader(nullptr);
|
||||
|
||||
D3D::stateman->PushBlendState(m_xfbEncodeBlendState);
|
||||
D3D::stateman->PushDepthState(m_xfbEncodeDepthState);
|
||||
|
|
Loading…
Reference in New Issue