GPU: Fix: Use 2 slots for each UDIMs texture instead of 4

Create GPUNodeLinks for tiled_image and tiled_image_mapping together, to ensure they are the same texture.

See blender/blender#105661 (comment) for context and a more in-depth explanation.

Pull Request: blender/blender#105772
This commit is contained in:
2023-03-15 17:58:25 +01:00
parent f518591abc
commit 1fc892744c
3 changed files with 28 additions and 30 deletions

View File

@@ -77,8 +77,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
if (ima->source == IMA_SRC_TILED) {
const char *gpu_node_name = use_cubic ? "node_tex_tile_cubic" : "node_tex_tile_linear";
GPUNodeLink *gpu_image = GPU_image_tiled(mat, ima, iuser, sampler_state);
GPUNodeLink *gpu_image_tile_mapping = GPU_image_tiled_mapping(mat, ima, iuser);
GPUNodeLink *gpu_image, *gpu_image_tile_mapping;
GPU_image_tiled(mat, ima, iuser, sampler_state, &gpu_image, &gpu_image_tile_mapping);
/* UDIM tiles needs a `sampler2DArray` and `sampler1DArray` for tile mapping. */
GPU_stack_link(mat, node, gpu_node_name, in, out, gpu_image, gpu_image_tile_mapping);
}