-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wgpuInstanceRequestAdapter fails when called with a specific backend #337
Comments
I had this issue too, forcing |
Same error when updating from v0.18.1.4 to v0.19.1.1. As mentioned above, it's happening with |
Unfortunately I am unable to reproduce this behavior, does it fail if |
Using This should be a minimal example that repros it: int main(int argc, char **argv)
{
WGPUInstance instance = wgpuCreateInstance(nullptr);
assert(instance);
// Note: uncomment to print available adapters (requires `wgpuSetLogLevel(WGPULogLevel_Info)`).
// const WGPUInstanceEnumerateAdapterOptions options = { .backends = WGPUInstanceBackend_All };
// const size_t count = wgpuInstanceEnumerateAdapters(instance, &options, nullptr);
// assert(count > 0);
const WGPURequestAdapterOptions options { .backendType = WGPUBackendType_D3D12 }; // !!
WGPUAdapter adapter = nullptr;
wgpuInstanceRequestAdapter(
instance,
&options,
[](WGPURequestAdapterStatus status, WGPUAdapter adapter, char const *message, void *userdata) {
if (status == WGPURequestAdapterStatus_Success) {
*reinterpret_cast<WGPUAdapter *>(userdata) = adapter;
}
},
/* userdata */ static_cast<void *>(&adapter));
assert(adapter);
} |
This is a bug upstream gfx-rs/wgpu#5289 Workaround for now is provide the desired backend flag/s when creating the instance rather than when requesting the adapter. WGPUInstanceExtras instanceExtras = { 0 };
instanceExtras.chain.sType = (WGPUSType)WGPUSType_InstanceExtras;
instanceExtras.backends = WGPUInstanceBackend_DX12;
WGPUInstanceDescriptor instanceDescriptor = { 0 };
instanceDescriptor.nextInChain = &instanceExtras.chain;
WGPUInstance instance = wgpuCreateInstance(&instanceDescriptor); |
result:
surface_ was created by SDL2 library, it used to work using the last wgpu-native release from github
The text was updated successfully, but these errors were encountered: