GeometryShaderGen: Pass the primitive type and always run the generator regardless of stereoscopy.

This commit is contained in:
Jules Blok
2014-12-14 19:41:16 +01:00
parent b406e4e1f2
commit aa4242fd9c
8 changed files with 28 additions and 32 deletions

View File

@ -186,14 +186,14 @@ void GeometryShaderCache::Shutdown()
g_gs_disk_cache.Close();
}
bool GeometryShaderCache::SetShader(u32 components)
bool GeometryShaderCache::SetShader(u32 primitive_type)
{
GeometryShaderUid uid;
GetGeometryShaderUid(uid, components, API_D3D);
GetGeometryShaderUid(uid, primitive_type, API_D3D);
if (g_ActiveConfig.bEnableShaderDebugging)
{
ShaderCode code;
GenerateGeometryShaderCode(code, components, API_D3D);
GenerateGeometryShaderCode(code, primitive_type, API_D3D);
geometry_uid_checker.AddToIndexAndCheck(code, uid, "Geometry", "g");
}
@ -222,7 +222,7 @@ bool GeometryShaderCache::SetShader(u32 components)
// Need to compile a new shader
ShaderCode code;
GenerateGeometryShaderCode(code, components, API_D3D);
GenerateGeometryShaderCode(code, primitive_type, API_D3D);
D3DBlob* pbytecode;
if (!D3D::CompileGeometryShader(code.GetBuffer(), &pbytecode))

View File

@ -18,7 +18,7 @@ public:
static void Init();
static void Clear();
static void Shutdown();
static bool SetShader(u32 components); // TODO: Should be renamed to LoadShader
static bool SetShader(u32 primitive_type); // TODO: Should be renamed to LoadShader
static bool InsertByteCode(const GeometryShaderUid &uid, const void* bytecode, unsigned int bytecodelen);
static ID3D11GeometryShader* GeometryShaderCache::GetClearGeometryShader();

View File

@ -141,7 +141,7 @@ void VertexManager::Draw(u32 stride)
{
D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
D3D::stateman->SetGeometryConstants(GeometryShaderCache::GetConstantBuffer());
D3D::stateman->SetGeometryShader(g_ActiveConfig.iStereoMode > 0 ? GeometryShaderCache::GetActiveShader() : nullptr);
D3D::stateman->SetGeometryShader(GeometryShaderCache::GetActiveShader());
D3D::stateman->Apply();
D3D::context->DrawIndexed(indices, startIndex, baseVertex);
@ -219,13 +219,10 @@ void VertexManager::vFlush(bool useDstAlpha)
return;
}
if (g_ActiveConfig.iStereoMode > 0)
if (!GeometryShaderCache::SetShader(current_primitive_type))
{
if (!GeometryShaderCache::SetShader(components))
{
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR, true, { printf("Fail to set pixel shader\n"); });
return;
}
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR, true, { printf("Fail to set pixel shader\n"); });
return;
}
if (g_ActiveConfig.backend_info.bSupportsBBox && BoundingBox::active)