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

[Merged by Bors] - use bevy default texture format if the surface is not yet available #6233

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions crates/bevy_render/src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ pub use render_device::*;
use crate::{
render_graph::RenderGraph,
settings::{WgpuSettings, WgpuSettingsPriority},
texture::BevyDefault,
view::{ExtractedWindows, ViewTarget},
};
use bevy_ecs::prelude::*;
use bevy_time::TimeSender;
use bevy_utils::Instant;
use std::sync::Arc;
use wgpu::{Adapter, AdapterInfo, CommandEncoder, Instance, Queue, RequestAdapterOptions};
use wgpu::{
Adapter, AdapterInfo, CommandEncoder, Instance, Queue, RequestAdapterOptions, TextureFormat,
};

/// Updates the [`RenderGraph`] with all of its nodes and then runs it to render the entire frame.
pub fn render_system(world: &mut World) {
Expand Down Expand Up @@ -278,11 +281,10 @@ pub async fn initialize_renderer(
let mut available_texture_formats = Vec::new();
if let Some(s) = request_adapter_options.compatible_surface {
available_texture_formats = s.get_supported_formats(&adapter);
if available_texture_formats.is_empty() {
info!("{:?}", adapter_info);
panic!("No supported texture formats found!");
}
};
if available_texture_formats.is_empty() {
available_texture_formats.push(TextureFormat::bevy_default())
}
let available_texture_formats = Arc::new(available_texture_formats);
(
RenderDevice::from(device),
Expand Down