Skip to content

Commit

Permalink
Latte: Try to use real colorbuffer texture size if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Exzap committed Mar 22, 2023
1 parent 6544752 commit 8e36e71
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,15 @@ LatteTextureView* LatteMRT::GetColorAttachmentTexture(uint32 index, bool createN
uint32 colorBufferHeight = pitchHeight / colorBufferPitch;
uint32 colorBufferWidth = colorBufferPitch;

// colorbuffer width/height has to be padded to 8/32 but the actual resolution might be smaller
// use the scissor box as a clue to figure out the original resolution if possible
uint32 scissorBoxWidth = LatteGPUState.contextNew.PA_SC_GENERIC_SCISSOR_BR.get_BR_X();
uint32 scissorBoxHeight = LatteGPUState.contextNew.PA_SC_GENERIC_SCISSOR_BR.get_BR_Y();
if (((scissorBoxWidth + 7) & ~7) == colorBufferWidth)
colorBufferWidth = scissorBoxWidth;
if (((colorBufferHeight + 31) & ~31) == colorBufferHeight)
colorBufferHeight = scissorBoxHeight;

bool colorBufferWasFound = false;
sint32 viewFirstMip = 0; // todo

Expand Down

0 comments on commit 8e36e71

Please sign in to comment.