From f7a584b841dc4fe5f15254adaa5d12a7473465ce Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 18 Oct 2012 12:37:51 +0000 Subject: Fix #32903: bring cycles glsl up to date with latest changes. --- source/blender/gpu/shaders/gpu_shader_material.glsl | 14 ++++++++++---- .../nodes/shader/nodes/node_shader_bsdf_anisotropic.c | 5 ++++- .../blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c | 5 ++++- source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c | 5 ++++- .../blender/nodes/shader/nodes/node_shader_bsdf_glossy.c | 6 ++++-- .../nodes/shader/nodes/node_shader_bsdf_translucent.c | 5 ++++- .../blender/nodes/shader/nodes/node_shader_bsdf_velvet.c | 5 ++++- source/blender/nodes/shader/nodes/node_shader_bump.c | 5 +++++ 8 files changed, 39 insertions(+), 11 deletions(-) (limited to 'source/blender') diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 81c3cab97d4..716ffc2b254 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -1992,7 +1992,7 @@ void node_bsdf_diffuse(vec4 color, float roughness, vec3 N, out vec4 result) result = vec4(L*color.rgb, 1.0); } -void node_bsdf_glossy(vec4 color, float roughness, vec3 N, vec3 I, out vec4 result) +void node_bsdf_glossy(vec4 color, float roughness, vec3 N, out vec4 result) { /* ambient light */ vec3 L = vec3(0.2); @@ -2013,12 +2013,12 @@ void node_bsdf_glossy(vec4 color, float roughness, vec3 N, vec3 I, out vec4 resu result = vec4(L*color.rgb, 1.0); } -void node_bsdf_anisotropic(vec4 color, float roughnessU, float roughnessV, vec3 N, vec3 I, out vec4 result) +void node_bsdf_anisotropic(vec4 color, float roughnessU, float roughnessV, vec3 N, vec3 T, out vec4 result) { node_bsdf_diffuse(color, 0.0, N, result); } -void node_bsdf_glass(vec4 color, float roughness, float ior, vec3 N, vec3 I, out vec4 result) +void node_bsdf_glass(vec4 color, float roughness, float ior, vec3 N, out vec4 result) { node_bsdf_diffuse(color, 0.0, N, result); } @@ -2195,7 +2195,8 @@ void node_light_path( out float is_glossy_ray, out float is_singular_ray, out float is_reflection_ray, - out float is_transmission_ray) + out float is_transmission_ray, + out float ray_length) { is_camera_ray = 1.0; is_shadow_ray = 0.0; @@ -2204,6 +2205,7 @@ void node_light_path( is_singular_ray = 0.0; is_reflection_ray = 0.0; is_transmission_ray = 0.0; + ray_length = 1.0; } void node_light_falloff(float strength, float tsmooth, out float quadratic, out float linear, out float constant) @@ -2221,6 +2223,10 @@ void node_object_info(out vec3 location, out float object_index, out float mater random = 0.0; } +void node_bump(float strength, float height, vec3 N, out vec3 result) +{ + result = N; +} /* output */ diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c index 82db5553a87..4a7643f5771 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c @@ -45,7 +45,10 @@ static bNodeSocketTemplate sh_node_bsdf_anisotropic_out[]= { static int node_shader_gpu_bsdf_anisotropic(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_bsdf_anisotropic", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION)); + if(!in[3].link) + in[3].link = GPU_builtin(GPU_VIEW_NORMAL); + + return GPU_stack_link(mat, "node_bsdf_anisotropic", in, out); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c index f9507d9a755..63ce637fd72 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c @@ -43,7 +43,10 @@ static bNodeSocketTemplate sh_node_bsdf_diffuse_out[]= { static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_bsdf_diffuse", in, out, GPU_builtin(GPU_VIEW_NORMAL)); + if(!in[2].link) + in[2].link = GPU_builtin(GPU_VIEW_NORMAL); + + return GPU_stack_link(mat, "node_bsdf_diffuse", in, out); } /* 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 858301a052d..7b8b80ae8e2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c @@ -44,7 +44,10 @@ static bNodeSocketTemplate sh_node_bsdf_glass_out[]= { static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_bsdf_glass", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION)); + if(!in[3].link) + in[3].link = GPU_builtin(GPU_VIEW_NORMAL); + + return GPU_stack_link(mat, "node_bsdf_glass", in, out); } /* 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 30697d75eae..9f42e23ebb6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c @@ -43,8 +43,10 @@ static bNodeSocketTemplate sh_node_bsdf_glossy_out[]= { static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { - /* todo: is incoming vector normalized? */ - return GPU_stack_link(mat, "node_bsdf_glossy", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION)); + if(!in[2].link) + in[2].link = GPU_builtin(GPU_VIEW_NORMAL); + + return GPU_stack_link(mat, "node_bsdf_glossy", in, out); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c index 1023fd2f3fc..b3290411aee 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c @@ -42,7 +42,10 @@ static bNodeSocketTemplate sh_node_bsdf_translucent_out[]= { static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_bsdf_translucent", in, out, GPU_builtin(GPU_VIEW_NORMAL)); + if(!in[1].link) + in[1].link = GPU_builtin(GPU_VIEW_NORMAL); + + return GPU_stack_link(mat, "node_bsdf_translucent", in, out); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c index c1483d41c94..97bc37a84c9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c @@ -43,7 +43,10 @@ static bNodeSocketTemplate sh_node_bsdf_velvet_out[]= { static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_bsdf_velvet", in, out, GPU_builtin(GPU_VIEW_NORMAL)); + if(!in[2].link) + in[2].link = GPU_builtin(GPU_VIEW_NORMAL); + + return GPU_stack_link(mat, "node_bsdf_velvet", in, out); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.c b/source/blender/nodes/shader/nodes/node_shader_bump.c index fc612ccc65b..9fd5f495c3b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bump.c +++ b/source/blender/nodes/shader/nodes/node_shader_bump.c @@ -46,6 +46,10 @@ static bNodeSocketTemplate sh_node_bump_out[]= { { -1, 0, "" } }; +static int gpu_shader_bump(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, "node_bump", in, out, GPU_builtin(GPU_VIEW_NORMAL)); +} /* node type definition */ void register_node_type_sh_bump(bNodeTreeType *ttype) @@ -58,6 +62,7 @@ void register_node_type_sh_bump(bNodeTreeType *ttype) node_type_size(&ntype, 150, 60, 200); node_type_storage(&ntype, "BumpNode", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, NULL); + node_type_gpu(&ntype, gpu_shader_bump); nodeRegisterType(ttype, &ntype); } -- cgit v1.2.3