gpu: correct nullable slice / _count-ed pointers (bug in Dawn docs)

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-27 09:38:26 -07:00 committed by Stephen Gutekanst
parent 937d0120a3
commit 158ba8db59
8 changed files with 26 additions and 13 deletions

View file

@ -34,5 +34,6 @@ pub const BindGroupDescriptor = extern struct {
label: ?[*:0]const u8 = null, label: ?[*:0]const u8 = null,
layout: BindGroupLayout, layout: BindGroupLayout,
entry_count: u32, entry_count: u32,
entries: [*]const BindGroupEntry, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
entries: ?[*]const BindGroupEntry,
}; };

View file

@ -37,5 +37,6 @@ pub const BindGroupLayoutDescriptor = extern struct {
next_in_chain: *const ChainedStruct, next_in_chain: *const ChainedStruct,
label: ?[*:0]const u8 = null, label: ?[*:0]const u8 = null,
entry_count: u32, entry_count: u32,
entries: [*]const BindGroupLayoutEntry, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
entries: ?[*]const BindGroupLayoutEntry,
}; };

View file

@ -15,7 +15,8 @@ pub const EncoderInternalUsageDescriptor = extern struct {
pub const InstanceDescriptor = extern struct { pub const InstanceDescriptor = extern struct {
chain: ChainedStruct, chain: ChainedStruct,
additional_runtime_search_paths_count: u32, additional_runtime_search_paths_count: u32,
additional_runtime_search_paths: [*]const u8, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
additional_runtime_search_paths: ?[*]const u8,
}; };
pub const TextureInternalUsageDescriptor = extern struct { pub const TextureInternalUsageDescriptor = extern struct {

View file

@ -112,11 +112,13 @@ pub const RenderPassDescriptor = extern struct {
next_in_chain: *const types.ChainedStruct, next_in_chain: *const types.ChainedStruct,
label: ?[*:0]const u8 = null, label: ?[*:0]const u8 = null,
color_attachment_count: u32, color_attachment_count: u32,
color_attachments: [*]const types.RenderPassColorAttachment, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
color_attachments: ?[*]const types.RenderPassColorAttachment,
depth_stencil_attachment: ?[*]const RenderPassDepthStencilAttachment = null, depth_stencil_attachment: ?[*]const RenderPassDepthStencilAttachment = null,
occlusion_query_set: ?query_set.QuerySet, occlusion_query_set: ?query_set.QuerySet,
timestamp_write_count: u32, timestamp_write_count: u32,
timestamp_writes: [*]const RenderPassTimestampWrite, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
timestamp_writes: ?[*]const RenderPassTimestampWrite,
}; };
pub inline fn createInstance(descriptor: ?*const instance.InstanceDescriptor) ?instance.Instance { pub inline fn createInstance(descriptor: ?*const instance.InstanceDescriptor) ?instance.Instance {

View file

@ -20,5 +20,6 @@ pub const PipelineLayoutDescriptor = extern struct {
next_in_chain: *const ChainedStruct, next_in_chain: *const ChainedStruct,
label: ?[*:0]const u8 = null, label: ?[*:0]const u8 = null,
bind_group_layout_count: u32, bind_group_layout_count: u32,
bind_group_layouts: [*]const BindGroupLayout, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
bind_group_layouts: ?[*]const BindGroupLayout,
}; };

View file

@ -34,6 +34,7 @@ pub const QuerySetDescriptor = extern struct {
label: ?[*:0]const u8 = null, label: ?[*:0]const u8 = null,
type: QueryType, type: QueryType,
count: u32, count: u32,
pipeline_statistics: [*]const PipelineStatisticName, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
pipeline_statistics: ?[*]const PipelineStatisticName,
pipeline_statistics_count: u32, pipeline_statistics_count: u32,
}; };

View file

@ -238,5 +238,6 @@ pub const TextureDescriptor = extern struct {
mip_level_count: u32 = 1, mip_level_count: u32 = 1,
sample_count: u32 = 1, sample_count: u32 = 1,
view_format_count: u32 = 0, view_format_count: u32 = 0,
view_formats: [*]const TextureFormat, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
view_formats: ?[*]const TextureFormat,
}; };

View file

@ -542,7 +542,8 @@ pub const BlendState = extern struct {
pub const CompilationInfo = extern struct { pub const CompilationInfo = extern struct {
next_in_chain: *const ChainedStruct, next_in_chain: *const ChainedStruct,
message_count: u32, message_count: u32,
messages: [*]const CompilationMessage, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
messages: ?[*]const CompilationMessage,
}; };
pub const DepthStencilState = extern struct { pub const DepthStencilState = extern struct {
@ -578,7 +579,8 @@ pub const ProgrammableStageDescriptor = extern struct {
module: ShaderModule, module: ShaderModule,
entry_point: [*:0]const u8, entry_point: [*:0]const u8,
constant_count: u32, constant_count: u32,
constants: [*]const ConstantEntry, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
constants: ?[*]const ConstantEntry,
}; };
pub const RenderPassColorAttachment = extern struct { pub const RenderPassColorAttachment = extern struct {
@ -604,7 +606,8 @@ pub const VertexBufferLayout = extern struct {
array_stride: u64, array_stride: u64,
step_mode: VertexStepMode, step_mode: VertexStepMode,
attribute_count: u32, attribute_count: u32,
attributes: [*]const VertexAttribute, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
attributes: ?[*]const VertexAttribute,
}; };
pub const ColorTargetState = extern struct { pub const ColorTargetState = extern struct {
@ -619,9 +622,11 @@ pub const VertexState = extern struct {
module: ShaderModule, module: ShaderModule,
entry_point: [*:0]const u8, entry_point: [*:0]const u8,
constant_count: u32, constant_count: u32,
constants: [*]const ConstantEntry, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
constants: ?[*]const ConstantEntry,
buffer_count: u32, buffer_count: u32,
buffers: [*]const VertexBufferLayout, // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
buffers: ?[*]const VertexBufferLayout,
}; };
pub const FragmentState = extern struct { pub const FragmentState = extern struct {