diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-04-28 02:29:51 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-04-28 17:33:15 +0300 |
commit | c06bfe9d09c33cebdffd2c840252d4863fd8ca33 (patch) | |
tree | 7949e7070c6411950770c3d584583749a623201f /source/blender/gpu | |
parent | c6fccbf842d8335dce156f608e631aca4a593100 (diff) |
UI: Remove hardcoded 11 uniform parameters
Using a define makes it easy to increase this later.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl index 7ae65dbc32a..9d0bacde1ff 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl @@ -78,31 +78,32 @@ const vec2 triavec[37] = vec2[37]( uniform mat4 ModelViewProjectionMatrix; +#define MAX_PARAM 11 #ifdef USE_INSTANCE #define MAX_INSTANCE 6 -uniform vec4 parameters[11 * MAX_INSTANCE]; +uniform vec4 parameters[MAX_PARAM * MAX_INSTANCE]; #else -uniform vec4 parameters[11]; +uniform vec4 parameters[MAX_PARAM]; #endif /* gl_InstanceID is 0 if not drawing instances. */ -#define recti parameters[gl_InstanceID * 11 + 0] -#define rect parameters[gl_InstanceID * 11 + 1] -#define radsi parameters[gl_InstanceID * 11 + 2].x -#define rads parameters[gl_InstanceID * 11 + 2].y -#define faci parameters[gl_InstanceID * 11 + 2].zw -#define roundCorners parameters[gl_InstanceID * 11 + 3] -#define colorInner1 parameters[gl_InstanceID * 11 + 4] -#define colorInner2 parameters[gl_InstanceID * 11 + 5] -#define colorEdge parameters[gl_InstanceID * 11 + 6] -#define colorEmboss parameters[gl_InstanceID * 11 + 7] -#define colorTria parameters[gl_InstanceID * 11 + 8] -#define tria1Center parameters[gl_InstanceID * 11 + 9].xy -#define tria2Center parameters[gl_InstanceID * 11 + 9].zw -#define tria1Size parameters[gl_InstanceID * 11 + 10].x -#define tria2Size parameters[gl_InstanceID * 11 + 10].y -#define shadeDir parameters[gl_InstanceID * 11 + 10].z -#define doAlphaCheck parameters[gl_InstanceID * 11 + 10].w +#define recti parameters[gl_InstanceID * MAX_PARAM + 0] +#define rect parameters[gl_InstanceID * MAX_PARAM + 1] +#define radsi parameters[gl_InstanceID * MAX_PARAM + 2].x +#define rads parameters[gl_InstanceID * MAX_PARAM + 2].y +#define faci parameters[gl_InstanceID * MAX_PARAM + 2].zw +#define roundCorners parameters[gl_InstanceID * MAX_PARAM + 3] +#define colorInner1 parameters[gl_InstanceID * MAX_PARAM + 4] +#define colorInner2 parameters[gl_InstanceID * MAX_PARAM + 5] +#define colorEdge parameters[gl_InstanceID * MAX_PARAM + 6] +#define colorEmboss parameters[gl_InstanceID * MAX_PARAM + 7] +#define colorTria parameters[gl_InstanceID * MAX_PARAM + 8] +#define tria1Center parameters[gl_InstanceID * MAX_PARAM + 9].xy +#define tria2Center parameters[gl_InstanceID * MAX_PARAM + 9].zw +#define tria1Size parameters[gl_InstanceID * MAX_PARAM + 10].x +#define tria2Size parameters[gl_InstanceID * MAX_PARAM + 10].y +#define shadeDir parameters[gl_InstanceID * MAX_PARAM + 10].z +#define doAlphaCheck parameters[gl_InstanceID * MAX_PARAM + 10].w in uint vflag; |