From 41fe42e366c1be55811b2811284f794a75e9b13c Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Wed, 27 Jul 2022 10:25:03 -0700 Subject: [PATCH] gpu: make all next_in_chain fields optional, default to null Signed-off-by: Stephen Gutekanst --- gpu/src/adapter.zig | 2 +- gpu/src/bind_group.zig | 4 ++-- gpu/src/bind_group_layout.zig | 4 ++-- gpu/src/buffer.zig | 4 ++-- gpu/src/command_buffer.zig | 2 +- gpu/src/command_encoder.zig | 2 +- gpu/src/compute_pipeline.zig | 2 +- gpu/src/device.zig | 2 +- gpu/src/external_texture.zig | 2 +- gpu/src/instance.zig | 2 +- gpu/src/pipeline_layout.zig | 2 +- gpu/src/query_set.zig | 2 +- gpu/src/queue.zig | 2 +- gpu/src/render_bundle.zig | 2 +- gpu/src/render_bundle_encoder.zig | 2 +- gpu/src/render_pipeline.zig | 2 +- gpu/src/sampler.zig | 4 ++-- gpu/src/shader_module.zig | 2 +- gpu/src/surface.zig | 2 +- gpu/src/swap_chain.zig | 2 +- gpu/src/texture.zig | 6 +++--- gpu/src/texture_view.zig | 2 +- gpu/src/types.zig | 32 +++++++++++++++---------------- 23 files changed, 44 insertions(+), 44 deletions(-) diff --git a/gpu/src/adapter.zig b/gpu/src/adapter.zig index a7e8f489..6740df65 100644 --- a/gpu/src/adapter.zig +++ b/gpu/src/adapter.zig @@ -66,7 +66,7 @@ pub const AdapterType = enum(u32) { }; pub const AdapterProperties = extern struct { - next_in_chain: *ChainedStructOut, + next_in_chain: ?*ChainedStructOut = null, vendor_id: u32, vendor_name: [*:0]const u8, architecture: [*:0]const u8, diff --git a/gpu/src/bind_group.zig b/gpu/src/bind_group.zig index 03b2657a..8c750e92 100644 --- a/gpu/src/bind_group.zig +++ b/gpu/src/bind_group.zig @@ -20,7 +20,7 @@ pub const BindGroup = *opaque { }; pub const BindGroupEntry = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, binding: u32, buffer: ?Buffer, offset: u64 = 0, @@ -30,7 +30,7 @@ pub const BindGroupEntry = extern struct { }; pub const BindGroupDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, layout: BindGroupLayout, entry_count: u32, diff --git a/gpu/src/bind_group_layout.zig b/gpu/src/bind_group_layout.zig index ce53c40c..3cd44f76 100644 --- a/gpu/src/bind_group_layout.zig +++ b/gpu/src/bind_group_layout.zig @@ -24,7 +24,7 @@ pub const BindGroupLayout = *opaque { }; pub const BindGroupLayoutEntry = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, binding: u32, visibility: ShaderStageFlags, buffer: BufferBindingLayout, @@ -34,7 +34,7 @@ pub const BindGroupLayoutEntry = extern struct { }; pub const BindGroupLayoutDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, entry_count: u32, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is. diff --git a/gpu/src/buffer.zig b/gpu/src/buffer.zig index 0507375c..bac4566c 100644 --- a/gpu/src/buffer.zig +++ b/gpu/src/buffer.zig @@ -96,14 +96,14 @@ pub const BufferUsage = packed struct { }; pub const BufferBindingLayout = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, type: BufferBindingType = .undef, has_dynamic_offset: bool = false, min_binding_size: u64 = 0, }; pub const BufferDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, usage: BufferUsage, size: u64, diff --git a/gpu/src/command_buffer.zig b/gpu/src/command_buffer.zig index b63ed138..afe008a5 100644 --- a/gpu/src/command_buffer.zig +++ b/gpu/src/command_buffer.zig @@ -16,6 +16,6 @@ pub const CommandBuffer = *opaque { }; pub const CommandBufferDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, }; diff --git a/gpu/src/command_encoder.zig b/gpu/src/command_encoder.zig index 8264d1a7..33fc8821 100644 --- a/gpu/src/command_encoder.zig +++ b/gpu/src/command_encoder.zig @@ -95,6 +95,6 @@ pub const CommandEncoder = *opaque { }; pub const CommandEncoderDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, }; diff --git a/gpu/src/compute_pipeline.zig b/gpu/src/compute_pipeline.zig index b5e47033..02d6d743 100644 --- a/gpu/src/compute_pipeline.zig +++ b/gpu/src/compute_pipeline.zig @@ -23,7 +23,7 @@ pub const ComputePipeline = *opaque { }; pub const ComputePipelineDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, layout: ?PipelineLayout, compute: ProgrammableStageDescriptor, diff --git a/gpu/src/device.zig b/gpu/src/device.zig index f705b693..ecc9bda0 100644 --- a/gpu/src/device.zig +++ b/gpu/src/device.zig @@ -191,7 +191,7 @@ pub const DeviceLostReason = enum(u32) { }; pub const DeviceDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, required_features_count: u32 = 0, required_features: ?[*]const FeatureName = null, diff --git a/gpu/src/external_texture.zig b/gpu/src/external_texture.zig index 515286d6..e8e4fedb 100644 --- a/gpu/src/external_texture.zig +++ b/gpu/src/external_texture.zig @@ -30,7 +30,7 @@ pub const ExternalTextureBindingLayout = extern struct { }; pub const ExternalTextureDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, plane0: TextureView, plane1: ?TextureView, diff --git a/gpu/src/instance.zig b/gpu/src/instance.zig index 197af518..8cf51a74 100644 --- a/gpu/src/instance.zig +++ b/gpu/src/instance.zig @@ -32,5 +32,5 @@ pub const RequestAdapterCallback = fn ( ) callconv(.C) void; pub const InstanceDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, }; diff --git a/gpu/src/pipeline_layout.zig b/gpu/src/pipeline_layout.zig index a17d09db..bee43ec7 100644 --- a/gpu/src/pipeline_layout.zig +++ b/gpu/src/pipeline_layout.zig @@ -17,7 +17,7 @@ pub const PipelineLayout = *opaque { }; pub const PipelineLayoutDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, bind_group_layout_count: u32, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is. diff --git a/gpu/src/query_set.zig b/gpu/src/query_set.zig index 9167510e..a026dabb 100644 --- a/gpu/src/query_set.zig +++ b/gpu/src/query_set.zig @@ -30,7 +30,7 @@ pub const QuerySet = *opaque { }; pub const QuerySetDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, type: QueryType, count: u32, diff --git a/gpu/src/queue.zig b/gpu/src/queue.zig index 6508b684..5ceebf77 100644 --- a/gpu/src/queue.zig +++ b/gpu/src/queue.zig @@ -54,6 +54,6 @@ pub const QueueWorkDoneStatus = enum(u32) { }; pub const QueueDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, }; diff --git a/gpu/src/render_bundle.zig b/gpu/src/render_bundle.zig index 5821683d..13ce38db 100644 --- a/gpu/src/render_bundle.zig +++ b/gpu/src/render_bundle.zig @@ -12,6 +12,6 @@ pub const RenderBundle = *opaque { }; pub const RenderBundleDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, }; diff --git a/gpu/src/render_bundle_encoder.zig b/gpu/src/render_bundle_encoder.zig index 3e4ee5da..e4564930 100644 --- a/gpu/src/render_bundle_encoder.zig +++ b/gpu/src/render_bundle_encoder.zig @@ -84,7 +84,7 @@ pub const RenderBundleEncoder = *opaque { }; pub const RenderBundleEncoderDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, color_formats_count: u32, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is. diff --git a/gpu/src/render_pipeline.zig b/gpu/src/render_pipeline.zig index 3e9f2c1c..88d5e59e 100644 --- a/gpu/src/render_pipeline.zig +++ b/gpu/src/render_pipeline.zig @@ -27,7 +27,7 @@ pub const RenderPipeline = *opaque { }; pub const RenderPipelineDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, layout: ?PipelineLayout, vertex: VertexState, diff --git a/gpu/src/sampler.zig b/gpu/src/sampler.zig index c3e1f889..91924f22 100644 --- a/gpu/src/sampler.zig +++ b/gpu/src/sampler.zig @@ -31,12 +31,12 @@ pub const SamplerBindingType = enum(u32) { }; pub const SamplerBindingLayout = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, type: SamplerBindingType = .undef, }; pub const SamplerDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, address_mode_u: SamplerAddressMode = .clamp_to_edge, address_mode_v: SamplerAddressMode = .clamp_to_edge, diff --git a/gpu/src/shader_module.zig b/gpu/src/shader_module.zig index 17794407..3fce8ea5 100644 --- a/gpu/src/shader_module.zig +++ b/gpu/src/shader_module.zig @@ -21,7 +21,7 @@ pub const ShaderModule = *opaque { }; pub const ShaderModuleDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, }; diff --git a/gpu/src/surface.zig b/gpu/src/surface.zig index 26ca64ab..9c09c326 100644 --- a/gpu/src/surface.zig +++ b/gpu/src/surface.zig @@ -12,7 +12,7 @@ pub const Surface = *opaque { }; pub const SurfaceDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, }; diff --git a/gpu/src/swap_chain.zig b/gpu/src/swap_chain.zig index e558cde5..be943809 100644 --- a/gpu/src/swap_chain.zig +++ b/gpu/src/swap_chain.zig @@ -29,7 +29,7 @@ pub const SwapChain = *opaque { }; pub const SwapChainDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, usage: TextureUsageFlags, format: TextureFormat, diff --git a/gpu/src/texture.zig b/gpu/src/texture.zig index 74e5e03e..456db070 100644 --- a/gpu/src/texture.zig +++ b/gpu/src/texture.zig @@ -215,21 +215,21 @@ pub const TextureUsageFlags = packed struct { }; pub const TextureBindingLayout = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, sample_type: TextureSampleType = .undef, view_dimension: TextureViewDimension = .dimension_undef, multisampled: bool = false, }; pub const TextureDataLayout = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, offset: u64 = 0, bytes_per_row: u32 = copy_stride_undefined, rows_per_image: u32 = copy_stride_undefined, }; pub const TextureDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, usage: TextureUsageFlags, dimension: TextureDimension = .dimension_2d, diff --git a/gpu/src/texture_view.zig b/gpu/src/texture_view.zig index 40a37ff1..0c53a9df 100644 --- a/gpu/src/texture_view.zig +++ b/gpu/src/texture_view.zig @@ -31,7 +31,7 @@ pub const TextureViewDimension = enum(u32) { }; pub const TextureViewDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, label: ?[*:0]const u8 = null, format: TextureFormat = .undef, dimension: TextureViewDimension = .dimension_undef, diff --git a/gpu/src/types.zig b/gpu/src/types.zig index 443d011c..abb3ece1 100644 --- a/gpu/src/types.zig +++ b/gpu/src/types.zig @@ -460,7 +460,7 @@ pub const Origin3D = extern struct { }; pub const CompilationMessage = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, message: ?[*:0]const u8, type: CompilationMessageType, line_num: u64, @@ -470,13 +470,13 @@ pub const CompilationMessage = extern struct { }; pub const ConstantEntry = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, key: [*:0]const u8, value: f64, }; pub const CopyTextureForBrowserOptions = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, flip_y: bool = false, needs_color_space_conversion: bool = false, src_alpha_mode: AlphaMode = .unpremultiplied, @@ -490,7 +490,7 @@ pub const CopyTextureForBrowserOptions = extern struct { }; pub const MultisampleState = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, count: u32 = 1, mask: u32 = 0xFFFFFFFF, alpha_to_coverage_enabled: bool = false, @@ -507,7 +507,7 @@ pub const PrimitiveDepthClipControl = extern struct { }; pub const PrimitiveState = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, topology: PrimitiveTopology = .triangle_list, strip_index_format: IndexFormat = .undef, front_face: FrontFace = .ccw, @@ -527,7 +527,7 @@ pub const StencilFaceState = extern struct { }; pub const StorageTextureBindingLayout = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, access: StorageTextureAccess = .undef, format: TextureFormat = .undef, view_dimension: TextureViewDimension = .dimension_undef, @@ -545,14 +545,14 @@ pub const BlendState = extern struct { }; pub const CompilationInfo = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, message_count: u32, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is. messages: ?[*]const CompilationMessage, }; pub const DepthStencilState = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, format: TextureFormat, depth_write_enabled: bool = false, depth_compare: CompareFunction = .always, @@ -566,13 +566,13 @@ pub const DepthStencilState = extern struct { }; pub const ImageCopyBuffer = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, layout: TextureDataLayout, buffer: Buffer, }; pub const ImageCopyTexture = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, texture: Texture, mip_level: u32 = 0, origin: Origin3D, @@ -580,7 +580,7 @@ pub const ImageCopyTexture = extern struct { }; pub const ProgrammableStageDescriptor = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, module: ShaderModule, entry_point: [*:0]const u8, constant_count: u32 = 0, @@ -604,12 +604,12 @@ pub const RenderPassColorAttachment = extern struct { }; pub const RequiredLimits = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, limits: Limits, }; pub const SupportedLimits = extern struct { - next_in_chain: *ChainedStructOut, + next_in_chain: ?*ChainedStructOut = null, limits: Limits, }; @@ -622,14 +622,14 @@ pub const VertexBufferLayout = extern struct { }; pub const ColorTargetState = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, format: TextureFormat, blend: ?*const BlendState, write_mask: ColorWriteMaskFlags = ColorWriteMaskFlags.all, }; pub const VertexState = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, module: ShaderModule, entry_point: [*:0]const u8, constant_count: u32 = 0, @@ -641,7 +641,7 @@ pub const VertexState = extern struct { }; pub const FragmentState = extern struct { - next_in_chain: *const ChainedStruct, + next_in_chain: ?*const ChainedStruct = null, module: ShaderModule, entry_point: [*:0]const u8, constant_count: u32 = 0,