Merge pull request #10396 from Pokechu22/efb-copy-clamp
Fix copy filter clamping (again)
This commit is contained in:
commit
f0136e0eb6
|
@ -2676,7 +2676,8 @@ void TextureCacheBase::CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_cop
|
|||
};
|
||||
Uniforms uniforms;
|
||||
const float rcp_efb_width = 1.0f / static_cast<float>(g_framebuffer_manager->GetEFBWidth());
|
||||
const float rcp_efb_height = 1.0f / static_cast<float>(g_framebuffer_manager->GetEFBHeight());
|
||||
const u32 efb_height = g_framebuffer_manager->GetEFBHeight();
|
||||
const float rcp_efb_height = 1.0f / static_cast<float>(efb_height);
|
||||
uniforms.src_left = framebuffer_rect.left * rcp_efb_width;
|
||||
uniforms.src_top = framebuffer_rect.top * rcp_efb_height;
|
||||
uniforms.src_width = framebuffer_rect.GetWidth() * rcp_efb_width;
|
||||
|
@ -2685,9 +2686,15 @@ void TextureCacheBase::CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_cop
|
|||
uniforms.filter_coefficients[1] = filter_coefficients.middle;
|
||||
uniforms.filter_coefficients[2] = filter_coefficients.lower;
|
||||
uniforms.gamma_rcp = 1.0f / gamma;
|
||||
uniforms.clamp_top = clamp_top ? framebuffer_rect.top * rcp_efb_height : 0.0f;
|
||||
int bottom_coord = framebuffer_rect.bottom - 1;
|
||||
uniforms.clamp_bottom = clamp_bottom ? bottom_coord * rcp_efb_height : 1.0f;
|
||||
// NOTE: when the clamp bits aren't set, the hardware will happily read beyond the EFB,
|
||||
// which returns random garbage from the empty bus (confirmed by hardware tests).
|
||||
//
|
||||
// In our implementation, the garbage just so happens to be the top or bottom row.
|
||||
// Statistically, that could happen.
|
||||
const u32 top_coord = clamp_top ? framebuffer_rect.top : 0;
|
||||
uniforms.clamp_top = (static_cast<float>(top_coord) + .5f) * rcp_efb_height;
|
||||
const u32 bottom_coord = (clamp_bottom ? framebuffer_rect.bottom : efb_height) - 1;
|
||||
uniforms.clamp_bottom = (static_cast<float>(bottom_coord) + .5f) * rcp_efb_height;
|
||||
uniforms.pixel_height = g_ActiveConfig.bCopyEFBScaled ? rcp_efb_height : 1.0f / EFB_HEIGHT;
|
||||
uniforms.padding = 0;
|
||||
g_vertex_manager->UploadUtilityUniforms(&uniforms, sizeof(uniforms));
|
||||
|
|
|
@ -127,7 +127,7 @@ ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data)
|
|||
{
|
||||
out.Write("VARYING_LOCATION(0) in vec3 v_tex0;\n");
|
||||
}
|
||||
out.Write("FRAGMENT_OUTPUT_LOCATION(0) out vec4 ocol0;"
|
||||
out.Write("FRAGMENT_OUTPUT_LOCATION(0) out vec4 ocol0;\n"
|
||||
"void main()\n{{\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue