Sitelet https://github.com/gpuweb/gpuweb/pull/3849
Skip to content

Make depthClearValue, depthWriteEnabled, depthCompare required - #3849

Merged
kainino0x merged 5 commits into
gpuweb:mainfrom
takahirox:RequiredProperties
Mar 2, 2023
Merged

kainino0x merged 5 commits into
gpuweb:mainfrom
takahirox:RequiredProperties

Conversation

@takahirox

Copy link
Copy Markdown
Contributor

Related: #3777 #3798

This PR makes depthClearValue, depthWriteEnabled, and depthCompare required for V1 as discussed at #3798. We might revisit them Post-V1.

This commit makes depthClearValue, depthWriteEnabled, and
depthCompare required for V1 as discussed at

gpuweb#3798

We might revisit them Post-V1.
@github-actions

github-actions Bot commented Feb 21, 2023 •

Copy link
Copy Markdown
Contributor

Previews, as seen when this build job started (ee29660):
WebGPU webgpu.idl | Explainer | Correspondence Reference
WGSL grammar.js | wgsl.lalr.txt

Comment thread spec/index.bs Outdated
Comment thread spec/index.bs Outdated
Comment thread spec/index.bs Outdated
Instead, check that it is provided if format has a depth aspect
and depthLoadOp is clear in the validation.

@toji toji left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kainino0x kainino0x left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM w/nit

Comment thread spec/index.bs Outdated
Comment thread spec/index.bs
boolean depthWriteEnabled = false;
GPUCompareFunction depthCompare = "always";
required boolean depthWriteEnabled;
required GPUCompareFunction depthCompare;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... arguably for the same reason, maybe these should be required only if the format has a depth aspect?

@kainino0x kainino0x Mar 1, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though like with the other case it's annoying for implementations; especially so in this case, because this boolean becomes tri-state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wouldn't be a problem if we made it an exception instead of a validation rule. But that would be a weird carveout.

@takahirox takahirox Mar 2, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... arguably for the same reason, maybe these should be required only if the format has a depth aspect?

Yeah, sounds like it is more consistent with depthClearValue although the implementation could be more complex as depthClearValue... If no objection, I will update the PR soon.

That wouldn't be a problem if we made it an exception instead of a validation rule.

Would you mind explaining it a bit more for me please because I couldn't get well? (Honestly I haven't comprehend the difference exception and validation rule well yet.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the error is raised as an exception then it can be implemented at the JavaScript bindings level (ie: Blink in Chromium), which is quite a bit simpler. If it's done as a validation error it needs to be passed all the way through the WebGPU native implementation, which then needs to figure out things like how to handle a tri-state boolean in a C API.

The reasons for preferring a validation error are that it's more consistent with the handling of every other error that is raised from this part of the code, and there may be some cases (not here) where some of the information necessary to validate are only tracked in the WebGPU implementation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no state needed to validate this, but there is a bit of static info that I don't think we currently need in the content timeline: for a given format, whether it has a depth aspect or not.

Probably will land this and open another issue for this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanations!

@toji toji mentioned this pull request Mar 2, 2023
wrench-bot pushed a commit to hexops-graveyard/dawn that referenced this pull request Mar 2, 2023
This commit makes depthWriteEnabled and depthCompare required and
makes depthClearValue conditionally required for the spec change
in WebGPU V1.

gpuweb/gpuweb#3849

depthClearValue is required if depthLoadOp is clear and the
attachment has a depth aspect. To simulate it, this commit lets
NAN represent unspecified depthClearValue and lets the default
value of depthClearValue be NAN.

Bug: dawn:1669
Change-Id: I469338e909b1d3c345bc2642ee47daee858909ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Comment thread spec/index.bs Outdated
@kainino0x
kainino0x enabled auto-merge (squash) March 2, 2023 20:02
@kainino0x
kainino0x merged commit 25e7b64 into gpuweb:main Mar 2, 2023
@takahirox
takahirox deleted the RequiredProperties branch March 2, 2023 21:18
aarongable pushed a commit to chromium/chromium that referenced this pull request Mar 13, 2023
This commit makes depthWriteEnabled and depthCompare required and
makes depthClearValue conditionally required for the spec change
in WebGPU V1.

gpuweb/gpuweb#3849

Also see https://dawn-review.googlesource.com/c/dawn/+/120620

Bug: dawn:1669
Change-Id: Ie3a3bd5844309b353ee0403fbb8c3e8aa1ba1b82
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4270352
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1116657}
@kainino0x kainino0x added the needs-cts-issue This change requires tests (or would need tests if accepted), but may not have a CTS issue filed yet label Apr 18, 2023
juj added a commit to juj/wasm_webgpu that referenced this pull request Aug 4, 2023
…ired. In particular, depthCompare no longer defaults to ALWAYS. gpuweb/gpuweb#3849
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-cts-issue This change requires tests (or would need tests if accepted), but may not have a CTS issue filed yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Defaults for depthWriteEnabled and depthCompare may be surprising Why does depthClearValue default to 0.0?

4 participants