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, 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); return Impl.adapterCreateDevice(adapter, descriptor);
} }

View file

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

View file

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
const ChainedStruct = @import("types.zig").ChainedStruct; const ChainedStruct = @import("types.zig").ChainedStruct;
const MapModeFlags = @import("types.zig").MapModeFlags; const MapMode = @import("types.zig").MapMode;
const Impl = @import("interface.zig").Impl; const Impl = @import("interface.zig").Impl;
pub const Buffer = opaque { pub const Buffer = opaque {
@ -28,7 +28,7 @@ pub const Buffer = opaque {
return Impl.bufferGetUsage(buffer); 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); Impl.bufferMapAsync(buffer, mode, offset, size, callback, userdata);
} }

View file

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

View file

@ -36,12 +36,12 @@ const ErrorType = @import("types.zig").ErrorType;
const ErrorFilter = @import("types.zig").ErrorFilter; const ErrorFilter = @import("types.zig").ErrorFilter;
const ErrorCallback = @import("types.zig").ErrorCallback; const ErrorCallback = @import("types.zig").ErrorCallback;
const LoggingCallback = @import("types.zig").LoggingCallback; const LoggingCallback = @import("types.zig").LoggingCallback;
const CreateComputePipelineAsyncCallback = @import("types.zig").CreateComputePipelineAsyncCallback; const CreateComputePipelineAsyncCallback = @import("main.zig").CreateComputePipelineAsyncCallback;
const CreateRenderPipelineAsyncCallback = @import("types.zig").CreateRenderPipelineAsyncCallback; const CreateRenderPipelineAsyncCallback = @import("main.zig").CreateRenderPipelineAsyncCallback;
const Impl = @import("interface.zig").Impl; const Impl = @import("interface.zig").Impl;
pub const Device = opaque { 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); return Impl.deviceCreateBindGroup(device, descriptor);
} }
@ -105,11 +105,11 @@ pub const Device = opaque {
return Impl.deviceCreateShaderModule(device, descriptor); 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); 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); 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 TextureView = @import("texture_view.zig").TextureView;
const Impl = @import("interface.zig").Impl; const Impl = @import("interface.zig").Impl;
pub const ExternalTexture = *opaque { pub const ExternalTexture = opaque {
pub inline fn destroy(external_texture: *ExternalTexture) void { pub inline fn destroy(external_texture: *ExternalTexture) void {
Impl.externalTextureDestroy(external_texture); Impl.externalTextureDestroy(external_texture);
} }
@ -33,7 +33,7 @@ pub const ExternalTextureDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null, next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null, label: ?[*:0]const u8 = null,
plane0: *TextureView, plane0: *TextureView,
plane1: ?TextureView, plane1: ?*TextureView,
do_yuv_to_rgb_conversion_only: bool = false, do_yuv_to_rgb_conversion_only: bool = false,
// TODO: dawn.json says length 12, does it mean array length? // TODO: dawn.json says length 12, does it mean array length?
yuv_to_rgb_conversion_matrix: ?[*]const f32, 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, "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, "bufferGetMappedRange", fn (buffer: *gpu.Buffer, offset: usize, size: usize) callconv(.Inline) ?*anyopaque);
assertDecl(T, "bufferGetSize", fn (buffer: *gpu.Buffer) callconv(.Inline) u64); 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, "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, "bufferSetLabel", fn (buffer: *gpu.Buffer, label: [*:0]const u8) callconv(.Inline) void);
assertDecl(T, "bufferUnmap", fn (buffer: *gpu.Buffer) 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, "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, "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, "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, "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, "deviceDestroy", fn (device: *gpu.Device) callconv(.Inline) void);
assertDecl(T, "deviceEnumerateFeatures", fn (device: *gpu.Device, features: [*]gpu.FeatureName) callconv(.Inline) usize); 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, "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, "renderPassEncoderEnd", fn (render_pass_encoder: *gpu.RenderPassEncoder) callconv(.Inline) void);
assertDecl(T, "renderPassEncoderEndOcclusionQuery", 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, "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, "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); 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 */); // 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); return T.commandEncoderBeginComputePass(command_encoder, descriptor);
} }
// WGPU_EXPORT WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * 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); 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); // 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); 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); // 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); 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); // 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); return T.deviceCreateComputePipeline(device, descriptor);
} }
@ -581,17 +581,17 @@ pub fn Export(comptime T: type) type {
} }
// WGPU_EXPORT WGPUBuffer wgpuDeviceCreateErrorBuffer(WGPUDevice device); // 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); return T.deviceCreateErrorBuffer(device);
} }
// WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateErrorExternalTexture(WGPUDevice 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); return T.deviceCreateErrorExternalTexture(device);
} }
// WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateExternalTexture(WGPUDevice device, WGPUExternalTextureDescriptor const * externalTextureDescriptor); // 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); 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); // 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); 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 */); // 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); return T.deviceCreateSampler(device, descriptor);
} }
// WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * 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); return T.deviceCreateShaderModule(device, descriptor);
} }
// WGPU_EXPORT WGPUSwapChain wgpuDeviceCreateSwapChain(WGPUDevice device, WGPUSurface surface /* nullable */, WGPUSwapChainDescriptor const * 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); return T.deviceCreateSwapChain(device, surface, descriptor);
} }
// WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * 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); 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); // 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); 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); // 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); 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); // 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); 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 */); // 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); return T.textureCreateView(texture, descriptor);
} }
@ -1232,7 +1232,7 @@ pub const StubInterface = Interface(struct {
unreachable; 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; _ = adapter;
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -1390,13 +1390,13 @@ pub const StubInterface = Interface(struct {
unreachable; 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; _ = command_encoder;
_ = descriptor; _ = descriptor;
unreachable; 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; _ = command_encoder;
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -1619,7 +1619,7 @@ pub const StubInterface = Interface(struct {
unreachable; 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; _ = device;
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -1631,7 +1631,7 @@ pub const StubInterface = Interface(struct {
unreachable; 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; _ = device;
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -1643,7 +1643,7 @@ pub const StubInterface = Interface(struct {
unreachable; 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; _ = device;
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -1657,17 +1657,17 @@ pub const StubInterface = Interface(struct {
unreachable; unreachable;
} }
pub inline fn deviceCreateErrorBuffer(device: *gpu.Device) gpu.Buffer { pub inline fn deviceCreateErrorBuffer(device: *gpu.Device) *gpu.Buffer {
_ = device; _ = device;
unreachable; unreachable;
} }
pub inline fn deviceCreateErrorExternalTexture(device: *gpu.Device) gpu.ExternalTexture { pub inline fn deviceCreateErrorExternalTexture(device: *gpu.Device) *gpu.ExternalTexture {
_ = device; _ = device;
unreachable; 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; _ = device;
_ = external_texture_descriptor; _ = external_texture_descriptor;
unreachable; unreachable;
@ -1691,7 +1691,7 @@ pub const StubInterface = Interface(struct {
unreachable; 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; _ = device;
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -1705,26 +1705,26 @@ pub const StubInterface = Interface(struct {
unreachable; 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; _ = device;
_ = descriptor; _ = descriptor;
unreachable; 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; _ = device;
_ = descriptor; _ = descriptor;
unreachable; 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; _ = device;
_ = surface; _ = surface;
_ = descriptor; _ = descriptor;
unreachable; 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; _ = device;
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -1846,7 +1846,7 @@ pub const StubInterface = Interface(struct {
unreachable; 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; _ = instance;
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -2139,7 +2139,7 @@ pub const StubInterface = Interface(struct {
unreachable; 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; _ = render_pass_encoder;
_ = bundles_count; _ = bundles_count;
_ = bundles; _ = bundles;
@ -2331,7 +2331,7 @@ pub const StubInterface = Interface(struct {
unreachable; unreachable;
} }
pub inline fn swapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) gpu.TextureView { pub inline fn swapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) *gpu.TextureView {
_ = swap_chain; _ = swap_chain;
unreachable; unreachable;
} }
@ -2351,7 +2351,7 @@ pub const StubInterface = Interface(struct {
unreachable; 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; _ = texture;
_ = descriptor; _ = descriptor;
unreachable; unreachable;

View file

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

View file

@ -43,7 +43,7 @@ pub const RenderPassEncoder = opaque {
Impl.renderPassEncoderEndOcclusionQuery(render_pass_encoder); 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); Impl.renderPassEncoderExecuteBundles(render_pass_encoder, bundles_count, bundles);
} }

View file

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

View file

@ -32,15 +32,15 @@ pub const SamplerBindingType = enum(u32) {
pub const SamplerBindingLayout = extern struct { pub const SamplerBindingLayout = extern struct {
next_in_chain: ?*const ChainedStruct = null, next_in_chain: ?*const ChainedStruct = null,
type: *SamplerBindingType = .undef, type: SamplerBindingType = .undef,
}; };
pub const SamplerDescriptor = extern struct { pub const SamplerDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null, next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null, label: ?[*:0]const u8 = null,
address_mode_u: *SamplerAddressMode = .clamp_to_edge, address_mode_u: SamplerAddressMode = .clamp_to_edge,
address_mode_v: *SamplerAddressMode = .clamp_to_edge, address_mode_v: SamplerAddressMode = .clamp_to_edge,
address_mode_w: *SamplerAddressMode = .clamp_to_edge, address_mode_w: SamplerAddressMode = .clamp_to_edge,
mag_filter: FilterMode = .nearest, mag_filter: FilterMode = .nearest,
min_filter: FilterMode = .nearest, min_filter: FilterMode = .nearest,
mipmap_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 Impl = @import("interface.zig").Impl;
const copy_stride_undefined = @import("main.zig").copy_stride_undefined; const copy_stride_undefined = @import("main.zig").copy_stride_undefined;
pub const Texture = *opaque { pub const Texture = opaque {
pub inline fn createView(texture: Texture, descriptor: ?*const TextureViewDescriptor) *TextureView { pub inline fn createView(texture: *Texture, descriptor: ?*const TextureViewDescriptor) *TextureView {
return Impl.textureCreateView(texture, descriptor); return Impl.textureCreateView(texture, descriptor);
} }
pub inline fn destroy(texture: Texture) void { pub inline fn destroy(texture: *Texture) void {
Impl.textureDestroy(texture); Impl.textureDestroy(texture);
} }
pub inline fn getDepthOrArrayLayers(texture: Texture) u32 { pub inline fn getDepthOrArrayLayers(texture: *Texture) u32 {
return Impl.textureGetDepthOrArrayLayers(texture); return Impl.textureGetDepthOrArrayLayers(texture);
} }
pub inline fn getDimension(texture: Texture) TextureDimension { pub inline fn getDimension(texture: *Texture) TextureDimension {
return Impl.textureGetDimension(texture); return Impl.textureGetDimension(texture);
} }
pub inline fn getFormat(texture: Texture) TextureFormat { pub inline fn getFormat(texture: *Texture) TextureFormat {
return Impl.textureGetFormat(texture); return Impl.textureGetFormat(texture);
} }
pub inline fn getHeight(texture: Texture) u32 { pub inline fn getHeight(texture: *Texture) u32 {
return Impl.textureGetHeight(texture); return Impl.textureGetHeight(texture);
} }
pub inline fn getMipLevelCount(texture: Texture) u32 { pub inline fn getMipLevelCount(texture: *Texture) u32 {
return Impl.textureGetMipLevelCount(texture); return Impl.textureGetMipLevelCount(texture);
} }
pub inline fn getSampleCount(texture: Texture) u32 { pub inline fn getSampleCount(texture: *Texture) u32 {
return Impl.textureGetSampleCount(texture); return Impl.textureGetSampleCount(texture);
} }
pub inline fn getUsage(texture: Texture) TextureUsageFlags { pub inline fn getUsage(texture: *Texture) TextureUsageFlags {
return Impl.textureGetUsage(texture); return Impl.textureGetUsage(texture);
} }
pub inline fn getWidth(texture: Texture) u32 { pub inline fn getWidth(texture: *Texture) u32 {
return Impl.textureGetWidth(texture); 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); Impl.textureSetLabel(texture, label);
} }
pub inline fn reference(texture: Texture) void { pub inline fn reference(texture: *Texture) void {
Impl.textureReference(texture); Impl.textureReference(texture);
} }
pub inline fn release(texture: Texture) void { pub inline fn release(texture: *Texture) void {
Impl.textureRelease(texture); Impl.textureRelease(texture);
} }
}; };

View file

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