Repository navigation
D3D12: Render Passes Keep What They Draw Again - #474
Merged
Merged
Conversation
…s are discarded
BeginRenderPass made a depth stencil buffer's access from both planes' accesses, starting from
D3D12_RENDER_PASS_BEGINNING_ACCESS{} and D3D12_RENDER_PASS_ENDING_ACCESS{} as the accesses that discard nothing. DISCARD
is both types' 0, so every depth stencil buffer was discarded as the pass began and as it ended: what a draw wrote to it
was not stored, and a plane the pass preserved was not loaded. They now start as PRESERVE.
d3d12_render_pass draws depth and stencil in a pass that preserves both and reads them back, then clears only the
depth in a second pass and reads that the stencil stayed, the two checks of vkd3d-proton's test_renderpass_rendering
that failed. Its fault d3d12_render_pass.5 puts the zeroed accesses back.
A render pass's discarding access is declared for one view, but BeginRenderPass discarded the view's whole texture: a pass whose targets were three slices of one array texture, the third ending DISCARD, lost what it drew to the second (vkd3d-proton's test_renderpass_rendering, line 1646). It now discards only through a view of every mip, slice and W slice of the texture, and a view of some of it discards nothing, as DiscardResource of a region does. d3d12_render_pass draws two slices of one array texture in a pass that discards the second and reads that the first kept what was drawn. Its fault d3d12_render_pass.6 takes the check out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes two ways a D3D12 render pass lost what it drew since discards were added (#372). vkd3d-proton's test_renderpass_rendering passes again with both.
BeginRenderPass works out a depth stencil buffer's access from both of its planes, starting from a D3D12_RENDER_PASS_BEGINNING_ACCESS{} and a D3D12_RENDER_PASS_ENDING_ACCESS{} meant as "nothing discarded". DISCARD is 0 in both enums, so every depth stencil buffer in a render pass was discarded as the pass began and as it ended: depth and stencil a draw wrote were not stored, and a plane the pass preserved was not loaded. Both now start as PRESERVE.
A discarding access is also declared for one view, but the pass discarded the view's whole texture. Where a pass's targets are slices of one array texture and one of them ends with DISCARD, the others lost what was drawn to them. A pass now discards a texture only through a view of all of it, the way DiscardResource already ignores a region.
d3d12_render_pass gains a depth stencil part (a pass that draws depth and stencil and preserves both, then one that clears only the depth and keeps the stencil) and a part with two slices of one array texture, the second discarded. Both fault patches are caught, and the render pass and discard tests pass on native, 9, 8 and 7 and their Metal 3 runs.