Skip to content

Commit 51726f8

Browse files
committed
Revert CommandBuffer<T> abstraction
1 parent 944bc33 commit 51726f8

File tree

8 files changed

+29
-51
lines changed

8 files changed

+29
-51
lines changed

Cargo.lock

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ processing = { path = "." }
2626
processing_pyo3 = { path = "crates/processing_pyo3" }
2727
processing_render = { path = "crates/processing_render" }
2828
processing_midi = { path = "crates/processing_midi" }
29-
processing_utils = { path = "crates/processing_utils" }
3029

3130
[dependencies]
3231
bevy = { workspace = true }

crates/processing_render/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ x11 = ["bevy/x11"]
1313

1414
[dependencies]
1515
bevy = { workspace = true }
16-
processing_utils = { workspace = true }
1716
lyon = "1.0"
1817
raw-window-handle = "0.6"
1918
thiserror = "2"

crates/processing_render/src/graphics.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ use crate::{
2929
Flush,
3030
error::{ProcessingError, Result},
3131
image::{Image, bytes_to_pixels, create_readback_buffer, pixel_size, pixels_to_bytes},
32-
render::{RenderState, command::DrawCommand},
32+
render::{
33+
RenderState,
34+
command::{CommandBuffer, DrawCommand},
35+
},
3336
surface::Surface,
3437
};
3538

36-
use processing_utils::CommandBuffer;
37-
3839
pub struct GraphicsPlugin;
3940

4041
impl Plugin for GraphicsPlugin {
@@ -241,7 +242,7 @@ pub fn create(
241242
}),
242243
Transform::from_xyz(0.0, 0.0, 999.9),
243244
render_layer,
244-
CommandBuffer::<DrawCommand>::new(),
245+
CommandBuffer::new(),
245246
RenderState::default(),
246247
SurfaceSize(width, height),
247248
Graphics {
@@ -471,7 +472,7 @@ pub fn end_draw(app: &mut App, entity: Entity) -> Result<()> {
471472

472473
pub fn record_command(
473474
In((graphics_entity, cmd)): In<(Entity, DrawCommand)>,
474-
mut graphics_query: Query<&mut CommandBuffer<DrawCommand>>,
475+
mut graphics_query: Query<&mut CommandBuffer>,
475476
) -> Result<()> {
476477
let mut command_buffer = graphics_query
477478
.get_mut(graphics_entity)

crates/processing_render/src/render/command.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,24 @@ pub enum DrawCommand {
5353
stacks: u32,
5454
},
5555
}
56+
57+
#[derive(Debug, Default, Component)]
58+
pub struct CommandBuffer {
59+
pub commands: Vec<DrawCommand>,
60+
}
61+
62+
impl CommandBuffer {
63+
pub fn new() -> Self {
64+
Self {
65+
commands: Vec::new(),
66+
}
67+
}
68+
69+
pub fn push(&mut self, cmd: DrawCommand) {
70+
self.commands.push(cmd);
71+
}
72+
73+
pub fn clear(&mut self) {
74+
self.commands.clear();
75+
}
76+
}

crates/processing_render/src/render/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use bevy::{
1010
math::{Affine3A, Mat4, Vec4},
1111
prelude::*,
1212
};
13-
use command::DrawCommand;
13+
use command::{CommandBuffer, DrawCommand};
1414
use material::MaterialKey;
1515
use primitive::{TessellationMode, box_mesh, empty_mesh, sphere_mesh};
1616
use transform::TransformStack;
@@ -22,8 +22,6 @@ use crate::{
2222
render::{material::UntypedMaterial, primitive::rect},
2323
};
2424

25-
use processing_utils::CommandBuffer;
26-
2725
#[derive(Component)]
2826
#[relationship(relationship_target = TransientMeshes)]
2927
pub struct BelongsToGraphics(pub Entity);
@@ -115,7 +113,7 @@ pub fn flush_draw_commands(
115113
mut graphics: Query<
116114
(
117115
Entity,
118-
&mut CommandBuffer<DrawCommand>,
116+
&mut CommandBuffer,
119117
&mut RenderState,
120118
&RenderLayers,
121119
&Projection,

crates/processing_utils/Cargo.toml

Lines changed: 0 additions & 10 deletions
This file was deleted.

crates/processing_utils/src/lib.rs

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)