gpu: correct alignment casts of callback helpers

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-12 00:03:46 -07:00 committed by Stephen Gutekanst
parent 6357f3a767
commit 4429be4f5f
4 changed files with 72 additions and 72 deletions

View file

@ -18,75 +18,75 @@ pub const BindGroupLayout = opaque {
texture: Texture.BindingLayout = .{},
storage_texture: StorageTextureBindingLayout = .{},
/// Helper to create a buffer BindGroupLayout.Entry.
pub fn buffer(
binding: u32,
visibility: ShaderStageFlags,
binding_type: Buffer.BindingType,
has_dynamic_offset: bool,
min_binding_size: u64,
) Entry {
return .{
.binding = binding,
.visibility = visibility,
.buffer = .{
.type = binding_type,
.has_dynamic_offset = has_dynamic_offset,
.min_binding_size = min_binding_size,
},
};
}
/// Helper to create a buffer BindGroupLayout.Entry.
pub fn buffer(
binding: u32,
visibility: ShaderStageFlags,
binding_type: Buffer.BindingType,
has_dynamic_offset: bool,
min_binding_size: u64,
) Entry {
return .{
.binding = binding,
.visibility = visibility,
.buffer = .{
.type = binding_type,
.has_dynamic_offset = has_dynamic_offset,
.min_binding_size = min_binding_size,
},
};
}
/// Helper to create a sampler BindGroupLayout.Entry.
pub fn sampler(
binding: u32,
visibility: ShaderStageFlags,
binding_type: Sampler.BindingType,
) Entry {
return .{
.binding = binding,
.visibility = visibility,
.sampler = .{ .type = binding_type },
};
}
/// Helper to create a sampler BindGroupLayout.Entry.
pub fn sampler(
binding: u32,
visibility: ShaderStageFlags,
binding_type: Sampler.BindingType,
) Entry {
return .{
.binding = binding,
.visibility = visibility,
.sampler = .{ .type = binding_type },
};
}
/// Helper to create a texture BindGroupLayout.Entry.
pub fn texture(
binding: u32,
visibility: ShaderStageFlags,
sample_type: Texture.SampleType,
view_dimension: TextureView.Dimension,
multisampled: bool,
) Entry {
return .{
.binding = binding,
.visibility = visibility,
.texture = .{
.sample_type = sample_type,
.view_dimension = view_dimension,
.multisampled = multisampled,
},
};
}
/// Helper to create a texture BindGroupLayout.Entry.
pub fn texture(
binding: u32,
visibility: ShaderStageFlags,
sample_type: Texture.SampleType,
view_dimension: TextureView.Dimension,
multisampled: bool,
) Entry {
return .{
.binding = binding,
.visibility = visibility,
.texture = .{
.sample_type = sample_type,
.view_dimension = view_dimension,
.multisampled = multisampled,
},
};
}
/// Helper to create a storage texture BindGroupLayout.Entry.
pub fn storageTexture(
binding: u32,
visibility: ShaderStageFlags,
access: StorageTextureAccess,
format: Texture.Format,
view_dimension: TextureView.Dimension,
) Entry {
return .{
.binding = binding,
.visibility = visibility,
.storage_texture = .{
.access = access,
.format = format,
.view_dimension = view_dimension,
},
};
}
/// Helper to create a storage texture BindGroupLayout.Entry.
pub fn storageTexture(
binding: u32,
visibility: ShaderStageFlags,
access: StorageTextureAccess,
format: Texture.Format,
view_dimension: TextureView.Dimension,
) Entry {
return .{
.binding = binding,
.visibility = visibility,
.storage_texture = .{
.access = access,
.format = format,
.view_dimension = view_dimension,
},
};
}
};
pub const Descriptor = extern struct {