mirror of
https://github.com/eliasstepanik/voxel-simulation.git
synced 2026-01-11 13:58:30 +00:00
Increase GPU worker buffer sizes
This commit is contained in:
parent
0f3b512935
commit
d05c0773c6
@ -1,7 +1,7 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_app_compute::prelude::*;
|
||||
|
||||
use super::structure::{MeshBufferPool, SparseVoxelOctree};
|
||||
use super::structure::{CHUNK_SIZE, MeshBufferPool, SparseVoxelOctree};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(ShaderType, Copy, Clone, Default)]
|
||||
@ -22,6 +22,11 @@ pub struct VertexGpu {
|
||||
pub uv: Vec2,
|
||||
}
|
||||
|
||||
const MAX_VOXELS: usize = (CHUNK_SIZE as usize) * (CHUNK_SIZE as usize) * (CHUNK_SIZE as usize);
|
||||
const MAX_QUADS: usize = MAX_VOXELS * 6;
|
||||
const MAX_VERTICES: usize = MAX_QUADS * 4;
|
||||
const MAX_INDICES: usize = MAX_QUADS * 6;
|
||||
|
||||
#[derive(TypePath)]
|
||||
struct GreedyMeshingShader;
|
||||
|
||||
@ -38,10 +43,10 @@ pub struct GpuMeshingWorker;
|
||||
impl ComputeWorker for GpuMeshingWorker {
|
||||
fn build(world: &mut World) -> AppComputeWorker<Self> {
|
||||
AppComputeWorkerBuilder::new(world)
|
||||
.add_storage("voxels", &[0u32; 1])
|
||||
.add_storage("voxels", &[0u32; MAX_VOXELS])
|
||||
.add_uniform("params", &Params::default())
|
||||
.add_storage("vertices", &[VertexGpu::default(); 1])
|
||||
.add_storage("indices", &[0u32; 1])
|
||||
.add_storage("vertices", &[VertexGpu::default(); MAX_VERTICES])
|
||||
.add_storage("indices", &[0u32; MAX_INDICES])
|
||||
.add_storage("counts", &[0u32; 2])
|
||||
.add_pass::<GreedyMeshingShader>(
|
||||
[1, 1, 1],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user