implement point coord properly

This commit is contained in:
Samuliak 2024-12-21 08:52:18 +01:00
parent 08ea28f56e
commit 967a74024a
No known key found for this signature in database
2 changed files with 5 additions and 2 deletions

View File

@ -4287,9 +4287,9 @@ void LatteDecompiler_emitMSLShader(LatteDecompilerShaderContext* shaderContext,
cemu_assert_debug((psInputTable->paramGen) == 1); // handle the other bits (the same set of coordinates with different perspective/projection settings?)
uint32 paramGenGPRIndex = psInputTable->paramGenGPR;
if (shaderContext->typeTracker.defaultDataType == LATTE_DECOMPILER_DTYPE_FLOAT)
src->addFmt("{} = in.position.xyxy;" _CRLF, _getRegisterVarName(shaderContext, paramGenGPRIndex));
src->addFmt("{} = pointCoord.xyxy;" _CRLF, _getRegisterVarName(shaderContext, paramGenGPRIndex));
else
src->addFmt("{} = bitCast<int>(gl_PointCoord.xyxy);" _CRLF, _getRegisterVarName(shaderContext, paramGenGPRIndex));
src->addFmt("{} = bitCast<int>(pointCoord.xyxy);" _CRLF, _getRegisterVarName(shaderContext, paramGenGPRIndex));
}
for (sint32 i = 0; i < psInputTable->count; i++)

View File

@ -516,6 +516,7 @@ namespace LatteDecompiler
}
else
{
// TODO: only include these if needed?
src->add("uint vid [[vertex_id]]");
src->add(", uint iid [[instance_id]]");
}
@ -532,6 +533,8 @@ namespace LatteDecompiler
break;
case LatteConst::ShaderType::Pixel:
src->add("FragmentIn in [[stage_in]]");
// TODO: only include these if needed?
src->add(", float2 pointCoord [[point_coord]]");
src->add(", bool frontFacing [[front_facing]]");
break;
default: