From: divverent Date: Sun, 20 Dec 2009 18:27:38 +0000 (+0000) Subject: allocate the right byte count for PVS data in framedata X-Git-Tag: xonotic-v0.1.0preview~1035 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=770aac97dc7ea7ddee614cc5e1c6cee23cfdb438;p=xonotic%2Fdarkplaces.git 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 --- 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