]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
allocate the right byte count for PVS data in framedata
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 20 Dec 2009 18:27:38 +0000 (18:27 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 20 Dec 2009 18:27:38 +0000 (18:27 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9612 d7cf8633-e32d-0410-b094-e92efae38249

r_shadow.c

index 59cd82da301f60ea74d072fd67814c56766163da..89c2560b88e8aa09943a2059d3a87d8511d6ab52 100644 (file)
@@ -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