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

Support for attach-less render passes #503

Open
kvark opened this issue Nov 21, 2019 · 10 comments
Open

Support for attach-less render passes #503

kvark opened this issue Nov 21, 2019 · 10 comments
Labels
api WebGPU API feature request A request for a new GPU feature exposed in the API
Milestone

Comments

@kvark
Copy link
Contributor

kvark commented Nov 21, 2019

There is a use case of doing a render pass with no attachments. For example, when the pixel shader does some work with storage buffers, and we still want rasterization to happen, just without rendering per se.

Currently what happens is - we don't know the rasterization area when the render pass is started, and our implementation panics. It has no way to know this today.

Possible solutions:

  1. say this is an unsupported use case. Users could technically have a dummy attachment and set up the blend equations to always fail...
  2. have an optional member of RenderPassDescriptor with the rasterization area. When not set, it's automatically derived from the attachments, which are expected to be of the same size.
@kvark
Copy link
Contributor Author

kvark commented Nov 21, 2019

Pinging @RafaelCintron and @litherum for whether it's even a good idea in Metal to have no targets/attachments in a render pass.

@Kangz
Copy link
Contributor

Kangz commented Nov 26, 2019

Looking at the Vulkan spec, this seems to be a supported usecase in vanilla Vulkan (I said the contrary in some other conversation but was wrong)

@kvark kvark added the feature request A request for a new GPU feature exposed in the API label Jan 4, 2021
@kvark kvark added this to the post-MVP milestone Jan 4, 2021
@kvark kvark modified the milestones: post-V1, V1.0 Aug 30, 2021
@kvark
Copy link
Contributor Author

kvark commented Aug 30, 2021

Moving to V1.0 to quickly mention in a discussion time slot. It may fall under the category of "allowed by all the native APIs", in which case we need to expose it.

@Kangz
Copy link
Contributor

Kangz commented Aug 31, 2021

I gave it a try in Dawn https://dawn-review.googlesource.com/c/dawn/+/63140 and even if I wasn't able to get the shader to write to an SSBO, I found interesting data.

On Metal, using attachment-less render passes requires setting the renderTargetWidth, renderTargetHeight and defaultRasterSampleCount members of MTLRenderPassDescriptor. These members were introduced in macO 10.15, so I don't think we can rely on them for WebGPU. This feature should probably be part of a later "flexibility" optional feature that isn't present on all systems.

@Jiawei-Shao
Copy link
Contributor

On Metal, using attachment-less render passes requires setting the renderTargetWidth, renderTargetHeight and defaultRasterSampleCount members of MTLRenderPassDescriptor. These members were introduced in macO 10.15, so I don't think we can rely on them for WebGPU. This feature should probably be part of a later "flexibility" optional feature that isn't present on all systems.

Maybe we can create a dummy color attachment with the given renderTargetWidth, renderTargetHeight and defaultRasterSampleCountinside the browser implementation as a workaround for macOS 10.14 and below?

@Kangz
Copy link
Contributor

Kangz commented Aug 31, 2021

That would work, but I don't think it qualifies as "all APIs support it" since we need emulation on Metal, and most likely on D3D12 when using D3D12 render passes. IMHO we should have a later extension for a bunch of nice to use feature that improve flexibility but might require emulation.

@kvark kvark modified the milestones: V1.0, post-V1 Aug 31, 2021
@kvark
Copy link
Contributor Author

kvark commented Aug 31, 2021

Thanks @Kangz ! That is a good argument to postponing this.

@kainino0x
Copy link
Contributor

On Metal, using attachment-less render passes requires setting the renderTargetWidth, renderTargetHeight and defaultRasterSampleCount members of MTLRenderPassDescriptor. These members were introduced in macO 10.15, so I don't think we can rely on them for WebGPU. This feature should probably be part of a later "flexibility" optional feature that isn't present on all systems.

Funny, this is exactly what we found we would need to do in order to support this feature. I suppose Metal must have added those for the same reason.

ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this issue Sep 6, 2022
* add tools/deno runner

This commit adds a `./tools/deno` runner for running CTS in Deno. It is
essentially a JS copy of the node runner, using Deno syscalls instead.

It requires you to have run `npm run standalone` before invoking.

* fix

* add trace support

* add --ignore

* docs
@Kangz Kangz modified the milestones: Milestone 3+, Milestone 2 Sep 26, 2023
@kainino0x kainino0x added the api WebGPU API label Apr 30, 2024
@magcius
Copy link

magcius commented Jun 26, 2024

Now that we mandate support for OS 15+, could we revisit this and see if we can add it?

@kainino0x
Copy link
Contributor

Evidently Chromium is/was already out of spec here, and somehow we accidentally allowed render passes with no attachments:
gpuweb/cts#3808 (and gpuweb/cts#3754, gpuweb/cts#3806, gpuweb/cts#3755)
But I don't know what it actually does, given we then have no way of knowing the render pass size.

It would be really nice if we could lift that restriction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api WebGPU API feature request A request for a new GPU feature exposed in the API
Projects
None yet
Development

No branches or pull requests

5 participants