wgpu icon indicating copy to clipboard operation
wgpu copied to clipboard

Use WGSL instead of GLSL in library documentation

Open kpreid opened this issue 3 years ago • 3 comments

There are a number of items in wgpu whose documentation contain examples using GLSL syntax or other references to GLSL elements. Since WGSL is now the standard shading language for WebGPU, it would be beneficial to readers if these examples were presented first in WGSL. (Keeping the GLSL would still be helpful for new users arriving from WebGL.)

Relevant occurrences of the text "GLSL" in documentation as of commit c36eb9f44bd9462fe176fb859839592131428feb (just after 0.13.1):

  • Features::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING
  • Features::UNIFORM_BUFFER_AND_STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING
  • BufferBindingType
  • BindingType
  • StorageTextureAccess
  • TextureSampleType
  • TextureViewDimension

Incomplete list (since it's hard to search for) of locations where the documentation refers to GLSL entities without even mentioning GLSL:

  • PipelineLayoutDescriptor refers to "set = 0" which is GLSL syntax.
  • BindingType::Texture::multisampled refers to GLSL texture sampling functions.
  • Features::TEXTURE_BINDING_ARRAY and BUFFER_BINDING_ARRAY have GLSL examples.

Also possibly of interest: the following items mention something like “See the OpenGL specification” but are not about shading language per se and are mostly just declining to explain a topic:

  • BlendFactor
  • BlendState
  • BindingType::StorageTexture
  • SamplerBindingType

kpreid avatar Jul 04 '22 16:07 kpreid

I can work on this.

ghost avatar Jul 15 '22 16:07 ghost

Shouldn't this be closed now?

Sebbl0508 avatar Jan 27 '23 21:01 Sebbl0508

Maybe, though #2888 technically didn't address everything @kpreid mentioned; it was primarily additive and didn't remove or modify bits where GLSL or OpenGL are mentioned out of context, for example. Remaining items of interest are:

  • BindingType::Texture::multisampled
  • BindingType::StorageTexture
  • BlendFactor
  • BlendState
  • PipelineLayoutDescriptor
  • SamplerBindingType

And maybe more.

ghost avatar Jan 27 '23 22:01 ghost