fix: texture bindings

This commit is contained in:
Samuliak 2024-08-05 08:54:11 +02:00
parent 5030a2e84a
commit f11526a244
3 changed files with 44 additions and 24 deletions

View file

@ -2193,7 +2193,7 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
src->add(".");
const char* resultElemTable[4] = {"x","y","z","w"};
sint32 numWrittenElements = 0;
for(sint32 f=0; f<4; f++)
for(sint32 f = 0; f < 4; f++)
{
if( texInstruction->dstSel[f] < 4 )
{
@ -2493,18 +2493,21 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
// lod bias
if( texOpcode == GPU7_TEX_INST_SAMPLE_C || texOpcode == GPU7_TEX_INST_SAMPLE_C_LZ )
{
src->add(")");
src->add(").");
if (numWrittenElements > 1)
{
// result is copied into multiple channels
src->add(".");
for (sint32 f = 0; f < numWrittenElements; f++)
{
cemu_assert_debug(texInstruction->dstSel[f] == 0); // only x component is defined
src->add("x");
}
}
else
{
src->add("x");
}
}
else
{