mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-01 13:34:18 +01:00
rint texture slice & explicitly specify texture lod
This commit is contained in:
parent
97be576cd6
commit
ed32feb3d9
@ -2240,6 +2240,8 @@ 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])) ||
|
||||||
|
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))
|
||||||
@ -2266,8 +2268,7 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
|
|||||||
if (!emulateCompare)
|
if (!emulateCompare)
|
||||||
{
|
{
|
||||||
src->add(".");
|
src->add(".");
|
||||||
if ((texOpcode == GPU7_TEX_INST_SAMPLE && (texInstruction->textureFetch.unnormalized[0] && texInstruction->textureFetch.unnormalized[1] && texInstruction->textureFetch.unnormalized[2] && texInstruction->textureFetch.unnormalized[3])) ||
|
if (isRead)
|
||||||
texOpcode == GPU7_TEX_INST_LD)
|
|
||||||
{
|
{
|
||||||
if (hasOffset)
|
if (hasOffset)
|
||||||
cemu_assert_unimplemented();
|
cemu_assert_unimplemented();
|
||||||
@ -2353,9 +2354,9 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
|
|||||||
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 0, LATTE_DECOMPILER_DTYPE_FLOAT);
|
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 0, LATTE_DECOMPILER_DTYPE_FLOAT);
|
||||||
src->add(", ");
|
src->add(", ");
|
||||||
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 1, LATTE_DECOMPILER_DTYPE_FLOAT);
|
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 1, LATTE_DECOMPILER_DTYPE_FLOAT);
|
||||||
src->add("), uint(");
|
src->add("), uint(rint(");
|
||||||
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 2, LATTE_DECOMPILER_DTYPE_FLOAT);
|
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 2, LATTE_DECOMPILER_DTYPE_FLOAT);
|
||||||
src->add(")");
|
src->add("))");
|
||||||
|
|
||||||
src->addFmt(", {}", _getTexGPRAccess(shaderContext, texInstruction->srcGpr, LATTE_DECOMPILER_DTYPE_FLOAT, texInstruction->textureFetch.srcSel[3], -1, -1, -1, tempBuffer0));
|
src->addFmt(", {}", _getTexGPRAccess(shaderContext, texInstruction->srcGpr, LATTE_DECOMPILER_DTYPE_FLOAT, texInstruction->textureFetch.srcSel[3], -1, -1, -1, tempBuffer0));
|
||||||
}
|
}
|
||||||
@ -2397,9 +2398,9 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
|
|||||||
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 0, LATTE_DECOMPILER_DTYPE_FLOAT);
|
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 0, LATTE_DECOMPILER_DTYPE_FLOAT);
|
||||||
src->add(", ");
|
src->add(", ");
|
||||||
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 1, LATTE_DECOMPILER_DTYPE_FLOAT);
|
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 1, LATTE_DECOMPILER_DTYPE_FLOAT);
|
||||||
src->add("), uint(");
|
src->add("), uint(rint(");
|
||||||
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 2, LATTE_DECOMPILER_DTYPE_FLOAT);
|
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 2, LATTE_DECOMPILER_DTYPE_FLOAT);
|
||||||
src->add(")");
|
src->add("))");
|
||||||
}
|
}
|
||||||
else if(texDim == Latte::E_DIM::DIM_3D)
|
else if(texDim == Latte::E_DIM::DIM_3D)
|
||||||
{
|
{
|
||||||
@ -2443,7 +2444,7 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
|
|||||||
// 1D textures don't support lod
|
// 1D textures don't support lod
|
||||||
if (texDim != Latte::E_DIM::DIM_1D && texDim != Latte::E_DIM::DIM_1D_ARRAY)
|
if (texDim != Latte::E_DIM::DIM_1D && texDim != Latte::E_DIM::DIM_1D_ARRAY)
|
||||||
{
|
{
|
||||||
if( texOpcode == GPU7_TEX_INST_SAMPLE_L || texOpcode == GPU7_TEX_INST_SAMPLE_LB || texOpcode == GPU7_TEX_INST_SAMPLE_C_L)
|
if (texOpcode == GPU7_TEX_INST_SAMPLE_L || texOpcode == GPU7_TEX_INST_SAMPLE_LB || texOpcode == GPU7_TEX_INST_SAMPLE_C_L)
|
||||||
{
|
{
|
||||||
src->add(", ");
|
src->add(", ");
|
||||||
if (texOpcode == GPU7_TEX_INST_SAMPLE_LB)
|
if (texOpcode == GPU7_TEX_INST_SAMPLE_LB)
|
||||||
@ -2458,7 +2459,7 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
|
|||||||
src->add(")");
|
src->add(")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( texOpcode == GPU7_TEX_INST_SAMPLE_LZ || texOpcode == GPU7_TEX_INST_SAMPLE_C_LZ )
|
else if (!isRead && !isGather/*texOpcode == GPU7_TEX_INST_SAMPLE_LZ || texOpcode == GPU7_TEX_INST_SAMPLE_C_LZ*/)
|
||||||
{
|
{
|
||||||
src->add(", level(0.0)");
|
src->add(", level(0.0)");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user