gpu: make all next_in_chain fields optional, default to null

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-27 10:25:03 -07:00 committed by Stephen Gutekanst
parent 9fccd0806c
commit 41fe42e366
23 changed files with 44 additions and 44 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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.

View file

@ -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,

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,
};

View file

@ -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.

View file

@ -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,

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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.

View file

@ -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,

View file

@ -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,

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,