diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-02-07 20:12:35 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-02-07 21:15:55 +0300 |
commit | 8a2f93b2aba76a6c1c065a08d14e414db8cb597e (patch) | |
tree | db2116fab4189eccee53a61a0973a4a67ace9a05 /source/blender | |
parent | 25c8b5046fae3d8a2390c5e8f11a95e510150a2f (diff) |
DRW: Opti: Use less bytes in DRWUniform.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 865937018a0..909095b8901 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -177,12 +177,14 @@ typedef enum { DRW_ATTRIB_FLOAT, } DRWAttribType; +#define MAX_UNIFORM_DATA_SIZE 16 + struct DRWUniform { struct DRWUniform *next; - DRWUniformType type; int location; - int length; - int arraysize; + char type; /* DRWUniformType */ + char length; /* cannot be more than 16 */ + char arraysize; /* cannot be more than 16 too */ const void *value; }; @@ -692,7 +694,8 @@ static void drw_interface_uniform(DRWShadingGroup *shgroup, const char *name, DRWUniform *uni = BLI_mempool_alloc(DST.vmempool->uniforms); - BLI_assert(arraysize > 0); + BLI_assert(arraysize > 0 && arraysize <= 16); + BLI_assert(arraysize * length <= MAX_UNIFORM_DATA_SIZE); uni->location = location; uni->type = type; |