diff options
Diffstat (limited to 'source/blender/nodes')
12 files changed, 36 insertions, 35 deletions
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c index 9615c6f01e0..93d03720058 100644 --- a/source/blender/nodes/shader/node_shader_util.c +++ b/source/blender/nodes/shader/node_shader_util.c @@ -276,7 +276,7 @@ void node_shader_gpu_bump_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink * void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link) { if (!*link) { - *link = GPU_attribute(CD_ORCO, ""); + *link = GPU_attribute(mat, CD_ORCO, ""); GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), *link, link); node_shader_gpu_bump_tex_coord(mat, node, link); } diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c index ecb8c53c312..757db5fe8b3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.c +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c @@ -66,7 +66,7 @@ static int node_shader_gpu_attribute(GPUMaterial *mat, GPU_builtin(GPU_VOLUME_TEMPERATURE)); } else { - GPUNodeLink *cd_attr = GPU_attribute(CD_AUTO_FROM_NAME, attr->name); + GPUNodeLink *cd_attr = GPU_attribute(mat, CD_AUTO_FROM_NAME, attr->name); GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr); /* for each output. */ diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.c b/source/blender/nodes/shader/nodes/node_shader_geometry.c index 6b23fec5f18..b1ee3c4806a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geometry.c +++ b/source/blender/nodes/shader/nodes/node_shader_geometry.c @@ -46,7 +46,8 @@ static int node_shader_gpu_geometry(GPUMaterial *mat, GPUNodeLink *bary_link = (!out[5].hasoutput) ? GPU_constant(val) : GPU_builtin(GPU_BARYCENTRIC_TEXCO); /* Opti: don't request orco if not needed. */ - GPUNodeLink *orco_link = (!out[2].hasoutput) ? GPU_constant(val) : GPU_attribute(CD_ORCO, ""); + GPUNodeLink *orco_link = (!out[2].hasoutput) ? GPU_constant(val) : + GPU_attribute(mat, CD_ORCO, ""); const bool success = GPU_stack_link(mat, node, diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.c b/source/blender/nodes/shader/nodes/node_shader_normal_map.c index 006f15f40a1..0f3ffe51706 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal_map.c +++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.c @@ -92,7 +92,7 @@ static int gpu_shader_normal_map(GPUMaterial *mat, GPU_link(mat, "node_normal_map", GPU_builtin(GPU_OBJECT_INFO), - GPU_attribute(CD_TANGENT, nm->uv_map), + GPU_attribute(mat, CD_TANGENT, nm->uv_map), GPU_builtin(GPU_WORLD_NORMAL), newnormal, &newnormal); diff --git a/source/blender/nodes/shader/nodes/node_shader_tangent.c b/source/blender/nodes/shader/nodes/node_shader_tangent.c index 478b9524737..474db465d87 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tangent.c +++ b/source/blender/nodes/shader/nodes/node_shader_tangent.c @@ -43,10 +43,10 @@ static int node_shader_gpu_tangent(GPUMaterial *mat, if (attr->direction_type == SHD_TANGENT_UVMAP) { return GPU_stack_link( - mat, node, "node_tangentmap", in, out, GPU_attribute(CD_TANGENT, attr->uv_map)); + mat, node, "node_tangentmap", in, out, GPU_attribute(mat, CD_TANGENT, attr->uv_map)); } else { - GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); + GPUNodeLink *orco = GPU_attribute(mat, CD_ORCO, ""); if (attr->axis == SHD_TANGENT_AXIS_X) { GPU_link(mat, "tangent_orco_x", orco, &orco); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c index 3c1a2280aae..81a5ee31f7d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c @@ -47,8 +47,8 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, /* Opti: don't request orco if not needed. */ GPUNodeLink *orco = (!out[0].hasoutput) ? GPU_constant((float[4]){0.0f, 0.0f, 0.0f, 0.0f}) : - GPU_attribute(CD_ORCO, ""); - GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, ""); + GPU_attribute(mat, CD_ORCO, ""); + GPUNodeLink *mtface = GPU_attribute(mat, CD_MTFACE, ""); GPUNodeLink *viewpos = GPU_builtin(GPU_VIEW_POSITION); GPUNodeLink *worldnor = GPU_builtin(GPU_WORLD_NORMAL); GPUNodeLink *texcofacs = GPU_builtin(GPU_CAMERA_TEXCO_FACTORS); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c index 6c380efe0b2..d2615d76345 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c @@ -88,7 +88,7 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, "node_tex_environment_equirectangular", in[0].link, GPU_constant(&clamp_size), - GPU_image(ima, iuser), + GPU_image(mat, ima, iuser), &in[0].link); } else { @@ -103,7 +103,7 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, GPU_link(mat, "node_tex_image_linear_no_mip", in[0].link, - GPU_image(ima, iuser), + GPU_image(mat, ima, iuser), &out[0].link, &outalpha); break; @@ -111,13 +111,17 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, GPU_link(mat, "node_tex_image_nearest", in[0].link, - GPU_image(ima, iuser), + GPU_image(mat, ima, iuser), &out[0].link, &outalpha); break; default: - GPU_link( - mat, "node_tex_image_cubic", in[0].link, GPU_image(ima, iuser), &out[0].link, &outalpha); + GPU_link(mat, + "node_tex_image_cubic", + in[0].link, + GPU_image(mat, ima, iuser), + &out[0].link, + &outalpha); break; } 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); } } } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c index b1fb0cad4b2..0a576e465fa 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c @@ -63,7 +63,7 @@ static int node_shader_gpu_tex_sky(GPUMaterial *mat, GPUNodeStack *out) { if (!in[0].link) { - in[0].link = GPU_attribute(CD_ORCO, ""); + in[0].link = GPU_attribute(mat, CD_ORCO, ""); } node_shader_gpu_tex_mapping(mat, node, in, out); diff --git a/source/blender/nodes/shader/nodes/node_shader_uvmap.c b/source/blender/nodes/shader/nodes/node_shader_uvmap.c index a2e47735490..f01542be44a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uvmap.c +++ b/source/blender/nodes/shader/nodes/node_shader_uvmap.c @@ -41,7 +41,7 @@ static int node_shader_gpu_uvmap(GPUMaterial *mat, GPUNodeStack *out) { NodeShaderUVMap *attr = node->storage; - GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, attr->uv_map); + GPUNodeLink *mtface = GPU_attribute(mat, CD_MTFACE, attr->uv_map); GPU_stack_link(mat, node, "node_uvmap", in, out, mtface); diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c index ac8b49c4572..df303b2d3f1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c +++ b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c @@ -60,7 +60,7 @@ static int gpu_shader_vector_displacement(GPUMaterial *mat, "node_vector_displacement_tangent", in, out, - GPU_attribute(CD_TANGENT, ""), + GPU_attribute(mat, CD_TANGENT, ""), GPU_builtin(GPU_WORLD_NORMAL), GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_VIEW_MATRIX)); diff --git a/source/blender/nodes/shader/nodes/node_shader_vertex_color.c b/source/blender/nodes/shader/nodes/node_shader_vertex_color.c index 8848fc37c66..98d575cece2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vertex_color.c +++ b/source/blender/nodes/shader/nodes/node_shader_vertex_color.c @@ -39,7 +39,7 @@ static int node_shader_gpu_vertex_color(GPUMaterial *mat, GPUNodeStack *out) { NodeShaderVertexColor *vertexColor = (NodeShaderVertexColor *)node->storage; - GPUNodeLink *vertexColorLink = GPU_attribute(CD_MCOL, vertexColor->layer_name); + GPUNodeLink *vertexColorLink = GPU_attribute(mat, CD_MCOL, vertexColor->layer_name); return GPU_stack_link(mat, node, "node_vertex_color", in, out, vertexColorLink); } |