From 2d815daca26b4757e7ecb788b597b0dfdfcb78fb Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Wed, 9 Mar 2022 09:49:57 -0700 Subject: [PATCH] gpu: note how to use @tagName with enums Signed-off-by: Stephen Gutekanst --- gpu/src/enums.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gpu/src/enums.zig b/gpu/src/enums.zig index c9f32f26..3eba3000 100644 --- a/gpu/src/enums.zig +++ b/gpu/src/enums.zig @@ -1,3 +1,5 @@ +const std = @import("std"); + pub const Feature = enum(u32) { depth24_unorm_stencil8 = 0x00000002, depth32_float_stencil8 = 0x00000003, @@ -14,14 +16,16 @@ pub const Feature = enum(u32) { dawn_native = 0x000003ec, }; -// TODO: add featureName stringer method - const AddressMode = enum(u32) { repeat = 0x00000000, mirror_repeat = 0x00000001, clamp_to_edge = 0x00000002, }; +test "name" { + try std.testing.expect(std.mem.eql(u8, @tagName(Feature.timestamp_query), "timestamp_query")); +} + test "syntax" { _ = Feature; _ = AddressMode;