gpu: implement Device.createCommandEncoder
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
117ad5dc3b
commit
9c7aa55273
2 changed files with 15 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ const ShaderModule = @import("ShaderModule.zig");
|
||||||
const Surface = @import("Surface.zig");
|
const Surface = @import("Surface.zig");
|
||||||
const SwapChain = @import("SwapChain.zig");
|
const SwapChain = @import("SwapChain.zig");
|
||||||
const RenderPipeline = @import("RenderPipeline.zig");
|
const RenderPipeline = @import("RenderPipeline.zig");
|
||||||
|
const CommandEncoder = @import("CommandEncoder.zig");
|
||||||
|
|
||||||
const Device = @This();
|
const Device = @This();
|
||||||
|
|
||||||
|
|
@ -26,7 +27,7 @@ pub const VTable = struct {
|
||||||
// WGPU_EXPORT WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor);
|
// WGPU_EXPORT WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor);
|
||||||
// WGPU_EXPORT WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor);
|
// WGPU_EXPORT WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor);
|
||||||
// WGPU_EXPORT WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor);
|
// WGPU_EXPORT WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor);
|
||||||
// WGPU_EXPORT WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, WGPUCommandEncoderDescriptor const * descriptor);
|
createCommandEncoder: fn (ptr: *anyopaque, descriptor: *const CommandEncoder.Descriptor) CommandEncoder,
|
||||||
// WGPU_EXPORT WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor);
|
// WGPU_EXPORT WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor);
|
||||||
// WGPU_EXPORT void wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallback callback, void * userdata);
|
// WGPU_EXPORT void wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallback callback, void * userdata);
|
||||||
// WGPU_EXPORT WGPUBuffer wgpuDeviceCreateErrorBuffer(WGPUDevice device);
|
// WGPU_EXPORT WGPUBuffer wgpuDeviceCreateErrorBuffer(WGPUDevice device);
|
||||||
|
|
@ -82,6 +83,10 @@ pub inline fn destroy(device: Device) void {
|
||||||
device.vtable.destroy(device.ptr);
|
device.vtable.destroy(device.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub inline fn createCommandEncoder(device: Device, descriptor: *const CommandEncoder.Descriptor) CommandEncoder {
|
||||||
|
return device.vtable.createCommandEncoder(device.ptr, descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
pub inline fn createRenderPipeline(device: Device, descriptor: *const RenderPipeline.Descriptor) RenderPipeline {
|
pub inline fn createRenderPipeline(device: Device, descriptor: *const RenderPipeline.Descriptor) RenderPipeline {
|
||||||
return device.vtable.createRenderPipeline(device.ptr, descriptor);
|
return device.vtable.createRenderPipeline(device.ptr, descriptor);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -378,6 +378,15 @@ const device_vtable = Device.VTable{
|
||||||
c.wgpuDeviceDestroy(@ptrCast(c.WGPUDevice, ptr));
|
c.wgpuDeviceDestroy(@ptrCast(c.WGPUDevice, ptr));
|
||||||
}
|
}
|
||||||
}).destroy,
|
}).destroy,
|
||||||
|
.createCommandEncoder = (struct {
|
||||||
|
pub fn createCommandEncoder(ptr: *anyopaque, descriptor: *const CommandEncoder.Descriptor) CommandEncoder {
|
||||||
|
const desc = c.WGPUCommandEncoderDescriptor{
|
||||||
|
.nextInChain = null,
|
||||||
|
.label = descriptor.label,
|
||||||
|
};
|
||||||
|
return wrapCommandEncoder(c.wgpuDeviceCreateCommandEncoder(@ptrCast(c.WGPUDevice, ptr), &desc));
|
||||||
|
}
|
||||||
|
}).createCommandEncoder,
|
||||||
.createRenderPipeline = (struct {
|
.createRenderPipeline = (struct {
|
||||||
pub fn createRenderPipeline(ptr: *anyopaque, descriptor: *const RenderPipeline.Descriptor) RenderPipeline {
|
pub fn createRenderPipeline(ptr: *anyopaque, descriptor: *const RenderPipeline.Descriptor) RenderPipeline {
|
||||||
var tmp_depth_stencil: c.WGPUDepthStencilState = undefined;
|
var tmp_depth_stencil: c.WGPUDepthStencilState = undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue