[Bf-blender-cvs] [66228d4362a] master: Fix T62090 : Eevee shader compilation: undefined variable "att1_is_srgb"
Clément Foucault
noreply at git.blender.org
Fri Mar 1 19:46:14 CET 2019
Commit: 66228d4362a64b31ad5614033412ba0b21ca371f
Author: Clément Foucault
Date: Fri Mar 1 17:57:06 2019 +0100
Branches: master
https://developer.blender.org/rB66228d4362a64b31ad5614033412ba0b21ca371f
Fix T62090 : Eevee shader compilation: undefined variable "att1_is_srgb"
The geom shader check was not needed and this uncovered an error in the
GPU_BARYCENTRIC_TEXCO optimization recently commited.
===================================================================
M source/blender/gpu/intern/gpu_codegen.c
M source/blender/nodes/shader/nodes/node_shader_geometry.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index a2c25a9ffb4..63d875b07fd 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -889,7 +889,7 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
input->attr_id, attr_prefix_get(input->attr_type), hash);
/* Auto attribute can be vertex color byte buffer.
* We need to know and convert them to linear space in VS. */
- if (!use_geom && input->attr_type == CD_AUTO_FROM_NAME) {
+ if (input->attr_type == CD_AUTO_FROM_NAME) {
BLI_dynstr_appendf(ds, "uniform bool ba%u;\n", hash);
BLI_dynstr_appendf(ds, "#define att%d_is_srgb ba%u\n", input->attr_id, hash);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.c b/source/blender/nodes/shader/nodes/node_shader_geometry.c
index 4c4ad7c4cc9..ec9b3a5443e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geometry.c
+++ b/source/blender/nodes/shader/nodes/node_shader_geometry.c
@@ -37,11 +37,13 @@ static int node_shader_gpu_geometry(GPUMaterial *mat, bNode *node, bNodeExecData
{
/* HACK: Don't request GPU_BARYCENTRIC_TEXCO if not used because it will
* trigger the use of geometry shader (and the performance penalty it implies). */
- eGPUBuiltin bary_builtin = (out[7].type == GPU_NONE) ? GPU_VIEW_NORMAL : GPU_BARYCENTRIC_TEXCO;
+ float val[2] = {0.0f, 0.0f};
+ GPUNodeLink *bary_link = (!out[5].hasoutput) ? GPU_constant(val) : GPU_builtin(GPU_BARYCENTRIC_TEXCO);
+
return GPU_stack_link(mat, node, "node_geometry", in, out,
GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL),
GPU_attribute(CD_ORCO, ""), GPU_builtin(GPU_OBJECT_MATRIX),
- GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(bary_builtin));
+ GPU_builtin(GPU_INVERSE_VIEW_MATRIX), bary_link);
}
/* node type definition */
More information about the Bf-blender-cvs
mailing list