mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-06 06:51:18 +12:00
mask out color attachments
This commit is contained in:
parent
e4068856bc
commit
68d328b094
2 changed files with 5 additions and 8 deletions
|
@ -183,7 +183,7 @@ struct LatteDecompilerShader
|
||||||
std::bitset<LATTE_NUM_MAX_TEX_UNITS> textureUnitMask2;
|
std::bitset<LATTE_NUM_MAX_TEX_UNITS> textureUnitMask2;
|
||||||
uint16 textureUnitSamplerAssignment[LATTE_NUM_MAX_TEX_UNITS]{ 0 }; // LATTE_DECOMPILER_SAMPLER_NONE means undefined
|
uint16 textureUnitSamplerAssignment[LATTE_NUM_MAX_TEX_UNITS]{ 0 }; // LATTE_DECOMPILER_SAMPLER_NONE means undefined
|
||||||
bool textureUsesDepthCompare[LATTE_NUM_MAX_TEX_UNITS]{};
|
bool textureUsesDepthCompare[LATTE_NUM_MAX_TEX_UNITS]{};
|
||||||
uint8 textureRenderTargetIndex[LATTE_NUM_MAX_TEX_UNITS] = {255};
|
uint8 textureRenderTargetIndex[LATTE_NUM_MAX_TEX_UNITS];
|
||||||
|
|
||||||
// analyzer stage (pixel outputs)
|
// analyzer stage (pixel outputs)
|
||||||
uint32 pixelColorOutputMask{ 0 }; // from LSB to MSB, 1 bit per written output. 1 if written (indices of color attachments)
|
uint32 pixelColorOutputMask{ 0 }; // from LSB to MSB, 1 bit per written output. 1 if written (indices of color attachments)
|
||||||
|
|
|
@ -855,6 +855,7 @@ void LatteDecompiler_analyze(LatteDecompilerShaderContext* shaderContext, LatteD
|
||||||
// check if textures are used as render targets
|
// check if textures are used as render targets
|
||||||
if (shader->shaderType == LatteConst::ShaderType::Pixel)
|
if (shader->shaderType == LatteConst::ShaderType::Pixel)
|
||||||
{
|
{
|
||||||
|
uint8 colorBufferMask = LatteMRT::GetActiveColorBufferMask(shader, *shaderContext->contextRegistersNew);
|
||||||
for (sint32 i = 0; i < shader->textureUnitListCount; i++)
|
for (sint32 i = 0; i < shader->textureUnitListCount; i++)
|
||||||
{
|
{
|
||||||
sint32 textureIndex = shader->textureUnitList[i];
|
sint32 textureIndex = shader->textureUnitList[i];
|
||||||
|
@ -867,15 +868,11 @@ void LatteDecompiler_analyze(LatteDecompilerShaderContext* shaderContext, LatteD
|
||||||
|
|
||||||
for (sint32 j = 0; j < LATTE_NUM_COLOR_TARGET; j++)
|
for (sint32 j = 0; j < LATTE_NUM_COLOR_TARGET; j++)
|
||||||
{
|
{
|
||||||
|
if (((colorBufferMask) & (1 << j)) == 0)
|
||||||
|
continue; // color buffer not enabled
|
||||||
|
|
||||||
uint32* colorBufferRegBase = shaderContext->contextRegisters + (mmCB_COLOR0_BASE + j);
|
uint32* colorBufferRegBase = shaderContext->contextRegisters + (mmCB_COLOR0_BASE + j);
|
||||||
uint32 regColorBufferBase = colorBufferRegBase[mmCB_COLOR0_BASE - mmCB_COLOR0_BASE] & 0xFFFFFF00; // the low 8 bits are ignored? How to Survive seems to rely on this
|
uint32 regColorBufferBase = colorBufferRegBase[mmCB_COLOR0_BASE - mmCB_COLOR0_BASE] & 0xFFFFFF00; // the low 8 bits are ignored? How to Survive seems to rely on this
|
||||||
uint32 regColorSize = colorBufferRegBase[mmCB_COLOR0_SIZE - mmCB_COLOR0_BASE];
|
|
||||||
uint32 regColorInfo = colorBufferRegBase[mmCB_COLOR0_INFO - mmCB_COLOR0_BASE];
|
|
||||||
uint32 regColorView = colorBufferRegBase[mmCB_COLOR0_VIEW - mmCB_COLOR0_BASE];
|
|
||||||
// decode color buffer reg info
|
|
||||||
Latte::E_HWTILEMODE colorBufferTileMode = (Latte::E_HWTILEMODE)((regColorInfo >> 8) & 0xF);
|
|
||||||
uint32 numberType = (regColorInfo >> 12) & 7;
|
|
||||||
Latte::E_GX2SURFFMT colorBufferFormat = LatteMRT::GetColorBufferFormat(j, *shaderContext->contextRegistersNew);
|
|
||||||
|
|
||||||
MPTR colorBufferPhysMem = regColorBufferBase;
|
MPTR colorBufferPhysMem = regColorBufferBase;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue