gpu: add BindGroup.Entry buffer/sampler/textureView constructor helpers
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
825a07ac2f
commit
3104083143
1 changed files with 28 additions and 0 deletions
|
|
@ -14,6 +14,34 @@ pub const BindGroup = opaque {
|
|||
size: u64,
|
||||
sampler: ?*Sampler = null,
|
||||
texture_view: ?*TextureView = null,
|
||||
|
||||
/// Helper to create a buffer BindGroup.Entry.
|
||||
pub fn buffer(binding: u32, buf: *Buffer, offset: u64, size: u64) Entry {
|
||||
return .{
|
||||
.binding = binding,
|
||||
.buffer = buf,
|
||||
.offset = offset,
|
||||
.size = size,
|
||||
};
|
||||
}
|
||||
|
||||
/// Helper to create a sampler BindGroup.Entry.
|
||||
pub fn sampler(binding: u32, _sampler: *Sampler) Entry {
|
||||
return .{
|
||||
.binding = binding,
|
||||
.sampler = _sampler,
|
||||
.size = 0,
|
||||
};
|
||||
}
|
||||
|
||||
/// Helper to create a texture view BindGroup.Entry.
|
||||
pub fn textureView(binding: u32, texture_view: *TextureView) Entry {
|
||||
return .{
|
||||
.binding = binding,
|
||||
.texture_view = texture_view,
|
||||
.size = 0,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
pub const Descriptor = extern struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue