From 276c917d7573425991f54d1d2c1baea1094e84af Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Wed, 27 Nov 2024 16:54:00 -0800 Subject: [PATCH 1/2] Fix generation of docs on array members Fixes 431 --- gen/cheader.tmpl | 7 ++++ gen/gen.go | 85 ++++++++++++++++++++++++++++++------------------ webgpu.h | 60 ++++++++++++++++++++++------------ 3 files changed, 100 insertions(+), 52 deletions(-) diff --git a/gen/cheader.tmpl b/gen/cheader.tmpl index 898dacb5..a7de571e 100644 --- a/gen/cheader.tmpl +++ b/gen/cheader.tmpl @@ -339,8 +339,15 @@ typedef struct WGPU{{.Name | PascalCase}}{{$.ExtSuffix}} { WGPUChainedStructOut chain; {{- end}} {{- range $memberIndex, $_ := .Members}} +{{- if (.Type | IsArray)}} + /** Array count for `{{.Name | CamelCase}}`. The `INIT` macro sets this to 0. */ + {{ StructMemberArrayCount $struct $memberIndex}} + {{- MCommentMember . 4 }} + {{ StructMemberArrayData $struct $memberIndex}} +{{- else}} {{- MCommentMember . 4 }} {{ StructMember $struct $memberIndex}} +{{- end}} {{- end}} } WGPU{{.Name | PascalCase}}{{$.ExtSuffix}} WGPU_STRUCTURE_ATTRIBUTE; diff --git a/gen/gen.go b/gen/gen.go index 1ce0c62e..e82b3159 100644 --- a/gen/gen.go +++ b/gen/gen.go @@ -173,6 +173,8 @@ func (g *Generator) Gen(dst io.Writer) error { "FunctionArgs": g.FunctionArgs, "CallbackArgs": g.CallbackArgs, "StructMember": g.StructMember, + "StructMemberArrayCount": g.StructMemberArrayCount, + "StructMemberArrayData": g.StructMemberArrayData, "StructMemberInitializer": g.StructMemberInitializer, }) t, err := t.Parse(tmpl) @@ -286,12 +288,7 @@ func (g *Generator) CType(typ string, pointerType PointerType, suffix string) st func (g *Generator) FunctionArgs(f Function, o *Object) string { sb := &strings.Builder{} if o != nil { - var typeSuffix string - if o.Namespace == "" { - typeSuffix = ConstantCase(g.ExtSuffix) - } else if o.Namespace != "webgpu" { - typeSuffix = ConstantCase(o.Namespace) - } + typeSuffix := g.TypeSuffixForNamespace(o.Namespace) if len(f.Args) > 0 { fmt.Fprintf(sb, "WGPU%s%s %s, ", PascalCase(o.Name), typeSuffix, CamelCase(o.Name)) } else { @@ -302,12 +299,7 @@ func (g *Generator) FunctionArgs(f Function, o *Object) string { if arg.Optional { sb.WriteString("WGPU_NULLABLE ") } - var typeSuffix string - if arg.Namespace == "" { - typeSuffix = ConstantCase(g.ExtSuffix) - } else if arg.Namespace != "webgpu" { - typeSuffix = ConstantCase(arg.Namespace) - } + typeSuffix := g.TypeSuffixForNamespace(arg.Namespace) matches := arrayTypeRegexp.FindStringSubmatch(arg.Type) if len(matches) == 2 { fmt.Fprintf(sb, "size_t %sCount, ", CamelCase(Singularize(arg.Name))) @@ -331,12 +323,7 @@ func (g *Generator) CallbackArgs(f Callback) string { if arg.Optional { sb.WriteString("WGPU_NULLABLE ") } - var typeSuffix string - if arg.Namespace == "" { - typeSuffix = ConstantCase(g.ExtSuffix) - } else if arg.Namespace != "webgpu" { - typeSuffix = ConstantCase(arg.Namespace) - } + typeSuffix := g.TypeSuffixForNamespace(arg.Namespace) var structPrefix string if strings.HasPrefix(arg.Type, "struct.") { structPrefix = "struct " @@ -438,29 +425,63 @@ func (g *Generator) BitflagValue(b Bitflag, entryIndex int) (string, error) { return entryValue, nil } +func (g *Generator) TypeSuffixForNamespace(namespace string) string { + switch namespace { + case "": + return ConstantCase(g.ExtSuffix) + case "webgpu": + return "" + default: + return ConstantCase(namespace) + } +} + func (g *Generator) StructMember(s Struct, memberIndex int) (string, error) { member := s.Members[memberIndex] + typeSuffix := g.TypeSuffixForNamespace(member.Namespace) + + matches := arrayTypeRegexp.FindStringSubmatch(member.Type) + if len(matches) == 2 { + panic("StructMember used on array type") + } + sb := &strings.Builder{} if member.Optional { sb.WriteString("WGPU_NULLABLE ") } - var typeSuffix string - if member.Namespace == "" { - typeSuffix = ConstantCase(g.ExtSuffix) - } else if member.Namespace != "webgpu" { - typeSuffix = ConstantCase(member.Namespace) + if strings.HasPrefix(member.Type, "callback.") { + fmt.Fprintf(sb, "%s %s;", g.CType(member.Type, "", "Info"), CamelCase(member.Name)) + } else { + fmt.Fprintf(sb, "%s %s;", g.CType(member.Type, member.Pointer, typeSuffix), CamelCase(member.Name)) } + return sb.String(), nil +} + +func (g *Generator) StructMemberArrayCount(s Struct, memberIndex int) (string, error) { + member := s.Members[memberIndex] + matches := arrayTypeRegexp.FindStringSubmatch(member.Type) - if len(matches) == 2 { - fmt.Fprintf(sb, "size_t %sCount;\n", CamelCase(Singularize(member.Name))) - fmt.Fprintf(sb, " %s %s;", g.CType(matches[1], member.Pointer, typeSuffix), CamelCase(member.Name)) - } else { - if strings.HasPrefix(member.Type, "callback.") { - fmt.Fprintf(sb, "%s %s;", g.CType(member.Type, "", "Info"), CamelCase(member.Name)) - } else { - fmt.Fprintf(sb, "%s %s;", g.CType(member.Type, member.Pointer, typeSuffix), CamelCase(member.Name)) - } + if len(matches) != 2 { + panic("StructMemberArrayCount used on non-array") + } + + return fmt.Sprintf("size_t %sCount;", CamelCase(Singularize(member.Name))), nil +} + +func (g *Generator) StructMemberArrayData(s Struct, memberIndex int) (string, error) { + member := s.Members[memberIndex] + typeSuffix := g.TypeSuffixForNamespace(member.Namespace) + + matches := arrayTypeRegexp.FindStringSubmatch(member.Type) + if len(matches) != 2 { + panic("StructMemberArrayCount used on non-array") + } + + sb := &strings.Builder{} + if member.Optional { + sb.WriteString("WGPU_NULLABLE ") } + fmt.Fprintf(sb, "%s %s;", g.CType(matches[1], member.Pointer, typeSuffix), CamelCase(member.Name)) return sb.String(), nil } diff --git a/webgpu.h b/webgpu.h index 390e4e96..78e5a87b 100644 --- a/webgpu.h +++ b/webgpu.h @@ -2231,10 +2231,11 @@ typedef struct WGPUPipelineLayoutDescriptor { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView label; + /** Array count for `bindGroupLayouts`. The `INIT` macro sets this to 0. */ + size_t bindGroupLayoutCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t bindGroupLayoutCount; WGPUBindGroupLayout const * bindGroupLayouts; } WGPUPipelineLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; @@ -2371,10 +2372,11 @@ typedef struct WGPURenderBundleEncoderDescriptor { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView label; + /** Array count for `colorFormats`. The `INIT` macro sets this to 0. */ + size_t colorFormatCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t colorFormatCount; WGPUTextureFormat const * colorFormats; /** * The `INIT` macro sets this to @ref WGPUTextureFormat_Undefined. @@ -2770,10 +2772,11 @@ typedef struct WGPUStorageTextureBindingLayout { * Default values can be set using @ref WGPU_SUPPORTED_FEATURES_INIT as initializer. */ typedef struct WGPUSupportedFeatures { + /** Array count for `features`. The `INIT` macro sets this to 0. */ + size_t featureCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t featureCount; WGPUFeatureName const * features; } WGPUSupportedFeatures WGPU_STRUCTURE_ATTRIBUTE; @@ -2789,10 +2792,11 @@ typedef struct WGPUSupportedFeatures { * Default values can be set using @ref WGPU_SUPPORTED_WGSL_LANGUAGE_FEATURES_INIT as initializer. */ typedef struct WGPUSupportedWGSLLanguageFeatures { + /** Array count for `features`. The `INIT` macro sets this to 0. */ + size_t featureCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t featureCount; WGPUWGSLLanguageFeatureName const * features; } WGPUSupportedWGSLLanguageFeatures WGPU_STRUCTURE_ATTRIBUTE; @@ -2818,28 +2822,31 @@ typedef struct WGPUSurfaceCapabilities { * The `INIT` macro sets this to @ref WGPUTextureUsage_None. */ WGPUTextureUsage usages; + /** Array count for `formats`. The `INIT` macro sets this to 0. */ + size_t formatCount; /** * A list of supported @ref WGPUTextureFormat values, in order of preference. * * The `INIT` macro sets this to `NULL`. */ - size_t formatCount; WGPUTextureFormat const * formats; + /** Array count for `presentModes`. The `INIT` macro sets this to 0. */ + size_t presentModeCount; /** * A list of supported @ref WGPUPresentMode values. * Guaranteed to contain @ref WGPUPresentMode_Fifo. * * The `INIT` macro sets this to `NULL`. */ - size_t presentModeCount; WGPUPresentMode const * presentModes; + /** Array count for `alphaModes`. The `INIT` macro sets this to 0. */ + size_t alphaModeCount; /** * A list of supported @ref WGPUCompositeAlphaMode values. * @ref WGPUCompositeAlphaMode_Auto will be an alias for the first element and will never be present in this array. * * The `INIT` macro sets this to `NULL`. */ - size_t alphaModeCount; WGPUCompositeAlphaMode const * alphaModes; } WGPUSurfaceCapabilities WGPU_STRUCTURE_ATTRIBUTE; @@ -2895,12 +2902,13 @@ typedef struct WGPUSurfaceConfiguration { * The `INIT` macro sets this to `0`. */ uint32_t height; + /** Array count for `viewFormats`. The `INIT` macro sets this to 0. */ + size_t viewFormatCount; /** * The additional @ref WGPUTextureFormat for @ref WGPUTextureView format reinterpretation of the surface's textures. * * The `INIT` macro sets this to `NULL`. */ - size_t viewFormatCount; WGPUTextureFormat const * viewFormats; /** * How the surface's frames will be composited on the screen. @@ -3337,10 +3345,11 @@ typedef struct WGPUBindGroupDescriptor { * The `INIT` macro sets this to `NULL`. */ WGPUBindGroupLayout layout; + /** Array count for `entries`. The `INIT` macro sets this to 0. */ + size_t entryCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t entryCount; WGPUBindGroupEntry const * entries; } WGPUBindGroupDescriptor WGPU_STRUCTURE_ATTRIBUTE; @@ -3426,10 +3435,11 @@ typedef struct WGPUBlendState { */ typedef struct WGPUCompilationInfo { WGPUChainedStruct const * nextInChain; + /** Array count for `messages`. The `INIT` macro sets this to 0. */ + size_t messageCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t messageCount; WGPUCompilationMessage const * messages; } WGPUCompilationInfo WGPU_STRUCTURE_ATTRIBUTE; @@ -3483,10 +3493,11 @@ typedef struct WGPUComputeState { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView entryPoint; + /** Array count for `constants`. The `INIT` macro sets this to 0. */ + size_t constantCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t constantCount; WGPUConstantEntry const * constants; } WGPUComputeState WGPU_STRUCTURE_ATTRIBUTE; @@ -3576,10 +3587,11 @@ typedef struct WGPUDeviceDescriptor { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView label; + /** Array count for `requiredFeatures`. The `INIT` macro sets this to 0. */ + size_t requiredFeatureCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t requiredFeatureCount; WGPUFeatureName const * requiredFeatures; /** * The `INIT` macro sets this to `NULL`. @@ -3798,10 +3810,11 @@ typedef struct WGPUTextureDescriptor { * The `INIT` macro sets this to `1`. */ uint32_t sampleCount; + /** Array count for `viewFormats`. The `INIT` macro sets this to 0. */ + size_t viewFormatCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t viewFormatCount; WGPUTextureFormat const * viewFormats; } WGPUTextureDescriptor WGPU_STRUCTURE_ATTRIBUTE; @@ -3838,10 +3851,11 @@ typedef struct WGPUVertexBufferLayout { * The `INIT` macro sets this to `0`. */ uint64_t arrayStride; + /** Array count for `attributes`. The `INIT` macro sets this to 0. */ + size_t attributeCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t attributeCount; WGPUVertexAttribute const * attributes; } WGPUVertexBufferLayout WGPU_STRUCTURE_ATTRIBUTE; @@ -3867,10 +3881,11 @@ typedef struct WGPUBindGroupLayoutDescriptor { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView label; + /** Array count for `entries`. The `INIT` macro sets this to 0. */ + size_t entryCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t entryCount; WGPUBindGroupLayoutEntry const * entries; } WGPUBindGroupLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; @@ -3959,10 +3974,11 @@ typedef struct WGPURenderPassDescriptor { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView label; + /** Array count for `colorAttachments`. The `INIT` macro sets this to 0. */ + size_t colorAttachmentCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t colorAttachmentCount; WGPURenderPassColorAttachment const * colorAttachments; /** * The `INIT` macro sets this to `NULL`. @@ -4006,15 +4022,17 @@ typedef struct WGPUVertexState { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView entryPoint; + /** Array count for `constants`. The `INIT` macro sets this to 0. */ + size_t constantCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t constantCount; WGPUConstantEntry const * constants; + /** Array count for `buffers`. The `INIT` macro sets this to 0. */ + size_t bufferCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t bufferCount; WGPUVertexBufferLayout const * buffers; } WGPUVertexState WGPU_STRUCTURE_ATTRIBUTE; @@ -4046,15 +4064,17 @@ typedef struct WGPUFragmentState { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView entryPoint; + /** Array count for `constants`. The `INIT` macro sets this to 0. */ + size_t constantCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t constantCount; WGPUConstantEntry const * constants; + /** Array count for `targets`. The `INIT` macro sets this to 0. */ + size_t targetCount; /** * The `INIT` macro sets this to `NULL`. */ - size_t targetCount; WGPUColorTargetState const * targets; } WGPUFragmentState WGPU_STRUCTURE_ATTRIBUTE; From f4282c3cfeafa24a208b7b5eaf5b7ba5fc70f79f Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Mon, 2 Dec 2024 20:13:32 -0800 Subject: [PATCH 2/2] 3-line Count comment --- gen/cheader.tmpl | 8 +++-- webgpu.h | 82 +++++++++++++++++++++++++++++++++++------------- 2 files changed, 66 insertions(+), 24 deletions(-) diff --git a/gen/cheader.tmpl b/gen/cheader.tmpl index a7de571e..7e86dda9 100644 --- a/gen/cheader.tmpl +++ b/gen/cheader.tmpl @@ -284,7 +284,7 @@ typedef struct WGPUChainedStructOut { * @{ */ - /** +/** * \defgroup WGPUCallbackInfo Callback Info Structs * \brief Callback info structures that are used in asynchronous functions. * @@ -317,7 +317,7 @@ typedef struct WGPU{{.Name | PascalCase}}CallbackInfo{{$.ExtSuffix}} { }) {{ end}}{{"\n" -}} - /** @} */ +/** @} */ {{- "\n"}} {{- range $struct := .Structs}} @@ -340,7 +340,9 @@ typedef struct WGPU{{.Name | PascalCase}}{{$.ExtSuffix}} { {{- end}} {{- range $memberIndex, $_ := .Members}} {{- if (.Type | IsArray)}} - /** Array count for `{{.Name | CamelCase}}`. The `INIT` macro sets this to 0. */ + /** + * Array count for `{{.Name | CamelCase}}`. The `INIT` macro sets this to 0. + */ {{ StructMemberArrayCount $struct $memberIndex}} {{- MCommentMember . 4 }} {{ StructMemberArrayData $struct $memberIndex}} diff --git a/webgpu.h b/webgpu.h index 78e5a87b..f926942b 100644 --- a/webgpu.h +++ b/webgpu.h @@ -1314,7 +1314,7 @@ typedef struct WGPUChainedStructOut { * @{ */ - /** +/** * \defgroup WGPUCallbackInfo Callback Info Structs * \brief Callback info structures that are used in asynchronous functions. * @@ -2231,7 +2231,9 @@ typedef struct WGPUPipelineLayoutDescriptor { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView label; - /** Array count for `bindGroupLayouts`. The `INIT` macro sets this to 0. */ + /** + * Array count for `bindGroupLayouts`. The `INIT` macro sets this to 0. + */ size_t bindGroupLayoutCount; /** * The `INIT` macro sets this to `NULL`. @@ -2372,7 +2374,9 @@ typedef struct WGPURenderBundleEncoderDescriptor { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView label; - /** Array count for `colorFormats`. The `INIT` macro sets this to 0. */ + /** + * Array count for `colorFormats`. The `INIT` macro sets this to 0. + */ size_t colorFormatCount; /** * The `INIT` macro sets this to `NULL`. @@ -2772,7 +2776,9 @@ typedef struct WGPUStorageTextureBindingLayout { * Default values can be set using @ref WGPU_SUPPORTED_FEATURES_INIT as initializer. */ typedef struct WGPUSupportedFeatures { - /** Array count for `features`. The `INIT` macro sets this to 0. */ + /** + * Array count for `features`. The `INIT` macro sets this to 0. + */ size_t featureCount; /** * The `INIT` macro sets this to `NULL`. @@ -2792,7 +2798,9 @@ typedef struct WGPUSupportedFeatures { * Default values can be set using @ref WGPU_SUPPORTED_WGSL_LANGUAGE_FEATURES_INIT as initializer. */ typedef struct WGPUSupportedWGSLLanguageFeatures { - /** Array count for `features`. The `INIT` macro sets this to 0. */ + /** + * Array count for `features`. The `INIT` macro sets this to 0. + */ size_t featureCount; /** * The `INIT` macro sets this to `NULL`. @@ -2822,7 +2830,9 @@ typedef struct WGPUSurfaceCapabilities { * The `INIT` macro sets this to @ref WGPUTextureUsage_None. */ WGPUTextureUsage usages; - /** Array count for `formats`. The `INIT` macro sets this to 0. */ + /** + * Array count for `formats`. The `INIT` macro sets this to 0. + */ size_t formatCount; /** * A list of supported @ref WGPUTextureFormat values, in order of preference. @@ -2830,7 +2840,9 @@ typedef struct WGPUSurfaceCapabilities { * The `INIT` macro sets this to `NULL`. */ WGPUTextureFormat const * formats; - /** Array count for `presentModes`. The `INIT` macro sets this to 0. */ + /** + * Array count for `presentModes`. The `INIT` macro sets this to 0. + */ size_t presentModeCount; /** * A list of supported @ref WGPUPresentMode values. @@ -2839,7 +2851,9 @@ typedef struct WGPUSurfaceCapabilities { * The `INIT` macro sets this to `NULL`. */ WGPUPresentMode const * presentModes; - /** Array count for `alphaModes`. The `INIT` macro sets this to 0. */ + /** + * Array count for `alphaModes`. The `INIT` macro sets this to 0. + */ size_t alphaModeCount; /** * A list of supported @ref WGPUCompositeAlphaMode values. @@ -2902,7 +2916,9 @@ typedef struct WGPUSurfaceConfiguration { * The `INIT` macro sets this to `0`. */ uint32_t height; - /** Array count for `viewFormats`. The `INIT` macro sets this to 0. */ + /** + * Array count for `viewFormats`. The `INIT` macro sets this to 0. + */ size_t viewFormatCount; /** * The additional @ref WGPUTextureFormat for @ref WGPUTextureView format reinterpretation of the surface's textures. @@ -3345,7 +3361,9 @@ typedef struct WGPUBindGroupDescriptor { * The `INIT` macro sets this to `NULL`. */ WGPUBindGroupLayout layout; - /** Array count for `entries`. The `INIT` macro sets this to 0. */ + /** + * Array count for `entries`. The `INIT` macro sets this to 0. + */ size_t entryCount; /** * The `INIT` macro sets this to `NULL`. @@ -3435,7 +3453,9 @@ typedef struct WGPUBlendState { */ typedef struct WGPUCompilationInfo { WGPUChainedStruct const * nextInChain; - /** Array count for `messages`. The `INIT` macro sets this to 0. */ + /** + * Array count for `messages`. The `INIT` macro sets this to 0. + */ size_t messageCount; /** * The `INIT` macro sets this to `NULL`. @@ -3493,7 +3513,9 @@ typedef struct WGPUComputeState { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView entryPoint; - /** Array count for `constants`. The `INIT` macro sets this to 0. */ + /** + * Array count for `constants`. The `INIT` macro sets this to 0. + */ size_t constantCount; /** * The `INIT` macro sets this to `NULL`. @@ -3587,7 +3609,9 @@ typedef struct WGPUDeviceDescriptor { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView label; - /** Array count for `requiredFeatures`. The `INIT` macro sets this to 0. */ + /** + * Array count for `requiredFeatures`. The `INIT` macro sets this to 0. + */ size_t requiredFeatureCount; /** * The `INIT` macro sets this to `NULL`. @@ -3810,7 +3834,9 @@ typedef struct WGPUTextureDescriptor { * The `INIT` macro sets this to `1`. */ uint32_t sampleCount; - /** Array count for `viewFormats`. The `INIT` macro sets this to 0. */ + /** + * Array count for `viewFormats`. The `INIT` macro sets this to 0. + */ size_t viewFormatCount; /** * The `INIT` macro sets this to `NULL`. @@ -3851,7 +3877,9 @@ typedef struct WGPUVertexBufferLayout { * The `INIT` macro sets this to `0`. */ uint64_t arrayStride; - /** Array count for `attributes`. The `INIT` macro sets this to 0. */ + /** + * Array count for `attributes`. The `INIT` macro sets this to 0. + */ size_t attributeCount; /** * The `INIT` macro sets this to `NULL`. @@ -3881,7 +3909,9 @@ typedef struct WGPUBindGroupLayoutDescriptor { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView label; - /** Array count for `entries`. The `INIT` macro sets this to 0. */ + /** + * Array count for `entries`. The `INIT` macro sets this to 0. + */ size_t entryCount; /** * The `INIT` macro sets this to `NULL`. @@ -3974,7 +4004,9 @@ typedef struct WGPURenderPassDescriptor { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView label; - /** Array count for `colorAttachments`. The `INIT` macro sets this to 0. */ + /** + * Array count for `colorAttachments`. The `INIT` macro sets this to 0. + */ size_t colorAttachmentCount; /** * The `INIT` macro sets this to `NULL`. @@ -4022,13 +4054,17 @@ typedef struct WGPUVertexState { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView entryPoint; - /** Array count for `constants`. The `INIT` macro sets this to 0. */ + /** + * Array count for `constants`. The `INIT` macro sets this to 0. + */ size_t constantCount; /** * The `INIT` macro sets this to `NULL`. */ WGPUConstantEntry const * constants; - /** Array count for `buffers`. The `INIT` macro sets this to 0. */ + /** + * Array count for `buffers`. The `INIT` macro sets this to 0. + */ size_t bufferCount; /** * The `INIT` macro sets this to `NULL`. @@ -4064,13 +4100,17 @@ typedef struct WGPUFragmentState { * The `INIT` macro sets this to @ref WGPU_STRING_VIEW_INIT. */ WGPUStringView entryPoint; - /** Array count for `constants`. The `INIT` macro sets this to 0. */ + /** + * Array count for `constants`. The `INIT` macro sets this to 0. + */ size_t constantCount; /** * The `INIT` macro sets this to `NULL`. */ WGPUConstantEntry const * constants; - /** Array count for `targets`. The `INIT` macro sets this to 0. */ + /** + * Array count for `targets`. The `INIT` macro sets this to 0. + */ size_t targetCount; /** * The `INIT` macro sets this to `NULL`.