fix: texture sample gradient errors

This commit is contained in:
Samuliak 2024-11-19 17:48:28 +01:00
parent b48656850e
commit b140984264
No known key found for this signature in database

View File

@ -2240,8 +2240,7 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
bool unnormalizationHandled = false; bool unnormalizationHandled = false;
bool useTexelCoordinates = false; bool useTexelCoordinates = false;
bool isRead = ((texOpcode == GPU7_TEX_INST_SAMPLE && (texInstruction->textureFetch.unnormalized[0] && texInstruction->textureFetch.unnormalized[1] && texInstruction->textureFetch.unnormalized[2] && texInstruction->textureFetch.unnormalized[3])) || bool isRead = ((texOpcode == GPU7_TEX_INST_SAMPLE && (texInstruction->textureFetch.unnormalized[0] && texInstruction->textureFetch.unnormalized[1] && texInstruction->textureFetch.unnormalized[2] && texInstruction->textureFetch.unnormalized[3])) || texOpcode == GPU7_TEX_INST_LD);
texOpcode == GPU7_TEX_INST_LD);
// handle illegal combinations // handle illegal combinations
if (texOpcode == GPU7_TEX_INST_FETCH4 && (texDim == Latte::E_DIM::DIM_1D || texDim == Latte::E_DIM::DIM_1D_ARRAY)) if (texOpcode == GPU7_TEX_INST_FETCH4 && (texDim == Latte::E_DIM::DIM_1D || texDim == Latte::E_DIM::DIM_1D_ARRAY))
@ -2459,7 +2458,7 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
src->add(")"); src->add(")");
} }
} }
else if (!isRead && !isGather/*texOpcode == GPU7_TEX_INST_SAMPLE_LZ || texOpcode == GPU7_TEX_INST_SAMPLE_C_LZ*/) else if (texOpcode == GPU7_TEX_INST_SAMPLE_LZ || texOpcode == GPU7_TEX_INST_SAMPLE_C_LZ)
{ {
src->add(", level(0.0)"); src->add(", level(0.0)");
} }
@ -2469,9 +2468,9 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
if (texOpcode == GPU7_TEX_INST_SAMPLE_G) if (texOpcode == GPU7_TEX_INST_SAMPLE_G)
{ {
if (texDim == Latte::E_DIM::DIM_2D || if (texDim == Latte::E_DIM::DIM_2D ||
texDim == Latte::E_DIM::DIM_1D ) texDim == Latte::E_DIM::DIM_1D)
{ {
src->add(",gradH.xy,gradV.xy"); src->add(", gradient2d(gradH.xy, gradV.xy)");
} }
else else
{ {