Merge pull request #846 from devnexen/vla_0_fix

GL1 renderer fix VLA with no size cases,
This commit is contained in:
Yamagi 2022-06-11 16:40:48 +02:00 committed by GitHub
commit a1dddaede3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -526,6 +526,11 @@ R_DrawParticles(void)
qboolean stereo_split_tb = ((gl_state.stereo_mode == STEREO_SPLIT_VERTICAL) && gl_state.camera_separation); qboolean stereo_split_tb = ((gl_state.stereo_mode == STEREO_SPLIT_VERTICAL) && gl_state.camera_separation);
qboolean stereo_split_lr = ((gl_state.stereo_mode == STEREO_SPLIT_HORIZONTAL) && gl_state.camera_separation); qboolean stereo_split_lr = ((gl_state.stereo_mode == STEREO_SPLIT_HORIZONTAL) && gl_state.camera_separation);
if (r_newrefdef.num_particles <= 0) /* avoiding VLA with no size and vertexes built on it */
{
return;
}
if (gl_config.pointparameters && !(stereo_split_tb || stereo_split_lr)) if (gl_config.pointparameters && !(stereo_split_tb || stereo_split_lr))
{ {
int i; int i;
@ -533,7 +538,7 @@ R_DrawParticles(void)
const particle_t *p; const particle_t *p;
YQ2_VLA(GLfloat, vtx, 3 * r_newrefdef.num_particles); YQ2_VLA(GLfloat, vtx, 3 * r_newrefdef.num_particles);
YQ2_VLA(GLfloat, clr, 4*r_newrefdef.num_particles); YQ2_VLA(GLfloat, clr, 4 * r_newrefdef.num_particles);
unsigned int index_vtx = 0; unsigned int index_vtx = 0;
unsigned int index_clr = 0; unsigned int index_clr = 0;