mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 15:31:26 +12:00
rsx: Do not allow framebuffer surfaces that exceed their allocated pitch dimensions
- Truncate surfaces to forcefully fit inside the declared region
This commit is contained in:
parent
537d3f2548
commit
d8f753f1e8
2 changed files with 27 additions and 4 deletions
|
@ -798,7 +798,7 @@ size_t get_texture_size(const rsx::vertex_texture &texture)
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 get_remap_encoding(const std::pair<std::array<u8, 4>, std::array<u8, 4>>& remap)
|
u32 get_remap_encoding(const std::pair<std::array<u8, 4>, std::array<u8, 4>>& remap)
|
||||||
{
|
{
|
||||||
u32 encode = 0;
|
u32 encode = 0;
|
||||||
encode |= (remap.first[0] << 0);
|
encode |= (remap.first[0] << 0);
|
||||||
encode |= (remap.first[1] << 2);
|
encode |= (remap.first[1] << 2);
|
||||||
|
|
|
@ -1110,10 +1110,19 @@ namespace rsx
|
||||||
{
|
{
|
||||||
layout.zeta_address = 0;
|
layout.zeta_address = 0;
|
||||||
}
|
}
|
||||||
|
else if (packed_render)
|
||||||
|
{
|
||||||
|
layout.actual_zeta_pitch = (layout.width * depth_texel_size);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Still exists? Unlikely to get discarded
|
const auto packed_zeta_pitch = (layout.width * depth_texel_size);
|
||||||
layout.actual_zeta_pitch = packed_render? (layout.width * depth_texel_size) : layout.zeta_pitch;
|
if (packed_zeta_pitch > layout.zeta_pitch)
|
||||||
|
{
|
||||||
|
layout.width = (layout.zeta_pitch / depth_texel_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
layout.actual_zeta_pitch = layout.zeta_pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &index : rsx::utility::get_rtt_indexes(layout.target))
|
for (const auto &index : rsx::utility::get_rtt_indexes(layout.target))
|
||||||
|
@ -1159,7 +1168,21 @@ namespace rsx
|
||||||
|
|
||||||
verify(HERE), layout.color_addresses[index];
|
verify(HERE), layout.color_addresses[index];
|
||||||
|
|
||||||
layout.actual_color_pitch[index] = packed_render? (layout.width * color_texel_size) : layout.color_pitch[index];
|
const auto packed_pitch = (layout.width * color_texel_size);
|
||||||
|
if (packed_render)
|
||||||
|
{
|
||||||
|
layout.actual_color_pitch[index] = packed_pitch;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (packed_pitch > layout.color_pitch[index])
|
||||||
|
{
|
||||||
|
layout.width = (layout.color_pitch[index] / color_texel_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
layout.actual_color_pitch[index] = layout.color_pitch[index];
|
||||||
|
}
|
||||||
|
|
||||||
framebuffer_status_valid = true;
|
framebuffer_status_valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue