handle rasterization kill for mesh shaders

This commit is contained in:
Samuliak 2024-09-11 10:55:10 +02:00
parent e8f726ecd7
commit 395cd1cd11
2 changed files with 18 additions and 14 deletions

View File

@ -504,23 +504,27 @@ void LatteSHRC_UpdateVSBaseHash(uint8* vertexShaderPtr, uint32 vertexShaderSize,
if (g_renderer->GetType() == RendererAPI::Metal) if (g_renderer->GetType() == RendererAPI::Metal)
{ {
if (usesGeometryShader) if (usesGeometryShader)
{
vsHash += _activeFetchShader->mtlShaderHashObject; vsHash += _activeFetchShader->mtlShaderHashObject;
}
else
{
// Rasterization
bool rasterizationEnabled = !LatteGPUState.contextNew.PA_CL_CLIP_CNTL.get_DX_RASTERIZATION_KILL();
// Rasterization // HACK
bool rasterizationEnabled = !LatteGPUState.contextNew.PA_CL_CLIP_CNTL.get_DX_RASTERIZATION_KILL(); if (!LatteGPUState.contextNew.PA_CL_VTE_CNTL.get_VPORT_X_OFFSET_ENA())
rasterizationEnabled = true;
// HACK const auto& polygonControlReg = LatteGPUState.contextNew.PA_SU_SC_MODE_CNTL;
if (!LatteGPUState.contextNew.PA_CL_VTE_CNTL.get_VPORT_X_OFFSET_ENA()) uint32 cullFront = polygonControlReg.get_CULL_FRONT();
rasterizationEnabled = true; uint32 cullBack = polygonControlReg.get_CULL_BACK();
if (cullFront && cullBack)
rasterizationEnabled = false;
const auto& polygonControlReg = LatteGPUState.contextNew.PA_SU_SC_MODE_CNTL; if (rasterizationEnabled)
uint32 cullFront = polygonControlReg.get_CULL_FRONT(); vsHash += 51ULL;
uint32 cullBack = polygonControlReg.get_CULL_BACK(); }
if (cullFront && cullBack)
rasterizationEnabled = false;
if (rasterizationEnabled)
vsHash += 51ULL;
} }
uint32 tmp = LatteGPUState.contextNew.PA_CL_VTE_CNTL.getRawValue() ^ 0x43F; uint32 tmp = LatteGPUState.contextNew.PA_CL_VTE_CNTL.getRawValue() ^ 0x43F;

View File

@ -3871,7 +3871,7 @@ void LatteDecompiler_emitMSLShader(LatteDecompilerShaderContext* shaderContext,
// Rasterization // Rasterization
rasterizationEnabled = true; rasterizationEnabled = true;
if (shader->shaderType == LatteConst::ShaderType::Vertex) if (shader->shaderType == LatteConst::ShaderType::Vertex && !(shaderContext->options->usesGeometryShader || isRectVertexShader))
{ {
rasterizationEnabled = !shaderContext->contextRegistersNew->PA_CL_CLIP_CNTL.get_DX_RASTERIZATION_KILL(); rasterizationEnabled = !shaderContext->contextRegistersNew->PA_CL_CLIP_CNTL.get_DX_RASTERIZATION_KILL();