diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-03-16 10:43:52 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-03-16 10:50:31 +0300 |
commit | 93e26cb770ab052ce06f7a1248d636a068b45edf (patch) | |
tree | 0d6a1804ee78e5dec404d09d1e74943b1812d64f /source/blender/draw/intern/draw_manager.h | |
parent | 43d0943141cb745d69d36eb1cf177c22663def61 (diff) |
DRW: Fix/refactor UBO & Texture binding.
Previous approach was not clear enough and caused problems.
UBOs were taking slots and not release them after a shading group even
if this UBO was only for this Shading Group (notably the nodetree ubo,
since we now share the same GPUShader for identical trees).
So I choose to have a better defined approach:
- Standard texture and ubo calls are assured to be valid for the shgrp
they are called from.
- (new) Persistent texture and ubo calls are assured to be valid accross
shgrps unless the shader changes.
The standards calls are still valids for the next shgrp but are not assured
to be so if this new shgrp binds a new texture.
This enables some optimisations by not adding redundant texture and ubo
binds.
Diffstat (limited to 'source/blender/draw/intern/draw_manager.h')
-rw-r--r-- | source/blender/draw/intern/draw_manager.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index 529166b5792..6d4eee08ad6 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -159,8 +159,10 @@ typedef enum { DRW_UNIFORM_INT, DRW_UNIFORM_FLOAT, DRW_UNIFORM_TEXTURE, + DRW_UNIFORM_TEXTURE_PERSIST, DRW_UNIFORM_BUFFER, - DRW_UNIFORM_BLOCK + DRW_UNIFORM_BLOCK, + DRW_UNIFORM_BLOCK_PERSIST } DRWUniformType; struct DRWUniform { @@ -335,10 +337,10 @@ typedef struct DRWManager { /** GPU Resource State: Memory storage between drawing. */ struct { GPUTexture **bound_texs; - bool *bound_tex_slots; + char *bound_tex_slots; int bind_tex_inc; GPUUniformBuffer **bound_ubos; - bool *bound_ubo_slots; + char *bound_ubo_slots; int bind_ubo_inc; } RST; } DRWManager; |