gpu: internalize ExternalTexture types
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
0a69ef98fa
commit
09bbc8458a
3 changed files with 29 additions and 30 deletions
|
|
@ -6,7 +6,6 @@ const Buffer = @import("buffer.zig").Buffer;
|
|||
const CommandEncoder = @import("command_encoder.zig").CommandEncoder;
|
||||
const ComputePipeline = @import("compute_pipeline.zig").ComputePipeline;
|
||||
const ExternalTexture = @import("external_texture.zig").ExternalTexture;
|
||||
const ExternalTextureDescriptor = @import("external_texture.zig").ExternalTextureDescriptor;
|
||||
const PipelineLayout = @import("pipeline_layout.zig").PipelineLayout;
|
||||
const PipelineLayoutDescriptor = @import("pipeline_layout.zig").PipelineLayoutDescriptor;
|
||||
const QuerySet = @import("query_set.zig").QuerySet;
|
||||
|
|
@ -89,7 +88,7 @@ pub const Device = opaque {
|
|||
return Impl.deviceCreateErrorExternalTexture(device);
|
||||
}
|
||||
|
||||
pub inline fn createExternalTexture(device: *Device, external_texture_descriptor: *const ExternalTextureDescriptor) *ExternalTexture {
|
||||
pub inline fn createExternalTexture(device: *Device, external_texture_descriptor: *const ExternalTexture.Descriptor) *ExternalTexture {
|
||||
return Impl.deviceCreateExternalTexture(device, external_texture_descriptor);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,31 @@ const TextureView = @import("texture_view.zig").TextureView;
|
|||
const Impl = @import("interface.zig").Impl;
|
||||
|
||||
pub const ExternalTexture = opaque {
|
||||
pub const BindingEntry = extern struct {
|
||||
chain: ChainedStruct,
|
||||
external_texture: *ExternalTexture,
|
||||
};
|
||||
|
||||
pub const BindingLayout = extern struct {
|
||||
chain: ChainedStruct,
|
||||
};
|
||||
|
||||
pub const Descriptor = extern struct {
|
||||
next_in_chain: ?*const ChainedStruct = null,
|
||||
label: ?[*:0]const u8 = null,
|
||||
plane0: *TextureView,
|
||||
plane1: ?*TextureView,
|
||||
do_yuv_to_rgb_conversion_only: bool = false,
|
||||
// TODO: dawn.json says length 12, does it mean array length?
|
||||
yuv_to_rgb_conversion_matrix: ?[*]const f32,
|
||||
// TODO: dawn.json says length 7, does it mean array length?
|
||||
src_transform_function_parameters: [*]const f32,
|
||||
// TODO: dawn.json says length 7, does it mean array length?
|
||||
dst_transform_function_parameters: [*]const f32,
|
||||
// TODO: dawn.json says length 9, does it mean array length?
|
||||
gamut_conversion_matrix: [*]const f32,
|
||||
};
|
||||
|
||||
pub inline fn destroy(external_texture: *ExternalTexture) void {
|
||||
Impl.externalTextureDestroy(external_texture);
|
||||
}
|
||||
|
|
@ -19,28 +44,3 @@ pub const ExternalTexture = opaque {
|
|||
Impl.externalTextureRelease(external_texture);
|
||||
}
|
||||
};
|
||||
|
||||
pub const ExternalTextureBindingEntry = extern struct {
|
||||
chain: ChainedStruct,
|
||||
external_texture: *ExternalTexture,
|
||||
};
|
||||
|
||||
pub const ExternalTextureBindingLayout = extern struct {
|
||||
chain: ChainedStruct,
|
||||
};
|
||||
|
||||
pub const ExternalTextureDescriptor = extern struct {
|
||||
next_in_chain: ?*const ChainedStruct = null,
|
||||
label: ?[*:0]const u8 = null,
|
||||
plane0: *TextureView,
|
||||
plane1: ?*TextureView,
|
||||
do_yuv_to_rgb_conversion_only: bool = false,
|
||||
// TODO: dawn.json says length 12, does it mean array length?
|
||||
yuv_to_rgb_conversion_matrix: ?[*]const f32,
|
||||
// TODO: dawn.json says length 7, does it mean array length?
|
||||
src_transform_function_parameters: [*]const f32,
|
||||
// TODO: dawn.json says length 7, does it mean array length?
|
||||
dst_transform_function_parameters: [*]const f32,
|
||||
// TODO: dawn.json says length 9, does it mean array length?
|
||||
gamut_conversion_matrix: [*]const f32,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ pub fn Interface(comptime T: type) type {
|
|||
assertDecl(T, "deviceCreateComputePipelineAsync", fn (device: *gpu.Device, descriptor: *const gpu.ComputePipeline.Descriptor, callback: gpu.CreateComputePipelineAsyncCallback, userdata: *anyopaque) callconv(.Inline) void);
|
||||
assertDecl(T, "deviceCreateErrorBuffer", fn (device: *gpu.Device) callconv(.Inline) *gpu.Buffer);
|
||||
assertDecl(T, "deviceCreateErrorExternalTexture", fn (device: *gpu.Device) callconv(.Inline) *gpu.ExternalTexture);
|
||||
assertDecl(T, "deviceCreateExternalTexture", fn (device: *gpu.Device, external_texture_descriptor: *const gpu.ExternalTextureDescriptor) callconv(.Inline) *gpu.ExternalTexture);
|
||||
assertDecl(T, "deviceCreateExternalTexture", fn (device: *gpu.Device, external_texture_descriptor: *const gpu.ExternalTexture.Descriptor) callconv(.Inline) *gpu.ExternalTexture);
|
||||
assertDecl(T, "deviceCreatePipelineLayout", fn (device: *gpu.Device, pipeline_layout_descriptor: *const gpu.PipelineLayoutDescriptor) callconv(.Inline) *gpu.PipelineLayout);
|
||||
assertDecl(T, "deviceCreateQuerySet", fn (device: *gpu.Device, descriptor: *const gpu.QuerySetDescriptor) callconv(.Inline) *gpu.QuerySet);
|
||||
assertDecl(T, "deviceCreateRenderBundleEncoder", fn (device: *gpu.Device, descriptor: *const gpu.RenderBundleEncoderDescriptor) callconv(.Inline) *gpu.RenderBundleEncoder);
|
||||
|
|
@ -589,7 +589,7 @@ pub fn Export(comptime T: type) type {
|
|||
}
|
||||
|
||||
// WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateExternalTexture(WGPUDevice device, WGPUExternalTextureDescriptor const * externalTextureDescriptor);
|
||||
export fn wgpuDeviceCreateExternalTexture(device: *gpu.Device, external_texture_descriptor: *const gpu.ExternalTextureDescriptor) *gpu.ExternalTexture {
|
||||
export fn wgpuDeviceCreateExternalTexture(device: *gpu.Device, external_texture_descriptor: *const gpu.ExternalTexture.Descriptor) *gpu.ExternalTexture {
|
||||
return T.deviceCreateExternalTexture(device, external_texture_descriptor);
|
||||
}
|
||||
|
||||
|
|
@ -1665,7 +1665,7 @@ pub const StubInterface = Interface(struct {
|
|||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn deviceCreateExternalTexture(device: *gpu.Device, external_texture_descriptor: *const gpu.ExternalTextureDescriptor) *gpu.ExternalTexture {
|
||||
pub inline fn deviceCreateExternalTexture(device: *gpu.Device, external_texture_descriptor: *const gpu.ExternalTexture.Descriptor) *gpu.ExternalTexture {
|
||||
_ = device;
|
||||
_ = external_texture_descriptor;
|
||||
unreachable;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue