gpu: add type-safety for chaining ExternalTexture.BindingLayout

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-16 20:36:12 -07:00
parent 1f0b50ba13
commit 8826cfb7a0
2 changed files with 7 additions and 2 deletions

View file

@ -6,11 +6,17 @@ const Texture = @import("texture.zig").Texture;
const TextureView = @import("texture_view.zig").TextureView;
const StorageTextureBindingLayout = @import("types.zig").StorageTextureBindingLayout;
const StorageTextureAccess = @import("types.zig").StorageTextureAccess;
const ExternalTexture = @import("external_texture.zig").ExternalTexture;
const Impl = @import("interface.zig").Impl;
pub const BindGroupLayout = opaque {
pub const Entry = extern struct {
next_in_chain: ?*const ChainedStruct = null,
pub const NextInChain = extern union {
generic: ?*const ChainedStruct,
external_texture_binding_layout: *const ExternalTexture.BindingLayout,
};
next_in_chain: NextInChain = .{ .generic = null },
binding: u32,
visibility: ShaderStageFlags,
buffer: Buffer.BindingLayout = .{},

View file

@ -8,7 +8,6 @@ pub const ExternalTexture = opaque {
external_texture: *ExternalTexture,
};
/// TODO: Can be chained in gpu.BindGroupLayout.Entry
pub const BindingLayout = extern struct {
chain: ChainedStruct = .{ .next = null, .s_type = .external_texture_binding_layout },
};