mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-07 23:41:18 +12:00
retrieve ps input table without using global variable
This commit is contained in:
parent
295a6ed9fd
commit
1750715791
4 changed files with 52 additions and 54 deletions
|
@ -209,11 +209,9 @@ void LatteShader_free(LatteDecompilerShader* shader)
|
|||
delete shader;
|
||||
}
|
||||
|
||||
// both vertex and geometry/pixel shader depend on PS inputs
|
||||
// we prepare the PS import info in advance
|
||||
void LatteShader_UpdatePSInputs(uint32* contextRegisters)
|
||||
void LatteShader_CreatePSInputTable(LatteShaderPSInputTable* psInputTable, uint32* contextRegisters)
|
||||
{
|
||||
// PS control
|
||||
// PS control
|
||||
uint32 psControl0 = contextRegisters[mmSPI_PS_IN_CONTROL_0];
|
||||
uint32 spi0_positionEnable = (psControl0 >> 8) & 1;
|
||||
uint32 spi0_positionCentroid = (psControl0 >> 9) & 1;
|
||||
|
@ -242,12 +240,12 @@ void LatteShader_UpdatePSInputs(uint32* contextRegisters)
|
|||
{
|
||||
key += std::rotr<uint64>(spi0_paramGen, 7);
|
||||
key += std::rotr<uint64>(spi0_paramGenAddr, 3);
|
||||
_activePSImportTable.paramGen = spi0_paramGen;
|
||||
_activePSImportTable.paramGenGPR = spi0_paramGenAddr;
|
||||
psInputTable->paramGen = spi0_paramGen;
|
||||
psInputTable->paramGenGPR = spi0_paramGenAddr;
|
||||
}
|
||||
else
|
||||
{
|
||||
_activePSImportTable.paramGen = 0;
|
||||
psInputTable->paramGen = 0;
|
||||
}
|
||||
|
||||
// semantic imports from vertex shader
|
||||
|
@ -281,9 +279,9 @@ void LatteShader_UpdatePSInputs(uint32* contextRegisters)
|
|||
key = std::rotl<uint64>(key, 7);
|
||||
if (spi0_positionEnable && f == spi0_positionAddr)
|
||||
{
|
||||
_activePSImportTable.import[f].semanticId = LATTE_ANALYZER_IMPORT_INDEX_SPIPOSITION;
|
||||
_activePSImportTable.import[f].isFlat = false;
|
||||
_activePSImportTable.import[f].isNoPerspective = false;
|
||||
psInputTable->import[f].semanticId = LATTE_ANALYZER_IMPORT_INDEX_SPIPOSITION;
|
||||
psInputTable->import[f].isFlat = false;
|
||||
psInputTable->import[f].isNoPerspective = false;
|
||||
key += (uint64)0x33;
|
||||
}
|
||||
else
|
||||
|
@ -296,13 +294,20 @@ void LatteShader_UpdatePSInputs(uint32* contextRegisters)
|
|||
semanticMask[psSemanticId >> 3] |= (1 << (psSemanticId & 7));
|
||||
#endif
|
||||
|
||||
_activePSImportTable.import[f].semanticId = psSemanticId;
|
||||
_activePSImportTable.import[f].isFlat = (psInputControl&(1 << 10)) != 0;
|
||||
_activePSImportTable.import[f].isNoPerspective = (psInputControl&(1 << 12)) != 0;
|
||||
psInputTable->import[f].semanticId = psSemanticId;
|
||||
psInputTable->import[f].isFlat = (psInputControl&(1 << 10)) != 0;
|
||||
psInputTable->import[f].isNoPerspective = (psInputControl&(1 << 12)) != 0;
|
||||
}
|
||||
}
|
||||
_activePSImportTable.key = key;
|
||||
_activePSImportTable.count = numPSInputs;
|
||||
psInputTable->key = key;
|
||||
psInputTable->count = numPSInputs;
|
||||
}
|
||||
|
||||
// both vertex and geometry/pixel shader depend on PS inputs
|
||||
// we prepare the PS import info in advance
|
||||
void LatteShader_UpdatePSInputs(uint32* contextRegisters)
|
||||
{
|
||||
LatteShader_CreatePSInputTable(&_activePSImportTable, contextRegisters);
|
||||
}
|
||||
|
||||
void LatteShader_CreateRendererShader(LatteDecompilerShader* shader, bool compileAsync)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue