gpu: add MapMode flagset
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
176ff4c72b
commit
17f3c174dc
3 changed files with 22 additions and 10 deletions
|
|
@ -1,13 +1,5 @@
|
||||||
typedef uint32_t WGPUFlags;
|
typedef uint32_t WGPUFlags;
|
||||||
|
|
||||||
typedef enum WGPUMapMode {
|
|
||||||
WGPUMapMode_None = 0x00000000,
|
|
||||||
WGPUMapMode_Read = 0x00000001,
|
|
||||||
WGPUMapMode_Write = 0x00000002,
|
|
||||||
WGPUMapMode_Force32 = 0x7FFFFFFF
|
|
||||||
} WGPUMapMode;
|
|
||||||
typedef WGPUFlags WGPUMapModeFlags;
|
|
||||||
|
|
||||||
typedef enum WGPUShaderStage {
|
typedef enum WGPUShaderStage {
|
||||||
WGPUShaderStage_None = 0x00000000,
|
WGPUShaderStage_None = 0x00000000,
|
||||||
WGPUShaderStage_Vertex = 0x00000001,
|
WGPUShaderStage_Vertex = 0x00000001,
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,6 @@ pub const Usage = packed struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn equal(a: Usage, b: Usage) bool {
|
pub fn equal(a: Usage, b: Usage) bool {
|
||||||
return @truncate(u10, @bitCast(u32, a)) == @truncate(u10, @bitCast(u32, b)) ;
|
return @truncate(u10, @bitCast(u32, a)) == @truncate(u10, @bitCast(u32, b));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,27 @@ pub const ColorWriteMask = packed struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn equal(a: ColorWriteMask, b: ColorWriteMask) bool {
|
pub fn equal(a: ColorWriteMask, b: ColorWriteMask) bool {
|
||||||
return @truncate(u4, @bitCast(u32, a)) == @truncate(u4, @bitCast(u32, b)) ;
|
return @truncate(u4, @bitCast(u32, a)) == @truncate(u4, @bitCast(u32, b));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const MapMode = packed struct {
|
||||||
|
read: bool = false,
|
||||||
|
write: bool = false,
|
||||||
|
|
||||||
|
_padding: u30 = 0,
|
||||||
|
|
||||||
|
comptime {
|
||||||
|
std.debug.assert(
|
||||||
|
@sizeOf(@This()) == @sizeOf(u32) and
|
||||||
|
@bitSizeOf(@This()) == @bitSizeOf(u32),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const undef = MapMode{};
|
||||||
|
|
||||||
|
pub fn equal(a: ColorWriteMask, b: ColorWriteMask) bool {
|
||||||
|
return @truncate(u2, @bitCast(u32, a)) == @truncate(u2, @bitCast(u32, b));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue