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

Skip to content

Conversation

dneto0
Copy link
Contributor

@dneto0 dneto0 commented Mar 30, 2021

Add pointer-chaining expressions: ptr.field and ptr[i]

Fixes: #1530

This builds on #1569

@dneto0 dneto0 requested review from kvark, litherum and alan-baker March 30, 2021 22:19
@dneto0 dneto0 added the wgsl WebGPU Shading Language Issues label Apr 1, 2021
Also replace "surfaces" with the simpler "is exposed"
@dneto0 dneto0 added this to the MVP milestone Apr 7, 2021
Copy link
Contributor

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Thank you for writing this!

I got two major concerns, and one minor one.
Major-1 is that I'd like us to pick between this and "->" so that we don't end up with both.
Major-2 is the description of out-of-bounds accesses

@kdashg
Copy link
Contributor

kdashg commented Apr 14, 2021

WGSL meeting minutes 2021-04-13
  • JB: Some reservations. Can say, “which usage is more common: Value of field, or address-of?”.
  • AB: This facilitates easier constant declarations, can chain into pointers into buffers. I’m for it.
  • JG: I like it, but it spends our “innovation points” on something entirely optional to the language.

@Kangz
Copy link
Contributor

Kangz commented Feb 1, 2022

Is this PR still current?

@dneto0 dneto0 modified the milestones: V1.0, post-V1 Feb 8, 2022
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
dneto0 added a commit to dneto0/gpuweb that referenced this pull request Oct 14, 2022
This resolves an ambiguity on how to type-check things like:

    var m:mat2x2<f32>;
    let p = &m;
    *p[0] = m[1];

This grammar change pulls processing of the * and & from lhs_expression
into core_lhs_expression. So this example will parse as if:

   (*p)[0] = m[1];

This is necessary, unless we want to support gpuweb#1580 (which propooses to
add apply array indexing and struct member selection on pointer values).

Note: This means reference expressions are parsed differently on the
left side of an assignment than they anywhere else.

Fixes: gpuweb#3530
@dneto0
Copy link
Contributor Author

dneto0 commented Sep 27, 2023

Closing. This was revisited, with consensus as described at #4114 (comment)

@dneto0 dneto0 closed this Sep 27, 2023
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
Status: Done
Development

Successfully merging this pull request may close these issues.

Pointer chaining in WGSL
5 participants