forked from blender/blender
main sync #3
@ -167,11 +167,12 @@ GPUNodeLink *GPU_image(GPUMaterial *mat,
|
|||||||
struct Image *ima,
|
struct Image *ima,
|
||||||
struct ImageUser *iuser,
|
struct ImageUser *iuser,
|
||||||
eGPUSamplerState sampler_state);
|
eGPUSamplerState sampler_state);
|
||||||
GPUNodeLink *GPU_image_tiled(GPUMaterial *mat,
|
void GPU_image_tiled(GPUMaterial *mat,
|
||||||
struct Image *ima,
|
struct Image *ima,
|
||||||
struct ImageUser *iuser,
|
struct ImageUser *iuser,
|
||||||
eGPUSamplerState sampler_state);
|
eGPUSamplerState sampler_state,
|
||||||
GPUNodeLink *GPU_image_tiled_mapping(GPUMaterial *mat, struct Image *ima, struct ImageUser *iuser);
|
GPUNodeLink **r_image_tiled_link,
|
||||||
|
GPUNodeLink **r_image_tiled_mapping_link);
|
||||||
GPUNodeLink *GPU_image_sky(GPUMaterial *mat,
|
GPUNodeLink *GPU_image_sky(GPUMaterial *mat,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
|
@ -476,7 +476,7 @@ static GPUMaterialTexture *gpu_node_graph_add_texture(GPUNodeGraph *graph,
|
|||||||
ImageUser *iuser,
|
ImageUser *iuser,
|
||||||
struct GPUTexture **colorband,
|
struct GPUTexture **colorband,
|
||||||
struct GPUTexture **sky,
|
struct GPUTexture **sky,
|
||||||
GPUNodeLinkType link_type,
|
bool is_tiled,
|
||||||
eGPUSamplerState sampler_state)
|
eGPUSamplerState sampler_state)
|
||||||
{
|
{
|
||||||
/* Find existing texture. */
|
/* Find existing texture. */
|
||||||
@ -502,7 +502,7 @@ static GPUMaterialTexture *gpu_node_graph_add_texture(GPUNodeGraph *graph,
|
|||||||
tex->sky = sky;
|
tex->sky = sky;
|
||||||
tex->sampler_state = sampler_state;
|
tex->sampler_state = sampler_state;
|
||||||
BLI_snprintf(tex->sampler_name, sizeof(tex->sampler_name), "samp%d", num_textures);
|
BLI_snprintf(tex->sampler_name, sizeof(tex->sampler_name), "samp%d", num_textures);
|
||||||
if (ELEM(link_type, GPU_NODE_LINK_IMAGE_TILED, GPU_NODE_LINK_IMAGE_TILED_MAPPING)) {
|
if (is_tiled) {
|
||||||
BLI_snprintf(
|
BLI_snprintf(
|
||||||
tex->tiled_mapping_name, sizeof(tex->tiled_mapping_name), "tsamp%d", num_textures);
|
tex->tiled_mapping_name, sizeof(tex->tiled_mapping_name), "tsamp%d", num_textures);
|
||||||
}
|
}
|
||||||
@ -631,7 +631,7 @@ GPUNodeLink *GPU_image(GPUMaterial *mat,
|
|||||||
GPUNodeLink *link = gpu_node_link_create();
|
GPUNodeLink *link = gpu_node_link_create();
|
||||||
link->link_type = GPU_NODE_LINK_IMAGE;
|
link->link_type = GPU_NODE_LINK_IMAGE;
|
||||||
link->texture = gpu_node_graph_add_texture(
|
link->texture = gpu_node_graph_add_texture(
|
||||||
graph, ima, iuser, nullptr, nullptr, link->link_type, sampler_state);
|
graph, ima, iuser, nullptr, nullptr, false, sampler_state);
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,31 +648,28 @@ GPUNodeLink *GPU_image_sky(GPUMaterial *mat,
|
|||||||
GPUNodeLink *link = gpu_node_link_create();
|
GPUNodeLink *link = gpu_node_link_create();
|
||||||
link->link_type = GPU_NODE_LINK_IMAGE_SKY;
|
link->link_type = GPU_NODE_LINK_IMAGE_SKY;
|
||||||
link->texture = gpu_node_graph_add_texture(
|
link->texture = gpu_node_graph_add_texture(
|
||||||
graph, nullptr, nullptr, nullptr, sky, link->link_type, sampler_state);
|
graph, nullptr, nullptr, nullptr, sky, false, sampler_state);
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUNodeLink *GPU_image_tiled(GPUMaterial *mat,
|
void GPU_image_tiled(GPUMaterial *mat,
|
||||||
Image *ima,
|
struct Image *ima,
|
||||||
ImageUser *iuser,
|
struct ImageUser *iuser,
|
||||||
eGPUSamplerState sampler_state)
|
eGPUSamplerState sampler_state,
|
||||||
|
GPUNodeLink **r_image_tiled_link,
|
||||||
|
GPUNodeLink **r_image_tiled_mapping_link)
|
||||||
{
|
{
|
||||||
GPUNodeGraph *graph = gpu_material_node_graph(mat);
|
GPUNodeGraph *graph = gpu_material_node_graph(mat);
|
||||||
GPUNodeLink *link = gpu_node_link_create();
|
GPUMaterialTexture *texture = gpu_node_graph_add_texture(
|
||||||
link->link_type = GPU_NODE_LINK_IMAGE_TILED;
|
graph, ima, iuser, nullptr, nullptr, true, sampler_state);
|
||||||
link->texture = gpu_node_graph_add_texture(
|
|
||||||
graph, ima, iuser, nullptr, nullptr, link->link_type, sampler_state);
|
|
||||||
return link;
|
|
||||||
}
|
|
||||||
|
|
||||||
GPUNodeLink *GPU_image_tiled_mapping(GPUMaterial *mat, Image *ima, ImageUser *iuser)
|
(*r_image_tiled_link) = gpu_node_link_create();
|
||||||
{
|
(*r_image_tiled_link)->link_type = GPU_NODE_LINK_IMAGE_TILED;
|
||||||
GPUNodeGraph *graph = gpu_material_node_graph(mat);
|
(*r_image_tiled_link)->texture = texture;
|
||||||
GPUNodeLink *link = gpu_node_link_create();
|
|
||||||
link->link_type = GPU_NODE_LINK_IMAGE_TILED_MAPPING;
|
(*r_image_tiled_mapping_link) = gpu_node_link_create();
|
||||||
link->texture = gpu_node_graph_add_texture(
|
(*r_image_tiled_mapping_link)->link_type = GPU_NODE_LINK_IMAGE_TILED_MAPPING;
|
||||||
graph, ima, iuser, nullptr, nullptr, link->link_type, GPU_SAMPLER_MAX);
|
(*r_image_tiled_mapping_link)->texture = texture;
|
||||||
return link;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *row)
|
GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *row)
|
||||||
@ -684,7 +681,7 @@ GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *ro
|
|||||||
GPUNodeLink *link = gpu_node_link_create();
|
GPUNodeLink *link = gpu_node_link_create();
|
||||||
link->link_type = GPU_NODE_LINK_COLORBAND;
|
link->link_type = GPU_NODE_LINK_COLORBAND;
|
||||||
link->texture = gpu_node_graph_add_texture(
|
link->texture = gpu_node_graph_add_texture(
|
||||||
graph, nullptr, nullptr, colorband, nullptr, link->link_type, GPU_SAMPLER_MAX);
|
graph, nullptr, nullptr, colorband, nullptr, false, GPU_SAMPLER_MAX);
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,8 +77,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
|
|||||||
|
|
||||||
if (ima->source == IMA_SRC_TILED) {
|
if (ima->source == IMA_SRC_TILED) {
|
||||||
const char *gpu_node_name = use_cubic ? "node_tex_tile_cubic" : "node_tex_tile_linear";
|
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, *gpu_image_tile_mapping;
|
||||||
GPUNodeLink *gpu_image_tile_mapping = GPU_image_tiled_mapping(mat, ima, iuser);
|
GPU_image_tiled(mat, ima, iuser, sampler_state, &gpu_image, &gpu_image_tile_mapping);
|
||||||
/* UDIM tiles needs a `sampler2DArray` and `sampler1DArray` for 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);
|
GPU_stack_link(mat, node, gpu_node_name, in, out, gpu_image, gpu_image_tile_mapping);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user