fix: sample compare component count

This commit is contained in:
Samuliak 2025-01-18 19:40:22 +01:00
parent f0cf61461c
commit 86f364889a
No known key found for this signature in database

View file

@ -2295,6 +2295,10 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
} }
else else
{ {
// sample_compare returns a float, need to convert to float4
if (isCompare)
src->addFmt("float4(");
if (emulateCompare) if (emulateCompare)
{ {
cemu_assert_debug(!isGather); cemu_assert_debug(!isGather);
@ -2555,9 +2559,9 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
src->add(")"); src->add(")");
} }
// sample_compare doesn't return a float if (isCompare)
if (!isCompare) src->add(")");
{
if (texOpcode == GPU7_TEX_INST_SAMPLE_C || texOpcode == GPU7_TEX_INST_SAMPLE_C_LZ) if (texOpcode == GPU7_TEX_INST_SAMPLE_C || texOpcode == GPU7_TEX_INST_SAMPLE_C_LZ)
{ {
src->add("."); src->add(".");
@ -2601,7 +2605,6 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
elemIndex = fetchToGather[elemIndex]; elemIndex = fetchToGather[elemIndex];
} }
src->add(resultElemTable[elemIndex]); src->add(resultElemTable[elemIndex]);
numWrittenElements++;
} }
else if (texInstruction->dstSel[f] == 7) else if (texInstruction->dstSel[f] == 7)
{ {
@ -2613,7 +2616,6 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
} }
} }
} }
}
src->add(");"); src->add(");");
// debug // debug