Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

kvark
Copy link
Contributor

@kvark kvark commented May 3, 2020

Fixes #514

This is a strawman proposal to solve the use case explained in #514 (comment)

If the depth in a render pass is read-only, its usage allows it also be used as a shader-accessible texture in this pass.

Obviously the spec will need to explain how this works. Filed #745 for more general introduction of the "shadow" usage bits.

Edit - unresolved questions:

  • whether the group agrees this is needed
  • mini-investigation on the platform support of this feature - Read-only depth/stencil usage (RODS) #514 (comment)
  • whether we can have separate flags for depth and stencil, or just one for combined
  • spec wording for the usage validation

Preview | Diff

@kvark
Copy link
Contributor Author

kvark commented May 3, 2020

Marking for "Needs Discussion" for the meeting after the next one, since we are behind the deadline for the current one.

@Kangz
Copy link
Contributor

Kangz commented May 4, 2020

+1 for the overall idea, but I have a concern that it adds another piece of renderpass <-> pipeline compatibility to check. Previously the attachment sample-count and formats had to match exactly so we could optimize the check to be a single pointer compare.

With this pipelines that are read-only for depth/stencil can be used for render passes with both read-only or writeable depth-stencil attachments. So we can't precompute the validation and have to check at setPipeline time. This is probably fine, but maybe we can consider having a depthReadOnly and stencilReadOnly on the GPUDepthStencilStateDescriptor?

@kvark
Copy link
Contributor Author

kvark commented May 4, 2020

For our implementation, there isn't any significant increase in the cost. At pipeline binding, we are currently checking the attachment formats, sample count, blend color, and stencil reference, plus the compatibility of the bindings. One extra flag is not changing the picture here. Moreover, we will combine blend color, stencil ref, and these new read-only flags into just a required bitmask, so adding flags there will be essentially free.

This is probably fine, but maybe we can consider having a depthReadOnly and stencilReadOnly on the GPUDepthStencilStateDescriptor?

I think that would be redundant. We can already see if the depth write mask is set there, and if the stencil operations are mutating.

@Kangz
Copy link
Contributor

Kangz commented May 8, 2020

One extra flag is not changing the picture here. Moreover, we will combine blend color, stencil ref, and these new read-only flags into just a required bitmask, so adding flags there will be essentially free.

This is cheap enough, I'll retract my comment.

LGTM

@kainino0x
Copy link
Contributor

Does this need to be tracked separately from #514 on the project board?

@litherum
Copy link
Contributor

Creating these kinds of read-only feedback loops (or, non-feedback loops, as it were) are well-defined and valid in Metal.

@kvark
Copy link
Contributor Author

kvark commented May 19, 2020

@kainino0x no, I added "Fixes #514" to the description.
Also, looks like we are all ready to merge this

@kvark kvark merged commit 5526a9c into master May 19, 2020
@kvark kvark deleted the kvark-ds-read-only branch May 19, 2020 17:27
JusSn pushed a commit to JusSn/gpuweb that referenced this pull request Jun 8, 2020
JusSn pushed a commit to JusSn/gpuweb that referenced this pull request Jun 8, 2020
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read-only depth/stencil usage (RODS)
5 participants