This commit is contained in:
Kravickas 2026-04-02 00:13:38 +03:00 committed by GitHub
commit 3d2aee10bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -889,9 +889,14 @@ RenderState Rasterizer::BeginRendering(const GraphicsPipeline* pipeline) {
ASSERT(desc.view_info.range.extent.levels == 1 && !image.binding.needs_rebind);
const bool has_stencil = image.info.props.has_stencil;
// Stencil writes can be enabled while depth writes are off.
const bool stencil_write =
has_stencil && regs.depth_control.stencil_enable && !desc.view_info.is_storage;
const auto new_layout = desc.view_info.is_storage
? has_stencil ? vk::ImageLayout::eDepthStencilAttachmentOptimal
: vk::ImageLayout::eDepthAttachmentOptimal
: stencil_write
? vk::ImageLayout::eDepthReadOnlyStencilAttachmentOptimal
: has_stencil ? vk::ImageLayout::eDepthStencilReadOnlyOptimal
: vk::ImageLayout::eDepthReadOnlyOptimal;
image.Transit(new_layout,