gpu: add SwapChain.Descriptor.equal ity

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-08 23:45:47 -07:00 committed by Stephen Gutekanst
parent 6ecc6d97a1
commit 0b63ea0ed0

View file

@ -1,3 +1,4 @@
const std = @import("std");
const TextureUsage = @import("texture_usage.zig").TextureUsage;
const TextureFormat = @import("texture_format.zig").TextureFormat;
const PresentMode = @import("present_mode.zig").PresentMode;
@ -34,6 +35,18 @@ pub const Descriptor = struct {
height: u32,
present_mode: PresentMode,
implementation: u64,
pub fn equal(a: *const Descriptor, b: *const Descriptor) bool {
if ((a.label == null) != (b.label == null)) return false;
if (a.label != null and !std.mem.eql(u8, a.label.?, b.label.?)) return false;
if (a.usage != b.usage) return false;
if (a.format != b.format) return false;
if (a.width != b.width) return false;
if (a.height != b.height) return false;
if (a.present_mode != b.present_mode) return false;
if (a.implementation != b.implementation) return false;
return true;
}
};
test "syntax" {