Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_mapping.c')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mapping.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c
index a84e88e9551..98dcd58b983 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c
@@ -88,13 +88,18 @@ static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, bNodeExecData *UNUS
TexMapping *texmap = node->storage;
float domin = (texmap->flag & TEXMAP_CLIP_MIN) != 0;
float domax = (texmap->flag & TEXMAP_CLIP_MAX) != 0;
- GPUNodeLink *tmat = GPU_uniform((float *)texmap->mat);
- GPUNodeLink *tmin = GPU_uniform(texmap->min);
- GPUNodeLink *tmax = GPU_uniform(texmap->max);
- GPUNodeLink *tdomin = GPU_uniform(&domin);
- GPUNodeLink *tdomax = GPU_uniform(&domax);
-
- GPU_stack_link(mat, node, "mapping", in, out, tmat, tmin, tmax, tdomin, tdomax);
+ static float max[3] = { FLT_MAX, FLT_MAX, FLT_MAX};
+ static float min[3] = {-FLT_MAX, -FLT_MAX, -FLT_MAX};
+ GPUNodeLink *tmin, *tmax, *tmat0, *tmat1, *tmat2, *tmat3;
+
+ tmin = GPU_uniform_buffer((domin) ? texmap->min : min, GPU_VEC3);
+ tmax = GPU_uniform_buffer((domax) ? texmap->max : max, GPU_VEC3);
+ tmat0 = GPU_uniform_buffer((float *)texmap->mat[0], GPU_VEC4);
+ tmat1 = GPU_uniform_buffer((float *)texmap->mat[1], GPU_VEC4);
+ tmat2 = GPU_uniform_buffer((float *)texmap->mat[2], GPU_VEC4);
+ tmat3 = GPU_uniform_buffer((float *)texmap->mat[3], GPU_VEC4);
+
+ GPU_stack_link(mat, node, "mapping", in, out, tmat0, tmat1, tmat2, tmat3, tmin, tmax);
if (texmap->type == TEXMAP_TYPE_NORMAL)
GPU_link(mat, "texco_norm", out[0].link, &out[0].link);