gpu: add Buffer.Usage flagset

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-11 08:47:55 -07:00 committed by Stephen Gutekanst
parent 3365320f64
commit e218eef6cb
2 changed files with 28 additions and 16 deletions

View file

@ -15,3 +15,31 @@ pub const MapAsyncStatus = enum(u32) {
destroyed_before_callback = 0x00000004,
unmapped_before_callback = 0x00000005,
};
pub const Usage = packed struct {
map_read: bool = false,
map_write: bool = false,
copy_src: bool = false,
copy_dst: bool = false,
index: bool = false,
vertex: bool = false,
uniform: bool = false,
storage: bool = false,
indirect: bool = false,
query_resolve: bool = false,
_pad0: u2 = 0,
_pad1: u8 = 0,
_pad2: u16 = 0,
comptime {
std.debug.assert(
@sizeOf(@This()) == @sizeOf(u32) and
@bitSizeOf(@This()) == @bitSizeOf(u32),
);
}
pub fn equal(a: Usage, b: Usage) bool {
return @bitCast(a, u32) == @bitCast(b, u32);
}
};