This is a duplicate of #9632, it was created since I forgot to make a new branch when I first made this PR, so I was having trouble resolving merge conflicts, meaning I had to rebuild my PR. # Objective - Allow other plugins to create the renderer resources. An example of where this would be required is my [OpenXR plugin](https://github.com/awtterpip/bevy_openxr) ## Solution - Changed the bevy RenderPlugin to optionally take precreated render resources instead of a configuration. ## Migration Guide The `RenderPlugin` now takes a `RenderCreation` enum instead of `WgpuSettings`. `RenderSettings::default()` returns `RenderSettings::Automatic(WgpuSettings::default())`. `RenderSettings` also implements `From<WgpuSettings>`. ```rust // before RenderPlugin { wgpu_settings: WgpuSettings { ... }, } // now RenderPlugin { render_creation: RenderCreation::Automatic(WgpuSettings { ... }), } // or RenderPlugin { render_creation: WgpuSettings { ... }.into(), } ``` --------- Co-authored-by: Malek <pocmalek@gmail.com> Co-authored-by: Robert Swain <robert.swain@gmail.com>
		
			
				
	
	
		
			25 lines
		
	
	
		
			629 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			629 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
//! An application that runs with default plugins and displays an empty
 | 
						|
//! window, but without an actual renderer.
 | 
						|
//! This can be very useful for integration tests or CI.
 | 
						|
//!
 | 
						|
//! See also the `headless` example which does not display a window.
 | 
						|
 | 
						|
use bevy::{
 | 
						|
    prelude::*,
 | 
						|
    render::{settings::WgpuSettings, RenderPlugin},
 | 
						|
};
 | 
						|
 | 
						|
fn main() {
 | 
						|
    App::new()
 | 
						|
        .add_plugins(
 | 
						|
            DefaultPlugins.set(RenderPlugin {
 | 
						|
                render_creation: WgpuSettings {
 | 
						|
                    backends: None,
 | 
						|
                    ..default()
 | 
						|
                }
 | 
						|
                .into(),
 | 
						|
            }),
 | 
						|
        )
 | 
						|
        .run();
 | 
						|
}
 |