svm_gamma.h 991 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright 2011-2013 Blender Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. CCL_NAMESPACE_BEGIN
  17. ccl_device void svm_node_gamma(
  18. ShaderData *sd, float *stack, uint in_gamma, uint in_color, uint out_color)
  19. {
  20. float3 color = stack_load_float3(stack, in_color);
  21. float gamma = stack_load_float(stack, in_gamma);
  22. color = svm_math_gamma_color(color, gamma);
  23. if (stack_valid(out_color))
  24. stack_store_float3(stack, out_color, color);
  25. }
  26. CCL_NAMESPACE_END