From 128f87a3fdd447c64eb3920a9a0e70db899ea141 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sat, 16 Jul 2022 00:02:20 -0700 Subject: [PATCH] gpu: add ExternalTexture.Descriptor Signed-off-by: Stephen Gutekanst --- gpu/TODO-webgpu.h | 12 ------------ gpu/src/external_texture.zig | 13 +++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/gpu/TODO-webgpu.h b/gpu/TODO-webgpu.h index 14c2d7e0..90461e2f 100644 --- a/gpu/TODO-webgpu.h +++ b/gpu/TODO-webgpu.h @@ -1,15 +1,3 @@ -typedef struct WGPUExternalTextureDescriptor { - next_in_chain: *const ChainedStruct, - label: ?[*:0]const u8 = null, - WGPUTextureView plane0; - WGPUTextureView plane1; // nullable - do_yuv_to_rgb_conversion_only: bool, - float const * yuvToRgbConversionMatrix; // nullable - float const * srcTransferFunctionParameters; - float const * dstTransferFunctionParameters; - float const * gamutConversionMatrix; -} WGPUExternalTextureDescriptor; - typedef struct WGPUInstanceDescriptor { next_in_chain: *const ChainedStruct, } WGPUInstanceDescriptor; diff --git a/gpu/src/external_texture.zig b/gpu/src/external_texture.zig index 92988c37..daac3d13 100644 --- a/gpu/src/external_texture.zig +++ b/gpu/src/external_texture.zig @@ -1,4 +1,5 @@ pub const ChainedStruct = @import("types.zig").ChainedStruct; +pub const TextureView = @import("texture_view.zig").TextureView; pub const ExternalTexture = enum(usize) { _, @@ -14,4 +15,16 @@ pub const ExternalTexture = enum(usize) { pub const BindingLayout = extern struct { chain: ChainedStruct, }; + + pub const Descriptor = extern struct { + next_in_chain: *const ChainedStruct, + label: ?[*:0]const u8 = null, + plane0: TextureView, + plane1: TextureView = TextureView.none, // nullable + do_yuv_to_rgb_conversion_only: bool, + yuv_to_rgb_conversion_matrix: ?[*]const f32 = null, // nullable + src_transform_function_parameters: [*]const f32, + dst_transform_function_parameters: [*]const f32, + gamut_conversion_matrix: [*]const f32, + }; };