Skip to content

Commit

Permalink
remove copyless (#6100)
Browse files Browse the repository at this point in the history
# Objective
Remove copyless
copyless apparently isn't needed anymore to prevent extraneous memcopies and therefore got deprecated: kvark/copyless#22
  • Loading branch information
SpecificProtagonist committed Sep 27, 2022
1 parent 5875ea7 commit 128c169
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion crates/bevy_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ hex = "0.4.2"
hexasphere = "7.2"
parking_lot = "0.12.1"
regex = "1.5"
copyless = "0.1.5"
ddsfile = { version = "0.5.0", optional = true }
ktx2 = { version = "0.3.0", optional = true }
# For ktx2 supercompression
Expand Down
4 changes: 1 addition & 3 deletions crates/bevy_render/src/render_phase/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ pub use draw_state::*;

use bevy_ecs::prelude::{Component, Query};

use copyless::VecHelper;

/// A resource to collect and sort draw requests for specific [`PhaseItems`](PhaseItem).
#[derive(Component)]
pub struct RenderPhase<I: PhaseItem> {
Expand All @@ -24,7 +22,7 @@ impl<I: PhaseItem> RenderPhase<I> {
/// Adds a [`PhaseItem`] to this render phase.
#[inline]
pub fn add(&mut self, item: I) {
self.items.alloc().init(item);
self.items.push(item);
}

/// Sorts all of its [`PhaseItems`](PhaseItem).
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_render/src/render_resource/buffer_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::{
renderer::{RenderDevice, RenderQueue},
};
use bevy_core::{cast_slice, Pod};
use copyless::VecHelper;
use wgpu::BufferUsages;

/// A structure for storing raw bytes that have already been properly formatted
Expand Down Expand Up @@ -72,7 +71,7 @@ impl<T: Pod> BufferVec<T> {

pub fn push(&mut self, value: T) -> usize {
let index = self.values.len();
self.values.alloc().init(value);
self.values.push(value);
index
}

Expand Down
1 change: 0 additions & 1 deletion crates/bevy_sprite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ guillotiere = "0.6.0"
thiserror = "1.0"
rectangle-pack = "0.4"
bitflags = "1.2"
copyless = "0.1.5"
5 changes: 2 additions & 3 deletions crates/bevy_sprite/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use bevy_transform::components::GlobalTransform;
use bevy_utils::FloatOrd;
use bevy_utils::HashMap;
use bytemuck::{Pod, Zeroable};
use copyless::VecHelper;
use fixedbitset::FixedBitSet;

#[derive(Resource)]
Expand Down Expand Up @@ -253,7 +252,7 @@ pub fn extract_sprites(
continue;
}
// PERF: we don't check in this function that the `Image` asset is ready, since it should be in most cases and hashing the handle is expensive
extracted_sprites.sprites.alloc().init(ExtractedSprite {
extracted_sprites.sprites.push(ExtractedSprite {
entity,
color: sprite.color,
transform: *transform,
Expand All @@ -272,7 +271,7 @@ pub fn extract_sprites(
}
if let Some(texture_atlas) = texture_atlases.get(texture_atlas_handle) {
let rect = Some(texture_atlas.textures[atlas_sprite.index as usize]);
extracted_sprites.sprites.alloc().init(ExtractedSprite {
extracted_sprites.sprites.push(ExtractedSprite {
entity,
color: atlas_sprite.color,
transform: *transform,
Expand Down

0 comments on commit 128c169

Please sign in to comment.