summarylogtreecommitdiffstats
path: root/0006-Establish-compatibility-with-latest-ANGLE.patch
diff options
context:
space:
mode:
Diffstat (limited to '0006-Establish-compatibility-with-latest-ANGLE.patch')
-rw-r--r--0006-Establish-compatibility-with-latest-ANGLE.patch295
1 files changed, 295 insertions, 0 deletions
diff --git a/0006-Establish-compatibility-with-latest-ANGLE.patch b/0006-Establish-compatibility-with-latest-ANGLE.patch
new file mode 100644
index 000000000000..a0bc2f006966
--- /dev/null
+++ b/0006-Establish-compatibility-with-latest-ANGLE.patch
@@ -0,0 +1,295 @@
+From 967f96d827bc9af129fd1431b97de0dc9a076bef Mon Sep 17 00:00:00 2001
+From: Martchus <martchus@gmx.net>
+Date: Sun, 25 Sep 2016 22:19:57 +0200
+Subject: [PATCH 6/9] Establish compatibility with latest ANGLE
+
+---
+ .../platform/graphics/ANGLEWebKitBridge.cpp | 126 ++++-----------------
+ .../WebCore/platform/graphics/ANGLEWebKitBridge.h | 17 +--
+ .../graphics/cairo/GraphicsContext3DCairo.cpp | 2 +-
+ .../platform/graphics/efl/GraphicsContext3DEfl.cpp | 2 +-
+ .../graphics/opengl/Extensions3DOpenGLCommon.cpp | 4 +-
+ .../platform/graphics/qt/GraphicsContext3DQt.cpp | 2 +-
+ 6 files changed, 33 insertions(+), 120 deletions(-)
+
+diff --git a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp
+index 9876c9f..84d3a2f 100644
+--- a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp
++++ b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp
+@@ -32,98 +32,25 @@
+
+ namespace WebCore {
+
+-// Temporary typedef to support an incompatible change in the ANGLE API.
+-#if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108
+-typedef int ANGLEGetInfoType;
+-#else
+-typedef size_t ANGLEGetInfoType;
+-#endif
+-
+-inline static ANGLEGetInfoType getValidationResultValue(const ShHandle compiler, ShShaderInfo shaderInfo)
+-{
+- ANGLEGetInfoType value = 0;
+- ShGetInfo(compiler, shaderInfo, &value);
+- return value;
+-}
+-
+-static bool getSymbolInfo(ShHandle compiler, ShShaderInfo symbolType, Vector<ANGLEShaderSymbol>& symbols)
+-{
+- ShShaderInfo symbolMaxNameLengthType;
+-
+- switch (symbolType) {
+- case SH_ACTIVE_ATTRIBUTES:
+- symbolMaxNameLengthType = SH_ACTIVE_ATTRIBUTE_MAX_LENGTH;
+- break;
+- case SH_ACTIVE_UNIFORMS:
+- symbolMaxNameLengthType = SH_ACTIVE_UNIFORM_MAX_LENGTH;
+- break;
+- default:
+- ASSERT_NOT_REACHED();
++template<typename vectype>
++bool readSymbols(const vectype *vec, Vector<ANGLEShaderSymbol> &symbols) {
++ if(!vec) {
+ return false;
+ }
+-
+- ANGLEGetInfoType numSymbols = getValidationResultValue(compiler, symbolType);
+-
+- ANGLEGetInfoType maxNameLength = getValidationResultValue(compiler, symbolMaxNameLengthType);
+- if (maxNameLength <= 1)
+- return false;
+-
+- ANGLEGetInfoType maxMappedNameLength = getValidationResultValue(compiler, SH_MAPPED_NAME_MAX_LENGTH);
+- if (maxMappedNameLength <= 1)
+- return false;
+-
+- // The maximum allowed symbol name length is 256 characters.
+- Vector<char, 256> nameBuffer(maxNameLength);
+- Vector<char, 256> mappedNameBuffer(maxMappedNameLength);
+-
+- for (ANGLEGetInfoType i = 0; i < numSymbols; ++i) {
++ for(typename vectype::const_iterator i = vec->begin(), end = vec->end(); i != end; ++i) {
+ ANGLEShaderSymbol symbol;
+- ANGLEGetInfoType nameLength = 0;
+- switch (symbolType) {
+- case SH_ACTIVE_ATTRIBUTES:
+- symbol.symbolType = SHADER_SYMBOL_TYPE_ATTRIBUTE;
+- ShGetActiveAttrib(compiler, i, &nameLength, &symbol.size, &symbol.dataType, nameBuffer.data(), mappedNameBuffer.data());
+- break;
+- case SH_ACTIVE_UNIFORMS:
+- symbol.symbolType = SHADER_SYMBOL_TYPE_UNIFORM;
+- ShGetActiveUniform(compiler, i, &nameLength, &symbol.size, &symbol.dataType, nameBuffer.data(), mappedNameBuffer.data());
+- break;
+- default:
+- ASSERT_NOT_REACHED();
+- return false;
+- }
+- if (!nameLength)
+- return false;
+-
+- // The ShGetActive* calls above are guaranteed to produce null-terminated strings for
+- // nameBuffer and mappedNameBuffer. Also, the character set for symbol names
+- // is a subset of Latin-1 as specified by the OpenGL ES Shading Language, Section 3.1 and
+- // WebGL, Section "Characters Outside the GLSL Source Character Set".
+-
+- String name = String(nameBuffer.data());
+- String mappedName = String(mappedNameBuffer.data());
+-
+- // ANGLE returns array names in the format "array[0]".
+- // The only way to know if a symbol is an array is to check if it ends with "[0]".
+- // We can't check the size because regular symbols and arrays of length 1 both have a size of 1.
+- symbol.isArray = name.endsWith("[0]") && mappedName.endsWith("[0]");
+- if (symbol.isArray) {
+- // Add a symbol for the array name without the "[0]" suffix.
+- name.truncate(name.length() - 3);
+- mappedName.truncate(mappedName.length() - 3);
+- }
+-
+- symbol.name = name;
+- symbol.mappedName = mappedName;
++ symbol.name = i->name.data();
++ symbol.mappedName = i->mappedName.data();
++ symbol.isArray = i->isArray();
+ symbols.append(symbol);
+-
+ if (symbol.isArray) {
+ // Add symbols for each array element.
++ symbol.size = i->arraySize;
+ symbol.isArray = false;
+- for (int i = 0; i < symbol.size; i++) {
+- String arrayBrackets = "[" + String::number(i) + "]";
+- symbol.name = name + arrayBrackets;
+- symbol.mappedName = mappedName + arrayBrackets;
++ for (int index = 0; index < symbol.size; index++) {
++ String arrayBrackets = "[" + String::number(index) + "]";
++ symbol.name = i->name.data() + arrayBrackets;
++ symbol.mappedName = i->mappedName.data() + arrayBrackets;
+ symbols.append(symbol);
+ }
+ }
+@@ -163,15 +90,14 @@ void ANGLEWebKitBridge::setResources(ShBuiltInResources resources)
+ {
+ // Resources are (possibly) changing - cleanup compilers if we had them already
+ cleanupCompilers();
+-
+ m_resources = resources;
+ }
+
+ bool ANGLEWebKitBridge::compileShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog, Vector<ANGLEShaderSymbol>& symbols, int extraCompileOptions)
+ {
+ if (!builtCompilers) {
+- m_fragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, m_shaderSpec, m_shaderOutput, &m_resources);
+- m_vertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, m_shaderSpec, m_shaderOutput, &m_resources);
++ m_fragmentCompiler = ShConstructCompiler(GL_FRAGMENT_SHADER, m_shaderSpec, m_shaderOutput, &m_resources);
++ m_vertexCompiler = ShConstructCompiler(GL_VERTEX_SHADER, m_shaderSpec, m_shaderOutput, &m_resources);
+ if (!m_fragmentCompiler || !m_vertexCompiler) {
+ cleanupCompilers();
+ return false;
+@@ -189,31 +115,17 @@ bool ANGLEWebKitBridge::compileShaderSource(const char* shaderSource, ANGLEShade
+
+ const char* const shaderSourceStrings[] = { shaderSource };
+
+- bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, SH_OBJECT_CODE | SH_ATTRIBUTES_UNIFORMS | extraCompileOptions);
++ bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, SH_OBJECT_CODE | SH_VARIABLES | extraCompileOptions);
+ if (!validateSuccess) {
+- int logSize = getValidationResultValue(compiler, SH_INFO_LOG_LENGTH);
+- if (logSize > 1) {
+- OwnArrayPtr<char> logBuffer = adoptArrayPtr(new char[logSize]);
+- if (logBuffer) {
+- ShGetInfoLog(compiler, logBuffer.get());
+- shaderValidationLog = logBuffer.get();
+- }
+- }
++ shaderValidationLog = ShGetInfoLog(compiler).data();
+ return false;
+ }
+
+- int translationLength = getValidationResultValue(compiler, SH_OBJECT_CODE_LENGTH);
+- if (translationLength > 1) {
+- OwnArrayPtr<char> translationBuffer = adoptArrayPtr(new char[translationLength]);
+- if (!translationBuffer)
+- return false;
+- ShGetObjectCode(compiler, translationBuffer.get());
+- translatedShaderSource = translationBuffer.get();
+- }
++ translatedShaderSource = ShGetObjectCode(compiler).data();
+
+- if (!getSymbolInfo(compiler, SH_ACTIVE_ATTRIBUTES, symbols))
++ if (!readSymbols(ShGetAttributes(compiler), symbols))
+ return false;
+- if (!getSymbolInfo(compiler, SH_ACTIVE_UNIFORMS, symbols))
++ if (!readSymbols(ShGetUniforms(compiler), symbols))
+ return false;
+
+ return true;
+diff --git a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h
+index 83c2e00..825c2d0 100644
+--- a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h
++++ b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h
+@@ -35,13 +35,14 @@
+ #include "GLSLANG/ShaderLang.h"
+ #else
+ #include "ShaderLang.h"
++#include "angle_gl.h"
+ #endif
+
+ namespace WebCore {
+
+ enum ANGLEShaderType {
+- SHADER_TYPE_VERTEX = SH_VERTEX_SHADER,
+- SHADER_TYPE_FRAGMENT = SH_FRAGMENT_SHADER,
++ SHADER_TYPE_VERTEX = GL_VERTEX_SHADER,
++ SHADER_TYPE_FRAGMENT = GL_FRAGMENT_SHADER,
+ };
+
+ enum ANGLEShaderSymbolType {
+@@ -53,24 +54,24 @@ struct ANGLEShaderSymbol {
+ ANGLEShaderSymbolType symbolType;
+ String name;
+ String mappedName;
+- ShDataType dataType;
++ sh::GLenum dataType;
+ int size;
+ bool isArray;
+
+ bool isSampler() const
+ {
+ return symbolType == SHADER_SYMBOL_TYPE_UNIFORM
+- && (dataType == SH_SAMPLER_2D
+- || dataType == SH_SAMPLER_CUBE
+- || dataType == SH_SAMPLER_2D_RECT_ARB
+- || dataType == SH_SAMPLER_EXTERNAL_OES);
++ && (dataType == GL_SAMPLER_2D
++ || dataType == GL_SAMPLER_CUBE
++ || dataType == GL_SAMPLER_2D_RECT_ARB
++ || dataType == GL_SAMPLER_EXTERNAL_OES);
+ }
+ };
+
+ class ANGLEWebKitBridge {
+ public:
+
+- ANGLEWebKitBridge(ShShaderOutput = SH_GLSL_OUTPUT, ShShaderSpec = SH_WEBGL_SPEC);
++ ANGLEWebKitBridge(ShShaderOutput = SH_GLSL_COMPATIBILITY_OUTPUT, ShShaderSpec = SH_WEBGL_SPEC);
+ ~ANGLEWebKitBridge();
+
+ ShBuiltInResources getResources() { return m_resources; }
+diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
+index d31adf3..3b99ad9 100644
+--- a/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
++++ b/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
+@@ -80,7 +80,7 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attri
+ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow*, GraphicsContext3D::RenderStyle renderStyle)
+ : m_currentWidth(0)
+ , m_currentHeight(0)
+- , m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT)
++ , m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_COMPATIBILITY_OUTPUT)
+ , m_attrs(attributes)
+ , m_texture(0)
+ , m_fbo(0)
+diff --git a/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp b/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp
+index ea25e43..a28c55f 100644
+--- a/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp
++++ b/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp
+@@ -41,7 +41,7 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attri
+ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+ : m_currentWidth(0)
+ , m_currentHeight(0)
+- , m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT)
++ , m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_COMPATIBILITY_OUTPUT)
+ , m_attrs(attrs)
+ , m_renderStyle(renderStyle)
+ , m_texture(0)
+diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
+index 29a13c8..11f88f1 100644
+--- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
++++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
+@@ -172,10 +172,10 @@ String Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE(Platform3DObject
+
+ String translatedShaderSource;
+ String shaderInfoLog;
+- int extraCompileOptions = SH_MAP_LONG_VARIABLE_NAMES | SH_CLAMP_INDIRECT_ARRAY_BOUNDS;
++ int extraCompileOptions = SH_CLAMP_INDIRECT_ARRAY_BOUNDS;
+
+ if (m_requiresBuiltInFunctionEmulation)
+- extraCompileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
++ extraCompileOptions |= SH_EMULATE_ABS_INT_FUNCTION;
+
+ Vector<ANGLEShaderSymbol> symbols;
+ bool isValid = compiler.compileShaderSource(entry.source.utf8().data(), shaderType, translatedShaderSource, shaderInfoLog, symbols, extraCompileOptions);
+diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+index 43b546d..73b61e2 100644
+--- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
++++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+@@ -428,7 +428,7 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi
+ , m_multisampleColorBuffer(0)
+ , m_functions(0)
+ , m_private(adoptPtr(new GraphicsContext3DPrivate(this, hostWindow, renderStyle)))
+- , m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT)
++ , m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_COMPATIBILITY_OUTPUT)
+ {
+ if (!m_private->m_surface || !m_private->m_platformContext) {
+ LOG_ERROR("GraphicsContext3D: GL context creation failed.");
+--
+2.10.2
+