mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-26 17:37:03 +00:00
vk_rasterizer: Fix stencil clears
This commit is contained in:
parent
8d8bb05055
commit
5d8b7a3d96
|
@ -161,10 +161,18 @@ RenderState Rasterizer::PrepareRenderState(u32 mrt_mask) {
|
|||
state.depth_attachment = {
|
||||
.imageView = *image_view.image_view,
|
||||
.imageLayout = vk::ImageLayout::eUndefined,
|
||||
.loadOp = is_clear ? vk::AttachmentLoadOp::eClear : vk::AttachmentLoadOp::eLoad,
|
||||
.loadOp = is_clear && regs.depth_control.depth_enable ? vk::AttachmentLoadOp::eClear
|
||||
: vk::AttachmentLoadOp::eLoad,
|
||||
.storeOp = vk::AttachmentStoreOp::eStore,
|
||||
.clearValue = vk::ClearValue{.depthStencil = {.depth = regs.depth_clear,
|
||||
.stencil = regs.stencil_clear}},
|
||||
.clearValue = vk::ClearValue{.depthStencil = {.depth = regs.depth_clear}},
|
||||
};
|
||||
state.stencil_attachment = {
|
||||
.imageView = *image_view.image_view,
|
||||
.imageLayout = vk::ImageLayout::eUndefined,
|
||||
.loadOp = is_clear && regs.depth_control.stencil_enable ? vk::AttachmentLoadOp::eClear
|
||||
: vk::AttachmentLoadOp::eLoad,
|
||||
.storeOp = vk::AttachmentStoreOp::eStore,
|
||||
.clearValue = vk::ClearValue{.depthStencil = {.stencil = regs.stencil_clear}},
|
||||
};
|
||||
texture_cache.TouchMeta(htile_address, slice, false);
|
||||
state.has_depth =
|
||||
|
@ -778,6 +786,7 @@ void Rasterizer::BeginRendering(const GraphicsPipeline& pipeline, RenderState& s
|
|||
desc.view_info.range);
|
||||
}
|
||||
state.depth_attachment.imageLayout = image.last_state.layout;
|
||||
state.stencil_attachment.imageLayout = image.last_state.layout;
|
||||
image.usage.depth_target = true;
|
||||
image.usage.stencil = has_stencil;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ void Scheduler::BeginRendering(const RenderState& new_state) {
|
|||
? render_state.color_attachments.data()
|
||||
: nullptr,
|
||||
.pDepthAttachment = render_state.has_depth ? &render_state.depth_attachment : nullptr,
|
||||
.pStencilAttachment = render_state.has_stencil ? &render_state.depth_attachment : nullptr,
|
||||
.pStencilAttachment = render_state.has_stencil ? &render_state.stencil_attachment : nullptr,
|
||||
};
|
||||
|
||||
current_cmdbuf.beginRendering(rendering_info);
|
||||
|
|
|
@ -21,6 +21,7 @@ class Instance;
|
|||
struct RenderState {
|
||||
std::array<vk::RenderingAttachmentInfo, 8> color_attachments{};
|
||||
vk::RenderingAttachmentInfo depth_attachment{};
|
||||
vk::RenderingAttachmentInfo stencil_attachment{};
|
||||
u32 num_color_attachments{};
|
||||
bool has_depth{};
|
||||
bool has_stencil{};
|
||||
|
|
Loading…
Reference in a new issue