diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-11-06 18:47:23 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-11-06 19:43:14 +0300 |
commit | ed555750eb8294005f54425094cb692f29830631 (patch) | |
tree | e0b0149dd5959080ca39bd53b3baefe527413f99 /source/blender/gpu/GPU_viewport.h | |
parent | 5d70e847dd6f5182fa67c3b08260fbb5366009b5 (diff) |
DRW: Use pseudo persistent memory pool for the rendering data structure.
This gets rid of the bottleneck of allocation / free of thousands of elements every frame.
Cache time (Eevee) (test scene is default file with cube duplicated 3241 times)
pre-patch: 23ms
post-patch: 14ms
Diffstat (limited to 'source/blender/gpu/GPU_viewport.h')
-rw-r--r-- | source/blender/gpu/GPU_viewport.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/gpu/GPU_viewport.h b/source/blender/gpu/GPU_viewport.h index 622b3b301e4..f2bb05a6d1e 100644 --- a/source/blender/gpu/GPU_viewport.h +++ b/source/blender/gpu/GPU_viewport.h @@ -43,6 +43,17 @@ typedef struct GPUViewport GPUViewport; +/* Contains memory pools informations */ +typedef struct ViewportMemoryPool { + struct BLI_mempool *calls; + struct BLI_mempool *calls_generate; + struct BLI_mempool *calls_dynamic; + struct BLI_mempool *shgroups; + struct BLI_mempool *uniforms; + struct BLI_mempool *attribs; + struct BLI_mempool *passes; +} ViewportMemoryPool; + /* All FramebufferLists are just the same pointers with different names */ typedef struct FramebufferList { struct GPUFrameBuffer *framebuffers[0]; @@ -94,6 +105,8 @@ void GPU_viewport_free(GPUViewport *viewport); GPUViewport *GPU_viewport_create_from_offscreen(struct GPUOffScreen *ofs); void GPU_viewport_clear_from_offscreen(GPUViewport *viewport); +ViewportMemoryPool *GPU_viewport_mempool_get(GPUViewport *viewport); + void *GPU_viewport_engine_data_create(GPUViewport *viewport, void *engine_type); void *GPU_viewport_engine_data_get(GPUViewport *viewport, void *engine_type); void *GPU_viewport_framebuffer_list_get(GPUViewport *viewport); @@ -107,7 +120,8 @@ bool GPU_viewport_do_update(GPUViewport *viewport); /* Texture pool */ GPUTexture *GPU_viewport_texture_pool_query(GPUViewport *viewport, void *engine, int width, int height, int channels, int format); -bool GPU_viewport_cache_validate(GPUViewport *viewport, unsigned int hash); +bool GPU_viewport_engines_data_validate(GPUViewport *viewport, unsigned int hash); +void GPU_viewport_cache_release(GPUViewport *viewport); /* debug */ bool GPU_viewport_debug_depth_create(GPUViewport *viewport, int width, int height, char err_out[256]); |