diff options
author | Zack Middleton <zturtleman@gmail.com> | 2013-06-18 18:00:45 -0500 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2014-06-17 17:43:32 +0100 |
commit | f245318b33c0b8398fbff96956a06d1098d46f83 (patch) | |
tree | 01fb4f5c54fb4a5375c108e42d9aead19a7c4bd2 /src/renderergl1 | |
parent | 2b6fe326bef2f881a453edfc0909a1af104ffd9d (diff) |
Fix IQM tess buffer overflow
Set the variables that use tess.numVertexes after calling RB_CHECKOVERFLOW() as it may set tess.numVertexes to 0!
Could cause visual issues and error "RB_EndSurface() - SHADER_MAX_VERTEXES hit".
Diffstat (limited to 'src/renderergl1')
-rw-r--r-- | src/renderergl1/tr_model_iqm.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/renderergl1/tr_model_iqm.c b/src/renderergl1/tr_model_iqm.c index 1116d09c..4859db4b 100644 --- a/src/renderergl1/tr_model_iqm.c +++ b/src/renderergl1/tr_model_iqm.c @@ -954,10 +954,10 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) { float jointMats[IQM_MAX_JOINTS * 12]; int i; - vec4_t *outXYZ = &tess.xyz[tess.numVertexes]; - vec4_t *outNormal = &tess.normal[tess.numVertexes]; - vec2_t (*outTexCoord)[2] = &tess.texCoords[tess.numVertexes]; - color4ub_t *outColor = &tess.vertexColors[tess.numVertexes]; + vec4_t *outXYZ; + vec4_t *outNormal; + vec2_t (*outTexCoord)[2]; + color4ub_t *outColor; int frame = data->num_frames ? backEnd.currentEntity->e.frame % data->num_frames : 0; int oldframe = data->num_frames ? backEnd.currentEntity->e.oldframe % data->num_frames : 0; @@ -969,6 +969,11 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) { RB_CHECKOVERFLOW( surf->num_vertexes, surf->num_triangles * 3 ); + outXYZ = &tess.xyz[tess.numVertexes]; + outNormal = &tess.normal[tess.numVertexes]; + outTexCoord = &tess.texCoords[tess.numVertexes]; + outColor = &tess.vertexColors[tess.numVertexes]; + // compute interpolated joint matrices if ( data->num_joints > 0 ) { ComputePoseMats( data, frame, oldframe, backlerp, jointMats ); |