gpu-dawn: add ability to get C WGPUInstance

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-02-26 19:12:20 -07:00 committed by Stephen Gutekanst
parent 412023ef1e
commit bb8a8c3631
2 changed files with 4 additions and 4 deletions

View file

@ -147,6 +147,9 @@ MACH_EXPORT MachDawnNativeInstance machDawnNativeInstance_init(void) {
MACH_EXPORT void machDawnNativeInstance_deinit(MachDawnNativeInstance instance) {
delete reinterpret_cast<dawn_native::Instance*>(instance);
}
MACH_EXPORT WGPUInstance machDawnNativeInstance_get(MachDawnNativeInstance instance) {
return reinterpret_cast<dawn_native::Instance*>(instance)->Get();
}
// TODO(dawn-native-mach): These API* methods correlate to the new API (which is unified between Dawn
// and wgpu-native?), e.g. dawn_native::Instance::APIRequestAdapter corresponds to wgpuInstanceRequestAdapter
// These are not implemented in Dawn yet according to austineng, but we should switch to this API once they do:
@ -218,10 +221,6 @@ MACH_EXPORT const DawnProcTable* machDawnNativeGetProcs() {
// TODO(dawn-native-mach):
// void SetPlatform(dawn_platform::Platform* platform);
// TODO(dawn-native-mach):
// // Returns the underlying WGPUInstance object.
// WGPUInstance Get() const;
// typedef struct MachUtilsBackendBindingImpl* MachUtilsBackendBinding;
MACH_EXPORT MachUtilsBackendBinding machUtilsCreateBinding(WGPUBackendType backendType, GLFWwindow* window, WGPUDevice device) {

View file

@ -80,6 +80,7 @@ typedef struct MachDawnNativeInstanceImpl* MachDawnNativeInstance;
MACH_EXPORT MachDawnNativeInstance machDawnNativeInstance_init(void);
MACH_EXPORT void machDawnNativeInstance_deinit(MachDawnNativeInstance);
MACH_EXPORT WGPUInstance machDawnNativeInstance_get(MachDawnNativeInstance instance);
MACH_EXPORT void machDawnNativeInstance_discoverDefaultAdapters(MachDawnNativeInstance);
// Adds adapters that can be discovered with the options provided (like a getProcAddress).