~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/cycles/kernel/svm/svm_ramp.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
{
26
26
        f = clamp(f, 0.0f, 1.0f)*(RAMP_TABLE_SIZE-1);
27
27
 
28
 
        int i = (int)f;
 
28
        /* clamp int as well in case of NaN */
 
29
        int i = clamp((int)f, 0, RAMP_TABLE_SIZE-1);
29
30
        float t = f - (float)i;
30
31
 
31
32
        float4 a = fetch_node_float(kg, offset+i);
62
63
        float fac = stack_load_float(stack, fac_offset);
63
64
        float3 color = stack_load_float3(stack, color_offset);
64
65
 
65
 
        float r = rgb_ramp_lookup(kg, *offset, rgb_ramp_lookup(kg, *offset, color.x).w).x;
66
 
        float g = rgb_ramp_lookup(kg, *offset, rgb_ramp_lookup(kg, *offset, color.y).w).y;
67
 
        float b = rgb_ramp_lookup(kg, *offset, rgb_ramp_lookup(kg, *offset, color.z).w).z;
 
66
        float r = rgb_ramp_lookup(kg, *offset, color.x).x;
 
67
        float g = rgb_ramp_lookup(kg, *offset, color.y).y;
 
68
        float b = rgb_ramp_lookup(kg, *offset, color.z).z;
68
69
 
69
70
        color = (1.0f - fac)*color + fac*make_float3(r, g, b);
70
71
        stack_store_float3(stack, out_offset, color);
72
73
        *offset += RAMP_TABLE_SIZE;
73
74
}
74
75
 
 
76
__device void svm_node_vector_curves(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
 
77
{
 
78
        uint fac_offset = node.y;
 
79
        uint color_offset = node.z;
 
80
        uint out_offset = node.w;
 
81
 
 
82
        float fac = stack_load_float(stack, fac_offset);
 
83
        float3 color = stack_load_float3(stack, color_offset);
 
84
 
 
85
        float r = rgb_ramp_lookup(kg, *offset, (color.x + 1.0f)*0.5f).x;
 
86
        float g = rgb_ramp_lookup(kg, *offset, (color.y + 1.0f)*0.5f).y;
 
87
        float b = rgb_ramp_lookup(kg, *offset, (color.z + 1.0f)*0.5f).z;
 
88
 
 
89
        color = (1.0f - fac)*color + fac*make_float3(r*2.0f - 1.0f, g*2.0f - 1.0f, b*2.0f - 1.0f);
 
90
        stack_store_float3(stack, out_offset, color);
 
91
 
 
92
        *offset += RAMP_TABLE_SIZE;
 
93
}
 
94
 
75
95
CCL_NAMESPACE_END
76
96
 
77
97
#endif /* __SVM_RAMP_H__ */