Skip to content

Commit

Permalink
Remove emscripten-only extension; slightly reorder SType (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x authored Aug 30, 2024
1 parent 9bc2892 commit f020689
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 42 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.PHONY: gen gen-check doc
.PHONY: help gen gen-check doc

# default target if you just type `make`
help:
@echo 'Targets are: help, fix, gen, gen-check, doc'

fix: webgpu.yml
go run ./fix -yaml webgpu.yml
Expand Down
26 changes: 6 additions & 20 deletions webgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ struct WGPUSurfaceCapabilities;
struct WGPUSurfaceConfiguration;
struct WGPUSurfaceDescriptor;
struct WGPUSurfaceSourceAndroidNativeWindow;
struct WGPUSurfaceSourceCanvasHTMLSelector_Emscripten;
struct WGPUSurfaceSourceMetalLayer;
struct WGPUSurfaceSourceWaylandSurface;
struct WGPUSurfaceSourceWindowsHWND;
Expand Down Expand Up @@ -588,16 +587,15 @@ typedef enum WGPURequestDeviceStatus {

typedef enum WGPUSType {
WGPUSType_Invalid = 0x00000000,
WGPUSType_SurfaceSourceMetalLayer = 0x00000001,
WGPUSType_SurfaceSourceWindowsHWND = 0x00000002,
WGPUSType_SurfaceSourceXlibWindow = 0x00000003,
WGPUSType_SurfaceSourceCanvasHTMLSelector_Emscripten = 0x00000004,
WGPUSType_ShaderSourceSPIRV = 0x00000005,
WGPUSType_ShaderSourceWGSL = 0x00000006,
WGPUSType_ShaderSourceSPIRV = 0x00000001,
WGPUSType_ShaderSourceWGSL = 0x00000002,
WGPUSType_RenderPassMaxDrawCount = 0x00000003,
WGPUSType_SurfaceSourceMetalLayer = 0x00000004,
WGPUSType_SurfaceSourceWindowsHWND = 0x00000005,
WGPUSType_SurfaceSourceXlibWindow = 0x00000006,
WGPUSType_SurfaceSourceWaylandSurface = 0x00000007,
WGPUSType_SurfaceSourceAndroidNativeWindow = 0x00000008,
WGPUSType_SurfaceSourceXCBWindow = 0x00000009,
WGPUSType_RenderPassMaxDrawCount = 0x0000000F,
WGPUSType_Force32 = 0x7FFFFFFF
} WGPUSType WGPU_ENUM_ATTRIBUTE;

Expand Down Expand Up @@ -1467,18 +1465,6 @@ typedef struct WGPUSurfaceSourceAndroidNativeWindow {
void * window;
} WGPUSurfaceSourceAndroidNativeWindow WGPU_STRUCTURE_ATTRIBUTE;

/**
* Chained in @ref WGPUSurfaceDescriptor to make an @ref WGPUSurface wrapping an [HTML `<canvas>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas).
*/
typedef struct WGPUSurfaceSourceCanvasHTMLSelector_Emscripten {
WGPUChainedStruct chain;
/**
* The [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors) for the `<canvas>` element that will be wrapped by the @ref WGPUSurface.
* Most commonly `"#id_of_the_canvas"`.
*/
char const * selector;
} WGPUSurfaceSourceCanvasHTMLSelector_Emscripten WGPU_STRUCTURE_ATTRIBUTE;

/**
* Chained in @ref WGPUSurfaceDescriptor to make an @ref WGPUSurface wrapping a [`CAMetalLayer`](https://developer.apple.com/documentation/quartzcore/cametallayer?language=objc).
*/
Expand Down
28 changes: 7 additions & 21 deletions webgpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -717,22 +717,23 @@ enums:
- name: invalid
doc: |
TODO
- name: surface_source_metal_layer
- name: shader_source_SPIRV
doc: |
TODO
- name: surface_source_windows_HWND
- name: shader_source_WGSL
doc: |
TODO
- name: surface_source_xlib_window
- name: render_pass_max_draw_count
doc: |
TODO
- name: surface_source_canvas_HTML_selector__Emscripten
# TODO(#214): Move all of the surface sources into block 0x0001
- name: surface_source_metal_layer
doc: |
TODO
- name: shader_source_SPIRV
- name: surface_source_windows_HWND
doc: |
TODO
- name: shader_source_WGSL
- name: surface_source_xlib_window
doc: |
TODO
- name: surface_source_wayland_surface
Expand All @@ -744,10 +745,6 @@ enums:
- name: surface_source_XCB_window
doc: |
TODO
- name: render_pass_max_draw_count
value: 0x000F
doc: |
TODO
- name: sampler_binding_type
doc: |
TODO
Expand Down Expand Up @@ -2765,17 +2762,6 @@ structs:
doc: The pointer to the [`ANativeWindow`](https://developer.android.com/ndk/reference/group/a-native-window) that will be wrapped by the @ref WGPUSurface.
type: c_void
pointer: mutable
- name: surface_source_canvas_HTML_selector__Emscripten
doc: Chained in @ref WGPUSurfaceDescriptor to make an @ref WGPUSurface wrapping an [HTML `<canvas>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas).
type: extension_in
extends:
- surface_descriptor
members:
- name: selector
doc: |
The [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors) for the `<canvas>` element that will be wrapped by the @ref WGPUSurface.
Most commonly `"#id_of_the_canvas"`.
type: string
- name: surface_source_metal_layer
doc: Chained in @ref WGPUSurfaceDescriptor to make an @ref WGPUSurface wrapping a [`CAMetalLayer`](https://developer.apple.com/documentation/quartzcore/cametallayer?language=objc).
type: extension_in
Expand Down

0 comments on commit f020689

Please sign in to comment.