gpu: implement Adapter type / backend type -> name conversion

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-07 11:28:46 -07:00 committed by Stephen Gutekanst
parent f849e03443
commit 5581584717

View file

@ -81,6 +81,15 @@ pub const Type = enum(u32) {
unknown,
};
pub fn typeName(t: Type) []const u8 {
return switch (t) {
.discrete_gpu => "Discrete GPU",
.integrated_gpu => "Integrated GPU",
.cpu => "CPU",
.unknown => "Unknown",
};
}
// TODO: docs
pub const BackendType = enum(u32) {
nul,
@ -93,6 +102,19 @@ pub const BackendType = enum(u32) {
opengles,
};
pub fn backendTypeName(t: BackendType) []const u8 {
return switch (t) {
.nul => "Null",
.webgpu => "WebGPU",
.d3d11 => "D3D11",
.d3d12 => "D3D12",
.metal => "Metal",
.vulkan => "Vulkan",
.opengl => "OpenGL",
.opengles => "OpenGLES",
};
}
test "syntax" {
_ = VTable;
_ = hasFeature;