gpu: add Texture.Usage flagset

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-11 09:02:20 -07:00 committed by Stephen Gutekanst
parent 72d9a325fe
commit 5ec7853d52
3 changed files with 28 additions and 12 deletions

View file

@ -1,3 +1,5 @@
const std = @import("std");
ptr: *anyopaque,
pub const Aspect = enum(u32) {
@ -128,3 +130,27 @@ pub const SampleType = enum(u32) {
sint = 0x00000004,
uint = 0x00000005,
};
pub const Usage = packed struct {
copy_src: bool = false,
copy_dst: bool = false,
texture_binding: bool = false,
storage_binding: bool = false,
render_attachment: bool = false,
present: bool = false,
_padding: u26 = 0,
comptime {
std.debug.assert(
@sizeOf(@This()) == @sizeOf(u32) and
@bitSizeOf(@This()) == @bitSizeOf(u32),
);
}
pub const none = Usage{};
pub fn equal(a: Usage, b: Usage) bool {
return @truncate(u6, @bitCast(u32, a)) == @truncate(u6, @bitCast(u32, b));
}
};