mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-06 23:11:18 +12:00
output all fragment inputs in the vertex shader
This commit is contained in:
parent
1752126f5c
commit
ac96a1dd53
1 changed files with 17 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "Common/precompiled.h"
|
#include "Common/precompiled.h"
|
||||||
#include "Cafe/HW/Latte/Renderer/Metal/MetalCommon.h"
|
#include "Cafe/HW/Latte/Renderer/Metal/MetalCommon.h"
|
||||||
|
#include "HW/Latte/Core/LatteShader.h"
|
||||||
|
|
||||||
namespace LatteDecompiler
|
namespace LatteDecompiler
|
||||||
{
|
{
|
||||||
|
@ -185,6 +186,7 @@ namespace LatteDecompiler
|
||||||
|
|
||||||
LatteShaderPSInputTable* psInputTable = LatteSHRC_GetPSInputTable();
|
LatteShaderPSInputTable* psInputTable = LatteSHRC_GetPSInputTable();
|
||||||
auto parameterMask = shaderContext->shader->outputParameterMask;
|
auto parameterMask = shaderContext->shader->outputParameterMask;
|
||||||
|
bool psInputsWritten[GPU7_PS_MAX_INPUTS] = {false};
|
||||||
for (uint32 i = 0; i < 32; i++)
|
for (uint32 i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
if ((parameterMask&(1 << i)) == 0)
|
if ((parameterMask&(1 << i)) == 0)
|
||||||
|
@ -205,6 +207,8 @@ namespace LatteDecompiler
|
||||||
if (psInputIndex == -1)
|
if (psInputIndex == -1)
|
||||||
continue; // no ps input
|
continue; // no ps input
|
||||||
|
|
||||||
|
psInputsWritten[psInputIndex] = true;
|
||||||
|
|
||||||
src->addFmt("float4 passParameterSem{}", psInputTable->import[psInputIndex].semanticId);
|
src->addFmt("float4 passParameterSem{}", psInputTable->import[psInputIndex].semanticId);
|
||||||
if (!isRectVertexShader)
|
if (!isRectVertexShader)
|
||||||
{
|
{
|
||||||
|
@ -217,6 +221,19 @@ namespace LatteDecompiler
|
||||||
src->addFmt(";" _CRLF);
|
src->addFmt(";" _CRLF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: handle this in the fragment shader instead?
|
||||||
|
// Declare all PS inputs that are not written by the VS
|
||||||
|
for (uint32 i = 0; i < psInputTable->count; i++)
|
||||||
|
{
|
||||||
|
if (psInputsWritten[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (psInputTable->import[i].semanticId > LATTE_ANALYZER_IMPORT_INDEX_PARAM_MAX)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
src->addFmt("float4 unknown{} [[user(locn{})]];" _CRLF, psInputTable->import[i].semanticId, i);
|
||||||
|
}
|
||||||
|
|
||||||
src->add("};" _CRLF _CRLF);
|
src->add("};" _CRLF _CRLF);
|
||||||
|
|
||||||
if (isRectVertexShader)
|
if (isRectVertexShader)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue