Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/fast/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1928,13 +1928,18 @@ void Interpreter::GfxSpTri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx
uint32_t loadedPx = tex_width[i] * tex_height[i];
uint32_t renderedPx = tex_width2[i] * tex_height2[i];
bool pyrLike = renderedPx > 0 && loadedPx > renderedPx && loadedPx * 8 < renderedPx * 13;
// HD replacements must clamp to the tile region
// HD replacements clamp to the rendered tile region, but only when the tile
// actually defines one. A tile with no size set (lrs <= uls) collapses tex_width2
// to ~1 texel; force-clamping to that tiles the upscaled texture (e.g. the CI8
// eyes, which load via segment with an unset tile size and wrap-sample).
bool isHd = mRdp->loaded_texture[i].raw_tex_metadata.h_byte_scale != 1 ||
mRdp->loaded_texture[i].raw_tex_metadata.v_pixel_scale != 1;
if ((isHd || pyrLike || (cms & G_TX_CLAMP)) && tex_width2[i] > 0 && tex_width2[i] < tex_width[i]) {
bool hdClampS = isHd && (mRdp->texture_tile[tile].lrs > mRdp->texture_tile[tile].uls);
bool hdClampT = isHd && (mRdp->texture_tile[tile].lrt > mRdp->texture_tile[tile].ult);
if ((hdClampS || pyrLike || (cms & G_TX_CLAMP)) && tex_width2[i] > 0 && tex_width2[i] < tex_width[i]) {
tex_width[i] = tex_width2[i];
}
if ((isHd || pyrLike || (cmt & G_TX_CLAMP)) && tex_height2[i] > 0 && tex_height2[i] < tex_height[i]) {
if ((hdClampT || pyrLike || (cmt & G_TX_CLAMP)) && tex_height2[i] > 0 && tex_height2[i] < tex_height[i]) {
tex_height[i] = tex_height2[i];
}

Expand Down