Commit: 5bf60530e5f1843b613439ea05790412d7f74d41 Author: Clément Foucault Date: Fri Jan 27 12:44:41 2017 +0100 Branches: clay-engine https://developer.blender.org/rB5bf60530e5f1843b613439ea05790412d7f74d41
Added switch to test viewport cache =================================================================== M source/blender/draw/DRW_engine.h M source/blender/draw/engines/clay/clay.c M source/blender/draw/intern/DRW_render.h M source/blender/draw/intern/draw_manager.c M source/blender/editors/space_view3d/view3d_draw.c M source/blender/gpu/intern/gpu_viewport.c =================================================================== diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index ad05cf625f..d58e2406fa 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -26,6 +26,8 @@ #ifndef __DRW_ENGINE_H__ #define __DRW_ENGINE_H__ +//#define WITH_VIEWPORT_CACHE_TEST + struct DRWPass; void DRW_engines_init(void); diff --git a/source/blender/draw/engines/clay/clay.c b/source/blender/draw/engines/clay/clay.c index f741cb54b9..cf5720b911 100644 --- a/source/blender/draw/engines/clay/clay.c +++ b/source/blender/draw/engines/clay/clay.c @@ -577,11 +577,18 @@ static void CLAY_view_draw(RenderEngine *UNUSED(engine), const struct bContext * /* TODO : tag to refresh by the deps graph */ /* ideally only refresh when objects are added/removed */ /* or render properties / materials change */ - //static bool once = false; +#ifdef WITH_VIEWPORT_CACHE_TEST + static bool once = false; + printf("AA\n"); +#endif if (DRW_viewport_cache_is_dirty() - //&& !once +#ifdef WITH_VIEWPORT_CACHE_TEST + && !once +#endif ) { - //once = true; +#ifdef WITH_VIEWPORT_CACHE_TEST + once = true; +#endif CLAY_create_cache(passes, context); } diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 8daf97875b..75f5a124a1 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -50,6 +50,8 @@ #include "RE_engine.h" +//#define WITH_VIEWPORT_CACHE_TEST + struct GPUFrameBuffer; struct GPUShader; struct GPUTexture; diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index a2ddf07079..0bb651897b 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -446,6 +446,10 @@ static void shgroup_dynamic_batch_from_calls(DRWShadingGroup *shgroup) int nbr = BLI_listbase_count(&shgroup->calls); GLenum type; +#ifdef WITH_VIEWPORT_CACHE_TEST + if (shgroup->dyngeom) return; +#endif + if (nbr == 0) { if (shgroup->dyngeom) { Batch_discard(shgroup->dyngeom); @@ -457,7 +461,6 @@ static void shgroup_dynamic_batch_from_calls(DRWShadingGroup *shgroup) /* Gather Data */ float *data = MEM_mallocN(sizeof(float) * 3 * nbr , "Object Center Batch data"); - /* TODO do something more generic usable for other things than obj center */ for (DRWCall *call = shgroup->calls.first; call; call = call->next, i++) { copy_v3_v3(&data[i*3], call->obmat[3]); } @@ -506,6 +509,7 @@ void DRW_pass_free(DRWPass *pass) BLI_freelistN(&pass->shgroups); } +/* TODO this is slow we should not have to use this (better store shgroup pointer somewhere) */ DRWShadingGroup *DRW_pass_nth_shgroup_get(DRWPass *pass, int n) { int i = 0; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index c8f0a4e325..f428b2cec4 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2109,7 +2109,7 @@ static void view3d_render_pass(const bContext *C, ARegion *ar) } } -static void view3d_draw_view_new(const bContext *C, ARegion *ar, DrawData *draw_data) +static void view3d_draw_view_new(const bContext *C, ARegion *ar, DrawData *UNUSED(draw_data)) { view3d_draw_setup_view(C, ar); diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index 015d71ac56..b1964857ab 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -87,8 +87,10 @@ void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect) /* add one pixel because of scissor test */ int rect_w = BLI_rcti_size_x(rect) + 1, rect_h = BLI_rcti_size_y(rect) + 1; +#ifndef WITH_VIEWPORT_CACHE_TEST /* TODO for testing only, we need proper cache invalidation */ GPU_viewport_passes_free(viewport); +#endif if (viewport->fbl->default_fb) { if (rect_w != viewport->size[0] || rect_h != viewport->size[1]) { _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs