Last active
August 29, 2015 14:27
-
-
Save birarda/5733ea7858a491846de1 to your computer and use it in GitHub Desktop.
Qt OS X GL Core Patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/qtwebkit/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp b/qtwebkit/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp | |
index d4ace36..e949304 100644 | |
--- a/qtwebkit/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp | |
+++ b/qtwebkit/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp | |
@@ -442,7 +442,16 @@ void GraphicsContext3D::compileShader(Platform3DObject shader) | |
ASSERT(shader); | |
makeContextCurrent(); | |
- String translatedShaderSource = m_extensions->getTranslatedShaderSourceANGLE(shader); | |
+ String translatedShaderSource; | |
+ { | |
+ | |
+ HashMap<Platform3DObject, GraphicsContext3D::ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader); | |
+ if (result == m_shaderSourceMap.end()) | |
+ return; | |
+ GraphicsContext3D::ShaderSourceEntry& entry = result->value; | |
+ translatedShaderSource = entry.source; | |
+// translatedShaderSource = m_extensions->getTranslatedShaderSourceANGLE(shader); | |
+ } | |
if (!translatedShaderSource.length()) | |
return; | |
diff --git a/qtwebkit/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp b/qtwebkit/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp | |
index 999d52f..6d67960 100644 | |
--- a/qtwebkit/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp | |
+++ b/qtwebkit/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp | |
@@ -119,6 +119,7 @@ TextureMapperShaderProgram::~TextureMapperShaderProgram() | |
} | |
#define GLSL_DIRECTIVE(...) "#"#__VA_ARGS__"\n" | |
+ | |
static const char* vertexTemplate = | |
STRINGIFY( | |
attribute vec4 a_vertex; | |
@@ -126,9 +127,9 @@ static const char* vertexTemplate = | |
uniform mat4 u_projectionMatrix; | |
uniform highp mat4 u_textureSpaceMatrix; | |
- varying vec2 v_texCoord; | |
- varying vec2 v_transformedTexCoord; | |
- varying float v_antialias; | |
+ out vec2 v_texCoord; | |
+ out vec2 v_transformedTexCoord; | |
+ out float v_antialias; | |
void noop(inout vec2 dummyParameter) { } | |
@@ -180,15 +181,6 @@ static const char* vertexTemplate = | |
} | |
); | |
-#define RECT_TEXTURE_DIRECTIVE \ | |
- GLSL_DIRECTIVE(ifdef ENABLE_Rect) \ | |
- GLSL_DIRECTIVE(define SamplerType sampler2DRect) \ | |
- GLSL_DIRECTIVE(define SamplerFunction texture2DRect) \ | |
- GLSL_DIRECTIVE(else) \ | |
- GLSL_DIRECTIVE(define SamplerType sampler2D) \ | |
- GLSL_DIRECTIVE(define SamplerFunction texture2D) \ | |
- GLSL_DIRECTIVE(endif) | |
- | |
#define ANTIALIASING_TEX_COORD_DIRECTIVE \ | |
GLSL_DIRECTIVE(if defined(ENABLE_Antialiasing) && defined(ENABLE_Texture)) \ | |
GLSL_DIRECTIVE(define transformTexCoord fragmentTransformTexCoord) \ | |
@@ -202,19 +194,17 @@ static const char* vertexTemplate = | |
GLSL_DIRECTIVE(define GAUSSIAN_KERNEL_HALF_WIDTH 11) \ | |
GLSL_DIRECTIVE(define GAUSSIAN_KERNEL_STEP 0.2) | |
- | |
static const char* fragmentTemplate = | |
- RECT_TEXTURE_DIRECTIVE | |
ANTIALIASING_TEX_COORD_DIRECTIVE | |
BLUR_CONSTANTS | |
STRINGIFY( | |
precision mediump float; | |
- uniform SamplerType s_sampler; | |
+ uniform sampler2D s_sampler; | |
uniform sampler2D s_contentTexture; | |
uniform float u_opacity; | |
- varying float v_antialias; | |
- varying vec2 v_texCoord; | |
- varying vec2 v_transformedTexCoord; | |
+ in float v_antialias; | |
+ in vec2 v_texCoord; | |
+ in vec2 v_transformedTexCoord; | |
uniform float u_filterAmount; | |
uniform vec2 u_blurRadius; | |
uniform vec2 u_shadowOffset; | |
@@ -222,6 +212,8 @@ static const char* fragmentTemplate = | |
uniform float u_gaussianKernel[GAUSSIAN_KERNEL_HALF_WIDTH]; | |
uniform highp mat4 u_textureSpaceMatrix; | |
+ out vec4 o_FragColor; | |
+ | |
void noop(inout vec4 dummyParameter) { } | |
void noop(inout vec4 dummyParameter, vec2 texCoord) { } | |
@@ -235,7 +227,7 @@ static const char* fragmentTemplate = | |
vec2 vertexTransformTexCoord() { return v_transformedTexCoord; } | |
- void applyTexture(inout vec4 color, vec2 texCoord) { color = SamplerFunction(s_sampler, texCoord); } | |
+ void applyTexture(inout vec4 color, vec2 texCoord) { color = texture(s_sampler, texCoord); } | |
void applyOpacity(inout vec4 color) { color *= u_opacity; } | |
void applyAntialiasing(inout vec4 color) { color *= antialias(); } | |
@@ -301,13 +293,13 @@ static const char* fragmentTemplate = | |
vec4 sampleColorAtRadius(float radius, vec2 texCoord) | |
{ | |
vec2 coord = texCoord + radius * u_blurRadius; | |
- return SamplerFunction(s_sampler, coord) * float(coord.x > 0. && coord.y > 0. && coord.x < 1. && coord.y < 1.); | |
+ return texture(s_sampler, coord) * float(coord.x > 0. && coord.y > 0. && coord.x < 1. && coord.y < 1.); | |
} | |
float sampleAlphaAtRadius(float radius, vec2 texCoord) | |
{ | |
vec2 coord = texCoord - u_shadowOffset + radius * u_blurRadius; | |
- return SamplerFunction(s_sampler, coord).a * float(coord.x > 0. && coord.y > 0. && coord.x < 1. && coord.y < 1.); | |
+ return texture(s_sampler, coord).a * float(coord.x > 0. && coord.y > 0. && coord.x < 1. && coord.y < 1.); | |
} | |
void applyBlurFilter(inout vec4 color, vec2 texCoord) | |
@@ -336,7 +328,7 @@ static const char* fragmentTemplate = | |
void applyContentTexture(inout vec4 color, vec2 texCoord) | |
{ | |
- vec4 contentColor = texture2D(s_contentTexture, texCoord); | |
+ vec4 contentColor = texture(s_contentTexture, texCoord); | |
color = sourceOver(contentColor, color); | |
} | |
@@ -361,13 +353,15 @@ static const char* fragmentTemplate = | |
applyBlurFilterIfNeeded(color, texCoord); | |
applyAlphaBlurIfNeeded(color, texCoord); | |
applyContentTextureIfNeeded(color, texCoord); | |
- gl_FragColor = color; | |
+ o_FragColor = color; | |
} | |
); | |
PassRefPtr<TextureMapperShaderProgram> TextureMapperShaderProgram::create(PassRefPtr<GraphicsContext3D> context, TextureMapperShaderProgram::Options options) | |
{ | |
StringBuilder shaderBuilder; | |
+ shaderBuilder.append("#version 150\n"); | |
+ | |
#define SET_APPLIER_FROM_OPTIONS(Applier) \ | |
shaderBuilder.append(\ | |
(options & TextureMapperShaderProgram::Applier) ? ENABLE_APPLIER(Applier) : DISABLE_APPLIER(Applier)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment