diff --git a/src/graphics/host_gpu/renderer/colorRenderTarget.cpp b/src/graphics/host_gpu/renderer/colorRenderTarget.cpp index c64fcda27..ffed443b3 100644 --- a/src/graphics/host_gpu/renderer/colorRenderTarget.cpp +++ b/src/graphics/host_gpu/renderer/colorRenderTarget.cpp @@ -7,8 +7,8 @@ #include "graphics/guest_gpu/hardwareContext.h" #include "graphics/guest_gpu/tile.h" #include "graphics/host_gpu/graphicContext.h" -#include "graphics/host_gpu/renderer/image/textureCommon.h" #include "graphics/host_gpu/renderer/debug.h" +#include "graphics/host_gpu/renderer/image/textureCommon.h" #include "graphics/host_gpu/renderer/pipeline/descriptorCache.h" #include "graphics/host_gpu/renderer/render.h" #include "graphics/host_gpu/renderer/renderContext.h" @@ -23,10 +23,10 @@ static std::atomic g_render_color_log_count = 0; // NOLINTNEXTLINE(readability-function-cognitive-complexity) void RenderExecutor::ResolveRenderColorTarget(uint64_t submit_id, RenderCommandBuffer& buffer, - RenderColorInfo& r, - uint32_t render_target_slice_offset, - uint32_t render_target_slot, bool ignore_target_mask, - bool exact_format) { + RenderColorInfo& r, + uint32_t render_target_slice_offset, + uint32_t render_target_slot, bool ignore_target_mask, + bool exact_format) { KYTY_PROFILER_FUNCTION(); const auto& hw = buffer.GetRegisters(); @@ -79,10 +79,8 @@ void RenderExecutor::ResolveRenderColorTarget(uint64_t submit_id, RenderCommandB const auto view = ResolveTargetViewInfo( rt.view.base_array_slice_index, rt.view.last_array_slice_index, render_target_slice_offset); switch (view.type) { - case TargetViewType::Image2D: break; - case TargetViewType::Image2DArray: - EXIT("layered render-target views are unsupported: base=%u count=%u\n", view.base_layer, - view.layer_count); + case TargetViewType::Image2D: + case TargetViewType::Image2DArray: break; case TargetViewType::Unsupported: EXIT("invalid render-target view: base=%u last=%u draw_offset=%u\n", rt.view.base_array_slice_index, rt.view.last_array_slice_index, @@ -241,12 +239,12 @@ void RenderExecutor::ResolveRenderColorTarget(uint64_t submit_id, RenderCommandB } TextureCache::ImageDesc desc {}; - desc.type = TextureCache::BindingType::RenderTarget; - desc.info.data = {rt.base.addr, backing_size}; - desc.info.pixel_format = target_format.format; - desc.info.guest_format = ImageOps::RenderTargetTransferFormat(bytes_per_element); - desc.info.type = Prospero::ImageType::kColor2D; - desc.info.extent = {width, height, 1}; + desc.type = TextureCache::BindingType::RenderTarget; + desc.info.data = {rt.base.addr, backing_size}; + desc.info.pixel_format = target_format.format; + desc.info.guest_format = ImageOps::RenderTargetTransferFormat(bytes_per_element); + desc.info.type = Prospero::ImageType::kColor2D; + desc.info.extent = {width, height, 1}; desc.info.resources = {levels, view.image_layers}; desc.info.pitch = pitch; desc.info.bytes_per_block = bytes_per_element; @@ -275,20 +273,20 @@ void RenderExecutor::ResolveRenderColorTarget(uint64_t submit_id, RenderCommandB desc.view_info.base_layer = view.base_layer; desc.view_info.layer_count = view.layer_count; desc.view_info.usage = vk::ImageUsageFlagBits::eColorAttachment; - auto& texture_cache = m_context.GetTextureCache(); - r.desc = std::move(desc); - r.image_id = texture_cache.FindImage(r.desc, exact_format); - r.type = RenderColorType::RenderTexture; - r.base_addr = rt.base.addr; - r.image_view = nullptr; - r.format = r.desc.view_info.format; - r.extent = view_extent; - r.base_mip_level = rt.view.current_mip_level; - r.buffer_size = backing_size; - r.samples = samples; - r.export_mapping = target_format.export_mapping; - r.color_clear_enable = false; - r.color_clear_value = {}; + auto& texture_cache = m_context.GetTextureCache(); + r.desc = std::move(desc); + r.image_id = texture_cache.FindImage(r.desc, exact_format); + r.type = RenderColorType::RenderTexture; + r.base_addr = rt.base.addr; + r.image_view = nullptr; + r.format = r.desc.view_info.format; + r.extent = view_extent; + r.base_mip_level = rt.view.current_mip_level; + r.buffer_size = backing_size; + r.samples = samples; + r.export_mapping = target_format.export_mapping; + r.color_clear_enable = false; + r.color_clear_value = {}; BindRenderTarget(r.image_id); } diff --git a/src/graphics/host_gpu/renderer/debug.cpp b/src/graphics/host_gpu/renderer/debug.cpp index 6b0b41503..f26e8c47b 100644 --- a/src/graphics/host_gpu/renderer/debug.cpp +++ b/src/graphics/host_gpu/renderer/debug.cpp @@ -548,14 +548,6 @@ static void ZCheck(const HW::DepthRenderTarget& z) { EXIT_NOT_IMPLEMENTED(z.htile_surface.prefetch_height != 0x00000000); EXIT_NOT_IMPLEMENTED(z.htile_surface.dst_outside_zero_to_one != 0x00000000); - if (z.depth_view.slice_start != 0x00000000 || z.depth_view.slice_max != 0x00000000) { - static std::atomic log_count {0}; - if (log_count.fetch_add(1, std::memory_order_relaxed) < 16) { - LOGF("DepthTarget: temporary: ignoring PS5 array slice view start=0x%08" PRIx32 - ", max=0x%08" PRIx32 "\n", - z.depth_view.slice_start, z.depth_view.slice_max); - } - } if (z.depth_view.current_mip_level != 0x00000000) { static std::atomic log_count {0}; if (log_count.fetch_add(1, std::memory_order_relaxed) < 16) { diff --git a/src/graphics/host_gpu/renderer/depthRenderTarget.cpp b/src/graphics/host_gpu/renderer/depthRenderTarget.cpp index bdb0c5577..83f2e915c 100644 --- a/src/graphics/host_gpu/renderer/depthRenderTarget.cpp +++ b/src/graphics/host_gpu/renderer/depthRenderTarget.cpp @@ -10,10 +10,10 @@ #include "graphics/guest_gpu/hardwareContext.h" #include "graphics/guest_gpu/tile.h" #include "graphics/host_gpu/graphicContext.h" -#include "graphics/host_gpu/renderer/image/textureCommon.h" #include "graphics/host_gpu/renderer/debug.h" -#include "graphics/host_gpu/renderer/pipeline/descriptorCache.h" #include "graphics/host_gpu/renderer/image/imageView.h" +#include "graphics/host_gpu/renderer/image/textureCommon.h" +#include "graphics/host_gpu/renderer/pipeline/descriptorCache.h" #include "graphics/host_gpu/renderer/render.h" #include "graphics/host_gpu/renderer/renderContext.h" #include "graphics/host_gpu/vulkanCommon.h" @@ -150,10 +150,8 @@ void RenderExecutor::ResolveRenderDepthTarget(uint64_t submit_id, RenderCommandB has_stencil, has_htile, z.stencil_info.htile_stencil_disabled); const auto view = ResolveTargetViewInfo(z.depth_view.slice_start, z.depth_view.slice_max); switch (view.type) { - case TargetViewType::Image2D: break; - case TargetViewType::Image2DArray: - DepthFatal("layered depth views are unsupported: base=%u count=%u", view.base_layer, - view.layer_count); + case TargetViewType::Image2D: + case TargetViewType::Image2DArray: break; case TargetViewType::Unsupported: DepthFatal("invalid depth view: base=%u last=%u", z.depth_view.slice_start, z.depth_view.slice_max); diff --git a/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp b/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp index 597d7fcf5..2babd3bcd 100644 --- a/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp +++ b/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp @@ -213,19 +213,21 @@ bool IsSupportedDepthTargetDescriptor(const ShaderTextureResource& descriptor, c const auto height = static_cast(descriptor.Height5()) + 1u; const auto pitch = TileGetTexturePitch(descriptor.Format(), width, 1, descriptor.TileMode()); const auto type = static_cast(descriptor.Type()); - const bool supported_single_layer = - image.info.resources.layers == 1 && descriptor.Depth() == 0 && - descriptor.BaseArray5() == 0 && - (type == Prospero::ImageType::kColor2D || type == Prospero::ImageType::kColor2DArray); + const bool supported_2d = type == Prospero::ImageType::kColor2D && + image.info.resources.layers == 1 && descriptor.Depth() == 0 && + descriptor.BaseArray5() == 0; + const bool supported_array = type == Prospero::ImageType::kColor2DArray && + descriptor.BaseArray5() <= descriptor.Depth() && + descriptor.Depth() < image.info.resources.layers; const bool supported_cube = type == Prospero::ImageType::kCube && width == height && image.info.resources.layers >= 6 && image.info.resources.layers % 6u == 0 && static_cast(descriptor.Depth()) + 1u == image.info.resources.layers && descriptor.BaseArray5() == 0; return image.info.IsDepth() && width == image.info.extent.width && - height == image.info.extent.height && (supported_single_layer || supported_cube) && - descriptor.BaseLevel() == 0 && descriptor.LastLevel() == 0 && descriptor.MaxMip() == 0 && - descriptor.MinLod() == 0 && descriptor.BaseArray5() == 0 && + height == image.info.extent.height && + (supported_2d || supported_array || supported_cube) && descriptor.BaseLevel() == 0 && + descriptor.LastLevel() == 0 && descriptor.MaxMip() == 0 && descriptor.MinLod() == 0 && descriptor.TileMode() == Prospero::GpuEnumValue(Prospero::TileMode::kDepth) && descriptor.BCSwizzle() == 0 && !descriptor.MsaaDepth() && pitch >= width && pitch == image.info.pitch;