summaryrefslogtreecommitdiffstats
path: root/tools/gfx/render.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gfx/render.cpp')
-rw-r--r--tools/gfx/render.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/tools/gfx/render.cpp b/tools/gfx/render.cpp
index f6e32fef8..0dd1e5bf5 100644
--- a/tools/gfx/render.cpp
+++ b/tools/gfx/render.cpp
@@ -20,6 +20,7 @@ Result SLANG_MCALL createCPUDevice(const IDevice::Desc* desc, IDevice** outDevic
Result SLANG_MCALL getD3D11Adapters(List<AdapterInfo>& outAdapters);
Result SLANG_MCALL getD3D12Adapters(List<AdapterInfo>& outAdapters);
Result SLANG_MCALL getVKAdapters(List<AdapterInfo>& outAdapters);
+Result SLANG_MCALL getMetalAdapters(List<AdapterInfo>& outAdapters);
Result SLANG_MCALL getCUDAAdapters(List<AdapterInfo>& outAdapters);
Result SLANG_MCALL reportD3DLiveObjects();
@@ -275,6 +276,14 @@ extern "C"
SLANG_RETURN_ON_FAIL(getCUDAAdapters(adapters));
break;
#endif
+#if SLANG_APPLE_FAMILY
+ case DeviceType::Vulkan:
+ SLANG_RETURN_ON_FAIL(getVKAdapters(adapters));
+ break;
+ case DeviceType::Metal:
+ SLANG_RETURN_ON_FAIL(getMetalAdapters(adapters));
+ break;
+#endif
case DeviceType::CPU:
return SLANG_E_NOT_IMPLEMENTED;
default:
@@ -330,21 +339,38 @@ extern "C"
}
break;
#elif SLANG_APPLE_FAMILY
- case DeviceType::Default:
+ case DeviceType::Vulkan:
+ {
+ return createVKDevice(desc, outDevice);
+ }
case DeviceType::Metal:
{
return createMetalDevice(desc, outDevice);
}
- case DeviceType::Vulkan:
+ case DeviceType::Default:
{
- return createVKDevice(desc, outDevice);
+ IDevice::Desc newDesc = *desc;
+ newDesc.deviceType = DeviceType::Metal;
+ if (_createDevice(&newDesc, outDevice) == SLANG_OK)
+ return SLANG_OK;
+ newDesc.deviceType = DeviceType::Vulkan;
+ if (_createDevice(&newDesc, outDevice) == SLANG_OK)
+ return SLANG_OK;
+ return SLANG_FAIL;
}
#elif SLANG_LINUX_FAMILY && !defined(__CYGWIN__)
- case DeviceType::Default:
case DeviceType::Vulkan:
{
return createVKDevice(desc, outDevice);
}
+ case DeviceType::Default:
+ {
+ IDevice::Desc newDesc = *desc;
+ newDesc.deviceType = DeviceType::Vulkan;
+ if (_createDevice(&newDesc, outDevice) == SLANG_OK)
+ return SLANG_OK;
+ return SLANG_FAIL;
+ }
#endif
case DeviceType::CUDA:
{
@@ -415,6 +441,8 @@ extern "C"
return "OpenGL";
case gfx::DeviceType::Vulkan:
return "Vulkan";
+ case gfx::DeviceType::Metal:
+ return "Metal";
case gfx::DeviceType::CPU:
return "CPU";
case gfx::DeviceType::CUDA: