Function bevy_internal::render::view::window::prepare_windows
source · pub fn prepare_windows(
windows: ResMut<'_, ExtractedWindows>,
window_surfaces: ResMut<'_, WindowSurfaces>,
render_device: Res<'_, RenderDevice>,
render_adapter: Res<'_, RenderAdapter>,
screenshot_pipeline: Res<'_, ScreenshotToScreenPipeline>,
pipeline_cache: Res<'_, PipelineCache>,
pipelines: ResMut<'_, SpecializedRenderPipelines<ScreenshotToScreenPipeline>>,
msaa: ResMut<'_, Msaa>,
render_instance: Res<'_, RenderInstance>
)
Expand description
(re)configures window surfaces, and obtains a swapchain texture for rendering.
NOTE: get_current_texture
in prepare_windows
can take a long time if the GPU workload is
the performance bottleneck. This can be seen in profiles as multiple prepare-set systems all
taking an unusually long time to complete, and all finishing at about the same time as the
prepare_windows
system. Improvements in bevy are planned to avoid this happening when it
should not but it will still happen as it is easy for a user to create a large GPU workload
relative to the GPU performance and/or CPU workload.
This can be caused by many reasons, but several of them are:
- GPU workload is more than your current GPU can manage
- Error / performance bug in your custom shaders
- wgpu was unable to detect a proper GPU hardware-accelerated device given the chosen
Backends
,WgpuLimits
, and/orWgpuFeatures
. For example, on Windows currentlyDirectX 11
is not supported by wgpu 0.12 and so if your GPU/drivers do not support Vulkan, it may be that a software renderer called “Microsoft Basic Render Driver” usingDirectX 12
will be chosen and performance will be very poor. This is visible in a log message that is output during renderer initialization. Future versions of wgpu will supportDirectX 11
, but another alternative is to try to useANGLE
andBackends::GL
if your GPU/drivers supportOpenGL 4.3
/OpenGL ES 3.0
or later.