From 3f51ef6fde78bf38074f383e2ea12b3ba56555c9 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Thu, 24 Nov 2022 09:55:18 -0700 Subject: [PATCH] gpu: make it easier to query Device/Adapter limits correctly Signed-off-by: Stephen Gutekanst --- libs/gpu/src/types.zig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/gpu/src/types.zig b/libs/gpu/src/types.zig index 5c2ef05c..83460a05 100644 --- a/libs/gpu/src/types.zig +++ b/libs/gpu/src/types.zig @@ -707,9 +707,17 @@ pub const RequiredLimits = extern struct { limits: Limits, }; +/// Used to query limits from a Device or Adapter. Can be used as follows: +/// +/// ``` +/// var limits: gpu.SupportedLimits = .{}; +/// if (!adapter.getLimits(&limits)) @panic("unsupported options"); +/// ``` +/// +/// Note that `getLimits` can only fail if `next_in_chain` options are invalid. pub const SupportedLimits = extern struct { next_in_chain: ?*ChainedStructOut = null, - limits: Limits, + limits: Limits = undefined, }; pub const VertexBufferLayout = extern struct {