From 872f0c31a87d522bc38f3fd701c861c5acbfced9 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Sun, 9 Nov 2025 23:12:20 -0600 Subject: [PATCH] particle_oriented_animated_quad_vbuf*: increase particle count --- src/particle_oriented_animated_quad_vbuf.cpp | 11 +++++++--- ...iented_animated_quad_vbuf_pixel_shader.cpp | 21 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/particle_oriented_animated_quad_vbuf.cpp b/src/particle_oriented_animated_quad_vbuf.cpp index 495040f..1b0d11d 100644 --- a/src/particle_oriented_animated_quad_vbuf.cpp +++ b/src/particle_oriented_animated_quad_vbuf.cpp @@ -243,6 +243,8 @@ void _3d_particle_inner(int particles_length, int position_offset) { const int vertex_count = 4 * particles_length; + assert(vertex_count <= 0xffffff); + ////////////////////////////////////////////////////////////////////////////// // VF ////////////////////////////////////////////////////////////////////////////// @@ -285,14 +287,17 @@ void _3d_particle_inner(int particles_length, int position_offset) // 3D_DRAW ////////////////////////////////////////////////////////////////////////////// + T0V(VAP_ALT_NUM_VERTICES, + vertex_count); + T3(_3D_DRAW_VBUF_2, (1 - 1)); TU( VAP_VF_CNTL__PRIM_TYPE(13) // quad list | VAP_VF_CNTL__PRIM_WALK(2) // vertex list (data fetched from memory) | VAP_VF_CNTL__INDEX_SIZE(0) | VAP_VF_CNTL__VTX_REUSE_DIS(0) | VAP_VF_CNTL__DUAL_INDEX_MODE(0) - | VAP_VF_CNTL__USE_ALT_NUM_VERTS(0) - | VAP_VF_CNTL__NUM_VERTICES(vertex_count) + | VAP_VF_CNTL__USE_ALT_NUM_VERTS(1) + | VAP_VF_CNTL__NUM_VERTICES(0) ); } @@ -730,7 +735,7 @@ int main() int colorbuffer_ix = 0; float theta = PI * 0.5; - particle particles[16 * 16] = {}; + particle particles[512 * 256] = {}; const int particles_length = (sizeof (particles)) / (sizeof (particles[0])); vertexbuffer_handle = init_particles_vertexbuffer(fd, particles_length, &vertexbuffer_ptr); init_particles(particles, particles_length); diff --git a/src/particle_oriented_animated_quad_vbuf_pixel_shader.cpp b/src/particle_oriented_animated_quad_vbuf_pixel_shader.cpp index 5676423..f2d812f 100644 --- a/src/particle_oriented_animated_quad_vbuf_pixel_shader.cpp +++ b/src/particle_oriented_animated_quad_vbuf_pixel_shader.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -275,6 +276,8 @@ void _3d_particle_inner(int particles_length, int position_offset) { const int vertex_count = 4 * particles_length; + assert(vertex_count <= 0xffffff); + ////////////////////////////////////////////////////////////////////////////// // VF ////////////////////////////////////////////////////////////////////////////// @@ -317,14 +320,17 @@ void _3d_particle_inner(int particles_length, int position_offset) // 3D_DRAW ////////////////////////////////////////////////////////////////////////////// + T0V(VAP_ALT_NUM_VERTICES, + vertex_count); + T3(_3D_DRAW_VBUF_2, (1 - 1)); TU( VAP_VF_CNTL__PRIM_TYPE(13) // quad list | VAP_VF_CNTL__PRIM_WALK(2) // vertex list (data fetched from memory) | VAP_VF_CNTL__INDEX_SIZE(0) | VAP_VF_CNTL__VTX_REUSE_DIS(0) | VAP_VF_CNTL__DUAL_INDEX_MODE(0) - | VAP_VF_CNTL__USE_ALT_NUM_VERTS(0) - | VAP_VF_CNTL__NUM_VERTICES(vertex_count) + | VAP_VF_CNTL__USE_ALT_NUM_VERTS(1) + | VAP_VF_CNTL__NUM_VERTICES(0) ); } @@ -1309,8 +1315,8 @@ int main() int colorbuffer_ix = 0; float theta = PI * 0.5; - const int floatbuffer_width = 64; - const int floatbuffer_height = 64; + const int floatbuffer_width = 512; + const int floatbuffer_height = 256; floatbuffer_state state = create_floatbuffers(fd, floatbuffer_width * floatbuffer_height); vertexbuffer_handle = init_particles_vertexbuffer(fd, state.length, &vertexbuffer_ptr); @@ -1366,6 +1372,13 @@ int main() if (ret == -1) break; + + + struct timespec duration = { + .tv_sec = 0, + .tv_nsec = 18000000, + }; + nanosleep(&duration, NULL); } primary_surface_address(rmmio, colorbuffer_ix);