Fix #32903: bring cycles glsl up to date with latest changes.

This commit is contained in:
Brecht Van Lommel 2012-10-18 12:37:51 +00:00
parent b3c605e139
commit f7a584b841
8 changed files with 39 additions and 11 deletions

@ -1992,7 +1992,7 @@ void node_bsdf_diffuse(vec4 color, float roughness, vec3 N, out vec4 result)
result = vec4(L*color.rgb, 1.0); 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 */ /* ambient light */
vec3 L = vec3(0.2); 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); 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); 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); node_bsdf_diffuse(color, 0.0, N, result);
} }
@ -2195,7 +2195,8 @@ void node_light_path(
out float is_glossy_ray, out float is_glossy_ray,
out float is_singular_ray, out float is_singular_ray,
out float is_reflection_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_camera_ray = 1.0;
is_shadow_ray = 0.0; is_shadow_ray = 0.0;
@ -2204,6 +2205,7 @@ void node_light_path(
is_singular_ray = 0.0; is_singular_ray = 0.0;
is_reflection_ray = 0.0; is_reflection_ray = 0.0;
is_transmission_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) 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; random = 0.0;
} }
void node_bump(float strength, float height, vec3 N, out vec3 result)
{
result = N;
}
/* output */ /* output */

@ -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) 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 */ /* node type definition */

@ -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) 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 */ /* node type definition */

@ -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) 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 */ /* node type definition */

@ -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) static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
/* todo: is incoming vector normalized? */ if(!in[2].link)
return GPU_stack_link(mat, "node_bsdf_glossy", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION)); in[2].link = GPU_builtin(GPU_VIEW_NORMAL);
return GPU_stack_link(mat, "node_bsdf_glossy", in, out);
} }
/* node type definition */ /* node type definition */

@ -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) 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 */ /* node type definition */

@ -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) 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 */ /* node type definition */

@ -46,6 +46,10 @@ static bNodeSocketTemplate sh_node_bump_out[]= {
{ -1, 0, "" } { -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 */ /* node type definition */
void register_node_type_sh_bump(bNodeTreeType *ttype) 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_size(&ntype, 150, 60, 200);
node_type_storage(&ntype, "BumpNode", node_free_standard_storage, node_copy_standard_storage); node_type_storage(&ntype, "BumpNode", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, NULL); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, gpu_shader_bump);
nodeRegisterType(ttype, &ntype); nodeRegisterType(ttype, &ntype);
} }