From 176ff4c72b4e4bd03ced70a86e5dac056082d0d3 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Mon, 11 Jul 2022 08:54:56 -0700 Subject: [PATCH] gpu: correct flagsets Signed-off-by: Stephen Gutekanst --- gpu/src/Buffer.zig | 8 ++++---- gpu/src/types.zig | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gpu/src/Buffer.zig b/gpu/src/Buffer.zig index de9386ad..b1153828 100644 --- a/gpu/src/Buffer.zig +++ b/gpu/src/Buffer.zig @@ -1,3 +1,5 @@ +const std = @import("std"); + ptr: *anyopaque, pub const BindingType = enum(u32) { @@ -28,9 +30,7 @@ pub const Usage = packed struct { indirect: bool = false, query_resolve: bool = false, - _pad0: u2 = 0, - _pad1: u8 = 0, - _pad2: u16 = 0, + _padding: u22 = 0, comptime { std.debug.assert( @@ -40,6 +40,6 @@ pub const Usage = packed struct { } pub fn equal(a: Usage, b: Usage) bool { - return @bitCast(a, u32) == @bitCast(b, u32); + return @truncate(u10, @bitCast(u32, a)) == @truncate(u10, @bitCast(u32, b)) ; } }; diff --git a/gpu/src/types.zig b/gpu/src/types.zig index ec74ab4a..bd2f3223 100644 --- a/gpu/src/types.zig +++ b/gpu/src/types.zig @@ -1,4 +1,5 @@ -const testing = @import("std").testing; +const std = @import("std"); +const testing = std.testing; pub const AlphaMode = enum(u32) { premultiplied = 0x00000000, @@ -301,9 +302,7 @@ pub const ColorWriteMask = packed struct { blue: bool = false, alpha: bool = false, - _pad0: u4 = 0, - _pad1: u8 = 0, - _pad2: u16 = 0, + _padding: u28 = 0, comptime { std.debug.assert( @@ -320,7 +319,7 @@ pub const ColorWriteMask = packed struct { }; pub fn equal(a: ColorWriteMask, b: ColorWriteMask) bool { - return @bitCast(a, u32) == @bitCast(b, u32); + return @truncate(u4, @bitCast(u32, a)) == @truncate(u4, @bitCast(u32, b)) ; } };