webgpu-native / webgpu-headers

https://webgpu-native.github.io/webgpu-headers/
BSD 3-Clause "New" or "Revised" License
359 stars 42 forks source link

Naming conventions for extension structs and implementation-specific extensions #212

Closed kainino0x closed 1 week ago

kainino0x commented 1 year ago

We should define some naming conventions for both standardized extension structs and implementation-specific extensions. Right now we have the following (inconsistent) names:

WGPUPrimitiveState extensions: WGPUPrimitiveDepthClipControl

WGPURenderPassDescriptor extensions: WGPURenderPassDescriptorMaxDrawCount

WGPUShaderModuleDescriptor extensions: WGPUShaderModuleSPIRVDescriptor WGPUShaderModuleWGSLDescriptor

WGPUSurfaceDescriptor extensions: WGPUSurfaceDescriptorFromAndroidNativeWindow WGPUSurfaceDescriptorFromCanvasHTMLSelector WGPUSurfaceDescriptorFromMetalLayer WGPUSurfaceDescriptorFromWaylandSurface WGPUSurfaceDescriptorFromWindowsHWND WGPUSurfaceDescriptorFromXcbWindow WGPUSurfaceDescriptorFromXlibWindow

Additionally for Dawn we might want things like WGPUSomeDescriptorNewFeatureDAWN? (though idk what the naming would be for wgpu-native)

Kangz commented 1 year ago

For ergonomics it seems that typing Descriptor all the time is annoying. So I'd favor a rule like:

So the list would become:

WGPUPrimitiveState extensions: WGPUPrimitiveDepthClipControl

WGPURenderPassDescriptor extensions: WGPURenderPassMaxDrawCount

WGPUShaderModuleDescriptor extensions: WGPUShaderModuleSPIRV WGPUShaderModuleWGSL

WGPUSurfaceDescriptor extensions: WGPUSurfaceFromAndroidNativeWindow WGPUSurfaceFromCanvasHTMLSelector WGPUSurfaceFromMetalLayer WGPUSurfaceFromWaylandSurface WGPUSurfaceFromWindowsHWND WGPUSurfaceFromXcbWindow WGPUSurfaceFromXlibWindow

WDYT?

kainino0x commented 1 year ago

webgpu.h meeting resolution (OUTDATED):

See also #214 about enum range reservations.

kainino0x commented 2 months ago

Feedback that eliding "Descriptor" from the extension struct names is confusing: https://chromium-review.googlesource.com/c/chromium/src/+/5691772/comment/25f7fc96_8d6b6f12/

kainino0x commented 1 month ago

Jul 18 meeting:

(I'll expand out that proposal in a followup comment)

kainino0x commented 1 month ago

Rough proposal:

WGPURenderPassDescriptor extensions: WGPURenderPassMaxDrawCount or ~WGPUMaxDrawCount~

WGPUShaderModuleDescriptor extensions: WGPUShaderSourceSPIRV WGPUShaderSourceWGSL

WGPUSurfaceDescriptor extensions: WGPUSurfaceSourceAndroidNativeWindow WGPUSurfaceSourceCanvasHTMLSelector_Emscripten (see https://github.com/webgpu-native/webgpu-headers/issues/214#issuecomment-2195624598) WGPUSurfaceSourceMetalLayer WGPUSurfaceSourceWaylandSurface WGPUSurfaceSourceWindowsHWND ~WGPUSurfaceSourceXcbWindow~ or WGPUSurfaceSourceXCBWindow WGPUSurfaceSourceXlibWindow

Other examples of how extensions could be named:

WGPUPrimitiveState extensions: WGPUPrimitiveDepthClipControl or WGPUDepthClipControl (we are getting rid of this but this is what it would look like)

WGPUShaderModuleDescriptor extensions: WGPUShaderSourceGLSL_WGPU WGPUShaderSourceGLSL_Dawn

beaufortfrancois commented 1 month ago

WGPUPrimitiveState extensions: WGPUPrimitiveDepthClipControl or WGPUDepthClipControl

My understanding was that we'd fold DepthClipControl into PrimitiveState with https://github.com/webgpu-native/webgpu-headers/pull/311 @kainino0x Did I misunderstand?

Kangz commented 1 month ago

Yes we're folding it, but that's just for the explanation of the new naming rules.

kainino0x commented 1 month ago

Oh yes, I intended to note that but forgot. Edited above.

beaufortfrancois commented 2 weeks ago

I believe we can close this issue after https://github.com/webgpu-native/webgpu-headers/pull/320 gets merged.

kainino0x commented 1 week ago

You're right, thanks! Dawn bug is https://crbug.com/42241174