bevy/crates
James Liu a85b740f24 Support recording multiple CommandBuffers in RenderContext (#7248)
# Objective
`RenderContext`, the core abstraction for running the render graph, currently only supports recording one `CommandBuffer` across the entire render graph. This means the entire buffer must be recorded sequentially, usually via the render graph itself. This prevents parallelization and forces users to only encode their commands in the render graph.

## Solution
Allow `RenderContext` to store a `Vec<CommandBuffer>` that it progressively appends to. By default, the context will not have a command encoder, but will create one as soon as either `begin_tracked_render_pass` or the `command_encoder` accesor is first called. `RenderContext::add_command_buffer` allows users to interrupt the current command encoder, flush it to the vec, append a user-provided `CommandBuffer` and reset the command encoder to start a new buffer. Users or the render graph will call `RenderContext::finish` to retrieve the series of buffers for submitting to the queue.

This allows users to encode their own `CommandBuffer`s outside of the render graph, potentially in different threads, and store them in components or resources.

Ideally, in the future, the core pipeline passes can run in `RenderStage::Render` systems and end up saving the completed command buffers to either `Commands` or a field in `RenderPhase`. 

## Alternatives
The alternative is to use to use wgpu's `RenderBundle`s, which can achieve similar results; however it's not universally available (no OpenGL, WebGL, and DX11).

---

## Changelog
Added: `RenderContext::new`
Added: `RenderContext::add_command_buffer`
Added: `RenderContext::finish`
Changed: `RenderContext::render_device` is now private. Use the accessor `RenderContext::render_device()` instead.
Changed: `RenderContext::command_encoder` is now private. Use the accessor `RenderContext::command_encoder()` instead.
Changed: `RenderContext` now supports adding external `CommandBuffer`s for inclusion into the render graphs. These buffers can be encoded outside of the render graph (i.e. in a system).

## Migration Guide
`RenderContext`'s fields are now private. Use the accessors on `RenderContext` instead, and construct it with `RenderContext::new`.
2023-01-22 00:21:55 +00:00
..
bevy_animation Basic adaptive batching for parallel query iteration (#4777) 2023-01-20 08:47:20 +00:00
bevy_app Pipelined Rendering (#6503) 2023-01-19 23:45:46 +00:00
bevy_asset fix load_internal_binary_asset with debug_asset_server (#7246) 2023-01-18 02:07:26 +00:00
bevy_audio AudioOutput is actually a normal resource now, not a non-send resource (#7262) 2023-01-18 17:20:26 +00:00
bevy_core Break CorePlugin into TaskPoolPlugin, TypeRegistrationPlugin, FrameCountPlugin. (#7083) 2023-01-05 11:42:35 +00:00
bevy_core_pipeline Support recording multiple CommandBuffers in RenderContext (#7248) 2023-01-22 00:21:55 +00:00
bevy_derive Fix ndk-macro link (#7027) 2022-12-25 05:06:03 +00:00
bevy_diagnostic Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
bevy_dylib Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_dynamic_plugin Adapt path type of dynamically_load_plugin (#6734) 2022-12-05 23:39:43 +00:00
bevy_ecs Added resource_id and changed init_resource and init_non_send_resource to return ComponentId (#7284) 2023-01-20 19:08:04 +00:00
bevy_ecs_compile_fail_tests Fix clippy lints and failed test with Rust 1.66 (#6945) 2022-12-15 18:05:15 +00:00
bevy_encase_derive add helper for macro to get either bevy::x or bevy_x depending on how it was imported (#7164) 2023-01-11 21:12:02 +00:00
bevy_gilrs Gamepad events refactor (#6965) 2023-01-09 19:24:52 +00:00
bevy_gltf enum Visibility component (#6320) 2022-12-25 00:39:29 +00:00
bevy_hierarchy Add ReplaceChildren and ClearChildren EntityCommands (#6035) 2023-01-16 21:24:15 +00:00
bevy_input Fix incorrect behavior of just_pressed and just_released in Input<GamepadButton> (#7238) 2023-01-16 21:09:24 +00:00
bevy_internal Pipelined Rendering (#6503) 2023-01-19 23:45:46 +00:00
bevy_log Fix suppression of all console logs when trace_tracy is enabled (#6955) 2022-12-20 23:45:43 +00:00
bevy_macro_utils Add bevy_ecs::schedule_v3 module (#6587) 2023-01-17 01:39:17 +00:00
bevy_math Improve code/comments for Ray::intersect_plane and its tests (#6823) 2022-12-05 22:49:06 +00:00
bevy_mikktspace Release 0.9.0 (#6568) 2022-11-12 20:01:29 +00:00
bevy_pbr Standard Material Blend Modes (#6644) 2023-01-21 21:46:53 +00:00
bevy_ptr Improve safety for CommandQueue internals (#7039) 2023-01-19 03:04:39 +00:00
bevy_reflect bevy_reflect: Add simple enum support to reflection paths (#6560) 2023-01-11 16:46:27 +00:00
bevy_reflect_compile_fail_tests bevy_reflect: Add compile fail tests for bevy_reflect (#7041) 2023-01-02 21:07:33 +00:00
bevy_render Support recording multiple CommandBuffers in RenderContext (#7248) 2023-01-22 00:21:55 +00:00
bevy_scene Fix beta clippy lints (#7154) 2023-01-11 09:51:22 +00:00
bevy_sprite Changed Msaa to Enum (#7292) 2023-01-20 14:25:21 +00:00
bevy_tasks Pipelined Rendering (#6503) 2023-01-19 23:45:46 +00:00
bevy_text Allow users of Text/TextBundle to choose from glyph_brush_layout's BuiltInLineBreaker options. (#7283) 2023-01-21 00:17:11 +00:00
bevy_time Add bevy_ecs::schedule_v3 module (#6587) 2023-01-17 01:39:17 +00:00
bevy_transform Basic adaptive batching for parallel query iteration (#4777) 2023-01-20 08:47:20 +00:00
bevy_ui Allow users of Text/TextBundle to choose from glyph_brush_layout's BuiltInLineBreaker options. (#7283) 2023-01-21 00:17:11 +00:00
bevy_utils Add bevy_ecs::schedule_v3 module (#6587) 2023-01-17 01:39:17 +00:00
bevy_window expose cursor position with scale (#7297) 2023-01-20 14:25:24 +00:00
bevy_winit break feedback loop when moving cursor (#7298) 2023-01-21 00:01:28 +00:00