diff options
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_tex_image.c')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_tex_image.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c index 781fd1eb579..ebc852486dc 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -123,26 +123,21 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, } if (!*texco) { - *texco = GPU_attribute(CD_MTFACE, ""); + *texco = GPU_attribute(mat, CD_MTFACE, ""); node_shader_gpu_bump_tex_coord(mat, node, texco); } node_shader_gpu_tex_mapping(mat, node, in, out); if (ima->source == IMA_SRC_TILED) { - /* The tiled shader needs both the tile array itself as well as the mapping from tile to array - * position. Which of these to allocate is automatically decided based on the shader argument - * type, so here the first GPU_image(ima, iuser) will resolve to the array and the second to - * the mapping since the third argument in the shader has type sampler2DArray while - * the fourth is sampler1DArray. - */ + /* UDIM tiles needs a samper2DArray and sampler1DArray for tile mapping. */ GPU_stack_link(mat, node, names_tiled[tex->interpolation], in, out, - GPU_image(ima, iuser), - GPU_image(ima, iuser)); + GPU_image_tiled(mat, ima, iuser), + GPU_image_tiled_mapping(mat, ima, iuser)); } else { switch (tex->projection) { @@ -157,20 +152,21 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, GPU_link(mat, "set_rgb", *texco, &input_coords); } if (do_texco_extend) { - GPU_link(mat, "point_texco_clamp", *texco, GPU_image(ima, iuser), texco); + GPU_link(mat, "point_texco_clamp", *texco, GPU_image(mat, ima, iuser), texco); } - GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(ima, iuser)); + GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(mat, ima, iuser)); break; case SHD_PROJ_BOX: vnor = GPU_builtin(GPU_WORLD_NORMAL); ob_mat = GPU_builtin(GPU_OBJECT_MATRIX); blend = GPU_uniform(&tex->projection_blend); - gpu_image = GPU_image(ima, iuser); + gpu_image = GPU_image(mat, ima, iuser); /* equivalent to normal_world_to_object */ GPU_link(mat, "normal_transform_transposed_m4v3", vnor, ob_mat, &norm); - GPU_link(mat, gpu_node_name, *texco, norm, GPU_image(ima, iuser), &col1, &col2, &col3); + GPU_link( + mat, gpu_node_name, *texco, norm, GPU_image(mat, ima, iuser), &col1, &col2, &col3); GPU_stack_link( mat, node, "node_tex_image_box", in, out, norm, col1, col2, col3, gpu_image, blend); break; @@ -184,9 +180,9 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, GPU_link(mat, "set_rgb", *texco, &input_coords); } if (do_texco_extend) { - GPU_link(mat, "point_texco_clamp", *texco, GPU_image(ima, iuser), texco); + GPU_link(mat, "point_texco_clamp", *texco, GPU_image(mat, ima, iuser), texco); } - GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(ima, iuser)); + GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(mat, ima, iuser)); break; case SHD_PROJ_TUBE: @@ -198,9 +194,9 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, GPU_link(mat, "set_rgb", *texco, &input_coords); } if (do_texco_extend) { - GPU_link(mat, "point_texco_clamp", *texco, GPU_image(ima, iuser), texco); + GPU_link(mat, "point_texco_clamp", *texco, GPU_image(mat, ima, iuser), texco); } - GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(ima, iuser)); + GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(mat, ima, iuser)); break; } @@ -208,7 +204,7 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, if (do_texco_clip) { gpu_node_name = names_clip[tex->interpolation]; in[0].link = input_coords; - GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(ima, iuser), out[0].link); + GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(mat, ima, iuser), out[0].link); } } } |