Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmarSquircleArt <omar.squircleart@gmail.com>2019-08-30 18:23:04 +0300
committerOmarSquircleArt <omar.squircleart@gmail.com>2019-08-30 18:28:57 +0300
commit8cd0da88e55a0c0f88297a5f0f770eb40acc6219 (patch)
tree585b9bcc07ce392c6164ac0230d56d617ac051ca /source/blender/nodes
parentac646bc20dafe176c1b84ee5beddf980aba11358 (diff)
GPU: Split gpu_shader_material into multiple files.
This patch continue the efforts to split the `gpu_shader_material` file started in D5569. Dependency resolution is now recursive. Each shading node gets its own file. Additionally, some utility files are added to be shared between files, like `math_util`, `color_util`, and `hash`. Some files are always included because they may be used in the execution function, like `world_normals`. Some glsl functions appeared to be unused, so they were removed, like `output_node`, `bits_to_01`, and `exp_blender`. Other functions have been renamed to be more general and get used as utils, like `texco_norm` which became `vector_normalize`. A lot of the opengl tests fails, but those same tests also fail in master, so this is probably unrelated to this patch. Reviewers: brecht Differential Revision: https://developer.blender.org/D5616
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/shader/node_shader_util.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mapping.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mixRgb.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal_map.c4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_environment.c6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vectTransform.c2
7 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 2e8f81979a8..65676a5ea91 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -283,7 +283,7 @@ void node_shader_gpu_tex_mapping(GPUMaterial *mat,
GPU_link(mat, "mapping", in[0].link, tmat0, tmat1, tmat2, tmat3, tmin, tmax, &in[0].link);
if (texmap->type == TEXMAP_TYPE_NORMAL) {
- GPU_link(mat, "texco_norm", in[0].link, &in[0].link);
+ GPU_link(mat, "vector_normalize", in[0].link, &in[0].link);
}
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c
index eca0d96f2c8..e58a5d72f28 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c
@@ -115,7 +115,7 @@ static int gpu_shader_mapping(GPUMaterial *mat,
GPU_stack_link(mat, node, "mapping", in, out, tmat0, tmat1, tmat2, tmat3, tmin, tmax);
if (texmap->type == TEXMAP_TYPE_NORMAL) {
- GPU_link(mat, "texco_norm", out[0].link, &out[0].link);
+ GPU_link(mat, "vector_normalize", out[0].link, &out[0].link);
}
return true;
diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
index 872f4f9da9c..ae2184d8237 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
@@ -92,7 +92,7 @@ static int gpu_shader_mix_rgb(GPUMaterial *mat,
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_constant(min), GPU_constant(max), &out[0].link);
+ GPU_link(mat, "clamp_color", 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_map.c b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
index 712c64084cc..18015d94f03 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal_map.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
@@ -114,8 +114,8 @@ static int gpu_shader_normal_map(GPUMaterial *mat,
break;
}
- GPU_link(mat, "vector_math_mix", strength, realnorm, negnorm, &out[0].link);
- GPU_link(mat, "vect_normalize", out[0].link, &out[0].link);
+ GPU_link(mat, "vector_mix", strength, realnorm, negnorm, &out[0].link);
+ GPU_link(mat, "vector_normalize", out[0].link, &out[0].link);
return true;
}
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 bd8355ec885..a02262950a8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
@@ -124,15 +124,15 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat,
if (ELEM(ima->alpha_mode, IMA_ALPHA_IGNORE, IMA_ALPHA_CHANNEL_PACKED) ||
IMB_colormanagement_space_name_is_data(ima->colorspace_settings.name)) {
/* Don't let alpha affect color output in these cases. */
- GPU_link(mat, "tex_color_alpha_clear", out[0].link, &out[0].link);
+ GPU_link(mat, "color_alpha_clear", out[0].link, &out[0].link);
}
else {
/* Always output with premultiplied alpha. */
if (ima->alpha_mode == IMA_ALPHA_PREMUL) {
- GPU_link(mat, "tex_color_alpha_clear", out[0].link, &out[0].link);
+ GPU_link(mat, "color_alpha_clear", out[0].link, &out[0].link);
}
else {
- GPU_link(mat, "tex_color_alpha_premultiply", out[0].link, &out[0].link);
+ GPU_link(mat, "color_alpha_premultiply", out[0].link, &out[0].link);
}
}
}
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 6f3614e357d..5eaf09659d8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -183,7 +183,7 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
if (ELEM(ima->alpha_mode, IMA_ALPHA_IGNORE, IMA_ALPHA_CHANNEL_PACKED) ||
IMB_colormanagement_space_name_is_data(ima->colorspace_settings.name)) {
/* Don't let alpha affect color output in these cases. */
- GPU_link(mat, "tex_color_alpha_clear", out[0].link, &out[0].link);
+ GPU_link(mat, "color_alpha_clear", out[0].link, &out[0].link);
}
else {
/* Output premultiplied alpha depending on alpha socket usage. This makes
@@ -192,18 +192,18 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
* not, then there will be no artifacts from zero alpha areas. */
if (ima->alpha_mode == IMA_ALPHA_PREMUL) {
if (out[1].hasoutput) {
- GPU_link(mat, "tex_color_alpha_unpremultiply", out[0].link, &out[0].link);
+ GPU_link(mat, "color_alpha_unpremultiply", out[0].link, &out[0].link);
}
else {
- GPU_link(mat, "tex_color_alpha_clear", out[0].link, &out[0].link);
+ GPU_link(mat, "color_alpha_clear", out[0].link, &out[0].link);
}
}
else {
if (out[1].hasoutput) {
- GPU_link(mat, "tex_color_alpha_clear", out[0].link, &out[0].link);
+ GPU_link(mat, "color_alpha_clear", out[0].link, &out[0].link);
}
else {
- GPU_link(mat, "tex_color_alpha_premultiply", out[0].link, &out[0].link);
+ GPU_link(mat, "color_alpha_premultiply", out[0].link, &out[0].link);
}
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_vectTransform.c b/source/blender/nodes/shader/nodes/node_shader_vectTransform.c
index fe0e7b1d638..563ef89162b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vectTransform.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectTransform.c
@@ -132,7 +132,7 @@ static int gpu_shader_vect_transform(GPUMaterial *mat,
}
if (nodeprop->type == SHD_VECT_TRANSFORM_TYPE_NORMAL) {
- GPU_link(mat, "vect_normalize", out[0].link, &out[0].link);
+ GPU_link(mat, "vector_normalize", out[0].link, &out[0].link);
}
return true;