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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2017-08-30 19:28:33 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-08-30 20:59:07 +0300
commit480def9c5587b710ce478a58985e2e4359c14467 (patch)
tree14749342b7010c562222bcb48058a87747c0df03 /intern/opencolorio
parent17f26e181febbc72b873131c40bea6d508264641 (diff)
Fix T52591: OpenColorIO not working correct with OpenGL core profile on macOS.
Also remove textureSize() replacement code, is always supported now.
Diffstat (limited to 'intern/opencolorio')
-rw-r--r--intern/opencolorio/gpu_shader_display_transform.glsl9
-rw-r--r--intern/opencolorio/ocio_impl_glsl.cc45
2 files changed, 6 insertions, 48 deletions
diff --git a/intern/opencolorio/gpu_shader_display_transform.glsl b/intern/opencolorio/gpu_shader_display_transform.glsl
index ae0c524300d..f1dca04b823 100644
--- a/intern/opencolorio/gpu_shader_display_transform.glsl
+++ b/intern/opencolorio/gpu_shader_display_transform.glsl
@@ -5,11 +5,6 @@ uniform sampler3D lut3d_texture;
uniform float dither;
#endif
-#ifdef USE_TEXTURE_SIZE
-uniform float image_texture_width;
-uniform float image_texture_height;
-#endif
-
in vec2 texCoord_interp;
out vec4 fragColor;
@@ -122,11 +117,7 @@ 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;
diff --git a/intern/opencolorio/ocio_impl_glsl.cc b/intern/opencolorio/ocio_impl_glsl.cc
index c8b64f72440..6d634da0477 100644
--- a/intern/opencolorio/ocio_impl_glsl.cc
+++ b/intern/opencolorio/ocio_impl_glsl.cc
@@ -85,8 +85,6 @@ typedef struct OCIO_GLSLDrawState {
bool predivide_used;
- bool texture_size_used;
-
/* Cache */
std::string lut3dcacheid;
std::string shadercacheid;
@@ -240,17 +238,6 @@ bool OCIOImpl::supportGLSLDraw()
return GLEW_VERSION_3_0 || GLEW_ARB_texture_float;
}
-static bool supportGLSL13()
-{
- const char *version = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
- int major = 1, minor = 0;
-
- if (version && sscanf(version, "%d.%d", &major, &minor) == 2)
- return (major > 1 || (major == 1 && minor >= 30));
-
- return false;
-}
-
/**
* Setup OpenGL contexts for a transform defined by processor using GLSL
* All LUT allocating baking and shader compilation happens here.
@@ -353,13 +340,7 @@ bool OCIOImpl::setupGLSLDraw(OCIO_GLSLDrawState **state_r, OCIO_ConstProcessorRc
/* Vertex shader */
std::ostringstream osv;
- if (supportGLSL13()) {
- osv << "#version 330\n";
- }
- else {
- osv << "#version 120\n";
- }
-
+ osv << "#version 330\n";
osv << datatoc_gpu_shader_display_transform_vertex_glsl;
state->vert_shader = compileShaderText(GL_VERTEX_SHADER, osv.str().c_str());
@@ -367,13 +348,11 @@ bool OCIOImpl::setupGLSLDraw(OCIO_GLSLDrawState **state_r, OCIO_ConstProcessorRc
/* Fragment shader */
std::ostringstream os;
- if (supportGLSL13()) {
- os << "#version 330\n";
- }
- else {
- os << "#define USE_TEXTURE_SIZE\n";
- state->texture_size_used = use_dither;
- }
+ os << "#version 330\n";
+
+ /* Work around OpenColorIO not supporting latest GLSL yet. */
+ os << "#define texture2D texture\n";
+ os << "#define texture3D texture\n";
if (use_predivide) {
os << "#define USE_PREDIVIDE\n";
@@ -432,18 +411,6 @@ bool OCIOImpl::setupGLSLDraw(OCIO_GLSLDrawState **state_r, OCIO_ConstProcessorRc
immUniform1i("image_texture", 0);
immUniform1i("lut3d_texture", 1);
- if (state->texture_size_used) {
- /* we use textureSize() if possible for best performance, if not
- * supported we query the size and pass it as uniform variables */
- GLint width, height;
-
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height);
-
- immUniform1f("image_texture_width", (float)width);
- immUniform1f("image_texture_height", (float)height);
- }
-
if (use_dither) {
immUniform1f("dither", dither);
}