diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index 82564acb82..d0099e71d1 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -1297,7 +1297,7 @@ namespace rsx sampled_image_descriptor upload_texture(commandbuffer_type& cmd, RsxTextureType& tex, surface_store_type& m_rtts, Args&&... extras) { const u32 texaddr = rsx::get_address(tex.offset(), tex.location()); - const u32 tex_size = (u32)get_placed_texture_storage_size(tex, 1, 256); + const u32 tex_size = (u32)get_placed_texture_storage_size(tex, 256, 512); const u32 format = tex.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN); const bool is_compressed_format = (format == CELL_GCM_TEXTURE_COMPRESSED_DXT1 || format == CELL_GCM_TEXTURE_COMPRESSED_DXT23 || format == CELL_GCM_TEXTURE_COMPRESSED_DXT45); diff --git a/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp b/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp index 6b6218073e..10e00a58d1 100644 --- a/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp +++ b/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp @@ -186,7 +186,10 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool sk const auto depth_format = rsx::method_registers.surface_depth_fmt(); const auto target = rsx::method_registers.surface_color_target(); - //NOTE: Z buffers with pitch = 64 are valid even if they would not fit (GT HD Concept) + //NOTE: Its is possible that some renders are done on a swizzled context. Pitch is meaningless in that case + //Seen in Nier (color) and GT HD concept (z buffer) + //Restriction is that the RTT is always a square region for that dimensions are powers of 2 + const auto required_zeta_pitch = std::max((u32)(depth_format == rsx::surface_depth_format::z16 ? clip_horizontal * 2 : clip_horizontal * 4), 64u); const auto required_color_pitch = std::max((u32)rsx::utility::get_packed_pitch(surface_format, clip_horizontal), 64u); const bool stencil_test_enabled = depth_format == rsx::surface_depth_format::z24s8 && rsx::method_registers.stencil_test_enabled(); @@ -204,12 +207,21 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool sk m_framebuffer_state_contested = true; } } + + if (depth_address && zeta_pitch < required_zeta_pitch) + { + if (zeta_pitch < 64 || clip_vertical != clip_horizontal) + depth_address = 0; + } } for (const auto &index : rsx::utility::get_rtt_indexes(target)) { if (pitchs[index] < required_color_pitch) - surface_addresses[index] = 0; + { + if (pitchs[index] < 64 || clip_vertical != clip_horizontal) + surface_addresses[index] = 0; + } if (surface_addresses[index] == depth_address) { @@ -237,7 +249,10 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool sk } if (!framebuffer_status_valid && !depth_address) + { + LOG_WARNING(RSX, "Framebuffer setup failed. Draw calls may have been lost"); return; + } m_rtts.prepare_render_target(nullptr, surface_format, depth_format, clip_horizontal, clip_vertical, target, surface_addresses, depth_address); diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 9d734b67f7..79048f445d 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -2424,7 +2424,10 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context) const auto depth_fmt = rsx::method_registers.surface_depth_fmt(); const auto target = rsx::method_registers.surface_color_target(); - //NOTE: Z buffers with pitch = 64 are valid even if they would not fit (GT HD Concept) + //NOTE: Its is possible that some renders are done on a swizzled context. Pitch is meaningless in that case + //Seen in Nier (color) and GT HD concept (z buffer) + //Restriction is that the RTT is always a square region for that dimensions are powers of 2 + const auto required_zeta_pitch = std::max((u32)(depth_fmt == rsx::surface_depth_format::z16 ? clip_width * 2 : clip_width * 4), 64u); const auto required_color_pitch = std::max((u32)rsx::utility::get_packed_pitch(color_fmt, clip_width), 64u); const bool stencil_test_enabled = depth_fmt == rsx::surface_depth_format::z24s8 && rsx::method_registers.stencil_test_enabled(); @@ -2442,12 +2445,21 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context) m_framebuffer_state_contested = true; } } + + if (zeta_address && zeta_pitch < required_zeta_pitch) + { + if (zeta_pitch < 64 || clip_width != clip_height) + zeta_address = 0; + } } for (const auto &index : rsx::utility::get_rtt_indexes(target)) { if (surface_pitchs[index] < required_color_pitch) - surface_addresses[index] = 0; + { + if (surface_pitchs[index] < 64 || clip_width != clip_height) + surface_addresses[index] = 0; + } if (surface_addresses[index] == zeta_address) { @@ -2474,7 +2486,10 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context) } if (!framebuffer_status_valid && !zeta_address) + { + LOG_WARNING(RSX, "Framebuffer setup failed. Draw calls may have been lost"); return; + } //At least one attachment exists framebuffer_status_valid = true;