diff --git a/gpu/build.zig b/gpu/build.zig index f91a1a7e..12d9ae04 100644 --- a/gpu/build.zig +++ b/gpu/build.zig @@ -7,12 +7,17 @@ pub fn build(b: *std.build.Builder) void { const target = b.standardTargetOptions(.{}); const lib = b.addStaticLibrary("gpu", "src/main.zig"); + lib.setTarget(target); lib.setBuildMode(mode); lib.install(); + glfw.link(b, lib, .{}); gpu_dawn.link(b, lib, .{}); const main_tests = b.addTest("src/main.zig"); + main_tests.setTarget(target); main_tests.setBuildMode(mode); + glfw.link(b, main_tests, .{}); + gpu_dawn.link(b, main_tests, .{}); const test_step = b.step("test", "Run library tests"); test_step.dependOn(&main_tests.step); diff --git a/gpu/src/TODO b/gpu/src/TODO index ded1021e..0a4bd22b 100644 --- a/gpu/src/TODO +++ b/gpu/src/TODO @@ -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); diff --git a/gpu/src/native.zig b/gpu/src/native.zig index 99aa2828..8d06def2 100644 --- a/gpu/src/native.zig +++ b/gpu/src/native.zig @@ -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