- 
                Notifications
    You must be signed in to change notification settings 
- Fork 343
[wgsl] Update storage textures to use access qualifiers #1182
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
Conversation
| This builds on top of #1180 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still find it unfortunate that we have this entirely different syntax for buffers and textures. Can't we similarly have buffer_storage<read> type instead of struct for storage buffers to be consistent?
| So instead of: You'd have: We'd also still have struct types, but that means struct types would never be used in the interface? So, offsets would only apply to buffer_storage? Would UBO buffers be declared in the same way with  | 
| Discussed at 2020-11-03 meeting. | 
| Strawman time! Straw-1: consistent decorations: [block] struct Foo {..};
var foo<storage> : [access(read_write)] Foo;
var bar: [access(write_only)] texture_storage_1d<rgba32f>;Straw-2: consistent type generics: storage_buffer<ReadWrite> Foo { .. };
var foo: Foo;
var bar: texture_storage_1d<WriteOnly, rgba32f>; | 
| Back to first principles: Textures: 
 Buffers: 
 Discussion: 
 Straw proposals Straw-3.1: storage textures have access parameter embedded in the type Straw-3.2: buffer read/read-write is attached to the variable, as var param Straw-3.3: buffer read/read-write is attached to the variable, as regular attribute. My preference would be 3.1 and 3.2 together. | 
| Discussed at the 2020-11-10 meeting. | 
| 
 Method call is an expression, too! Buffer assignment is a statement. We can say that access qualifiers reduce the set of available expressions and statements involving these global variables. Seems pretty consistent to me. 
 Well, the same argument can be applied to  
 That's a fair wish. Having one  
 How would you feel about straw-3.4? [[block]] struct Foo {...};
var<storage> FooParam : [[access(read)]]Foo;
var<storage> FooW0 : [[access(read_write)]] Foo;
var bar: [[access(write)]] texture_storage_1d<rgba32f>; | 
| I've rebased this on top of #1183 as they both provide the access qualifiers. I've moved the annotation for the textures to be on the type declaration, which makes them look the same as storage buffers.  | 
| I can live with Straw-3.4 I asked questions on #1183: 
 | 
| Discussed at 2020-11-17 meeting. | 
| On the call today, we concluded that both parties express their arguments for/against consistency of textures and buffers. Checking the thread here, it appears that @dneto0 already expressed the position in great detail. We concluded that Straw 3.4 is compatible with the first principles as written, and also is consistent (so a good compromise). @jdashg does the argument miss anything? Another point I made when chatting with @dj2 is the host side. From WebGPU host API, here is how it looks: const bgl = device.createBindGroupLayout({
  entries: [
    {
      binding: 0,
      visibility: GPUShaderStage.VERTEX,
      type: "readonly-storage-buffer", // <-
      hasDynamicOffset: false,
    },
    {
      binding: 0,
      visibility: GPUShaderStage.FRAGMENT,
      type: "readonly-storage-texture", // <-
      viewDimension: "2d",
      storageTextureFormat: "rgba8unorm",
    },
  ],
});The way I imagine this being specified is along these lines: 
 | 
| Discussed at the 2020-12-08 meeting. | 
| (Oh no, I lost my draft comment!) Now, we can make  | 
| Resolution: Accept the PR (but there was a lot of discussion and at least the title should change) | 
This CL updates the spec to use texture_storage_* without the _ro or _wo qualifiers. The access is stipulated with an access decoration. Issue #1159
| I've updated this PR and fixed up the title/comment. I think it should be good to go, but it was a .... bad ... merge. Please read it over and make sure I didn't merge anything incorrectly. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like your rebase succeeded!
    
      
        1 similar comment
      
    
  
    Additional tweaks after gpuweb#1182. Update the terms `read-only` and `write-only` in terms of the new access qualifiers. Drop `[[access(read)]]` and `[[access(write)]]` annotations from the texture intrinsic overloads. These aren't legal signatures, and also incorrectly suggest that `[[access(read_write)]]` is not permitted. Issue: gpuweb#1159
Additional tweaks after gpuweb#1182. Update the terms `read-only` and `write-only` in terms of the new access qualifiers. Drop `[[access(read)]]` and `[[access(write)]]` annotations from the texture intrinsic overloads. These aren't legal signatures, and also incorrectly suggest that `[[access(read_write)]]` is not permitted. Issue: gpuweb#1159
Additional tweaks after gpuweb#1182. Update the terms `read-only` and `write-only` in terms of the new access qualifiers. Drop `[[access(read)]]` and `[[access(write)]]` annotations from the texture intrinsic overloads. These aren't legal signatures, and also incorrectly suggest that `[[access(read_write)]]` is not permitted. Also replace `<dfn dfn ...` with `<dfn ...`. I asssume this was a copypasta typo. Issue: gpuweb#1159
Update the terms `read-only` and `write-only` in terms of the new access qualifiers. Drop `[[access(read)]]` and `[[access(write)]]` annotations from the texture intrinsic overloads. These aren't legal signatures, and also incorrectly suggest that `[[access(read_write)]]` is not permitted. Also replace `<dfn dfn ...` with `<dfn ...`. I asssume this was a copypasta typo. Issue: gpuweb#1159
Additional tweaks after gpuweb#1182. Update the terms `read-only` and `write-only` in terms of the new access qualifiers. Drop `[[access(read)]]` and `[[access(write)]]` annotations from the texture intrinsic overloads. These aren't legal signatures, and also incorrectly suggest that `[[access(read_write)]]` is not permitted. Also replace `<dfn dfn ...` with `<dfn ...`. I asssume this was a copypasta typo. Issue: gpuweb#1159
Additional tweaks after gpuweb#1182. Update the terms `read-only` and `write-only` in terms of the new access qualifiers. Drop `[[access(read)]]` and `[[access(write)]]` annotations from the texture intrinsic overloads. These aren't legal signatures, and also incorrectly suggest that `[[access(read_write)]]` is not permitted. Issue: gpuweb#1159
Update the new `textureDimensions()` section for changes introduced in gpuweb#1182
Update the new `textureDimensions()` section for changes introduced in #1182
This CL updates the storage textures to use an access qualifier instead of the typename
to specify read/write.
For example,
texture_storage_ro_1d<type>->[[access(read)]] texture_storage_1d<type>.Issue #1159