remove copyless (#6100)

# Objective
Remove copyless
copyless apparently isn't needed anymore to prevent extraneous memcopies and therefore got deprecated: https://github.com/kvark/copyless/issues/22
This commit is contained in:
SpecificProtagonist 2022-09-27 18:11:40 +00:00
parent 5875ea7db0
commit 128c169503
5 changed files with 4 additions and 10 deletions

View File

@ -65,7 +65,6 @@ hex = "0.4.2"
hexasphere = "7.2" hexasphere = "7.2"
parking_lot = "0.12.1" parking_lot = "0.12.1"
regex = "1.5" regex = "1.5"
copyless = "0.1.5"
ddsfile = { version = "0.5.0", optional = true } ddsfile = { version = "0.5.0", optional = true }
ktx2 = { version = "0.3.0", optional = true } ktx2 = { version = "0.3.0", optional = true }
# For ktx2 supercompression # For ktx2 supercompression

View File

@ -6,8 +6,6 @@ pub use draw_state::*;
use bevy_ecs::prelude::{Component, Query}; use bevy_ecs::prelude::{Component, Query};
use copyless::VecHelper;
/// A resource to collect and sort draw requests for specific [`PhaseItems`](PhaseItem). /// A resource to collect and sort draw requests for specific [`PhaseItems`](PhaseItem).
#[derive(Component)] #[derive(Component)]
pub struct RenderPhase<I: PhaseItem> { pub struct RenderPhase<I: PhaseItem> {
@ -24,7 +22,7 @@ impl<I: PhaseItem> RenderPhase<I> {
/// Adds a [`PhaseItem`] to this render phase. /// Adds a [`PhaseItem`] to this render phase.
#[inline] #[inline]
pub fn add(&mut self, item: I) { pub fn add(&mut self, item: I) {
self.items.alloc().init(item); self.items.push(item);
} }
/// Sorts all of its [`PhaseItems`](PhaseItem). /// Sorts all of its [`PhaseItems`](PhaseItem).

View File

@ -3,7 +3,6 @@ use crate::{
renderer::{RenderDevice, RenderQueue}, renderer::{RenderDevice, RenderQueue},
}; };
use bevy_core::{cast_slice, Pod}; use bevy_core::{cast_slice, Pod};
use copyless::VecHelper;
use wgpu::BufferUsages; use wgpu::BufferUsages;
/// A structure for storing raw bytes that have already been properly formatted /// A structure for storing raw bytes that have already been properly formatted
@ -72,7 +71,7 @@ impl<T: Pod> BufferVec<T> {
pub fn push(&mut self, value: T) -> usize { pub fn push(&mut self, value: T) -> usize {
let index = self.values.len(); let index = self.values.len();
self.values.alloc().init(value); self.values.push(value);
index index
} }

View File

@ -31,4 +31,3 @@ guillotiere = "0.6.0"
thiserror = "1.0" thiserror = "1.0"
rectangle-pack = "0.4" rectangle-pack = "0.4"
bitflags = "1.2" bitflags = "1.2"
copyless = "0.1.5"

View File

@ -31,7 +31,6 @@ use bevy_transform::components::GlobalTransform;
use bevy_utils::FloatOrd; use bevy_utils::FloatOrd;
use bevy_utils::HashMap; use bevy_utils::HashMap;
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
use copyless::VecHelper;
use fixedbitset::FixedBitSet; use fixedbitset::FixedBitSet;
#[derive(Resource)] #[derive(Resource)]
@ -253,7 +252,7 @@ pub fn extract_sprites(
continue; 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 // 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, entity,
color: sprite.color, color: sprite.color,
transform: *transform, transform: *transform,
@ -272,7 +271,7 @@ pub fn extract_sprites(
} }
if let Some(texture_atlas) = texture_atlases.get(texture_atlas_handle) { if let Some(texture_atlas) = texture_atlases.get(texture_atlas_handle) {
let rect = Some(texture_atlas.textures[atlas_sprite.index as usize]); let rect = Some(texture_atlas.textures[atlas_sprite.index as usize]);
extracted_sprites.sprites.alloc().init(ExtractedSprite { extracted_sprites.sprites.push(ExtractedSprite {
entity, entity,
color: atlas_sprite.color, color: atlas_sprite.color,
transform: *transform, transform: *transform,