diff --git a/gen/README.md b/gen/README.md index 6b902aa..612c892 100644 --- a/gen/README.md +++ b/gen/README.md @@ -32,13 +32,15 @@ Since the generator does some duplication validation, the order of the files mat | `float64` | | `c_void` | -| Structure types | | -| --------------- | ------------------------------------------------------- | -| `base_in` | in-structs that can be extended | -| `base_out` | out-structs that can be extended | -| `extension_in` | in-structs that are extensions | -| `extension_out` | out-structs that are extensions | -| `standalone` | structs that are niether extensions nor can be extended | +| Structure types | | +| --------------------- | ------------------------------------------------------- | +| `base_in` | in-structs that can be extended | +| `base_out` | out-structs that can be extended | +| `base_in_or_out` | extensible structs used as either input or output | +| `extension_in` | extension structs used in `base_in` chains | +| `extension_out` | extension structs used in `base_out` chains | +| `extension_in_or_out` | extension structs used `base_in_or_out` chains | +| `standalone` | structs that are niether extensions nor can be extended | #### Arrays diff --git a/gen/cheader.tmpl b/gen/cheader.tmpl index 472eaec..e9735ba 100644 --- a/gen/cheader.tmpl +++ b/gen/cheader.tmpl @@ -306,10 +306,16 @@ typedef struct WGPU{{.Name | PascalCase}}{{$.ExtSuffix}} { WGPUChainedStruct const * nextInChain; {{- else if eq .Type "base_out" }} WGPUChainedStructOut * nextInChain; +{{- else if eq .Type "base_in_or_out" }} + /** This struct chain is used as mutable in some places and immutable in others. */ + WGPUChainedStructOut * nextInChain; {{- else if eq .Type "extension_in"}} WGPUChainedStruct chain; {{- else if eq .Type "extension_out"}} WGPUChainedStructOut chain; +{{- else if eq .Type "extension_in_or_out"}} + /** This struct chain is used as mutable in some places and immutable in others. */ + WGPUChainedStructOut chain; {{- end}} {{- range $memberIndex, $_ := .Members}} {{- MCommentMember . 4 }} diff --git a/schema.json b/schema.json index 2dc15f2..9c9d8db 100644 --- a/schema.json +++ b/schema.json @@ -417,8 +417,10 @@ "enum": [ "base_in", "base_out", + "base_in_or_out", "extension_in", "extension_out", + "extension_in_or_out", "standalone" ] }, diff --git a/webgpu.h b/webgpu.h index de4617d..089d625 100644 --- a/webgpu.h +++ b/webgpu.h @@ -226,20 +226,18 @@ struct WGPUBlendState; struct WGPUCompilationInfo; struct WGPUComputePassDescriptor; struct WGPUDepthStencilState; +struct WGPUDeviceDescriptor; struct WGPUFutureWaitInfo; struct WGPUImageCopyBuffer; struct WGPUImageCopyTexture; struct WGPUInstanceDescriptor; struct WGPUProgrammableStageDescriptor; struct WGPURenderPassColorAttachment; -struct WGPURequiredLimits; -struct WGPUSupportedLimits; struct WGPUTextureDescriptor; struct WGPUVertexBufferLayout; struct WGPUBindGroupLayoutDescriptor; struct WGPUColorTargetState; struct WGPUComputePipelineDescriptor; -struct WGPUDeviceDescriptor; struct WGPURenderPassDescriptor; struct WGPUVertexState; struct WGPUFragmentState; @@ -1450,7 +1448,8 @@ typedef struct WGPUFuture { * Features enabled on the WGPUInstance */ typedef struct WGPUInstanceFeatures { - WGPUChainedStruct const * nextInChain; + /** This struct chain is used as mutable in some places and immutable in others. */ + WGPUChainedStructOut * nextInChain; /** * Enable use of ::wgpuInstanceWaitAny with `timeoutNS > 0`. */ @@ -1462,6 +1461,8 @@ typedef struct WGPUInstanceFeatures { } WGPUInstanceFeatures WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPULimits { + /** This struct chain is used as mutable in some places and immutable in others. */ + WGPUChainedStructOut * nextInChain; uint32_t maxTextureDimension1D; uint32_t maxTextureDimension2D; uint32_t maxTextureDimension3D; @@ -1937,6 +1938,20 @@ typedef struct WGPUDepthStencilState { float depthBiasClamp; } WGPUDepthStencilState WGPU_STRUCTURE_ATTRIBUTE; +typedef struct WGPUDeviceDescriptor { + WGPUChainedStruct const * nextInChain; + /** + * This is a \ref NonNullInputString. + */ + WGPUStringView label; + size_t requiredFeatureCount; + WGPUFeatureName const * requiredFeatures; + WGPU_NULLABLE WGPULimits const * requiredLimits; + WGPUQueueDescriptor defaultQueue; + WGPUDeviceLostCallbackInfo deviceLostCallbackInfo; + WGPUUncapturedErrorCallbackInfo uncapturedErrorCallbackInfo; +} WGPUDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + /** * Struct holding a future to wait on, and a `completed` boolean flag. */ @@ -1992,16 +2007,6 @@ typedef struct WGPURenderPassColorAttachment { WGPUColor clearValue; } WGPURenderPassColorAttachment WGPU_STRUCTURE_ATTRIBUTE; -typedef struct WGPURequiredLimits { - WGPUChainedStruct const * nextInChain; - WGPULimits limits; -} WGPURequiredLimits WGPU_STRUCTURE_ATTRIBUTE; - -typedef struct WGPUSupportedLimits { - WGPUChainedStructOut * nextInChain; - WGPULimits limits; -} WGPUSupportedLimits WGPU_STRUCTURE_ATTRIBUTE; - typedef struct WGPUTextureDescriptor { WGPUChainedStruct const * nextInChain; /** @@ -2062,20 +2067,6 @@ typedef struct WGPUComputePipelineDescriptor { WGPUProgrammableStageDescriptor compute; } WGPUComputePipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE; -typedef struct WGPUDeviceDescriptor { - WGPUChainedStruct const * nextInChain; - /** - * This is a \ref NonNullInputString. - */ - WGPUStringView label; - size_t requiredFeatureCount; - WGPUFeatureName const * requiredFeatures; - WGPU_NULLABLE WGPURequiredLimits const * requiredLimits; - WGPUQueueDescriptor defaultQueue; - WGPUDeviceLostCallbackInfo deviceLostCallbackInfo; - WGPUUncapturedErrorCallbackInfo uncapturedErrorCallbackInfo; -} WGPUDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE; - typedef struct WGPURenderPassDescriptor { WGPUChainedStruct const * nextInChain; /** @@ -2168,7 +2159,7 @@ typedef void (*WGPUProcAdapterGetInfo)(WGPUAdapter adapter, WGPUAdapterInfo * in * Proc pointer type for @ref wgpuAdapterGetLimits: * > @copydoc wgpuAdapterGetLimits */ -typedef WGPUBool (*WGPUProcAdapterGetLimits)(WGPUAdapter adapter, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcAdapterGetLimits)(WGPUAdapter adapter, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE; /** * Proc pointer type for @ref wgpuAdapterHasFeature: * > @copydoc wgpuAdapterHasFeature @@ -2551,7 +2542,7 @@ typedef WGPUStatus (*WGPUProcDeviceGetFeatures)(WGPUDevice device, WGPUSupported * Proc pointer type for @ref wgpuDeviceGetLimits: * > @copydoc wgpuDeviceGetLimits */ -typedef WGPUBool (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE; /** * Proc pointer type for @ref wgpuDeviceGetQueue: * > @copydoc wgpuDeviceGetQueue @@ -3177,7 +3168,7 @@ WGPU_EXPORT WGPUStatus wgpuAdapterGetFeatures(WGPUAdapter adapter, WGPUSupported * This parameter is @ref ReturnedWithOwnership. */ WGPU_EXPORT void wgpuAdapterGetInfo(WGPUAdapter adapter, WGPUAdapterInfo * info) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE; WGPU_EXPORT WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; WGPU_EXPORT WGPUFuture wgpuAdapterRequestDevice(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; WGPU_EXPORT void wgpuAdapterAddRef(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; @@ -3354,7 +3345,7 @@ WGPU_EXPORT void wgpuDeviceDestroy(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; * - `features` has an invalid struct chain. */ WGPU_EXPORT WGPUStatus wgpuDeviceGetFeatures(WGPUDevice device, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE; -WGPU_EXPORT WGPUBool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuDeviceGetLimits(WGPUDevice device, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE; WGPU_EXPORT WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; WGPU_EXPORT WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; WGPU_EXPORT WGPUFuture wgpuDevicePopErrorScope(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; diff --git a/webgpu.yml b/webgpu.yml index fcb5607..e8ffd8c 100644 --- a/webgpu.yml +++ b/webgpu.yml @@ -1908,7 +1908,7 @@ structs: - name: required_limits doc: | TODO - type: struct.required_limits + type: struct.limits pointer: immutable optional: true - name: default_queue @@ -2025,7 +2025,7 @@ structs: - name: instance_features doc: | Features enabled on the WGPUInstance - type: base_in + type: base_in_or_out members: - name: timed_wait_any_enable doc: Enable use of ::wgpuInstanceWaitAny with `timeoutNS > 0`. @@ -2036,7 +2036,7 @@ structs: - name: limits doc: | TODO - type: standalone + type: base_in_or_out members: - name: max_texture_dimension_1D doc: | @@ -2509,15 +2509,6 @@ structs: doc: | TODO type: bool - - name: required_limits - doc: | - TODO - type: base_in - members: - - name: limits - doc: | - TODO - type: struct.limits - name: sampler_binding_layout doc: | TODO @@ -2661,15 +2652,6 @@ structs: TODO type: array pointer: immutable - - name: supported_limits - doc: | - TODO - type: base_out - members: - - name: limits - doc: | - TODO - type: struct.limits - name: surface_capabilities doc: Filled by `::wgpuSurfaceGetCapabilities` with what's supported for `::wgpuSurfaceConfigure` for a pair of @ref WGPUSurface and @ref WGPUAdapter. type: base_out @@ -3208,7 +3190,7 @@ objects: - name: limits doc: | TODO - type: struct.supported_limits + type: struct.limits pointer: mutable - name: has_feature doc: | @@ -3914,7 +3896,7 @@ objects: - name: limits doc: | TODO - type: struct.supported_limits + type: struct.limits pointer: mutable - name: has_feature doc: |