From e6aec9bce3ed5083ab4a3f9e0636dbfdff81418b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Tue, 28 Oct 2025 10:47:25 +0100 Subject: [PATCH] Update default values for component swizzle --- webgpu.h | 28 ++++++++++++++++++++-------- webgpu.json | 12 ++++-------- webgpu.yml | 16 ++++++++++++---- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/webgpu.h b/webgpu.h index 78005a8..4158dcc 100644 --- a/webgpu.h +++ b/webgpu.h @@ -3586,25 +3586,37 @@ typedef struct WGPUTextureComponentSwizzle { /** * The value that replaces the red channel in the shader. * - * The `INIT` macro sets this to @ref WGPUComponentSwizzle_R. + * If set to @ref WGPUComponentSwizzle_Undefined, + * [defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_R. + * + * The `INIT` macro sets this to @ref WGPUComponentSwizzle_Undefined. */ WGPUComponentSwizzle r; /** * The value that replaces the green channel in the shader. * - * The `INIT` macro sets this to @ref WGPUComponentSwizzle_G. + * If set to @ref WGPUComponentSwizzle_Undefined, + * [defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_G. + * + * The `INIT` macro sets this to @ref WGPUComponentSwizzle_Undefined. */ WGPUComponentSwizzle g; /** * The value that replaces the blue channel in the shader. * - * The `INIT` macro sets this to @ref WGPUComponentSwizzle_B. + * If set to @ref WGPUComponentSwizzle_Undefined, + * [defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_B. + * + * The `INIT` macro sets this to @ref WGPUComponentSwizzle_Undefined. */ WGPUComponentSwizzle b; /** * The value that replaces the alpha channel in the shader. * - * The `INIT` macro sets this to @ref WGPUComponentSwizzle_A. + * If set to @ref WGPUComponentSwizzle_Undefined, + * [defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_A. + * + * The `INIT` macro sets this to @ref WGPUComponentSwizzle_Undefined. */ WGPUComponentSwizzle a; } WGPUTextureComponentSwizzle WGPU_STRUCTURE_ATTRIBUTE; @@ -3613,10 +3625,10 @@ typedef struct WGPUTextureComponentSwizzle { * Initializer for @ref WGPUTextureComponentSwizzle. */ #define WGPU_TEXTURE_COMPONENT_SWIZZLE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureComponentSwizzle, { \ - /*.r=*/WGPUComponentSwizzle_R _wgpu_COMMA \ - /*.g=*/WGPUComponentSwizzle_G _wgpu_COMMA \ - /*.b=*/WGPUComponentSwizzle_B _wgpu_COMMA \ - /*.a=*/WGPUComponentSwizzle_A _wgpu_COMMA \ + /*.r=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \ + /*.g=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \ + /*.b=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \ + /*.a=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \ }) /** diff --git a/webgpu.json b/webgpu.json index 1ee57e5..52f6b97 100644 --- a/webgpu.json +++ b/webgpu.json @@ -6539,26 +6539,22 @@ "doc": "When accessed by a shader, the red/green/blue/alpha channels are replaced\nby the value corresponding to the component specified in r, g, b, and a,\nrespectively unlike the JS API which uses a string of length four, with\neach character mapping to the texture view's red/green/blue/alpha channels.\n", "members": [ { - "default": "r", - "doc": "The value that replaces the red channel in the shader.\n", + "doc": "The value that replaces the red channel in the shader.\n\nIf set to @ref WGPUComponentSwizzle_Undefined,\n[defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_R.\n", "name": "r", "type": "enum.component_swizzle" }, { - "default": "g", - "doc": "The value that replaces the green channel in the shader.\n", + "doc": "The value that replaces the green channel in the shader.\n\nIf set to @ref WGPUComponentSwizzle_Undefined,\n[defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_G.\n", "name": "g", "type": "enum.component_swizzle" }, { - "default": "b", - "doc": "The value that replaces the blue channel in the shader.\n", + "doc": "The value that replaces the blue channel in the shader.\n\nIf set to @ref WGPUComponentSwizzle_Undefined,\n[defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_B.\n", "name": "b", "type": "enum.component_swizzle" }, { - "default": "a", - "doc": "The value that replaces the alpha channel in the shader.\n", + "doc": "The value that replaces the alpha channel in the shader.\n\nIf set to @ref WGPUComponentSwizzle_Undefined,\n[defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_A.\n", "name": "a", "type": "enum.component_swizzle" } diff --git a/webgpu.yml b/webgpu.yml index 08097b6..a2723cc 100644 --- a/webgpu.yml +++ b/webgpu.yml @@ -3200,23 +3200,31 @@ structs: - name: r doc: | The value that replaces the red channel in the shader. + + If set to @ref WGPUComponentSwizzle_Undefined, + [defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_R. type: enum.component_swizzle - default: r - name: g doc: | The value that replaces the green channel in the shader. + + If set to @ref WGPUComponentSwizzle_Undefined, + [defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_G. type: enum.component_swizzle - default: g - name: b doc: | The value that replaces the blue channel in the shader. + + If set to @ref WGPUComponentSwizzle_Undefined, + [defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_B. type: enum.component_swizzle - default: b - name: a doc: | The value that replaces the alpha channel in the shader. + + If set to @ref WGPUComponentSwizzle_Undefined, + [defaults](@ref SentinelValues) to @ref WGPUComponentSwizzle_A. type: enum.component_swizzle - default: a - name: texture_component_swizzle_descriptor doc: | TODO