Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a read-only depth buffer for transparent/transmissive passes #16631

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JMS55
Copy link
Contributor

@JMS55 JMS55 commented Dec 3, 2024

Objective

Solution

  • Bind the depth attachment as read-only (depth_ops: None) during the transparent/transmissive pass

Changelog

  • Added ViewDepthTexture::get_read_only_attachment()
  • Added DepthAttachment::get_read_only_attachment()

@JMS55 JMS55 added A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times C-Code-Quality A section of code that is hard to understand or change labels Dec 3, 2024
@JMS55
Copy link
Contributor Author

JMS55 commented Dec 3, 2024

Unfortunately we're hitting VK validation errors now.

2024-12-03T18:12:17.469103Z ERROR wgpu_hal::vulkan::instance: VALIDATION [SYNC-HAZARD-WRITE-AFTER-WRITE (0x5c0ec5d6)]
        Validation Error: [ SYNC-HAZARD-WRITE-AFTER-WRITE ] Object 0: handle = 0x1ac4c3cdf38, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0x5c0ec5d6 | vkQueueSubmit():  Hazard WRITE_AFTER_WRITE for entry 28, VkCommandBuffer 0x1ac6f16d7c8[main_transparent_pass_3d], Submitted access info (submitted_usage: SYNC_LATE_FRAGMENT_TESTS_DEPTH_STENCIL_ATTACHMENT_WRITE, command: vkCmdEndRenderPass, seq_no: 3, renderpass: VkRenderPass 0x2610a100000001b1[], reset_no: 356, debug_region: main_transparent_pass_3d). Access info (prior_usage: SYNC_IMAGE_LAYOUT_TRANSITION, write_barriers: SYNC_VERTEX_SHADER_SHADER_BINDING_TABLE_READ|SYNC_VERTEX_SHADER_SHADER_SAMPLED_READ|SYNC_VERTEX_SHADER_SHADER_STORAGE_READ|SYNC_FRAGMENT_SHADER_DEPTH_STENCIL_ATTACHMENT_READ|SYNC_FRAGMENT_SHADER_SHADER_BINDING_TABLE_READ|SYNC_FRAGMENT_SHADER_SHADER_SAMPLED_READ|SYNC_FRAGMENT_SHADER_SHADER_STORAGE_READ|SYNC_EARLY_FRAGMENT_TESTS_DEPTH_STENCIL_ATTACHMENT_READ|SYNC_LATE_FRAGMENT_TESTS_DEPTH_STENCIL_ATTACHMENT_READ|SYNC_COMPUTE_SHADER_SHADER_BINDING_TABLE_READ|SYNC_COMPUTE_SHADER_SHADER_SAMPLED_READ|SYNC_COMPUTE_SHADER_SHADER_STORAGE_READ, queue: VkQueue 0x1ac4c3cdf38[], submit: 978, batch: 0, batch_tag: 53965, command: vkCmdPipelineBarrier, command_buffer: VkCommandBuffer 0x1ac6f1951c8[(wgpu internal) Transit], seq_no: 1, VkImage 0xcee26f000000015c[view_depth_texture], VkImage 0xf6d9250000000139[], reset_no: 387).  

Upstream issue: gfx-rs/wgpu#5231

@JMS55 JMS55 added the S-Blocked This cannot move forward until something else changes label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Code-Quality A section of code that is hard to understand or change C-Performance A change motivated by improving speed, memory usage or compile times S-Blocked This cannot move forward until something else changes
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Depth buffer is cleared after MainPass3d before custom rendering nodes
1 participant