mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-21 03:16:54 +02:00
renderer: broaden compatibility
This commit is contained in:
@@ -7,8 +7,8 @@
|
|||||||
#include "graphics/guest_gpu/hardwareContext.h"
|
#include "graphics/guest_gpu/hardwareContext.h"
|
||||||
#include "graphics/guest_gpu/tile.h"
|
#include "graphics/guest_gpu/tile.h"
|
||||||
#include "graphics/host_gpu/graphicContext.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/debug.h"
|
||||||
|
#include "graphics/host_gpu/renderer/image/textureCommon.h"
|
||||||
#include "graphics/host_gpu/renderer/pipeline/descriptorCache.h"
|
#include "graphics/host_gpu/renderer/pipeline/descriptorCache.h"
|
||||||
#include "graphics/host_gpu/renderer/render.h"
|
#include "graphics/host_gpu/renderer/render.h"
|
||||||
#include "graphics/host_gpu/renderer/renderContext.h"
|
#include "graphics/host_gpu/renderer/renderContext.h"
|
||||||
@@ -23,10 +23,10 @@ static std::atomic<uint32_t> g_render_color_log_count = 0;
|
|||||||
|
|
||||||
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
|
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
|
||||||
void RenderExecutor::ResolveRenderColorTarget(uint64_t submit_id, RenderCommandBuffer& buffer,
|
void RenderExecutor::ResolveRenderColorTarget(uint64_t submit_id, RenderCommandBuffer& buffer,
|
||||||
RenderColorInfo& r,
|
RenderColorInfo& r,
|
||||||
uint32_t render_target_slice_offset,
|
uint32_t render_target_slice_offset,
|
||||||
uint32_t render_target_slot, bool ignore_target_mask,
|
uint32_t render_target_slot, bool ignore_target_mask,
|
||||||
bool exact_format) {
|
bool exact_format) {
|
||||||
KYTY_PROFILER_FUNCTION();
|
KYTY_PROFILER_FUNCTION();
|
||||||
const auto& hw = buffer.GetRegisters();
|
const auto& hw = buffer.GetRegisters();
|
||||||
|
|
||||||
@@ -79,10 +79,8 @@ void RenderExecutor::ResolveRenderColorTarget(uint64_t submit_id, RenderCommandB
|
|||||||
const auto view = ResolveTargetViewInfo(
|
const auto view = ResolveTargetViewInfo(
|
||||||
rt.view.base_array_slice_index, rt.view.last_array_slice_index, render_target_slice_offset);
|
rt.view.base_array_slice_index, rt.view.last_array_slice_index, render_target_slice_offset);
|
||||||
switch (view.type) {
|
switch (view.type) {
|
||||||
case TargetViewType::Image2D: break;
|
case TargetViewType::Image2D:
|
||||||
case TargetViewType::Image2DArray:
|
case TargetViewType::Image2DArray: break;
|
||||||
EXIT("layered render-target views are unsupported: base=%u count=%u\n", view.base_layer,
|
|
||||||
view.layer_count);
|
|
||||||
case TargetViewType::Unsupported:
|
case TargetViewType::Unsupported:
|
||||||
EXIT("invalid render-target view: base=%u last=%u draw_offset=%u\n",
|
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,
|
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 {};
|
TextureCache::ImageDesc desc {};
|
||||||
desc.type = TextureCache::BindingType::RenderTarget;
|
desc.type = TextureCache::BindingType::RenderTarget;
|
||||||
desc.info.data = {rt.base.addr, backing_size};
|
desc.info.data = {rt.base.addr, backing_size};
|
||||||
desc.info.pixel_format = target_format.format;
|
desc.info.pixel_format = target_format.format;
|
||||||
desc.info.guest_format = ImageOps::RenderTargetTransferFormat(bytes_per_element);
|
desc.info.guest_format = ImageOps::RenderTargetTransferFormat(bytes_per_element);
|
||||||
desc.info.type = Prospero::ImageType::kColor2D;
|
desc.info.type = Prospero::ImageType::kColor2D;
|
||||||
desc.info.extent = {width, height, 1};
|
desc.info.extent = {width, height, 1};
|
||||||
desc.info.resources = {levels, view.image_layers};
|
desc.info.resources = {levels, view.image_layers};
|
||||||
desc.info.pitch = pitch;
|
desc.info.pitch = pitch;
|
||||||
desc.info.bytes_per_block = bytes_per_element;
|
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.base_layer = view.base_layer;
|
||||||
desc.view_info.layer_count = view.layer_count;
|
desc.view_info.layer_count = view.layer_count;
|
||||||
desc.view_info.usage = vk::ImageUsageFlagBits::eColorAttachment;
|
desc.view_info.usage = vk::ImageUsageFlagBits::eColorAttachment;
|
||||||
auto& texture_cache = m_context.GetTextureCache();
|
auto& texture_cache = m_context.GetTextureCache();
|
||||||
r.desc = std::move(desc);
|
r.desc = std::move(desc);
|
||||||
r.image_id = texture_cache.FindImage(r.desc, exact_format);
|
r.image_id = texture_cache.FindImage(r.desc, exact_format);
|
||||||
r.type = RenderColorType::RenderTexture;
|
r.type = RenderColorType::RenderTexture;
|
||||||
r.base_addr = rt.base.addr;
|
r.base_addr = rt.base.addr;
|
||||||
r.image_view = nullptr;
|
r.image_view = nullptr;
|
||||||
r.format = r.desc.view_info.format;
|
r.format = r.desc.view_info.format;
|
||||||
r.extent = view_extent;
|
r.extent = view_extent;
|
||||||
r.base_mip_level = rt.view.current_mip_level;
|
r.base_mip_level = rt.view.current_mip_level;
|
||||||
r.buffer_size = backing_size;
|
r.buffer_size = backing_size;
|
||||||
r.samples = samples;
|
r.samples = samples;
|
||||||
r.export_mapping = target_format.export_mapping;
|
r.export_mapping = target_format.export_mapping;
|
||||||
r.color_clear_enable = false;
|
r.color_clear_enable = false;
|
||||||
r.color_clear_value = {};
|
r.color_clear_value = {};
|
||||||
BindRenderTarget(r.image_id);
|
BindRenderTarget(r.image_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.prefetch_height != 0x00000000);
|
||||||
EXIT_NOT_IMPLEMENTED(z.htile_surface.dst_outside_zero_to_one != 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<uint32_t> 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) {
|
if (z.depth_view.current_mip_level != 0x00000000) {
|
||||||
static std::atomic<uint32_t> log_count {0};
|
static std::atomic<uint32_t> log_count {0};
|
||||||
if (log_count.fetch_add(1, std::memory_order_relaxed) < 16) {
|
if (log_count.fetch_add(1, std::memory_order_relaxed) < 16) {
|
||||||
|
|||||||
@@ -10,10 +10,10 @@
|
|||||||
#include "graphics/guest_gpu/hardwareContext.h"
|
#include "graphics/guest_gpu/hardwareContext.h"
|
||||||
#include "graphics/guest_gpu/tile.h"
|
#include "graphics/guest_gpu/tile.h"
|
||||||
#include "graphics/host_gpu/graphicContext.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/debug.h"
|
||||||
#include "graphics/host_gpu/renderer/pipeline/descriptorCache.h"
|
|
||||||
#include "graphics/host_gpu/renderer/image/imageView.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/render.h"
|
||||||
#include "graphics/host_gpu/renderer/renderContext.h"
|
#include "graphics/host_gpu/renderer/renderContext.h"
|
||||||
#include "graphics/host_gpu/vulkanCommon.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);
|
has_stencil, has_htile, z.stencil_info.htile_stencil_disabled);
|
||||||
const auto view = ResolveTargetViewInfo(z.depth_view.slice_start, z.depth_view.slice_max);
|
const auto view = ResolveTargetViewInfo(z.depth_view.slice_start, z.depth_view.slice_max);
|
||||||
switch (view.type) {
|
switch (view.type) {
|
||||||
case TargetViewType::Image2D: break;
|
case TargetViewType::Image2D:
|
||||||
case TargetViewType::Image2DArray:
|
case TargetViewType::Image2DArray: break;
|
||||||
DepthFatal("layered depth views are unsupported: base=%u count=%u", view.base_layer,
|
|
||||||
view.layer_count);
|
|
||||||
case TargetViewType::Unsupported:
|
case TargetViewType::Unsupported:
|
||||||
DepthFatal("invalid depth view: base=%u last=%u", z.depth_view.slice_start,
|
DepthFatal("invalid depth view: base=%u last=%u", z.depth_view.slice_start,
|
||||||
z.depth_view.slice_max);
|
z.depth_view.slice_max);
|
||||||
|
|||||||
@@ -213,19 +213,21 @@ bool IsSupportedDepthTargetDescriptor(const ShaderTextureResource& descriptor, c
|
|||||||
const auto height = static_cast<uint32_t>(descriptor.Height5()) + 1u;
|
const auto height = static_cast<uint32_t>(descriptor.Height5()) + 1u;
|
||||||
const auto pitch = TileGetTexturePitch(descriptor.Format(), width, 1, descriptor.TileMode());
|
const auto pitch = TileGetTexturePitch(descriptor.Format(), width, 1, descriptor.TileMode());
|
||||||
const auto type = static_cast<Prospero::ImageType>(descriptor.Type());
|
const auto type = static_cast<Prospero::ImageType>(descriptor.Type());
|
||||||
const bool supported_single_layer =
|
const bool supported_2d = type == Prospero::ImageType::kColor2D &&
|
||||||
image.info.resources.layers == 1 && descriptor.Depth() == 0 &&
|
image.info.resources.layers == 1 && descriptor.Depth() == 0 &&
|
||||||
descriptor.BaseArray5() == 0 &&
|
descriptor.BaseArray5() == 0;
|
||||||
(type == Prospero::ImageType::kColor2D || type == Prospero::ImageType::kColor2DArray);
|
const bool supported_array = type == Prospero::ImageType::kColor2DArray &&
|
||||||
|
descriptor.BaseArray5() <= descriptor.Depth() &&
|
||||||
|
descriptor.Depth() < image.info.resources.layers;
|
||||||
const bool supported_cube =
|
const bool supported_cube =
|
||||||
type == Prospero::ImageType::kCube && width == height && image.info.resources.layers >= 6 &&
|
type == Prospero::ImageType::kCube && width == height && image.info.resources.layers >= 6 &&
|
||||||
image.info.resources.layers % 6u == 0 &&
|
image.info.resources.layers % 6u == 0 &&
|
||||||
static_cast<uint32_t>(descriptor.Depth()) + 1u == image.info.resources.layers &&
|
static_cast<uint32_t>(descriptor.Depth()) + 1u == image.info.resources.layers &&
|
||||||
descriptor.BaseArray5() == 0;
|
descriptor.BaseArray5() == 0;
|
||||||
return image.info.IsDepth() && width == image.info.extent.width &&
|
return image.info.IsDepth() && width == image.info.extent.width &&
|
||||||
height == image.info.extent.height && (supported_single_layer || supported_cube) &&
|
height == image.info.extent.height &&
|
||||||
descriptor.BaseLevel() == 0 && descriptor.LastLevel() == 0 && descriptor.MaxMip() == 0 &&
|
(supported_2d || supported_array || supported_cube) && descriptor.BaseLevel() == 0 &&
|
||||||
descriptor.MinLod() == 0 && descriptor.BaseArray5() == 0 &&
|
descriptor.LastLevel() == 0 && descriptor.MaxMip() == 0 && descriptor.MinLod() == 0 &&
|
||||||
descriptor.TileMode() == Prospero::GpuEnumValue(Prospero::TileMode::kDepth) &&
|
descriptor.TileMode() == Prospero::GpuEnumValue(Prospero::TileMode::kDepth) &&
|
||||||
descriptor.BCSwizzle() == 0 && !descriptor.MsaaDepth() && pitch >= width &&
|
descriptor.BCSwizzle() == 0 && !descriptor.MsaaDepth() && pitch >= width &&
|
||||||
pitch == image.info.pitch;
|
pitch == image.info.pitch;
|
||||||
|
|||||||
Reference in New Issue
Block a user