Clay Engine: Use G.debug_value to test cache performance

Use debug 666 for cache without instance buffer caching.
Use debug 667 for cache with instance buffer caching.
This commit is contained in:
2017-02-19 14:31:02 +01:00
parent c8b7e7973a
commit 446625c561
5 changed files with 13 additions and 23 deletions

View File

@@ -26,8 +26,6 @@
#ifndef __DRW_ENGINE_H__
#define __DRW_ENGINE_H__
//#define WITH_VIEWPORT_CACHE_TEST
struct CollectionEngineSettings;
struct DRWPass;
struct Material;

View File

@@ -700,17 +700,8 @@ static void CLAY_view_draw(RenderEngine *UNUSED(engine), const bContext *context
/* TODO : tag to refresh by the deps graph */
/* ideally only refresh when objects are added/removed */
/* or render properties / materials change */
#ifdef WITH_VIEWPORT_CACHE_TEST
static bool once = false;
#endif
if (DRW_viewport_cache_is_dirty()
#ifdef WITH_VIEWPORT_CACHE_TEST
&& !once
#endif
) {
#ifdef WITH_VIEWPORT_CACHE_TEST
once = true;
#endif
if (DRW_viewport_cache_is_dirty()) {
SceneLayer *sl = CTX_data_scene_layer(context);
CLAY_cache_init();

View File

@@ -52,8 +52,6 @@
#include "RE_engine.h"
//#define WITH_VIEWPORT_CACHE_TEST
struct bContext;
struct GPUFrameBuffer;
struct GPUShader;

View File

@@ -672,9 +672,10 @@ static void shgroup_dynamic_instance(DRWShadingGroup *shgroup)
static void shgroup_dynamic_batch_from_calls(DRWShadingGroup *shgroup)
{
#ifdef WITH_VIEWPORT_CACHE_TEST
if (shgroup->interface->instance_vbo || shgroup->batch_geom) return;
#endif
if ((shgroup->interface->instance_vbo || shgroup->batch_geom) &&
(G.debug_value == 667))
return;
if (shgroup->type == DRW_SHG_INSTANCE) {
shgroup_dynamic_instance(shgroup);
}

View File

@@ -38,6 +38,8 @@
#include "DNA_vec_types.h"
#include "BKE_global.h"
#include "GPU_framebuffer.h"
#include "GPU_glew.h"
#include "GPU_immediate.h"
@@ -115,11 +117,11 @@ void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect, const char *engi
/* 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->psl);
GPU_viewport_passes_free(viewport->psl_mode);
#endif
if (G.debug_value != 666 && G.debug_value != 667) {
/* TODO for testing only, we need proper cache invalidation */
GPU_viewport_passes_free(viewport->psl);
GPU_viewport_passes_free(viewport->psl_mode);
}
if (!STREQ(engine, viewport->engine_name)) {
GPU_viewport_storage_free(viewport->stl);