Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/opencolorio/gpu_shader_display_transform.glsl')
-rw-r--r--intern/opencolorio/gpu_shader_display_transform.glsl15
1 files changed, 13 insertions, 2 deletions
diff --git a/intern/opencolorio/gpu_shader_display_transform.glsl b/intern/opencolorio/gpu_shader_display_transform.glsl
index 8a85d6cbffe..5921d6d9c73 100644
--- a/intern/opencolorio/gpu_shader_display_transform.glsl
+++ b/intern/opencolorio/gpu_shader_display_transform.glsl
@@ -1,11 +1,15 @@
uniform sampler2D image_texture;
uniform sampler3D lut3d_texture;
-uniform bool predivide;
#ifdef USE_DITHER
uniform float dither;
#endif
+#ifdef USE_TEXTURE_SIZE
+uniform float image_texture_width;
+uniform float image_texture_height;
+#endif
+
#ifdef USE_CURVE_MAPPING
/* Curve mapping parameters
*
@@ -115,7 +119,11 @@ float dither_random_value(vec2 co)
vec2 round_to_pixel(vec2 st)
{
vec2 result;
+#ifdef USE_TEXTURE_SIZE
+ vec2 size = vec2(image_texture_width, image_texture_height);
+#else
vec2 size = textureSize(image_texture, 0);
+#endif
result.x = float(int(st.x * size.x)) / size.x;
result.y = float(int(st.y * size.y)) / size.y;
return result;
@@ -139,12 +147,15 @@ void main()
#ifdef USE_CURVE_MAPPING
col = curvemapping_evaluate_premulRGBF(col);
#endif
- if (predivide && col[3] > 0.0 && col[3] < 1.0) {
+
+#ifdef USE_PREDIVIDE
+ if (col[3] > 0.0 && col[3] < 1.0) {
float inv_alpha = 1.0 / col[3];
col[0] *= inv_alpha;
col[1] *= inv_alpha;
col[2] *= inv_alpha;
}
+#endif
/* NOTE: This is true we only do de-premul here and NO premul
* and the reason is simple -- opengl is always configured