gpu: make ShaderModule.Descriptor.next_in_chain type-safe
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
ce8e062249
commit
ab71c7fd93
2 changed files with 10 additions and 8 deletions
|
|
@ -223,8 +223,4 @@ The following are definitive candidates for helpers we haven't implemented yet:
|
||||||
* `gpu.RenderBundleEncoder.setBindGroup` (slice param)
|
* `gpu.RenderBundleEncoder.setBindGroup` (slice param)
|
||||||
* `gpu.RenderPassEncoder.executeBundles` (slice param)
|
* `gpu.RenderPassEncoder.executeBundles` (slice param)
|
||||||
* `gpu.RenderPassEncoder.setBindGroup` (slice param)
|
* `gpu.RenderPassEncoder.setBindGroup` (slice param)
|
||||||
|
* Other `next_in_chain` extensions (look at dawn.json after the bug to get this documented was fixed)
|
||||||
Descriptors `next_in_chain` extensions could be more type-safe, at least:
|
|
||||||
|
|
||||||
* `gpu.ShaderModule.Descriptor` (WGSL/SPIRV divide simplification)
|
|
||||||
* Others mentioned after the bug we filed on Dawn was fixed (consult dawn.json now)
|
|
||||||
|
|
|
||||||
|
|
@ -5,19 +5,25 @@ const CompilationInfo = @import("types.zig").CompilationInfo;
|
||||||
const Impl = @import("interface.zig").Impl;
|
const Impl = @import("interface.zig").Impl;
|
||||||
|
|
||||||
pub const ShaderModule = opaque {
|
pub const ShaderModule = opaque {
|
||||||
|
pub const Extension = extern union {
|
||||||
|
generic: ?*const ChainedStruct,
|
||||||
|
spirv_descriptor: ?*const SPIRVDescriptor,
|
||||||
|
wgsl_descriptor: ?*const WGSLDescriptor,
|
||||||
|
};
|
||||||
|
|
||||||
pub const Descriptor = extern struct {
|
pub const Descriptor = extern struct {
|
||||||
next_in_chain: ?*const ChainedStruct = null,
|
next_in_chain: Extension = .{ .generic = null },
|
||||||
label: ?[*:0]const u8 = null,
|
label: ?[*:0]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const SPIRVDescriptor = extern struct {
|
pub const SPIRVDescriptor = extern struct {
|
||||||
chain: ChainedStruct,
|
chain: ChainedStruct = .{ .next = null, .s_type = .shader_module_spirv_descriptor },
|
||||||
code_size: u32,
|
code_size: u32,
|
||||||
code: [*]const u32,
|
code: [*]const u32,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const WGSLDescriptor = extern struct {
|
pub const WGSLDescriptor = extern struct {
|
||||||
chain: ChainedStruct,
|
chain: ChainedStruct = .{ .next = null, .s_type = .shader_module_wgsl_descriptor },
|
||||||
source: [*:0]const u8,
|
source: [*:0]const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue