gpu: internalize RenderBundleEncoder types

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-29 23:53:36 -07:00 committed by Stephen Gutekanst
parent b4830688bb
commit 836c46cc6c
3 changed files with 16 additions and 17 deletions

View file

@ -8,7 +8,6 @@ const ExternalTexture = @import("external_texture.zig").ExternalTexture;
const PipelineLayout = @import("pipeline_layout.zig").PipelineLayout;
const QuerySet = @import("query_set.zig").QuerySet;
const RenderBundleEncoder = @import("render_bundle_encoder.zig").RenderBundleEncoder;
const RenderBundleEncoderDescriptor = @import("render_bundle_encoder.zig").RenderBundleEncoderDescriptor;
const RenderPipeline = @import("render_pipeline.zig").RenderPipeline;
const RenderPipelineDescriptor = @import("render_pipeline.zig").RenderPipelineDescriptor;
const Sampler = @import("sampler.zig").Sampler;
@ -97,7 +96,7 @@ pub const Device = opaque {
return Impl.deviceCreateQuerySet(device, descriptor);
}
pub inline fn createRenderBundleEncoder(device: *Device, descriptor: *const RenderBundleEncoderDescriptor) *RenderBundleEncoder {
pub inline fn createRenderBundleEncoder(device: *Device, descriptor: *const RenderBundleEncoder.Descriptor) *RenderBundleEncoder {
return Impl.deviceCreateRenderBundleEncoder(device, descriptor);
}

View file

@ -90,7 +90,7 @@ pub fn Interface(comptime T: type) type {
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.PipelineLayout.Descriptor) callconv(.Inline) *gpu.PipelineLayout);
assertDecl(T, "deviceCreateQuerySet", fn (device: *gpu.Device, descriptor: *const gpu.QuerySet.Descriptor) callconv(.Inline) *gpu.QuerySet);
assertDecl(T, "deviceCreateRenderBundleEncoder", fn (device: *gpu.Device, descriptor: *const gpu.RenderBundleEncoderDescriptor) callconv(.Inline) *gpu.RenderBundleEncoder);
assertDecl(T, "deviceCreateRenderBundleEncoder", fn (device: *gpu.Device, descriptor: *const gpu.RenderBundleEncoder.Descriptor) callconv(.Inline) *gpu.RenderBundleEncoder);
assertDecl(T, "deviceCreateRenderPipeline", fn (device: *gpu.Device, descriptor: *const gpu.RenderPipelineDescriptor) callconv(.Inline) *gpu.RenderPipeline);
assertDecl(T, "deviceCreateRenderPipelineAsync", fn (device: *gpu.Device, descriptor: *const gpu.RenderPipelineDescriptor, callback: gpu.CreateRenderPipelineAsyncCallback, userdata: *anyopaque) callconv(.Inline) void);
assertDecl(T, "deviceCreateSampler", fn (device: *gpu.Device, descriptor: ?*const gpu.SamplerDescriptor) callconv(.Inline) *gpu.Sampler);
@ -604,7 +604,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor);
export fn wgpuDeviceCreateRenderBundleEncoder(device: *gpu.Device, descriptor: *const gpu.RenderBundleEncoderDescriptor) *gpu.RenderBundleEncoder {
export fn wgpuDeviceCreateRenderBundleEncoder(device: *gpu.Device, descriptor: *const gpu.RenderBundleEncoder.Descriptor) *gpu.RenderBundleEncoder {
return T.deviceCreateRenderBundleEncoder(device, descriptor);
}
@ -1683,7 +1683,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn deviceCreateRenderBundleEncoder(device: *gpu.Device, descriptor: *const gpu.RenderBundleEncoderDescriptor) *gpu.RenderBundleEncoder {
pub inline fn deviceCreateRenderBundleEncoder(device: *gpu.Device, descriptor: *const gpu.RenderBundleEncoder.Descriptor) *gpu.RenderBundleEncoder {
_ = device;
_ = descriptor;
unreachable;

View file

@ -9,6 +9,18 @@ const IndexFormat = @import("types.zig").IndexFormat;
const Impl = @import("interface.zig").Impl;
pub const RenderBundleEncoder = opaque {
pub const Descriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
color_formats_count: u32,
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
color_formats: ?[*]const TextureFormat,
depth_stencil_format: TextureFormat = .undef,
sample_count: u32 = 1,
depth_read_only: bool = false,
stencil_read_only: bool = false,
};
/// Default `instance_count`: 1
/// Default `first_vertex`: 0
/// Default `first_instance`: 0
@ -82,15 +94,3 @@ pub const RenderBundleEncoder = opaque {
Impl.renderBundleEncoderRelease(render_bundle_encoder);
}
};
pub const RenderBundleEncoderDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
color_formats_count: u32,
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
color_formats: ?[*]const TextureFormat,
depth_stencil_format: TextureFormat = .undef,
sample_count: u32 = 1,
depth_read_only: bool = false,
stencil_read_only: bool = false,
};