Skip to content

WgpuOptionsPriority::Functionality overwrites app preferences with suboptimal configuration #3686

@djeedai

Description

@djeedai

Bevy version

0.6.0

Operating system & version

Windows 10 (but issue is independent)

What you did

Run any app on Windows 10 NVIDIA GeForce RTX 2070 with Vulkan.

What you expected to happen

No warning.

What actually happened

WARN wgpu_core::instance: Feature MAPPABLE_PRIMARY_BUFFERS enabled on a discrete gpu. This is a massive performance footgun and likely not what you wanted

Additional information

I tried setting explicitly Features::MAPPABLE_PRIMARY_BUFFERS off in WgpuOptions, without success.

Eventually I ran under debugger and found that the default WgpuOptionsPriority value is Functionality, which in bevy_render while creating device will override any app's setting with those of the selected adapter:

if matches!(options.priority, WgpuOptionsPriority::Functionality) {
options.features =
adapter.features() | wgpu::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES;
options.limits = adapter.limits();
}

While this makes sense for a lot of those settings, like the various hardware limits, this makes no sense for several flags which being reported by adapter.features() only inform the app that the GPU supports the feature, but in no way was intended to tell the app that this is an optimal feature to use. This is the case in particular for MAPPABLE_PRIMARY_BUFFERS which is supported on an RTX 2070 but as the warning shows is strongly discouraged. Yet the bevy_render code simply set options.features = adapter.features() indiscriminately.

Metadata

Metadata

Assignees

Labels

A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorC-PerformanceA change motivated by improving speed, memory usage or compile times

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions