This patch refactors GPU shaders to remove includes to the utility gpu_shader_common_math.glsl file. This is done because it has duplicate functions that exist in other files, and it was really created for use in GPU material nodes. The safe_divide and hypot functions were removed since they exist in gpu_shader_math_base_lib.glsl. The compatible_[mod|pow] and wrap functions were moved into gpu_shader_math_base_lib.glsl. The floor_to_int function was inlined since it was trivial and only used in one place. The quick_floor was removed because it was unused. The euler_to_mat3 function was replaced with the from_rotation function from gpu_shader_math_matrix_lib.glsl. Now the file only contains some GPU material node utility functions. Pull Request: https://projects.blender.org/blender/blender/pulls/135160
21 lines
434 B
GLSL
21 lines
434 B
GLSL
/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#include "gpu_shader_math_base_lib.glsl"
|
|
|
|
void node_gamma(vec4 col, float gamma, out vec4 outcol)
|
|
{
|
|
outcol = col;
|
|
|
|
if (col.r > 0.0) {
|
|
outcol.r = compatible_pow(col.r, gamma);
|
|
}
|
|
if (col.g > 0.0) {
|
|
outcol.g = compatible_pow(col.g, gamma);
|
|
}
|
|
if (col.b > 0.0) {
|
|
outcol.b = compatible_pow(col.b, gamma);
|
|
}
|
|
}
|