gpu: begin plotting how to wrap a WGPUInstance

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-06 19:34:39 -07:00 committed by Stephen Gutekanst
parent 5f7fe4d7e2
commit 5656d3252a
3 changed files with 9 additions and 14 deletions

View file

@ -17,7 +17,6 @@ typedef struct WGPUCommandEncoderImpl* WGPUCommandEncoder;
typedef struct WGPUComputePassEncoderImpl* WGPUComputePassEncoder;
typedef struct WGPUComputePipelineImpl* WGPUComputePipeline;
typedef struct WGPUExternalTextureImpl* WGPUExternalTexture;
typedef struct WGPUInstanceImpl* WGPUInstance;
typedef struct WGPUPipelineLayoutImpl* WGPUPipelineLayout;
typedef struct WGPUQuerySetImpl* WGPUQuerySet;
typedef struct WGPUQueueImpl* WGPUQueue;
@ -738,10 +737,6 @@ typedef struct WGPUExternalTextureDescriptor {
WGPUPredefinedColorSpace colorSpace;
} WGPUExternalTextureDescriptor;
typedef struct WGPUInstanceDescriptor {
WGPUChainedStruct const * nextInChain;
} WGPUInstanceDescriptor;
typedef struct WGPUMultisampleState {
WGPUChainedStruct const * nextInChain;
uint32_t count;
@ -1164,7 +1159,6 @@ typedef void (*WGPUQueueWorkDoneCallback)(WGPUQueueWorkDoneStatus status, void *
typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPUAdapter adapter, char const * message, void * userdata);
typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, char const * message, void * userdata);
WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPUInstanceDescriptor const * descriptor);
WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPUDevice device, char const * procName);
// Methods of BindGroup
@ -1240,12 +1234,6 @@ WGPU_EXPORT void wgpuExternalTextureSetLabel(WGPUExternalTexture externalTexture
WGPU_EXPORT void wgpuExternalTextureReference(WGPUExternalTexture externalTexture);
WGPU_EXPORT void wgpuExternalTextureRelease(WGPUExternalTexture externalTexture);
// Methods of Instance
WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor);
WGPU_EXPORT void wgpuInstanceRequestAdapter(WGPUInstance instance, WGPURequestAdapterOptions const * options, WGPURequestAdapterCallback callback, void * userdata);
WGPU_EXPORT void wgpuInstanceReference(WGPUInstance instance);
WGPU_EXPORT void wgpuInstanceRelease(WGPUInstance instance);
// Methods of PipelineLayout
WGPU_EXPORT void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, char const * label);
WGPU_EXPORT void wgpuPipelineLayoutReference(WGPUPipelineLayout pipelineLayout);

View file

@ -1,9 +1,11 @@
//! A native webgpu.h implementation of the gpu.Interface
const c = @import("c.zig").c;
const Interface = @import("Interface.zig");
/// Returns a native webgpu.h implementation of the gpu.Interface
pub fn native() Interface {
/// Returns a native webgpu.h implementation of the gpu.Interface, wrapping the given WGPUInstance.
pub fn native(instance: c.WGPUInstance) Interface {
// TODO: implement Interface
_ = instance;
@panic("not implemented");
// TODO: implement Device interface