From d19c868fb6b3697533c8e99b6c17ed3dc75489f1 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Fri, 11 Mar 2022 16:25:39 -0700 Subject: [PATCH] gpu: add PipelineLayout.Descriptor Signed-off-by: Stephen Gutekanst --- gpu/src/ExternalTexture.zig | 11 +++++++++++ gpu/src/PipelineLayout.zig | 8 ++++++++ gpu/src/TODO | 19 +++++-------------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/gpu/src/ExternalTexture.zig b/gpu/src/ExternalTexture.zig index 0db0ca8a..b9c877c2 100644 --- a/gpu/src/ExternalTexture.zig +++ b/gpu/src/ExternalTexture.zig @@ -1,3 +1,6 @@ +const Texture = @import("Texture.zig"); +const PredefinedColorSpace = @import("enums.zig").PredefinedColorSpace; + const ExternalTexture = @This(); /// The type erased pointer to the ExternalTexture implementation @@ -28,9 +31,17 @@ pub inline fn destroy(texture: ExternalTexture) void { texture.vtable.destroy(texture.ptr); } +pub const Descriptor = struct { + label: ?[*:0]const u8 = null, + plane0: Texture.View, + plane1: Texture.View, + color_space: PredefinedColorSpace, +}; + test "syntax" { _ = VTable; _ = reference; _ = release; _ = destroy; + _ = Descriptor; } diff --git a/gpu/src/PipelineLayout.zig b/gpu/src/PipelineLayout.zig index 6a4d29e1..a0fd009b 100644 --- a/gpu/src/PipelineLayout.zig +++ b/gpu/src/PipelineLayout.zig @@ -1,3 +1,5 @@ +const BindGroup = @import("BindGroup.zig"); + const PipelineLayout = @This(); /// The type erased pointer to the PipelineLayout implementation @@ -23,8 +25,14 @@ pub inline fn setLabel(qset: PipelineLayout, label: [:0]const u8) void { qset.vtable.setLabel(qset.ptr, label); } +pub const Descriptor = struct { + label: ?[*:0]const u8 = null, + bind_group_layouts: []const BindGroup.Layout, +}; + test "syntax" { _ = VTable; _ = reference; _ = release; + _ = Descriptor; } diff --git a/gpu/src/TODO b/gpu/src/TODO index 3ad0dce8..fe3caee3 100644 --- a/gpu/src/TODO +++ b/gpu/src/TODO @@ -21,28 +21,32 @@ typedef struct WGPUChainedStructOut { - +// TODO: Dawn specific typedef struct WGPUDawnCacheDeviceDescriptor { WGPUChainedStruct chain; char const * isolationKey; } WGPUDawnCacheDeviceDescriptor; +// TODO: Dawn specific typedef struct WGPUDawnEncoderInternalUsageDescriptor { WGPUChainedStruct chain; bool useInternalUsages; } WGPUDawnEncoderInternalUsageDescriptor; +// TODO: Dawn specific typedef struct WGPUDawnInstanceDescriptor { WGPUChainedStruct chain; uint32_t additionalRuntimeSearchPathsCount; const char* const * additionalRuntimeSearchPaths; } WGPUDawnInstanceDescriptor; +// TODO: Dawn specific typedef struct WGPUDawnTextureInternalUsageDescriptor { WGPUChainedStruct chain; WGPUTextureUsageFlags internalUsage; } WGPUDawnTextureInternalUsageDescriptor; +// TODO: Dawn specific typedef struct WGPUDawnTogglesDeviceDescriptor { WGPUChainedStruct chain; uint32_t forceEnabledTogglesCount; @@ -51,20 +55,7 @@ typedef struct WGPUDawnTogglesDeviceDescriptor { const char* const * forceDisabledToggles; } WGPUDawnTogglesDeviceDescriptor; -typedef struct WGPUExternalTextureDescriptor { - WGPUChainedStruct const * nextInChain; - char const * label; - WGPUTextureView plane0; - WGPUTextureView plane1; - WGPUPredefinedColorSpace colorSpace; -} WGPUExternalTextureDescriptor; -typedef struct WGPUPipelineLayoutDescriptor { - WGPUChainedStruct const * nextInChain; - char const * label; - uint32_t bindGroupLayoutCount; - WGPUBindGroupLayout const * bindGroupLayouts; -} WGPUPipelineLayoutDescriptor; typedef struct WGPUQuerySetDescriptor { WGPUChainedStruct const * nextInChain;