mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-21 19:36:55 +02:00
renderer: ignore inactive stencil registers for depth-only targets (#425)
graphics: ignore inactive Hi-Stencil state Co-authored-by: nmzik <Nmzik@mail.ru>
This commit is contained in:
@@ -177,10 +177,7 @@ void RenderExecutor::ResolveRenderDepthTarget(uint64_t submit_id, CommandBuffer&
|
|||||||
(z.stencil_read_base_addr & 0xffffu) != 0) {
|
(z.stencil_read_base_addr & 0xffffu) != 0) {
|
||||||
DepthFatal("unsupported stencil attachment state");
|
DepthFatal("unsupported stencil attachment state");
|
||||||
}
|
}
|
||||||
} else if (z.stencil_read_base_addr != 0 || z.stencil_write_base_addr != 0 ||
|
} else if (z.stencil_read_base_addr != 0 || z.stencil_write_base_addr != 0) {
|
||||||
!htile_stencil_compat ||
|
|
||||||
z.stencil_info.texture_compatibility !=
|
|
||||||
Prospero::TextureCompatibleStencil::kDisable) {
|
|
||||||
DepthFatal("stencil state without an active stencil attachment");
|
DepthFatal("stencil state without an active stencil attachment");
|
||||||
}
|
}
|
||||||
if (has_htile) {
|
if (has_htile) {
|
||||||
|
|||||||
@@ -11,9 +11,11 @@
|
|||||||
|
|
||||||
namespace Libs::Graphics {
|
namespace Libs::Graphics {
|
||||||
|
|
||||||
|
// Without a stencil plane, Hi-Stencil fields are inactive. An active plane is compatible when
|
||||||
|
// Hi-Stencil is disabled or HTile backing is present.
|
||||||
inline constexpr bool depth_htile_stencil_acceleration_compatible(bool has_stencil, bool has_htile,
|
inline constexpr bool depth_htile_stencil_acceleration_compatible(bool has_stencil, bool has_htile,
|
||||||
bool htile_stencil_disabled) {
|
bool htile_stencil_disabled) {
|
||||||
return htile_stencil_disabled || (has_stencil && has_htile);
|
return !has_stencil || htile_stencil_disabled || has_htile;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RenderDepthInfo {
|
struct RenderDepthInfo {
|
||||||
|
|||||||
@@ -8358,12 +8358,17 @@ public:
|
|||||||
RenderExecutorTestAccess::ResetBindings(executor);
|
RenderExecutorTestAccess::ResetBindings(executor);
|
||||||
|
|
||||||
constexpr uint64_t depth_only_address = base + 0x140000;
|
constexpr uint64_t depth_only_address = base + 0x140000;
|
||||||
|
constexpr uint64_t depth_only_htile_address = base + 0x150000;
|
||||||
|
constexpr uint32_t captured_depth_only_z_info = 0x22900983u;
|
||||||
|
constexpr uint32_t captured_depth_only_stencil_info = 0x00100980u;
|
||||||
HW::DepthRenderTarget depth_only_target{};
|
HW::DepthRenderTarget depth_only_target{};
|
||||||
depth_only_target.z_info.format = Prospero::DepthFormat::kZ32F;
|
depth_only_target.z_info =
|
||||||
depth_only_target.z_info.z_compare_base = Prospero::ZCompareBase::kZMax;
|
HW::DepthZInfo::Decode(captured_depth_only_z_info);
|
||||||
depth_only_target.stencil_info.htile_stencil_disabled = true;
|
depth_only_target.stencil_info =
|
||||||
|
HW::DepthStencilInfo::Decode(captured_depth_only_stencil_info);
|
||||||
depth_only_target.z_read_base_addr = depth_only_address;
|
depth_only_target.z_read_base_addr = depth_only_address;
|
||||||
depth_only_target.z_write_base_addr = depth_only_address;
|
depth_only_target.z_write_base_addr = depth_only_address;
|
||||||
|
depth_only_target.htile_data_base_addr = depth_only_htile_address;
|
||||||
depth_only_target.size = {63, 63, true};
|
depth_only_target.size = {63, 63, true};
|
||||||
registers.SetDepthRenderTarget(depth_only_target);
|
registers.SetDepthRenderTarget(depth_only_target);
|
||||||
HW::DepthControl depth_only_control{};
|
HW::DepthControl depth_only_control{};
|
||||||
@@ -8382,6 +8387,7 @@ public:
|
|||||||
Require(
|
Require(
|
||||||
name, "depth-only target with stale stencil state",
|
name, "depth-only target with stale stencil state",
|
||||||
depth_only.image_id && depth_only.format == vk::Format::eD32Sfloat &&
|
depth_only.image_id && depth_only.format == vk::Format::eD32Sfloat &&
|
||||||
|
depth_only.htile &&
|
||||||
depth_only.depth_test_enable && depth_only.depth_write_enable &&
|
depth_only.depth_test_enable && depth_only.depth_write_enable &&
|
||||||
depth_only.depth_clear_enable &&
|
depth_only.depth_clear_enable &&
|
||||||
!depth_only.stencil_test_enable &&
|
!depth_only.stencil_test_enable &&
|
||||||
@@ -8389,14 +8395,16 @@ public:
|
|||||||
depth_only.stencil_buffer_vaddr == 0 &&
|
depth_only.stencil_buffer_vaddr == 0 &&
|
||||||
depth_only.stencil_buffer_size == 0 &&
|
depth_only.stencil_buffer_size == 0 &&
|
||||||
depth_only.desc.info.stencil.Empty() &&
|
depth_only.desc.info.stencil.Empty() &&
|
||||||
|
depth_only.htile_buffer_vaddr == depth_only_htile_address &&
|
||||||
|
depth_only.desc.info.metadata.range.address ==
|
||||||
|
depth_only_htile_address &&
|
||||||
depth_only.depth_buffer_size != 0 &&
|
depth_only.depth_buffer_size != 0 &&
|
||||||
depth_only_address + depth_only.depth_buffer_size <=
|
depth_only_address + depth_only.depth_buffer_size <=
|
||||||
base + allocation_size &&
|
base + allocation_size &&
|
||||||
depth_only.vaddr_num == 1 &&
|
depth_only.vaddr_num == 1 &&
|
||||||
depth_only.AttachmentWriteAspects() ==
|
depth_only.AttachmentWriteAspects() ==
|
||||||
vk::ImageAspectFlagBits::eDepth,
|
vk::ImageAspectFlagBits::eDepth,
|
||||||
"raw stencil test or clear state leaked into a depth-only "
|
"inactive stencil state changed a depth-only HTile attachment");
|
||||||
"attachment");
|
|
||||||
RenderExecutorTestAccess::ResetBindings(executor);
|
RenderExecutorTestAccess::ResetBindings(executor);
|
||||||
|
|
||||||
const auto sampled_width = depth_only.desc.info.extent.width - 1u;
|
const auto sampled_width = depth_only.desc.info.extent.width - 1u;
|
||||||
@@ -23792,18 +23800,18 @@ void CheckNativeMsaaState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheckDepthHtileStencilCompatibility() {
|
void CheckDepthHtileStencilCompatibility() {
|
||||||
|
Require("DepthHtileStencilCompatibility", "inactive stencil plane",
|
||||||
|
depth_htile_stencil_acceleration_compatible(false, true, false),
|
||||||
|
"inactive Hi-Stencil state was treated as an attachment");
|
||||||
Require("DepthHtileStencilCompatibility", "disabled acceleration",
|
Require("DepthHtileStencilCompatibility", "disabled acceleration",
|
||||||
depth_htile_stencil_acceleration_compatible(false, false, true),
|
depth_htile_stencil_acceleration_compatible(true, false, true),
|
||||||
"disabled Hi-Stencil state was rejected");
|
"disabled Hi-Stencil state was rejected");
|
||||||
Require("DepthHtileStencilCompatibility", "PS5 stencil plus HTile",
|
Require("DepthHtileStencilCompatibility", "PS5 stencil plus HTile",
|
||||||
depth_htile_stencil_acceleration_compatible(true, true, false),
|
depth_htile_stencil_acceleration_compatible(true, true, false),
|
||||||
"valid PS5 Hi-Stencil attachment was rejected");
|
"valid PS5 Hi-Stencil attachment was rejected");
|
||||||
Require("DepthHtileStencilCompatibility", "missing stencil plane",
|
|
||||||
!depth_htile_stencil_acceleration_compatible(false, true, false),
|
|
||||||
"Hi-Stencil without a stencil plane was silently admitted");
|
|
||||||
Require("DepthHtileStencilCompatibility", "missing HTile metadata",
|
Require("DepthHtileStencilCompatibility", "missing HTile metadata",
|
||||||
!depth_htile_stencil_acceleration_compatible(true, false, false),
|
!depth_htile_stencil_acceleration_compatible(true, false, false),
|
||||||
"Hi-Stencil without HTile metadata was silently admitted");
|
"active Hi-Stencil without HTile metadata was admitted");
|
||||||
std::printf("[host] %-32s ok\n", "DepthHtileStencilCompatibility");
|
std::printf("[host] %-32s ok\n", "DepthHtileStencilCompatibility");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user