Skip to content
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

OS-independent texture format setting in swapchain #3897

Closed
nia-e opened this issue Feb 8, 2022 · 2 comments
Closed

OS-independent texture format setting in swapchain #3897

nia-e opened this issue Feb 8, 2022 · 2 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-Crash A sudden unexpected crash

Comments

@nia-e
Copy link

nia-e commented Feb 8, 2022

What problem does this solve or what need does it fill?

The current bevy_render crate assumes the supported texture format based on OS. This may lead to issues, e.g. Nvidia on Wayland not supporting the expected Bgra8UnormSrgb format (only supporting Bgra8Unorm).

What solution would you like?

Perform platform-independent querying of supported texture formats in swapchain, with a preferred one then being picked for Surface:: configure.

What alternative(s) have you considered?

(In my case) using Xwayland by disabling the wayland feature works, but causes blurriness with fractional scaling.

Additional context

My current (incomplete) fix can be found at https://github.com/a-b-c-1-2-3/bevy on branch support-non-srgb, but this only allows for a feature to disable sRGB, not proper runtime querying of supported formats.

@nia-e nia-e added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Feb 8, 2022
@superdump superdump moved this to Todo in Rendering Feb 8, 2022
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-Linux Specific to the Linux desktop operating system and removed C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled O-Linux Specific to the Linux desktop operating system labels Feb 8, 2022
@Zentropivity
Copy link

Zentropivity commented Mar 18, 2022

I too have come across this issue. On bevy main (de677db).

The output of cargo run --release --features wayland --example bevymark:

INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1050 Ti", vendor: 4318, device: 7298, device_type: DiscreteGpu, backend: Vulkan }
thread 'main' panicked at 'Error in Surface::configure: requested format Bgra8UnormSrgb is not in list of supported formats: [Bgra8Unorm]', /home/zen/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:214:9
Using `RUST_BACKTRACE=1`, followed by:
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panicking.rs:116:14
   2: wgpu::backend::direct::Context::handle_error_fatal
   3: <wgpu::backend::direct::Context as wgpu::Context>::surface_configure
   4: bevy_render::view::window::prepare_windows
   5: <bevy_ecs::system::function_system::FunctionSystem<In,Out,Param,Marker,F> as bevy_ecs::system::system::System>::run_unsafe
   6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   8: async_task::raw::RawTask<F,T,S>::run
   9: async_executor::LocalExecutor::try_tick
  10: std::thread::local::LocalKey<T>::with
  11: <bevy_ecs::schedule::executor_parallel::ParallelExecutor as bevy_ecs::schedule::executor::ParallelSystemExecutor>::run_systems
  12: <bevy_ecs::schedule::stage::SystemStage as bevy_ecs::schedule::stage::Stage>::run
  13: <bevy_render::RenderPlugin as bevy_app::plugin::Plugin>::build::{{closure}}
  14: bevy_app::app::App::update
  15: bevy_winit::winit_runner_with::{{closure}}
  16: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run_return
  17: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run
  18: winit::platform_impl::platform::EventLoop<T>::run
  19: winit::event_loop::EventLoop<T>::run
  20: bevy_winit::run
  21: bevy_winit::winit_runner_with
  22: core::ops::function::Fn::call
  23: bevy_app::app::App::run
  24: bevymark::main
System information
                   -`
                  .o+`
                 `ooo/
                `+oooo:
               `+oooooo:                 zen@zen-arch 
               -+oooooo+:                ------------ 
             `/:-:++oooo+:               OS: Arch Linux x86_64 
            `/++++/+++++++:              Host: X570 AORUS ELITE -CF 
           `/++++++++++++++:             Kernel: 5.16.15-arch1-1 
          `/+++ooooooooooooo/`           Uptime: 2 hours, 21 mins 
         ./ooosssso++osssssso+`          Packages: 1230 (pacman) 
        .oossssso-````/ossssss+`         Shell: fish 3.3.1 
       -osssssso.      :ssssssso.        Resolution: 1920x1080 
      :osssssss/        osssso+++.       DE: Plasma 5.24.3 
     /ossssssss/        +ssssooo/-       WM: kwin 
   `/ossssso+/:-        -:/+osssso+-     WM Theme: Arc-Dark 
  `+sso+:-`                 `.-/+oso:    Theme: [Plasma], Arc-Dark-solid [GTK2/3] 
 `++:.                           `-/+/   Icons: Papirus-Dark [Plasma], Papirus-Dark [GTK2/3] 
 .`                                 `/   Terminal: kate 
                                         CPU: AMD Ryzen 7 5800X (16) @ 3.800GHz 
                                         GPU: NVIDIA GeForce GTX 1050 Ti 
                                         Memory: 3106MiB / 32087MiB 

I believe that this issue should be labeled C-Crash too.

@OtherCannon
Copy link

I've also experienced this issue, I'm using Fedora 36 with an NVIDIA RTX 2070 SUPER. Enabling the wayland feature gives me the same error.

VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Jul 21, 2022
…engine#3897

There is no Srgb support on some GPU and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which return `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem.

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Jul 21, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Jul 21, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Jul 21, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Jul 22, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Jul 24, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Jul 24, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Jul 29, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
@NiklasEi NiklasEi added the P-Crash A sudden unexpected crash label Aug 14, 2022
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Aug 16, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Aug 20, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Sep 5, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Sep 9, 2022
…engine#3897

# Objective

There is no Srgb support on some platforms with some GPUs and display protocols (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and use `wgpu::Adapter` to get proper `TextureFormat`.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Sep 30, 2022
There is no Srgb support on some GPU and display protocols with `winit` (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and `first_available_texture_format`, use the `first_available_texture_format` by default.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Sep 30, 2022
There is no Srgb support on some GPU and display protocols with `winit` (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and `first_available_texture_format`, use the `first_available_texture_format` by default.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Sep 30, 2022
There is no Srgb support on some GPU and display protocols with `winit` (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and `first_available_texture_format`, use the `first_available_texture_format` by default.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Sep 30, 2022
There is no Srgb support on some GPU and display protocols with `winit` (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and `first_available_texture_format`, use the `first_available_texture_format` by default.

## Changelog

* Fixed bevyengine#3897
VitalyAnkh added a commit to VitalyAnkh/bevy that referenced this issue Sep 30, 2022
There is no Srgb support on some GPU and display protocols with `winit` (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and `first_available_texture_format`, use the `first_available_texture_format` by default.

## Changelog

* Fixed bevyengine#3897
@bors bors bot closed this as completed in f5322cd Oct 10, 2022
Repository owner moved this from Todo to Done in Rendering Oct 10, 2022
james7132 pushed a commit to james7132/bevy that referenced this issue Oct 19, 2022
…engine#3897 (bevyengine#5413)

# Objective
There is no Srgb support on some GPU and display protocols with `winit` (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897.

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and `first_available_texture_format`, use the `first_available_texture_format` by default.

## Changelog

* Fixed bevyengine#3897.
james7132 pushed a commit to james7132/bevy that referenced this issue Oct 28, 2022
…engine#3897 (bevyengine#5413)

# Objective
There is no Srgb support on some GPU and display protocols with `winit` (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897.

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and `first_available_texture_format`, use the `first_available_texture_format` by default.

## Changelog

* Fixed bevyengine#3897.
Pietrek14 pushed a commit to Pietrek14/bevy that referenced this issue Dec 17, 2022
…engine#3897 (bevyengine#5413)

# Objective
There is no Srgb support on some GPU and display protocols with `winit` (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897.

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and `first_available_texture_format`, use the `first_available_texture_format` by default.

## Changelog

* Fixed bevyengine#3897.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
…engine#3897 (bevyengine#5413)

# Objective
There is no Srgb support on some GPU and display protocols with `winit` (for example, Nvidia's GPUs with Wayland). Thus `TextureFormat::bevy_default()` which returns `Rgba8UnormSrgb` or `Bgra8UnormSrgb` will cause panics on such platforms. This patch will resolve this problem. Fix bevyengine#3897.

## Solution

Make `initialize_renderer` expose `wgpu::Adapter` and `first_available_texture_format`, use the `first_available_texture_format` by default.

## Changelog

* Fixed bevyengine#3897.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-Crash A sudden unexpected crash
Projects
Status: Done
5 participants