From 77b39bbaa0c796b936f8691c1431f467d4f39981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 13 Aug 2018 15:30:29 +0200 Subject: Cleanup: Rename GPU_* functions to make more sense * Remove GPU_link_changed which is unused. * Remove all GPU link function that are not used anymore. * GPU_uniform_buffer is now GPU_uniform. * GPU_texture_ramp is now GPU_color_band. * GPU_uniform is now GPU_constant. --- source/blender/gpu/GPU_material.h | 9 +- source/blender/gpu/intern/gpu_codegen.c | 96 ++-------------------- source/blender/gpu/intern/gpu_codegen.h | 1 - source/blender/gpu/intern/gpu_shader.c | 7 +- source/blender/nodes/shader/node_shader_util.c | 12 +-- .../nodes/shader/nodes/node_shader_blackbody.c | 4 +- .../nodes/shader/nodes/node_shader_bsdf_glass.c | 2 +- .../nodes/shader/nodes/node_shader_bsdf_glossy.c | 2 +- .../shader/nodes/node_shader_bsdf_principled.c | 4 +- .../blender/nodes/shader/nodes/node_shader_bump.c | 2 +- .../nodes/shader/nodes/node_shader_curves.c | 8 +- .../shader/nodes/node_shader_eevee_specular.c | 4 +- .../nodes/shader/nodes/node_shader_mapping.c | 12 +-- .../blender/nodes/shader/nodes/node_shader_math.c | 2 +- .../nodes/shader/nodes/node_shader_mixRgb.c | 2 +- .../nodes/shader/nodes/node_shader_normal.c | 2 +- .../nodes/shader/nodes/node_shader_normal_map.c | 10 +-- .../nodes/node_shader_subsurface_scattering.c | 2 +- .../nodes/shader/nodes/node_shader_tex_brick.c | 4 +- .../nodes/shader/nodes/node_shader_tex_gradient.c | 2 +- .../nodes/shader/nodes/node_shader_tex_image.c | 2 +- .../nodes/shader/nodes/node_shader_tex_magic.c | 2 +- .../nodes/shader/nodes/node_shader_tex_musgrave.c | 2 +- .../nodes/shader/nodes/node_shader_tex_voronoi.c | 2 +- .../nodes/shader/nodes/node_shader_tex_wave.c | 2 +- .../nodes/shader/nodes/node_shader_valToRgb.c | 6 +- .../nodes/shader/nodes/node_shader_vectTransform.c | 2 +- .../shader/nodes/node_shader_volume_principled.c | 10 +-- 28 files changed, 61 insertions(+), 154 deletions(-) (limited to 'source/blender') diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index 6b0296361ec..5bbe9d6d904 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -224,16 +224,11 @@ typedef enum GPUDynamicType { } GPUDynamicType; GPUNodeLink *GPU_attribute(CustomDataType type, const char *name); +GPUNodeLink *GPU_constant(float *num); GPUNodeLink *GPU_uniform(float *num); -GPUNodeLink *GPU_dynamic_uniform(float *num, GPUDynamicType dynamictype, void *data); -GPUNodeLink *GPU_uniform_buffer(float *num, GPUType gputype); GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser, bool is_data); -GPUNodeLink *GPU_cube_map(struct Image *ima, struct ImageUser *iuser, bool is_data); -GPUNodeLink *GPU_image_preview(struct PreviewImage *prv); -GPUNodeLink *GPU_texture_ramp(GPUMaterial *mat, int size, float *pixels, float *layer); -GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex, GPUDynamicType dynamictype, void *data); +GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *layer); GPUNodeLink *GPU_builtin(GPUBuiltin builtin); -GPUNodeLink *GPU_opengl_builtin(GPUOpenGLBuiltin builtin); void GPU_node_link_set_type(GPUNodeLink *link, GPUType type); bool GPU_link(GPUMaterial *mat, const char *name, ...); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 289befe674e..0eee9bf6ead 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -1447,19 +1447,19 @@ static GPUNodeLink *gpu_uniformbuffer_link( case SOCK_FLOAT: { bNodeSocketValueFloat *socket_data = socket->default_value; - link = GPU_uniform_buffer(&socket_data->value, GPU_FLOAT); + link = GPU_uniform(&socket_data->value); break; } case SOCK_VECTOR: { bNodeSocketValueRGBA *socket_data = socket->default_value; - link = GPU_uniform_buffer(socket_data->value, GPU_VEC3); + link = GPU_uniform(socket_data->value); break; } case SOCK_RGBA: { bNodeSocketValueRGBA *socket_data = socket->default_value; - link = GPU_uniform_buffer(socket_data->value, GPU_VEC4); + link = GPU_uniform(socket_data->value); break; } default: @@ -1612,7 +1612,7 @@ GPUNodeLink *GPU_attribute(const CustomDataType type, const char *name) return link; } -GPUNodeLink *GPU_uniform(float *num) +GPUNodeLink *GPU_constant(float *num) { GPUNodeLink *link = GPU_node_link_create(); @@ -1622,30 +1622,13 @@ GPUNodeLink *GPU_uniform(float *num) return link; } -GPUNodeLink *GPU_dynamic_uniform(float *num, GPUDynamicType dynamictype, void *data) -{ - GPUNodeLink *link = GPU_node_link_create(); - - link->ptr1 = num; - link->ptr2 = data; - link->dynamic = true; - link->dynamictype = dynamictype; - - - return link; -} - -/** - * Add uniform to UBO struct of GPUMaterial. - */ -GPUNodeLink *GPU_uniform_buffer(float *num, GPUType gputype) +GPUNodeLink *GPU_uniform(float *num) { GPUNodeLink *link = GPU_node_link_create(); link->ptr1 = num; link->ptr2 = NULL; link->dynamic = true; link->dynamictype = GPU_DYNAMIC_UBO; - link->type = gputype; return link; } @@ -1662,53 +1645,18 @@ GPUNodeLink *GPU_image(Image *ima, ImageUser *iuser, bool is_data) return link; } -GPUNodeLink *GPU_cube_map(Image *ima, ImageUser *iuser, bool is_data) -{ - GPUNodeLink *link = GPU_node_link_create(); - - link->image = GPU_NODE_LINK_IMAGE_CUBE_MAP; - link->ptr1 = ima; - link->ptr2 = iuser; - link->image_isdata = is_data; - - return link; -} - -GPUNodeLink *GPU_image_preview(PreviewImage *prv) -{ - GPUNodeLink *link = GPU_node_link_create(); - - link->image = GPU_NODE_LINK_IMAGE_PREVIEW; - link->ptr1 = prv; - - return link; -} - - -GPUNodeLink *GPU_texture_ramp(GPUMaterial *mat, int size, float *pixels, float *row) +GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *layer) { GPUNodeLink *link = GPU_node_link_create(); link->texture = true; - link->ptr1 = gpu_material_ramp_texture_row_set(mat, size, pixels, row); + link->ptr1 = gpu_material_ramp_texture_row_set(mat, size, pixels, layer); MEM_freeN(pixels); return link; } -GPUNodeLink *GPU_dynamic_texture(GPUTexture *tex, GPUDynamicType dynamictype, void *data) -{ - GPUNodeLink *link = GPU_node_link_create(); - - link->dynamic = true; - link->dynamictex = tex; - link->dynamictype = dynamictype; - link->ptr2 = data; - - return link; -} - GPUNodeLink *GPU_builtin(GPUBuiltin builtin) { GPUNodeLink *link = GPU_node_link_create(); @@ -1718,15 +1666,6 @@ GPUNodeLink *GPU_builtin(GPUBuiltin builtin) return link; } -GPUNodeLink *GPU_opengl_builtin(GPUOpenGLBuiltin builtin) -{ - GPUNodeLink *link = GPU_node_link_create(); - - link->oglbuiltin = builtin; - - return link; -} - bool GPU_link(GPUMaterial *mat, const char *name, ...) { GPUNode *node; @@ -1826,27 +1765,6 @@ bool GPU_stack_link(GPUMaterial *material, bNode *bnode, const char *name, GPUNo return true; } -int GPU_link_changed(GPUNodeLink *link) -{ - GPUNode *node; - GPUInput *input; - const char *name; - - if (link->output) { - node = link->output->node; - name = node->name; - - if (STREQ(name, "set_value") || STREQ(name, "set_rgb")) { - input = node->inputs.first; - return (input->link != NULL); - } - - return 1; - } - else - return 0; -} - GPUNodeLink *GPU_uniformbuffer_link_out(GPUMaterial *mat, bNode *node, GPUNodeStack *stack, const int index) { return gpu_uniformbuffer_link(mat, node, stack, index, SOCK_OUT); diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h index 77e6e5cf4ef..21dcaf6b591 100644 --- a/source/blender/gpu/intern/gpu_codegen.h +++ b/source/blender/gpu/intern/gpu_codegen.h @@ -198,6 +198,5 @@ void gpu_codegen_exit(void); const char *GPU_builtin_name(GPUBuiltin builtin); void gpu_material_add_node(struct GPUMaterial *material, struct GPUNode *node); struct GPUTexture **gpu_material_ramp_texture_row_set(GPUMaterial *mat, int size, float *pixels, float *row); -int GPU_link_changed(struct GPUNodeLink *link); #endif diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 6560b5e7f13..b812cf61483 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -239,13 +239,8 @@ static void gpu_shader_standard_defines( bool use_opensubdiv) { /* some useful defines to detect GPU type */ - if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) { + if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) strcat(defines, "#define GPU_ATI\n"); - if (GLEW_VERSION_3_0) { - /* TODO(merwin): revisit this version check; GLEW_VERSION_3_0 means GL 3.0 or newer */ - strcat(defines, "#define CLIP_WORKAROUND\n"); - } - } else if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY)) strcat(defines, "#define GPU_NVIDIA\n"); else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY)) diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c index 63c1cac566d..80cfba00e0a 100644 --- a/source/blender/nodes/shader/node_shader_util.c +++ b/source/blender/nodes/shader/node_shader_util.c @@ -257,12 +257,12 @@ void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in 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); + tmin = GPU_uniform((domin) ? texmap->min : min); + tmax = GPU_uniform((domax) ? texmap->max : max); + tmat0 = GPU_uniform((float *)texmap->mat[0]); + tmat1 = GPU_uniform((float *)texmap->mat[1]); + tmat2 = GPU_uniform((float *)texmap->mat[2]); + tmat3 = GPU_uniform((float *)texmap->mat[3]); GPU_link(mat, "mapping", in[0].link, tmat0, tmat1, tmat2, tmat3, tmin, tmax, &in[0].link); diff --git a/source/blender/nodes/shader/nodes/node_shader_blackbody.c b/source/blender/nodes/shader/nodes/node_shader_blackbody.c index e57f5e0d6cf..28ba3d2c5c8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_blackbody.c +++ b/source/blender/nodes/shader/nodes/node_shader_blackbody.c @@ -46,9 +46,9 @@ static int node_shader_gpu_blackbody(GPUMaterial *mat, bNode *node, bNodeExecDat blackbody_temperature_to_rgb_table(data, size, 965.0f, 12000.0f); float layer; - GPUNodeLink *ramp_texture = GPU_texture_ramp(mat, size, data, &layer); + GPUNodeLink *ramp_texture = GPU_color_band(mat, size, data, &layer); - return GPU_stack_link(mat, node, "node_blackbody", in, out, ramp_texture, GPU_uniform(&layer)); + return GPU_stack_link(mat, node, "node_blackbody", in, out, ramp_texture, GPU_constant(&layer)); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c index ada6e21356f..b18dcacb98f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c @@ -54,7 +54,7 @@ static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, bNode *node, bNodeExecDa GPU_material_flag_set(mat, GPU_MATFLAG_GLOSSY | GPU_MATFLAG_REFRACT); - return GPU_stack_link(mat, node, "node_bsdf_glass", in, out, GPU_uniform(&node->ssr_id)); + return GPU_stack_link(mat, node, "node_bsdf_glass", in, out, GPU_constant(&node->ssr_id)); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c index f56837de261..342b3a67ffb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c @@ -53,7 +53,7 @@ static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, bNode *node, bNodeExecD GPU_material_flag_set(mat, GPU_MATFLAG_GLOSSY); - return GPU_stack_link(mat, node, "node_bsdf_glossy", in, out, GPU_uniform(&node->ssr_id)); + return GPU_stack_link(mat, node, "node_bsdf_glossy", in, out, GPU_constant(&node->ssr_id)); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c index 370dcdcc2ea..16d35c7003a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c @@ -104,7 +104,7 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeE } else { float one[3] = {1.0f, 1.0f, 1.0f}; - GPU_link(mat, "set_rgb", GPU_uniform((float *)one), &sss_scale); + GPU_link(mat, "set_rgb", GPU_constant((float *)one), &sss_scale); } bool use_diffuse = socket_not_one(4) && socket_not_one(15); @@ -149,7 +149,7 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeE GPU_material_flag_set(mat, flag); return GPU_stack_link(mat, node, node_name, in, out, GPU_builtin(GPU_VIEW_POSITION), - GPU_uniform(&node->ssr_id), GPU_uniform(&node->sss_id), sss_scale); + GPU_constant(&node->ssr_id), GPU_constant(&node->sss_id), sss_scale); } static void node_shader_update_principled(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.c b/source/blender/nodes/shader/nodes/node_shader_bump.c index 08b50a886c5..b71a59d8c11 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bump.c +++ b/source/blender/nodes/shader/nodes/node_shader_bump.c @@ -52,7 +52,7 @@ static int gpu_shader_bump(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED( else GPU_link(mat, "direction_transform_m4v3", in[3].link, GPU_builtin(GPU_VIEW_MATRIX), &in[3].link); float invert = node->custom1; - GPU_stack_link(mat, node, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_uniform(&invert)); + GPU_stack_link(mat, node, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_constant(&invert)); /* Other nodes are applying view matrix if the input Normal has a link. * We don't want normal to have view matrix applied twice, so we cancel it here. * diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c index 21bdc3cd0d8..243d57339ea 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.c +++ b/source/blender/nodes/shader/nodes/node_shader_curves.c @@ -66,9 +66,9 @@ static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, bNodeExecData *UN int size; curvemapping_table_RGBA(node->storage, &array, &size); - GPUNodeLink *tex = GPU_texture_ramp(mat, size, array, &layer); + GPUNodeLink *tex = GPU_color_band(mat, size, array, &layer); - return GPU_stack_link(mat, node, "curves_vec", in, out, tex, GPU_uniform(&layer)); + return GPU_stack_link(mat, node, "curves_vec", in, out, tex, GPU_constant(&layer)); } void register_node_type_sh_curve_vec(void) @@ -126,9 +126,9 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UN curvemapping_initialize(node->storage); curvemapping_table_RGBA(node->storage, &array, &size); - GPUNodeLink *tex = GPU_texture_ramp(mat, size, array, &layer); + GPUNodeLink *tex = GPU_color_band(mat, size, array, &layer); - return GPU_stack_link(mat, node, "curves_rgb", in, out, tex, GPU_uniform(&layer)); + return GPU_stack_link(mat, node, "curves_rgb", in, out, tex, GPU_constant(&layer)); } void register_node_type_sh_curve_rgb(void) diff --git a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c index 6583dd0cec3..939cd9f79a2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c +++ b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c @@ -64,12 +64,12 @@ static int node_shader_gpu_eevee_specular(GPUMaterial *mat, bNode *node, bNodeEx /* Occlusion */ if (!in[9].link) { - GPU_link(mat, "set_value", GPU_uniform(&one), &in[9].link); + GPU_link(mat, "set_value", GPU_constant(&one), &in[9].link); } GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_GLOSSY); - return GPU_stack_link(mat, node, "node_eevee_specular", in, out, GPU_uniform(&node->ssr_id)); + return GPU_stack_link(mat, node, "node_eevee_specular", in, out, GPU_constant(&node->ssr_id)); } diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c index 98dcd58b983..282c6a4f147 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mapping.c +++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c @@ -92,12 +92,12 @@ static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, bNodeExecData *UNUS 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); + tmin = GPU_uniform((domin) ? texmap->min : min); + tmax = GPU_uniform((domax) ? texmap->max : max); + tmat0 = GPU_uniform((float *)texmap->mat[0]); + tmat1 = GPU_uniform((float *)texmap->mat[1]); + tmat2 = GPU_uniform((float *)texmap->mat[2]); + tmat3 = GPU_uniform((float *)texmap->mat[3]); GPU_stack_link(mat, node, "mapping", in, out, tmat0, tmat1, tmat2, tmat3, tmin, tmax); diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c index 1b702a722ba..a072c686686 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.c +++ b/source/blender/nodes/shader/nodes/node_shader_math.c @@ -332,7 +332,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED( if (node->custom2 & SHD_MATH_CLAMP) { float min[3] = {0.0f, 0.0f, 0.0f}; float max[3] = {1.0f, 1.0f, 1.0f}; - GPU_link(mat, "clamp_val", out[0].link, GPU_uniform(min), GPU_uniform(max), &out[0].link); + GPU_link(mat, "clamp_val", out[0].link, GPU_constant(min), GPU_constant(max), &out[0].link); } return 1; diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c index b598859ab8e..5bf5ce69261 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c @@ -76,7 +76,7 @@ static int gpu_shader_mix_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUS if (ret && node->custom2 & SHD_MIXRGB_CLAMP) { float min[3] = {0.0f, 0.0f, 0.0f}; float max[3] = {1.0f, 1.0f, 1.0f}; - GPU_link(mat, "clamp_vec3", out[0].link, GPU_uniform(min), GPU_uniform(max), &out[0].link); + GPU_link(mat, "clamp_vec3", out[0].link, GPU_constant(min), GPU_constant(max), &out[0].link); } return ret; } diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c index 121cb9cc1a5..13335c86382 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal.c +++ b/source/blender/nodes/shader/nodes/node_shader_normal.c @@ -60,7 +60,7 @@ static void node_shader_exec_normal(void *UNUSED(data), int UNUSED(thread), bNod static int gpu_shader_normal(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - GPUNodeLink *vec = GPU_uniform(out[0].vec); + GPUNodeLink *vec = GPU_constant(out[0].vec); return GPU_stack_link(mat, node, "normal_new_shading", in, out, vec); } 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 e4b5aaef72d..c066fea81ad 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal_map.c +++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.c @@ -66,23 +66,23 @@ static int gpu_shader_normal_map(GPUMaterial *mat, bNode *node, bNodeExecData *U else if (node->original) { bNodeSocket *socket = BLI_findlink(&node->original->inputs, 0); bNodeSocketValueFloat *socket_data = socket->default_value; - strength = GPU_uniform_buffer(&socket_data->value, GPU_FLOAT); + strength = GPU_uniform(&socket_data->value); } else - strength = GPU_uniform(in[0].vec); + strength = GPU_constant(in[0].vec); if (in[1].link) realnorm = in[1].link; else if (node->original) { bNodeSocket *socket = BLI_findlink(&node->original->inputs, 1); bNodeSocketValueRGBA *socket_data = socket->default_value; - realnorm = GPU_uniform_buffer(socket_data->value, GPU_VEC3); + realnorm = GPU_uniform(socket_data->value); } else - realnorm = GPU_uniform(in[1].vec); + realnorm = GPU_constant(in[1].vec); negnorm = GPU_builtin(GPU_VIEW_NORMAL); - GPU_link(mat, "math_max", strength, GPU_uniform(d), &strength); + GPU_link(mat, "math_max", strength, GPU_constant(d), &strength); const char *color_to_normal_fnc_name = "color_to_normal_new_shading"; if (nm->space == SHD_SPACE_BLENDER_OBJECT || nm->space == SHD_SPACE_BLENDER_WORLD) diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c index f8af125eb9e..7cc80a0c636 100644 --- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c +++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c @@ -67,7 +67,7 @@ static int node_shader_gpu_subsurface_scattering(GPUMaterial *mat, bNode *node, &socket_data_sharp->value); } - return GPU_stack_link(mat, node, "node_subsurface_scattering", in, out, GPU_uniform(&node->sss_id)); + return GPU_stack_link(mat, node, "node_subsurface_scattering", in, out, GPU_constant(&node->sss_id)); } static void node_shader_update_subsurface_scattering(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c index 227df5e8e56..2002e3c14c9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c @@ -82,8 +82,8 @@ static int node_shader_gpu_tex_brick(GPUMaterial *mat, bNode *node, bNodeExecDat float squash_freq = tex->squash_freq; return GPU_stack_link(mat, node, "node_tex_brick", in, out, - GPU_uniform(&tex->offset), GPU_uniform(&offset_freq), - GPU_uniform(&tex->squash), GPU_uniform(&squash_freq)); + GPU_constant(&tex->offset), GPU_constant(&offset_freq), + GPU_constant(&tex->squash), GPU_constant(&squash_freq)); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c index 06f3773e6d8..750ce60e84d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c @@ -61,7 +61,7 @@ static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, bNodeExec NodeTexGradient *tex = (NodeTexGradient *)node->storage; float gradient_type = tex->gradient_type; - return GPU_stack_link(mat, node, "node_tex_gradient", in, out, GPU_uniform(&gradient_type)); + return GPU_stack_link(mat, node, "node_tex_gradient", in, out, GPU_constant(&gradient_type)); } /* node type definition */ 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 9782df2638f..0b33b186dd2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -124,7 +124,7 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, bNodeExecDat norm, col1, col2, col3, GPU_image(ima, iuser, isdata), - GPU_uniform(&blend), + GPU_constant(&blend), &out[0].link, &out[1].link); break; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c index deb81b7b78f..fb3012e1d2b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c @@ -64,7 +64,7 @@ static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, bNodeExecDat node_shader_gpu_tex_mapping(mat, node, in, out); - return GPU_stack_link(mat, node, "node_tex_magic", in, out, GPU_uniform(&depth)); + return GPU_stack_link(mat, node, "node_tex_magic", in, out, GPU_constant(&depth)); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c index 03f401e7f01..30171eea9e2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c @@ -68,7 +68,7 @@ static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, bNodeExec NodeTexMusgrave *tex = (NodeTexMusgrave *)node->storage; float type = tex->musgrave_type; - return GPU_stack_link(mat, node, "node_tex_musgrave", in, out, GPU_uniform(&type)); + return GPU_stack_link(mat, node, "node_tex_musgrave", in, out, GPU_constant(&type)); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c index 18d0dee8b88..2105bbfa25a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c @@ -66,7 +66,7 @@ static int node_shader_gpu_tex_voronoi(GPUMaterial *mat, bNode *node, bNodeExecD NodeTexVoronoi *tex = (NodeTexVoronoi *)node->storage; float coloring = tex->coloring; - return GPU_stack_link(mat, node, "node_tex_voronoi", in, out, GPU_uniform(&coloring)); + return GPU_stack_link(mat, node, "node_tex_voronoi", in, out, GPU_constant(&coloring)); } static void node_shader_update_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c index 2b06f66eb63..ac955b29808 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c @@ -67,7 +67,7 @@ static int node_shader_gpu_tex_wave(GPUMaterial *mat, bNode *node, bNodeExecData float wave_type = tex->wave_type; float wave_profile = tex->wave_profile; - return GPU_stack_link(mat, node, "node_tex_wave", in, out, GPU_uniform(&wave_type), GPU_uniform(&wave_profile)); + return GPU_stack_link(mat, node, "node_tex_wave", in, out, GPU_constant(&wave_type), GPU_constant(&wave_profile)); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c index 5f583e1e29b..4f4462f20bb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c @@ -70,13 +70,13 @@ static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNU int size; BKE_colorband_evaluate_table_rgba(coba, &array, &size); - GPUNodeLink *tex = GPU_texture_ramp(mat, size, array, &layer); + GPUNodeLink *tex = GPU_color_band(mat, size, array, &layer); if (coba->ipotype == COLBAND_INTERP_CONSTANT) { - return GPU_stack_link(mat, node, "valtorgb_nearest", in, out, tex, GPU_uniform(&layer)); + return GPU_stack_link(mat, node, "valtorgb_nearest", in, out, tex, GPU_constant(&layer)); } else { - return GPU_stack_link(mat, node, "valtorgb", in, out, tex, GPU_uniform(&layer)); + return GPU_stack_link(mat, node, "valtorgb", in, out, tex, GPU_constant(&layer)); } } diff --git a/source/blender/nodes/shader/nodes/node_shader_vectTransform.c b/source/blender/nodes/shader/nodes/node_shader_vectTransform.c index 63964e27d20..bce96230403 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vectTransform.c +++ b/source/blender/nodes/shader/nodes/node_shader_vectTransform.c @@ -106,7 +106,7 @@ static int gpu_shader_vect_transform(GPUMaterial *mat, bNode *node, bNodeExecDat if (in[0].hasinput) inputlink = in[0].link; else - inputlink = GPU_uniform(in[0].vec); + inputlink = GPU_constant(in[0].vec); fromto = get_gpulink_matrix_from_to(nodeprop->convert_from, nodeprop->convert_to); diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c index c946c42f9af..cf458ac8f51 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c @@ -120,15 +120,15 @@ static int node_shader_gpu_volume_principled(GPUMaterial *mat, bNode *node, bNod /* Default values if attributes not found. */ if (!density) { static float one = 1.0f; - density = GPU_uniform(&one); + density = GPU_constant(&one); } if (!color) { static float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - color = GPU_uniform(white); + color = GPU_constant(white); } if (!temperature) { static float one = 1.0f; - temperature = GPU_uniform(&one); + temperature = GPU_constant(&one); } /* Create blackbody spectrum. */ @@ -141,10 +141,10 @@ static int node_shader_gpu_volume_principled(GPUMaterial *mat, bNode *node, bNod else { data = MEM_callocN(sizeof(float) * size * 4, "blackbody black"); } - GPUNodeLink *spectrummap = GPU_texture_ramp(mat, size, data, &layer); + GPUNodeLink *spectrummap = GPU_color_band(mat, size, data, &layer); return GPU_stack_link(mat, node, "node_volume_principled", in, out, density, color, temperature, spectrummap, - GPU_uniform(&layer)); + GPU_constant(&layer)); } /* node type definition */ -- cgit v1.2.3