jspanchu / webgpu-dawn-binaries

14 stars 1 forks source link

DynDawn - Dynamic Dawn Library

This repository builds and distributes a loadable shared library comprising the Dawn implementation of WebGPU. Here's how you can use it without worrying about building dawn with all it's intricacies and linking it into your app/library.

See tests/simple.c and tests/simple.cpp for more details.

linux

#include <dawn/webgpu.h>
#include <dlfcn.h>
void* lib = dlopen(libdawn.so, RTLD_LAZY);
WGPUProcCreateInstance wgpuCreateInstance = (WGPUProcCreateInstance)dlsym(lib, "wgpuCreateInstance");
// Load more functions ..

macOS

#include <dawn/webgpu.h>
#include <dlfcn.h>
void* lib = dlopen(libdawn.dyld, RTLD_LAZY);
WGPUProcCreateInstance wgpuCreateInstance = (WGPUProcCreateInstance)dlsym(lib, "wgpuCreateInstance");
// Load more functions ..

windows

#include <dawn/webgpu.h>
#include <windows.h>
HINSTANCE lib = LoadLibraryA(TEXT(dawn.dll));
WGPUProcCreateInstance wgpuCreateInstance = (WGPUProcCreateInstance)GetProcAddress(lib, "wgpuCreateInstance");
// Load more functions ..