gpu: fix tests

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-29 23:23:20 -07:00 committed by Stephen Gutekanst
parent 3589e9cbaf
commit 1ce40e1b46
14 changed files with 84 additions and 84 deletions

View file

@ -36,7 +36,7 @@ pub const Adapter = opaque {
backend_type: Type,
};
pub inline fn createDevice(adapter: *Adapter, descriptor: ?*const DeviceDescriptor) ?Device {
pub inline fn createDevice(adapter: *Adapter, descriptor: ?*const DeviceDescriptor) ?*Device {
return Impl.adapterCreateDevice(adapter, descriptor);
}

View file

@ -25,8 +25,8 @@ pub const BindGroupEntry = extern struct {
buffer: ?*Buffer,
offset: u64 = 0,
size: u64,
sampler: ?Sampler,
texture_view: ?TextureView,
sampler: ?*Sampler,
texture_view: ?*TextureView,
};
pub const BindGroupDescriptor = extern struct {

View file

@ -1,6 +1,6 @@
const std = @import("std");
const ChainedStruct = @import("types.zig").ChainedStruct;
const MapModeFlags = @import("types.zig").MapModeFlags;
const MapMode = @import("types.zig").MapMode;
const Impl = @import("interface.zig").Impl;
pub const Buffer = opaque {
@ -28,7 +28,7 @@ pub const Buffer = opaque {
return Impl.bufferGetUsage(buffer);
}
pub inline fn bufferMapAsync(buffer: *Buffer, mode: MapModeFlags, offset: usize, size: usize, callback: BufferMapCallback, userdata: *anyopaque) void {
pub inline fn bufferMapAsync(buffer: *Buffer, mode: MapMode, offset: usize, size: usize, callback: BufferMapCallback, userdata: *anyopaque) void {
Impl.bufferMapAsync(buffer, mode, offset, size, callback, userdata);
}

View file

@ -25,6 +25,6 @@ pub const ComputePipeline = opaque {
pub const ComputePipelineDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
layout: ?PipelineLayout,
layout: ?*PipelineLayout,
compute: ProgrammableStageDescriptor,
};

View file

@ -36,12 +36,12 @@ const ErrorType = @import("types.zig").ErrorType;
const ErrorFilter = @import("types.zig").ErrorFilter;
const ErrorCallback = @import("types.zig").ErrorCallback;
const LoggingCallback = @import("types.zig").LoggingCallback;
const CreateComputePipelineAsyncCallback = @import("types.zig").CreateComputePipelineAsyncCallback;
const CreateRenderPipelineAsyncCallback = @import("types.zig").CreateRenderPipelineAsyncCallback;
const CreateComputePipelineAsyncCallback = @import("main.zig").CreateComputePipelineAsyncCallback;
const CreateRenderPipelineAsyncCallback = @import("main.zig").CreateRenderPipelineAsyncCallback;
const Impl = @import("interface.zig").Impl;
pub const Device = opaque {
pub inline fn createBindGroup(device: *Device, descriptor: *const BindGroupDescriptor) BindGroup {
pub inline fn createBindGroup(device: *Device, descriptor: *const BindGroupDescriptor) *BindGroup {
return Impl.deviceCreateBindGroup(device, descriptor);
}
@ -105,11 +105,11 @@ pub const Device = opaque {
return Impl.deviceCreateShaderModule(device, descriptor);
}
pub inline fn createSwapChain(device: *Device, surface: ?Surface, descriptor: *const SwapChainDescriptor) *SwapChain {
pub inline fn createSwapChain(device: *Device, surface: ?*Surface, descriptor: *const SwapChainDescriptor) *SwapChain {
return Impl.deviceCreateSwapChain(device, surface, descriptor);
}
pub inline fn createTexture(device: *Device, descriptor: *const TextureDescriptor) Texture {
pub inline fn createTexture(device: *Device, descriptor: *const TextureDescriptor) *Texture {
return Impl.deviceCreateTexture(device, descriptor);
}

View file

@ -2,7 +2,7 @@ const ChainedStruct = @import("types.zig").ChainedStruct;
const TextureView = @import("texture_view.zig").TextureView;
const Impl = @import("interface.zig").Impl;
pub const ExternalTexture = *opaque {
pub const ExternalTexture = opaque {
pub inline fn destroy(external_texture: *ExternalTexture) void {
Impl.externalTextureDestroy(external_texture);
}
@ -33,7 +33,7 @@ pub const ExternalTextureDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
plane0: *TextureView,
plane1: ?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,

View file

@ -37,7 +37,7 @@ pub fn Interface(comptime T: type) type {
assertDecl(T, "bufferGetConstMappedRange", fn (buffer: *gpu.Buffer, offset: usize, size: usize) callconv(.Inline) ?*const anyopaque);
assertDecl(T, "bufferGetMappedRange", fn (buffer: *gpu.Buffer, offset: usize, size: usize) callconv(.Inline) ?*anyopaque);
assertDecl(T, "bufferGetSize", fn (buffer: *gpu.Buffer) callconv(.Inline) u64);
assertDecl(T, "bufferGetUsage", fn (buffer: *gpu.Buffer) callconv(.Inline) *gpu.BufferUsage);
assertDecl(T, "bufferGetUsage", fn (buffer: *gpu.Buffer) callconv(.Inline) gpu.BufferUsage);
assertDecl(T, "bufferMapAsync", fn (buffer: *gpu.Buffer, mode: gpu.MapMode, offset: usize, size: usize, callback: gpu.BufferMapCallback, userdata: *anyopaque) callconv(.Inline) void);
assertDecl(T, "bufferSetLabel", fn (buffer: *gpu.Buffer, label: [*:0]const u8) callconv(.Inline) void);
assertDecl(T, "bufferUnmap", fn (buffer: *gpu.Buffer) callconv(.Inline) void);
@ -97,7 +97,7 @@ pub fn Interface(comptime T: type) type {
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);
assertDecl(T, "deviceCreateShaderModule", fn (device: *gpu.Device, descriptor: *const gpu.ShaderModuleDescriptor) callconv(.Inline) *gpu.ShaderModule);
assertDecl(T, "deviceCreateSwapChain", fn (device: *gpu.Device, surface: ?gpu.Surface, descriptor: *const gpu.SwapChainDescriptor) callconv(.Inline) *gpu.SwapChain);
assertDecl(T, "deviceCreateSwapChain", fn (device: *gpu.Device, surface: ?*gpu.Surface, descriptor: *const gpu.SwapChainDescriptor) callconv(.Inline) *gpu.SwapChain);
assertDecl(T, "deviceCreateTexture", fn (device: *gpu.Device, descriptor: *const gpu.TextureDescriptor) callconv(.Inline) *gpu.Texture);
assertDecl(T, "deviceDestroy", fn (device: *gpu.Device) callconv(.Inline) void);
assertDecl(T, "deviceEnumerateFeatures", fn (device: *gpu.Device, features: [*]gpu.FeatureName) callconv(.Inline) usize);
@ -164,7 +164,7 @@ pub fn Interface(comptime T: type) type {
assertDecl(T, "renderPassEncoderDrawIndirect", fn (render_pass_encoder: *gpu.RenderPassEncoder, indirect_buffer: *gpu.Buffer, indirect_offset: u64) callconv(.Inline) void);
assertDecl(T, "renderPassEncoderEnd", fn (render_pass_encoder: *gpu.RenderPassEncoder) callconv(.Inline) void);
assertDecl(T, "renderPassEncoderEndOcclusionQuery", fn (render_pass_encoder: *gpu.RenderPassEncoder) callconv(.Inline) void);
assertDecl(T, "renderPassEncoderExecuteBundles", fn (render_pass_encoder: *gpu.RenderPassEncoder, bundles_count: u32, bundles: [*]const gpu.RenderBundle) callconv(.Inline) void);
assertDecl(T, "renderPassEncoderExecuteBundles", fn (render_pass_encoder: *gpu.RenderPassEncoder, bundles_count: u32, bundles: [*]const *const gpu.RenderBundle) callconv(.Inline) void);
assertDecl(T, "renderPassEncoderInsertDebugMarker", fn (render_pass_encoder: *gpu.RenderPassEncoder, marker_label: [*:0]const u8) callconv(.Inline) void);
assertDecl(T, "renderPassEncoderPopDebugGroup", fn (render_pass_encoder: *gpu.RenderPassEncoder) callconv(.Inline) void);
assertDecl(T, "renderPassEncoderPushDebugGroup", fn (render_pass_encoder: *gpu.RenderPassEncoder, group_label: [*:0]const u8) callconv(.Inline) void);
@ -376,12 +376,12 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, WGPUComputePassDescriptor const * descriptor /* nullable */);
export fn wgpuCommandEncoderBeginComputePass(command_encoder: *gpu.CommandEncoder, descriptor: ?*const gpu.ComputePassDescriptor) gpu.ComputePassEncoder {
export fn wgpuCommandEncoderBeginComputePass(command_encoder: *gpu.CommandEncoder, descriptor: ?*const gpu.ComputePassDescriptor) *gpu.ComputePassEncoder {
return T.commandEncoderBeginComputePass(command_encoder, descriptor);
}
// WGPU_EXPORT WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor);
export fn wgpuCommandEncoderBeginRenderPass(command_encoder: *gpu.CommandEncoder, descriptor: *const gpu.RenderPassDescriptor) gpu.RenderPassEncoder {
export fn wgpuCommandEncoderBeginRenderPass(command_encoder: *gpu.CommandEncoder, descriptor: *const gpu.RenderPassDescriptor) *gpu.RenderPassEncoder {
return T.commandEncoderBeginRenderPass(command_encoder, descriptor);
}
@ -551,7 +551,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor);
export fn wgpuDeviceCreateBindGroup(device: *gpu.Device, descriptor: *const gpu.BindGroupDescriptor) gpu.BindGroup {
export fn wgpuDeviceCreateBindGroup(device: *gpu.Device, descriptor: *const gpu.BindGroupDescriptor) *gpu.BindGroup {
return T.deviceCreateBindGroup(device, descriptor);
}
@ -561,7 +561,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor);
export fn wgpuDeviceCreateBuffer(device: *gpu.Device, descriptor: *const gpu.BufferDescriptor) gpu.Buffer {
export fn wgpuDeviceCreateBuffer(device: *gpu.Device, descriptor: *const gpu.BufferDescriptor) *gpu.Buffer {
return T.deviceCreateBuffer(device, descriptor);
}
@ -571,7 +571,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor);
export fn wgpuDeviceCreateComputePipeline(device: *gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor) gpu.ComputePipeline {
export fn wgpuDeviceCreateComputePipeline(device: *gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor) *gpu.ComputePipeline {
return T.deviceCreateComputePipeline(device, descriptor);
}
@ -581,17 +581,17 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUBuffer wgpuDeviceCreateErrorBuffer(WGPUDevice device);
export fn wgpuDeviceCreateErrorBuffer(device: *gpu.Device) gpu.Buffer {
export fn wgpuDeviceCreateErrorBuffer(device: *gpu.Device) *gpu.Buffer {
return T.deviceCreateErrorBuffer(device);
}
// WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateErrorExternalTexture(WGPUDevice device);
export fn wgpuDeviceCreateErrorExternalTexture(device: *gpu.Device) gpu.ExternalTexture {
export fn wgpuDeviceCreateErrorExternalTexture(device: *gpu.Device) *gpu.ExternalTexture {
return T.deviceCreateErrorExternalTexture(device);
}
// 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.ExternalTextureDescriptor) *gpu.ExternalTexture {
return T.deviceCreateExternalTexture(device, external_texture_descriptor);
}
@ -611,7 +611,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor);
export fn wgpuDeviceCreateRenderPipeline(device: *gpu.Device, descriptor: *const gpu.RenderPipelineDescriptor) gpu.RenderPipeline {
export fn wgpuDeviceCreateRenderPipeline(device: *gpu.Device, descriptor: *const gpu.RenderPipelineDescriptor) *gpu.RenderPipeline {
return T.deviceCreateRenderPipeline(device, descriptor);
}
@ -621,22 +621,22 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, WGPUSamplerDescriptor const * descriptor /* nullable */);
export fn wgpuDeviceCreateSampler(device: *gpu.Device, descriptor: ?*const gpu.SamplerDescriptor) gpu.Sampler {
export fn wgpuDeviceCreateSampler(device: *gpu.Device, descriptor: ?*const gpu.SamplerDescriptor) *gpu.Sampler {
return T.deviceCreateSampler(device, descriptor);
}
// WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor);
export fn wgpuDeviceCreateShaderModule(device: *gpu.Device, descriptor: *const gpu.ShaderModuleDescriptor) gpu.ShaderModule {
export fn wgpuDeviceCreateShaderModule(device: *gpu.Device, descriptor: *const gpu.ShaderModuleDescriptor) *gpu.ShaderModule {
return T.deviceCreateShaderModule(device, descriptor);
}
// WGPU_EXPORT WGPUSwapChain wgpuDeviceCreateSwapChain(WGPUDevice device, WGPUSurface surface /* nullable */, WGPUSwapChainDescriptor const * descriptor);
export fn wgpuDeviceCreateSwapChain(device: *gpu.Device, surface: ?gpu.Surface, descriptor: *const gpu.SwapChainDescriptor) gpu.SwapChain {
export fn wgpuDeviceCreateSwapChain(device: *gpu.Device, surface: ?*gpu.Surface, descriptor: *const gpu.SwapChainDescriptor) *gpu.SwapChain {
return T.deviceCreateSwapChain(device, surface, descriptor);
}
// WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor);
export fn wgpuDeviceCreateTexture(device: *gpu.Device, descriptor: *const gpu.TextureDescriptor) gpu.Texture {
export fn wgpuDeviceCreateTexture(device: *gpu.Device, descriptor: *const gpu.TextureDescriptor) *gpu.Texture {
return T.deviceCreateTexture(device, descriptor);
}
@ -741,7 +741,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor);
export fn wgpuInstanceCreateSurface(instance: *gpu.Instance, descriptor: *const gpu.SurfaceDescriptor) gpu.Surface {
export fn wgpuInstanceCreateSurface(instance: *gpu.Instance, descriptor: *const gpu.SurfaceDescriptor) *gpu.Surface {
return T.instanceCreateSurface(instance, descriptor);
}
@ -966,7 +966,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, uint32_t bundlesCount, WGPURenderBundle const * bundles);
export fn wgpuRenderPassEncoderExecuteBundles(render_pass_encoder: *gpu.RenderPassEncoder, bundles_count: u32, bundles: [*]const gpu.RenderBundle) void {
export fn wgpuRenderPassEncoderExecuteBundles(render_pass_encoder: *gpu.RenderPassEncoder, bundles_count: u32, bundles: [*]const *const gpu.RenderBundle) void {
T.renderPassEncoderExecuteBundles(render_pass_encoder, bundles_count, bundles);
}
@ -1118,7 +1118,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUTextureView wgpuSwapChainGetCurrentTextureView(WGPUSwapChain swapChain);
export fn wgpuSwapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) gpu.TextureView {
export fn wgpuSwapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) *gpu.TextureView {
return T.swapChainGetCurrentTextureView(swap_chain);
}
@ -1138,7 +1138,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPUTextureViewDescriptor const * descriptor /* nullable */);
export fn wgpuTextureCreateView(texture: *gpu.Texture, descriptor: ?*const gpu.TextureViewDescriptor) gpu.TextureView {
export fn wgpuTextureCreateView(texture: *gpu.Texture, descriptor: ?*const gpu.TextureViewDescriptor) *gpu.TextureView {
return T.textureCreateView(texture, descriptor);
}
@ -1232,7 +1232,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn adapterCreateDevice(adapter: *gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) ?gpu.Device {
pub inline fn adapterCreateDevice(adapter: *gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) ?*gpu.Device {
_ = adapter;
_ = descriptor;
unreachable;
@ -1390,13 +1390,13 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn commandEncoderBeginComputePass(command_encoder: *gpu.CommandEncoder, descriptor: ?*const gpu.ComputePassDescriptor) gpu.ComputePassEncoder {
pub inline fn commandEncoderBeginComputePass(command_encoder: *gpu.CommandEncoder, descriptor: ?*const gpu.ComputePassDescriptor) *gpu.ComputePassEncoder {
_ = command_encoder;
_ = descriptor;
unreachable;
}
pub inline fn commandEncoderBeginRenderPass(command_encoder: *gpu.CommandEncoder, descriptor: *const gpu.RenderPassDescriptor) gpu.RenderPassEncoder {
pub inline fn commandEncoderBeginRenderPass(command_encoder: *gpu.CommandEncoder, descriptor: *const gpu.RenderPassDescriptor) *gpu.RenderPassEncoder {
_ = command_encoder;
_ = descriptor;
unreachable;
@ -1619,7 +1619,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn deviceCreateBindGroup(device: *gpu.Device, descriptor: *const gpu.BindGroupDescriptor) gpu.BindGroup {
pub inline fn deviceCreateBindGroup(device: *gpu.Device, descriptor: *const gpu.BindGroupDescriptor) *gpu.BindGroup {
_ = device;
_ = descriptor;
unreachable;
@ -1631,7 +1631,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn deviceCreateBuffer(device: *gpu.Device, descriptor: *const gpu.BufferDescriptor) gpu.Buffer {
pub inline fn deviceCreateBuffer(device: *gpu.Device, descriptor: *const gpu.BufferDescriptor) *gpu.Buffer {
_ = device;
_ = descriptor;
unreachable;
@ -1643,7 +1643,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn deviceCreateComputePipeline(device: *gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor) gpu.ComputePipeline {
pub inline fn deviceCreateComputePipeline(device: *gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor) *gpu.ComputePipeline {
_ = device;
_ = descriptor;
unreachable;
@ -1657,17 +1657,17 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn deviceCreateErrorBuffer(device: *gpu.Device) gpu.Buffer {
pub inline fn deviceCreateErrorBuffer(device: *gpu.Device) *gpu.Buffer {
_ = device;
unreachable;
}
pub inline fn deviceCreateErrorExternalTexture(device: *gpu.Device) gpu.ExternalTexture {
pub inline fn deviceCreateErrorExternalTexture(device: *gpu.Device) *gpu.ExternalTexture {
_ = device;
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.ExternalTextureDescriptor) *gpu.ExternalTexture {
_ = device;
_ = external_texture_descriptor;
unreachable;
@ -1691,7 +1691,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn deviceCreateRenderPipeline(device: *gpu.Device, descriptor: *const gpu.RenderPipelineDescriptor) gpu.RenderPipeline {
pub inline fn deviceCreateRenderPipeline(device: *gpu.Device, descriptor: *const gpu.RenderPipelineDescriptor) *gpu.RenderPipeline {
_ = device;
_ = descriptor;
unreachable;
@ -1705,26 +1705,26 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn deviceCreateSampler(device: *gpu.Device, descriptor: ?*const gpu.SamplerDescriptor) gpu.Sampler {
pub inline fn deviceCreateSampler(device: *gpu.Device, descriptor: ?*const gpu.SamplerDescriptor) *gpu.Sampler {
_ = device;
_ = descriptor;
unreachable;
}
pub inline fn deviceCreateShaderModule(device: *gpu.Device, descriptor: *const gpu.ShaderModuleDescriptor) gpu.ShaderModule {
pub inline fn deviceCreateShaderModule(device: *gpu.Device, descriptor: *const gpu.ShaderModuleDescriptor) *gpu.ShaderModule {
_ = device;
_ = descriptor;
unreachable;
}
pub inline fn deviceCreateSwapChain(device: *gpu.Device, surface: ?gpu.Surface, descriptor: *const gpu.SwapChainDescriptor) gpu.SwapChain {
pub inline fn deviceCreateSwapChain(device: *gpu.Device, surface: ?*gpu.Surface, descriptor: *const gpu.SwapChainDescriptor) *gpu.SwapChain {
_ = device;
_ = surface;
_ = descriptor;
unreachable;
}
pub inline fn deviceCreateTexture(device: *gpu.Device, descriptor: *const gpu.TextureDescriptor) gpu.Texture {
pub inline fn deviceCreateTexture(device: *gpu.Device, descriptor: *const gpu.TextureDescriptor) *gpu.Texture {
_ = device;
_ = descriptor;
unreachable;
@ -1846,7 +1846,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn instanceCreateSurface(instance: *gpu.Instance, descriptor: *const gpu.SurfaceDescriptor) gpu.Surface {
pub inline fn instanceCreateSurface(instance: *gpu.Instance, descriptor: *const gpu.SurfaceDescriptor) *gpu.Surface {
_ = instance;
_ = descriptor;
unreachable;
@ -2139,7 +2139,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn renderPassEncoderExecuteBundles(render_pass_encoder: *gpu.RenderPassEncoder, bundles_count: u32, bundles: [*]const gpu.RenderBundle) void {
pub inline fn renderPassEncoderExecuteBundles(render_pass_encoder: *gpu.RenderPassEncoder, bundles_count: u32, bundles: [*]const *const gpu.RenderBundle) void {
_ = render_pass_encoder;
_ = bundles_count;
_ = bundles;
@ -2331,7 +2331,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn swapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) gpu.TextureView {
pub inline fn swapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) *gpu.TextureView {
_ = swap_chain;
unreachable;
}
@ -2351,7 +2351,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn textureCreateView(texture: *gpu.Texture, descriptor: ?*const gpu.TextureViewDescriptor) gpu.TextureView {
pub inline fn textureCreateView(texture: *gpu.Texture, descriptor: ?*const gpu.TextureViewDescriptor) *gpu.TextureView {
_ = texture;
_ = descriptor;
unreachable;

View file

@ -54,26 +54,26 @@ pub const Proc = *anyopaque;
pub const CreateComputePipelineAsyncCallback = fn (
status: types.CreatePipelineAsyncStatus,
compute_pipeline: compute_pipeline.ComputePipeline,
compute_pipeline: *compute_pipeline.ComputePipeline,
message: [*:0]const u8,
userdata: *anyopaque,
) callconv(.C) void;
pub const CreateRenderPipelineAsyncCallback = fn (
status: types.CreatePipelineAsyncStatus,
pipeline: render_pipeline.RenderPipeline,
pipeline: *render_pipeline.RenderPipeline,
message: [*:0]const u8,
userdata: *anyopaque,
) callconv(.C) void;
pub const ComputePassTimestampWrite = extern struct {
query_set: query_set.QuerySet,
query_set: *query_set.QuerySet,
query_index: u32,
location: types.ComputePassTimestampLocation,
};
pub const RenderPassDepthStencilAttachment = extern struct {
view: texture_view.TextureView,
view: *texture_view.TextureView,
depth_load_op: types.LoadOp = .undef,
depth_store_op: types.StoreOp = .undef,
/// deprecated
@ -89,14 +89,14 @@ pub const RenderPassDepthStencilAttachment = extern struct {
};
pub const RenderPassTimestampWrite = extern struct {
query_set: query_set.QuerySet,
query_set: *query_set.QuerySet,
query_index: u32,
location: types.RenderPassTimestampLocation,
};
pub const RequestAdapterOptions = extern struct {
next_in_chain: *const types.ChainedStruct,
compatible_surface: ?surface.Surface,
compatible_surface: ?*surface.Surface,
power_preference: types.PowerPreference = .undef,
force_fallback_adapter: bool = false,
};
@ -116,7 +116,7 @@ pub const RenderPassDescriptor = extern struct {
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
color_attachments: ?[*]const types.RenderPassColorAttachment,
depth_stencil_attachment: ?[*]const RenderPassDepthStencilAttachment,
occlusion_query_set: ?query_set.QuerySet,
occlusion_query_set: ?*query_set.QuerySet,
timestamp_write_count: u32 = 0,
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
timestamp_writes: ?[*]const RenderPassTimestampWrite = null,
@ -126,7 +126,7 @@ pub inline fn createInstance(descriptor: ?*const instance.Instance.Descriptor) ?
return interface.Impl.createInstance(descriptor);
}
pub inline fn getProcAddress(_device: device.Device, proc_name: [*:0]const u8) ?Proc {
pub inline fn getProcAddress(_device: *device.Device, proc_name: [*:0]const u8) ?Proc {
return interface.Impl.getProcAddress(_device, proc_name);
}

View file

@ -32,11 +32,11 @@ pub const Queue = opaque {
Impl.queueWriteTexture(queue, data, data_size, data_layout, write_size);
}
pub inline fn reference(queue: Queue) void {
pub inline fn reference(queue: *Queue) void {
Impl.queueReference(queue);
}
pub inline fn release(queue: Queue) void {
pub inline fn release(queue: *Queue) void {
Impl.queueRelease(queue);
}
};

View file

@ -43,7 +43,7 @@ pub const RenderPassEncoder = opaque {
Impl.renderPassEncoderEndOcclusionQuery(render_pass_encoder);
}
pub inline fn executeBundles(render_pass_encoder: *RenderPassEncoder, bundles_count: u32, bundles: [*]const RenderBundle) void {
pub inline fn executeBundles(render_pass_encoder: *RenderPassEncoder, bundles_count: u32, bundles: [*]const *const RenderBundle) void {
Impl.renderPassEncoderExecuteBundles(render_pass_encoder, bundles_count, bundles);
}

View file

@ -29,7 +29,7 @@ pub const RenderPipeline = opaque {
pub const RenderPipelineDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
layout: ?PipelineLayout,
layout: ?*PipelineLayout,
vertex: VertexState,
primitive: PrimitiveState,
depth_stencil: ?*const DepthStencilState,

View file

@ -32,15 +32,15 @@ pub const SamplerBindingType = enum(u32) {
pub const SamplerBindingLayout = extern struct {
next_in_chain: ?*const ChainedStruct = null,
type: *SamplerBindingType = .undef,
type: SamplerBindingType = .undef,
};
pub const SamplerDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
address_mode_u: *SamplerAddressMode = .clamp_to_edge,
address_mode_v: *SamplerAddressMode = .clamp_to_edge,
address_mode_w: *SamplerAddressMode = .clamp_to_edge,
address_mode_u: SamplerAddressMode = .clamp_to_edge,
address_mode_v: SamplerAddressMode = .clamp_to_edge,
address_mode_w: SamplerAddressMode = .clamp_to_edge,
mag_filter: FilterMode = .nearest,
min_filter: FilterMode = .nearest,
mipmap_filter: FilterMode = .nearest,

View file

@ -7,56 +7,56 @@ const Extent3D = @import("types.zig").Extent3D;
const Impl = @import("interface.zig").Impl;
const copy_stride_undefined = @import("main.zig").copy_stride_undefined;
pub const Texture = *opaque {
pub inline fn createView(texture: Texture, descriptor: ?*const TextureViewDescriptor) *TextureView {
pub const Texture = opaque {
pub inline fn createView(texture: *Texture, descriptor: ?*const TextureViewDescriptor) *TextureView {
return Impl.textureCreateView(texture, descriptor);
}
pub inline fn destroy(texture: Texture) void {
pub inline fn destroy(texture: *Texture) void {
Impl.textureDestroy(texture);
}
pub inline fn getDepthOrArrayLayers(texture: Texture) u32 {
pub inline fn getDepthOrArrayLayers(texture: *Texture) u32 {
return Impl.textureGetDepthOrArrayLayers(texture);
}
pub inline fn getDimension(texture: Texture) TextureDimension {
pub inline fn getDimension(texture: *Texture) TextureDimension {
return Impl.textureGetDimension(texture);
}
pub inline fn getFormat(texture: Texture) TextureFormat {
pub inline fn getFormat(texture: *Texture) TextureFormat {
return Impl.textureGetFormat(texture);
}
pub inline fn getHeight(texture: Texture) u32 {
pub inline fn getHeight(texture: *Texture) u32 {
return Impl.textureGetHeight(texture);
}
pub inline fn getMipLevelCount(texture: Texture) u32 {
pub inline fn getMipLevelCount(texture: *Texture) u32 {
return Impl.textureGetMipLevelCount(texture);
}
pub inline fn getSampleCount(texture: Texture) u32 {
pub inline fn getSampleCount(texture: *Texture) u32 {
return Impl.textureGetSampleCount(texture);
}
pub inline fn getUsage(texture: Texture) TextureUsageFlags {
pub inline fn getUsage(texture: *Texture) TextureUsageFlags {
return Impl.textureGetUsage(texture);
}
pub inline fn getWidth(texture: Texture) u32 {
pub inline fn getWidth(texture: *Texture) u32 {
return Impl.textureGetWidth(texture);
}
pub inline fn setLabel(texture: Texture, label: [*:0]const u8) void {
pub inline fn setLabel(texture: *Texture, label: [*:0]const u8) void {
Impl.textureSetLabel(texture, label);
}
pub inline fn reference(texture: Texture) void {
pub inline fn reference(texture: *Texture) void {
Impl.textureReference(texture);
}
pub inline fn release(texture: Texture) void {
pub inline fn release(texture: *Texture) void {
Impl.textureRelease(texture);
}
};

View file

@ -573,7 +573,7 @@ pub const ImageCopyBuffer = extern struct {
pub const ImageCopyTexture = extern struct {
next_in_chain: ?*const ChainedStruct = null,
texture: Texture,
texture: *Texture,
mip_level: u32 = 0,
origin: Origin3D,
aspect: TextureAspect = .all,
@ -589,8 +589,8 @@ pub const ProgrammableStageDescriptor = extern struct {
};
pub const RenderPassColorAttachment = extern struct {
view: ?TextureView,
resolve_target: ?TextureView,
view: ?*TextureView,
resolve_target: ?*TextureView,
load_op: LoadOp,
store_op: StoreOp,
/// deprecated