Skip to content

Commit

Permalink
WebGPU: Prefer D3D12 back-end and high performance GPU for Dawn (#80)
Browse files Browse the repository at this point in the history
I observed rapid memory leakage on D3D11 back-end with integrated GPU.

This helps to address shader-slang/slang#5233.
  • Loading branch information
aleino-nv authored Oct 15, 2024
1 parent 9d13bd4 commit 4fd4dd7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/wgpu/wgpu-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ Result DeviceImpl::initialize(const DeviceDesc& desc)
}
};

api.wgpuInstanceRequestAdapter(m_ctx.instance, nullptr, requestAdapterCallback, &m_ctx);
WGPURequestAdapterOptions options = {};
options.powerPreference = WGPUPowerPreference_HighPerformance;
#if SLANG_WINDOWS_FAMILY
options.backendType = WGPUBackendType_D3D12;
#elif SLANG_LINUX_FAMILY
options.backendType = WGPUBackendType_Vulkan;
#endif
api.wgpuInstanceRequestAdapter(m_ctx.instance, &options, requestAdapterCallback, &m_ctx);
if (!m_ctx.adapter)
{
return SLANG_FAIL;
Expand Down

0 comments on commit 4fd4dd7

Please sign in to comment.