From 425eb81019670611661350947ab3cf47ca5b4bee Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Thu, 14 Jul 2022 23:42:26 -0700 Subject: [PATCH] gpu: translate Adapter.Properties Signed-off-by: Stephen Gutekanst --- gpu/TODO-webgpu.h | 12 ------------ gpu/src/Adapter.zig | 13 +++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/gpu/TODO-webgpu.h b/gpu/TODO-webgpu.h index ecea952a..3b7ebb1b 100644 --- a/gpu/TODO-webgpu.h +++ b/gpu/TODO-webgpu.h @@ -1,15 +1,3 @@ -typedef struct WGPUAdapterProperties { - WGPUChainedStructOut * nextInChain; - uint32_t vendorID; - char const * vendorName; - char const * architecture; - uint32_t deviceID; - char const * name; - char const * driverDescription; - WGPUAdapterType adapterType; - WGPUBackendType backendType; -} WGPUAdapterProperties; - typedef struct WGPUBindGroupEntry { WGPUChainedStruct const * nextInChain; uint32_t binding; diff --git a/gpu/src/Adapter.zig b/gpu/src/Adapter.zig index a146828e..4431094d 100644 --- a/gpu/src/Adapter.zig +++ b/gpu/src/Adapter.zig @@ -1,4 +1,5 @@ const testing = @import("std").testing; +const ChainedStructOut = @import("types.zig").ChainedStructOut; ptr: *anyopaque, @@ -18,6 +19,18 @@ pub const Type = enum(u32) { } }; +pub const Properties = extern struct { + next_in_chain: *ChainedStructOut, + vendor_id: u32, + vendor_name: [*:0]const u8, + architecture: [*:0]const u8, + device_id: u32, + name: [*:0]const u8, + driver_description: [*:0]const u8, + adapter_type: Type, + backend_type: Type, +}; + test "Adapter.Type name" { try testing.expectEqualStrings("Discrete GPU", Type.discrete_gpu.name()); }