bevy: Gpu not working / being detected
Bevy version
0.6.1
Operating system & version
Windows 11
What you did
New rust project
$ cargo new --bin my_game
$ cargo add bevy
add example code
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.run();
}
What you expected to happen
See game window pop up.
What actually happened
Bunch of errors show up, window appears for an instance and crashes.
Additional information
Full output:
2022-04-12T00:33:05.334771Z ERROR wgpu_hal::vulkan::instance: objects: (type: INSTANCE, hndl: 0x1e171fabf00, name: ?)
2022-04-12T00:33:05.335922Z ERROR wgpu_hal::vulkan::instance: GENERAL [Loader Message (0x0)]
setup_loader_tramp_phys_devs: Failed during dispatch call of 'vkEnumeratePhysicalDevices' to lower layers or loader to get count.
2022-04-12T00:33:05.336360Z ERROR wgpu_hal::vulkan::instance: objects: (type: INSTANCE, hndl: 0x1e171fabf00, name: ?)
2022-04-12T00:33:06.265140Z INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1650 Ti", vendor: 4318, device: 8085, device_type: DiscreteGpu, backend: Dx12 }
2022-04-12T00:33:10.323805Z ERROR present_frames: wgpu_hal::dx12::instance: ID3D12CommandQueue::Present: Resource state (0x800: D3D12_RESOURCE_STATE_COPY_SOURCE) (promoted from COMMON state) of resource (0x000001E17BDCAD80:'Unnamed ID3D12Resource Object') (subresource: 0) must be in COMMON state when transitioning to use in a different Command List type, because resource state on previous Command List type : D3D12_COMMAND_LIST_TYPE_COPY, is actually incompatible and different from that on the next Command List type : D3D12_COMMAND_LIST_TYPE_DIRECT. [ RESOURCE_MANIPULATION ERROR #990: RESOURCE_BARRIER_MISMATCHING_COMMAND_LIST_TYPE]
This is after installing latest drivers.
I then also tried a suggestion from another issue https://github.com/bevyengine/bevy/issues/3645
use bevy::prelude::*;
use bevy::render::options::{Backends, WgpuOptions};
fn main() {
App::new()
.insert_resource(WgpuOptions {
backends: Some(Backends::VULKAN),
..Default::default()
})
.add_plugins(DefaultPlugins)
.run();
}
which has similar effects
full output:
2022-04-12T00:37:24.382750Z ERROR wgpu_hal::vulkan::instance: GENERAL [Loader Message (0x0)]
setup_loader_tramp_phys_devs: Failed during dispatch call of 'vkEnumeratePhysicalDevices' to lower layers or loader to get count.
2022-04-12T00:37:24.383295Z ERROR wgpu_hal::vulkan::instance: objects: (type: INSTANCE, hndl: 0x21c5d6f82e0, name: ?)
2022-04-12T00:37:24.384123Z ERROR wgpu_hal::vulkan::instance: GENERAL [Loader Message (0x0)]
setup_loader_tramp_phys_devs: Failed during dispatch call of 'vkEnumeratePhysicalDevices' to lower layers or loader to get count.
2022-04-12T00:37:24.384396Z ERROR wgpu_hal::vulkan::instance: objects: (type: INSTANCE, hndl: 0x21c5d6f82e0, name: ?)
thread 'main' panicked at 'Unable to find a GPU! Make sure you have installed required drivers!', C:\Users\verca\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_render-0.6.1\src\renderer\mod.rs:74:10
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (5 by maintainers)
Update: I found the solution !
Context: This is a bug in dx12, the bug suppression was added in wgpu, that is why the wgpu examples run correctly, but it hasn’t been released yet, so bevy which still uses 0.12.0 wgpu fails.
Solution: Patch wgpu to use the latest branch instead of version 0.12.0
This should be enough to fix the issue ! Hope this helps someone else (:
@alice-i-cecile looks like there already exists issue #12739 that was already opened
I haven’t made an issue there and am not sure if there is one already.
I wanted to first find the exact commit that introduces the fix so that way is easier to create a patch.
I will link once I create the issue