gpu: add Buffer.Usage flagset
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
3365320f64
commit
e218eef6cb
2 changed files with 28 additions and 16 deletions
|
|
@ -1,21 +1,5 @@
|
|||
typedef uint32_t WGPUFlags;
|
||||
|
||||
typedef enum WGPUBufferUsage {
|
||||
WGPUBufferUsage_None = 0x00000000,
|
||||
WGPUBufferUsage_MapRead = 0x00000001,
|
||||
WGPUBufferUsage_MapWrite = 0x00000002,
|
||||
WGPUBufferUsage_CopySrc = 0x00000004,
|
||||
WGPUBufferUsage_CopyDst = 0x00000008,
|
||||
WGPUBufferUsage_Index = 0x00000010,
|
||||
WGPUBufferUsage_Vertex = 0x00000020,
|
||||
WGPUBufferUsage_Uniform = 0x00000040,
|
||||
WGPUBufferUsage_Storage = 0x00000080,
|
||||
WGPUBufferUsage_Indirect = 0x00000100,
|
||||
WGPUBufferUsage_QueryResolve = 0x00000200,
|
||||
WGPUBufferUsage_Force32 = 0x7FFFFFFF
|
||||
} WGPUBufferUsage;
|
||||
typedef WGPUFlags WGPUBufferUsageFlags;
|
||||
|
||||
typedef enum WGPUColorWriteMask {
|
||||
WGPUColorWriteMask_None = 0x00000000,
|
||||
WGPUColorWriteMask_Red = 0x00000001,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue