Skip to content

Conversation

@alan-baker
Copy link
Contributor

Fixes #921

  • Change the behavior of discard to convert the invocation into a
    helper invocation
  • Update behavior analysis to remove the Discard behavior
    • Additionally remove the analysis of expressions since functions can
      only have the behaviors {} (an error) or {Next}
  • Add a section describing helper invocations in fragment shdaers

@alan-baker alan-baker added the wgsl WebGPU Shading Language Issues label Jul 8, 2022
@alan-baker alan-baker added this to the V1.0 milestone Jul 8, 2022
@alan-baker alan-baker requested review from dneto0, kdashg and litherum July 8, 2022 18:47
Copy link
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

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

Partial review

wgsl/index.bs Outdated

## Fragment Shaders and Helper Invocations ## {#fragment-shaders-helper-invocations}

Invocations in the [=fragment shader stage=] are divided into 2x2 grids of neighbouring invocations.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should say in what sense they are "neighbouring".

Suggest

of invocations with neighboring framebuffer positions in the X and Y dimensions.

(I filed separate issue #3177 so we can make 'position' a cross-reference)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I rebased on top of the definitions and made this a link.

wgsl/index.bs Outdated
[[#texturestore|textureStore]] function calls performed by helper invocations
will have no effect on the texture.
[[#atomic-builtin-functions|Atomic built-in funtions]] performed by helper
invocations will return undefined results.
Copy link
Contributor

Choose a reason for hiding this comment

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

And atomic operations don't write.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's covered by the write access restriction above.

Copy link
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

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

Overall looking good.

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

Fixes gpuweb#921

* Change the behavior of `discard` to convert the invocation into a
  helper invocation
* Update behavior analysis to remove the Discard behavior
  * Additionally remove the analysis of expressions since functions can
    only have the behaviors {} (an error) or {Next}
* Add a section describing helper invocations in fragment shdaers
* remove discard bullet about entry point return evaluation
* better introduce helper invocations in terms of rasterization
* fix typos
@github-actions
Copy link
Contributor

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

Copy link
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

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

Very tidy and compact!

@dneto0 dneto0 merged commit 53460cd into gpuweb:main Jul 18, 2022
This repetition can be interrupted by a [=statement/break=], [=statement/return=], or
[=statement/discard=] statement.
This repetition can be interrupted by a [=statement/break=], or
[=statement/return=] statement.
Copy link
Member

Choose a reason for hiding this comment

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

The repetition may be interrupted if all invocations in the quad discard and get demoted to helper?

The compound statement [=shader-creation error|must not=] contain a [=statement/return=] at any compound statement nesting level.

The compound statement [=shader-creation error|must not=] contain a [=statement/discard=] at any compound statement nesting level nor through function calls.
See [[#behaviors]] for a more formal description of this rule.
Copy link
Member

Choose a reason for hiding this comment

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

What about if all invocations discard? Is that valid or invalid?

jdarpinian pushed a commit to jdarpinian/gpuweb that referenced this pull request Aug 12, 2022
* Describe discard as demoting to a helper invocation

Fixes gpuweb#921

* Change the behavior of `discard` to convert the invocation into a
  helper invocation
* Update behavior analysis to remove the Discard behavior
  * Additionally remove the analysis of expressions since functions can
    only have the behaviors {} (an error) or {Next}
* Add a section describing helper invocations in fragment shdaers

* Clarify textureStore and entry point returns don't happen for helpers

* Address review feedback

* remove discard bullet about entry point return evaluation
* better introduce helper invocations in terms of rasterization
* fix typos

* Improve restriction wording

* fix typo

* Add link to position
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wgsl WebGPU Shading Language Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigation: kill vs demoteToHelper behavior in native APIs

3 participants