From 770aac97dc7ea7ddee614cc5e1c6cee23cfdb438 Mon Sep 17 00:00:00 2001 From: divverent Date: Sun, 20 Dec 2009 18:27:38 +0000 Subject: [PATCH] allocate the right byte count for PVS data in framedata git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9612 d7cf8633-e32d-0410-b094-e92efae38249 --- r_shadow.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/r_shadow.c b/r_shadow.c index 59cd82da..89c2560b 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -3678,8 +3678,10 @@ void R_Shadow_PrepareLight(rtlight_t *rtlight) rtlight->cached_shadowentities_noselfshadow = (entity_render_t**)R_FrameData_Store(numshadowentities_noselfshadow*sizeof(entity_render_t *), (void*)shadowentities_noselfshadow); if (shadowtrispvs == r_shadow_buffer_shadowtrispvs) { - rtlight->cached_shadowtrispvs = (unsigned char *)R_FrameData_Store(r_refdef.scene.worldmodel->brush.shadowmesh ? r_refdef.scene.worldmodel->brush.shadowmesh->numtriangles : r_refdef.scene.worldmodel->surfmesh.num_triangles, shadowtrispvs); - rtlight->cached_lighttrispvs = (unsigned char *)R_FrameData_Store(r_refdef.scene.worldmodel->surfmesh.num_triangles, lighttrispvs); + int numshadowtrispvsbytes = (((r_refdef.scene.worldmodel->brush.shadowmesh ? r_refdef.scene.worldmodel->brush.shadowmesh->numtriangles : r_refdef.scene.worldmodel->surfmesh.num_triangles) + 7) >> 3); + int numlighttrispvsbytes = ((r_refdef.scene.worldmodel->surfmesh.num_triangles + 7) >> 3); + rtlight->cached_shadowtrispvs = (unsigned char *)R_FrameData_Store(numshadowtrispvsbytes, shadowtrispvs); + rtlight->cached_lighttrispvs = (unsigned char *)R_FrameData_Store(numlighttrispvsbytes, lighttrispvs); rtlight->cached_surfacelist = (int*)R_FrameData_Store(numsurfaces*sizeof(int), (void*)surfacelist); } else -- 2.39.2