From 937d0120a30c9ea7f90e8c4d35f9c214225dcab7 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Wed, 27 Jul 2022 09:22:39 -0700 Subject: [PATCH] gpu: update defaults/optionality for ColorTargetState/VertexState Signed-off-by: Stephen Gutekanst --- gpu/src/external_texture.zig | 2 +- gpu/src/main.zig | 2 +- gpu/src/types.zig | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gpu/src/external_texture.zig b/gpu/src/external_texture.zig index c24bd170..2d726e3b 100644 --- a/gpu/src/external_texture.zig +++ b/gpu/src/external_texture.zig @@ -35,7 +35,7 @@ pub const ExternalTextureDescriptor = extern struct { plane0: TextureView, plane1: ?TextureView, do_yuv_to_rgb_conversion_only: bool, - yuv_to_rgb_conversion_matrix: ?[*]const f32 = null, // nullable + yuv_to_rgb_conversion_matrix: ?[*]const f32 = null, src_transform_function_parameters: [*]const f32, dst_transform_function_parameters: [*]const f32, gamut_conversion_matrix: [*]const f32, diff --git a/gpu/src/main.zig b/gpu/src/main.zig index f06a0690..e9f6b1f8 100644 --- a/gpu/src/main.zig +++ b/gpu/src/main.zig @@ -113,7 +113,7 @@ pub const RenderPassDescriptor = extern struct { label: ?[*:0]const u8 = null, color_attachment_count: u32, color_attachments: [*]const types.RenderPassColorAttachment, - depth_stencil_attachment: ?[*]const RenderPassDepthStencilAttachment = null, // nullable + depth_stencil_attachment: ?[*]const RenderPassDepthStencilAttachment = null, occlusion_query_set: ?query_set.QuerySet, timestamp_write_count: u32, timestamp_writes: [*]const RenderPassTimestampWrite, diff --git a/gpu/src/types.zig b/gpu/src/types.zig index f8781ceb..3c530026 100644 --- a/gpu/src/types.zig +++ b/gpu/src/types.zig @@ -610,8 +610,8 @@ pub const VertexBufferLayout = extern struct { pub const ColorTargetState = extern struct { next_in_chain: *const ChainedStruct, format: TextureFormat, - blend: ?*const BlendState = null, - write_mask: ColorWriteMaskFlags, + blend: ?*const BlendState, + write_mask: ColorWriteMaskFlags = ColorWriteMaskFlags.all, }; pub const VertexState = extern struct { @@ -628,10 +628,12 @@ pub const FragmentState = extern struct { next_in_chain: *const ChainedStruct, module: ShaderModule, entry_point: [*:0]const u8, - constant_count: u32, - constants: [*]const ConstantEntry, + constant_count: u32 = 0, + // TODO: file a bug on Dawn, this is not marked as nullable but in fact is. + constants: ?[*]const ConstantEntry = null, target_count: u32, - targets: [*]const ColorTargetState, + // TODO: file a bug on Dawn, this is not marked as nullable but in fact is. + targets: ?[*]const ColorTargetState, }; test "BackendType name" {