From 11bfeb45ce1b1cdb95e6cd4a4ec4efae2b5184e0 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 5 Aug 2015 15:11:50 +0200 Subject: OpenSubdiv: Completely avoid possible access to non-existing CPU data Make it so CCGDM reports 0 number of geometry when it uses GPU backend for drawing. This screws up a bit statistics in info header and requires to have some special handle of CCGDM in the drawing code, but makes it so non of the areas will try to access non-existing geometry. --- source/blender/blenkernel/intern/CCGSubSurf.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/CCGSubSurf.c') diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index bd5ddba9590..95ddb9d5498 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -1515,6 +1515,12 @@ int ccgSubSurf_getNumFinalVerts(const CCGSubSurf *ss) ss->fMap->numEntries + ss->numGrids * ((gridSize - 2) + ((gridSize - 2) * (gridSize - 2)))); +#ifdef WITH_OPENSUBDIV + if (ss->skip_grids) { + return 0; + } +#endif + return numFinalVerts; } int ccgSubSurf_getNumFinalEdges(const CCGSubSurf *ss) @@ -1523,13 +1529,22 @@ int ccgSubSurf_getNumFinalEdges(const CCGSubSurf *ss) int gridSize = ccg_gridsize(ss->subdivLevels); int numFinalEdges = (ss->eMap->numEntries * (edgeSize - 1) + ss->numGrids * ((gridSize - 1) + 2 * ((gridSize - 2) * (gridSize - 1)))); - +#ifdef WITH_OPENSUBDIV + if (ss->skip_grids) { + return 0; + } +#endif return numFinalEdges; } int ccgSubSurf_getNumFinalFaces(const CCGSubSurf *ss) { int gridSize = ccg_gridsize(ss->subdivLevels); int numFinalFaces = ss->numGrids * ((gridSize - 1) * (gridSize - 1)); +#ifdef WITH_OPENSUBDIV + if (ss->skip_grids) { + return 0; + } +#endif return numFinalFaces; } -- cgit v1.2.3