Cycles: Constant fold for the Gamma Node.
This commit is contained in:
@@ -21,12 +21,7 @@ ccl_device void svm_node_gamma(ShaderData *sd, float *stack, uint in_gamma, uint
|
||||
float3 color = stack_load_float3(stack, in_color);
|
||||
float gamma = stack_load_float(stack, in_gamma);
|
||||
|
||||
if(color.x > 0.0f)
|
||||
color.x = powf(color.x, gamma);
|
||||
if(color.y > 0.0f)
|
||||
color.y = powf(color.y, gamma);
|
||||
if(color.z > 0.0f)
|
||||
color.z = powf(color.z, gamma);
|
||||
color = svm_math_gamma_color(color, gamma);
|
||||
|
||||
if(stack_valid(out_color))
|
||||
stack_store_float3(stack, out_color, color);
|
||||
|
@@ -166,5 +166,17 @@ ccl_device float3 svm_math_blackbody_color(float t) {
|
||||
return make_float3(4.70366907f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
ccl_device_inline float3 svm_math_gamma_color(float3 color, float gamma)
|
||||
{
|
||||
if(color.x > 0.0f)
|
||||
color.x = powf(color.x, gamma);
|
||||
if(color.y > 0.0f)
|
||||
color.y = powf(color.y, gamma);
|
||||
if(color.z > 0.0f)
|
||||
color.z = powf(color.z, gamma);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
Reference in New Issue
Block a user