mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 09:09:18 +01:00
Latte: Support for SAMPLE_LB
This commit is contained in:
parent
df282ab230
commit
2167143c17
@ -666,6 +666,9 @@ void LatteDecompiler_ParseTEXClause(LatteDecompilerShader* shaderContext, LatteD
|
||||
uint32 offsetY = (word2 >> 5) & 0x1F;
|
||||
uint32 offsetZ = (word2 >> 10) & 0x1F;
|
||||
|
||||
sint8 lodBias = (word2 >> 21) & 0x7F;
|
||||
if ((lodBias&0x40) != 0)
|
||||
lodBias |= 0x80;
|
||||
// bufferID -> Texture index
|
||||
// samplerId -> Sampler index
|
||||
sint32 textureIndex = bufferId - 0x00;
|
||||
@ -693,6 +696,7 @@ void LatteDecompiler_ParseTEXClause(LatteDecompilerShader* shaderContext, LatteD
|
||||
texInstruction.textureFetch.unnormalized[1] = coordTypeY == 0;
|
||||
texInstruction.textureFetch.unnormalized[2] = coordTypeZ == 0;
|
||||
texInstruction.textureFetch.unnormalized[3] = coordTypeW == 0;
|
||||
texInstruction.textureFetch.lodBias = (sint8)lodBias;
|
||||
cfInstruction->instructionsTEX.emplace_back(texInstruction);
|
||||
}
|
||||
else if( inst0_4 == GPU7_TEX_INST_SET_CUBEMAP_INDEX )
|
||||
|
@ -2561,8 +2561,13 @@ void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContext, Latt
|
||||
// lod or lod bias parameter
|
||||
if( texOpcode == GPU7_TEX_INST_SAMPLE_L || texOpcode == GPU7_TEX_INST_SAMPLE_LB || texOpcode == GPU7_TEX_INST_SAMPLE_C_L)
|
||||
{
|
||||
src->add(",");
|
||||
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 3, LATTE_DECOMPILER_DTYPE_FLOAT);
|
||||
if(texOpcode == GPU7_TEX_INST_SAMPLE_LB)
|
||||
src->addFmt("{}", (float)texInstruction->textureFetch.lodBias / 16.0f);
|
||||
else
|
||||
{
|
||||
src->add(",");
|
||||
_emitTEXSampleCoordInputComponent(shaderContext, texInstruction, 3, LATTE_DECOMPILER_DTYPE_FLOAT);
|
||||
}
|
||||
}
|
||||
else if( texOpcode == GPU7_TEX_INST_SAMPLE_LZ || texOpcode == GPU7_TEX_INST_SAMPLE_C_LZ )
|
||||
{
|
||||
|
@ -57,6 +57,7 @@ struct LatteDecompilerTEXInstruction
|
||||
sint8 offsetY{};
|
||||
sint8 offsetZ{};
|
||||
bool unnormalized[4]{}; // set if texture coordinates are in [0,dim] range instead of [0,1]
|
||||
sint8 lodBias{}; // divide by 16 to get actual value
|
||||
}textureFetch;
|
||||
// memRead
|
||||
struct
|
||||
|
Loading…
Reference in New Issue
Block a user