mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-22 20:06:54 +02:00
Graphics: respect physical tile layout when resolving depth aliases
This commit is contained in:
+5
-4
@@ -678,7 +678,8 @@ void TextureCache::CopyImageMip(ImageId destination_id, ImageId source_id, uint3
|
|||||||
ImageId TextureCache::ResolveDepthOverlap(const ImageInfo& requested, BindingType binding,
|
ImageId TextureCache::ResolveDepthOverlap(const ImageInfo& requested, BindingType binding,
|
||||||
ImageId cached_id) {
|
ImageId cached_id) {
|
||||||
auto& cached = m_slot_images[cached_id];
|
auto& cached = m_slot_images[cached_id];
|
||||||
if (!cached.info.IsDepth() && !requested.IsDepth()) {
|
if ((!cached.info.IsDepth() && !requested.IsDepth()) ||
|
||||||
|
cached.info.tile_mode != requested.tile_mode) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const bool stencil_match = requested.HasStencil() == cached.info.HasStencil();
|
const bool stencil_match = requested.HasStencil() == cached.info.HasStencil();
|
||||||
@@ -692,8 +693,8 @@ ImageId TextureCache::ResolveDepthOverlap(const ImageInfo& requested, BindingTyp
|
|||||||
requested.samples == 1 && requested.data == cached.info.data &&
|
requested.samples == 1 && requested.data == cached.info.data &&
|
||||||
requested.extent == cached.info.extent && requested.resources == cached.info.resources &&
|
requested.extent == cached.info.extent && requested.resources == cached.info.resources &&
|
||||||
requested.type == cached.info.type && requested.pitch == cached.info.pitch &&
|
requested.type == cached.info.type && requested.pitch == cached.info.pitch &&
|
||||||
requested.tile_mode == cached.info.tile_mode && !requested.HasStencil() &&
|
!requested.HasStencil() && !cached.info.HasStencil() && !requested.HasMetadata() &&
|
||||||
!cached.info.HasStencil() && !requested.HasMetadata() && !cached.info.HasMetadata();
|
!cached.info.HasMetadata();
|
||||||
// PPSA04264
|
// PPSA04264
|
||||||
const bool retain_cached_layout =
|
const bool retain_cached_layout =
|
||||||
requested.samples == 1 && cached.info.samples == 1 && cached.backing.samples == 1 &&
|
requested.samples == 1 && cached.info.samples == 1 && cached.backing.samples == 1 &&
|
||||||
@@ -704,7 +705,7 @@ ImageId TextureCache::ResolveDepthOverlap(const ImageInfo& requested, BindingTyp
|
|||||||
requested.resources.layers != 0 && cached.info.resources.layers != 0 &&
|
requested.resources.layers != 0 && cached.info.resources.layers != 0 &&
|
||||||
requested.resources.layers < cached.info.resources.layers &&
|
requested.resources.layers < cached.info.resources.layers &&
|
||||||
requested.type == cached.info.type && requested.pitch == cached.info.pitch &&
|
requested.type == cached.info.type && requested.pitch == cached.info.pitch &&
|
||||||
requested.tile_mode == cached.info.tile_mode && requested.mip_layout[0].offset == 0 &&
|
requested.mip_layout[0].offset == 0 &&
|
||||||
cached.info.mip_layout[0].offset == 0 &&
|
cached.info.mip_layout[0].offset == 0 &&
|
||||||
requested.mip_layout[0].size == requested.data.size &&
|
requested.mip_layout[0].size == requested.data.size &&
|
||||||
cached.info.mip_layout[0].size == cached.info.data.size &&
|
cached.info.mip_layout[0].size == cached.info.data.size &&
|
||||||
|
|||||||
@@ -11930,6 +11930,36 @@ public:
|
|||||||
"attachment usage leaked into the next draw");
|
"attachment usage leaked into the next draw");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PPSA03541 reuses a tile24 depth allocation through a tile27 RGB10A2 T#.
|
||||||
|
auto pooled_resource = sampled_depth_resource;
|
||||||
|
pooled_resource.numeric_class = Prospero::TextureNumericClass::Float;
|
||||||
|
ImageId pooled_color_id{};
|
||||||
|
for (const bool color : {false, true, false, true}) {
|
||||||
|
auto value = shared_depth_value;
|
||||||
|
value.dwords[1] = static_cast<uint32_t>(phased_depth_address >> 40u) |
|
||||||
|
(static_cast<uint32_t>(color ? Prospero::BufferFormat::k10_10_10_2UNorm
|
||||||
|
: Prospero::BufferFormat::k32Float) << 20u);
|
||||||
|
value.dwords[3] = color ? 0x91b00facu : 0x91800204u;
|
||||||
|
const auto binding = RenderExecutorTestAccess::ResolveTexture(
|
||||||
|
executor, pooled_resource, value);
|
||||||
|
const auto view = texture_cache.FindTexture(binding.image_id, binding.desc);
|
||||||
|
if (color && !pooled_color_id) {
|
||||||
|
pooled_color_id = binding.image_id;
|
||||||
|
}
|
||||||
|
Require(name, "pooled depth/color tile identity",
|
||||||
|
view != nullptr &&
|
||||||
|
binding.image_id == (color ? pooled_color_id : phased_depth.image_id) &&
|
||||||
|
(!color || binding.image_id != phased_depth.image_id) &&
|
||||||
|
texture_cache.GetImage(binding.image_id).backing.format ==
|
||||||
|
(color ? vk::Format::eA2B10G10R10UnormPack32
|
||||||
|
: vk::Format::eD32SfloatS8Uint) &&
|
||||||
|
binding.desc.info.tile_mode ==
|
||||||
|
(color ? Prospero::TileMode::kRenderTarget
|
||||||
|
: Prospero::TileMode::kDepth),
|
||||||
|
"a changed tile family reused depth or repeated sampling lost its backing");
|
||||||
|
RenderExecutorTestAccess::ResetBindings(executor);
|
||||||
|
}
|
||||||
|
|
||||||
auto video_subresource =
|
auto video_subresource =
|
||||||
make_target_desc(base + 0x20000, target_mip_size, {1, 1, 1});
|
make_target_desc(base + 0x20000, target_mip_size, {1, 1, 1});
|
||||||
video_subresource.type = BindingType::VideoOut;
|
video_subresource.type = BindingType::VideoOut;
|
||||||
|
|||||||
Reference in New Issue
Block a user