2016-03-10 19:44:30 +01:00
|
|
|
--- qtwebkit-opensource-src-5.5.1/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h.orig 2015-10-13 06:37:18.000000000 +0200
|
|
|
|
+++ qtwebkit-opensource-src-5.5.1/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h 2016-03-09 17:17:26.000000000 +0100
|
2016-02-04 00:33:39 +01:00
|
|
|
@@ -35,13 +35,14 @@
|
2016-02-03 20:42:14 +01:00
|
|
|
#include "GLSLANG/ShaderLang.h"
|
|
|
|
#else
|
2016-02-04 00:33:39 +01:00
|
|
|
#include "ShaderLang.h"
|
2016-02-03 20:42:14 +01:00
|
|
|
+#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,17 +54,17 @@
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-03-10 19:44:30 +01:00
|
|
|
--- qtwebkit-opensource-src-5.5.1/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp.orig 2015-10-13 06:37:17.000000000 +0200
|
|
|
|
+++ qtwebkit-opensource-src-5.5.1/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp 2016-03-09 20:45:20.000000000 +0100
|
|
|
|
@@ -32,98 +32,25 @@
|
2016-02-03 20:42:14 +01:00
|
|
|
|
2016-03-10 19:44:30 +01:00
|
|
|
namespace WebCore {
|
2016-02-03 20:42:14 +01:00
|
|
|
|
2016-03-10 19:44:30 +01:00
|
|
|
-// 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) {
|
2016-02-03 20:42:14 +01:00
|
|
|
- case SH_ACTIVE_ATTRIBUTES:
|
|
|
|
- symbolMaxNameLengthType = SH_ACTIVE_ATTRIBUTE_MAX_LENGTH;
|
2016-03-10 19:44:30 +01:00
|
|
|
- break;
|
2016-02-03 20:42:14 +01:00
|
|
|
- case SH_ACTIVE_UNIFORMS:
|
|
|
|
- symbolMaxNameLengthType = SH_ACTIVE_UNIFORM_MAX_LENGTH;
|
2016-03-10 19:44:30 +01:00
|
|
|
- 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) {
|
2016-02-03 20:42:14 +01:00
|
|
|
ANGLEShaderSymbol symbol;
|
2016-03-10 19:44:30 +01:00
|
|
|
- ANGLEGetInfoType nameLength = 0;
|
|
|
|
- switch (symbolType) {
|
2016-02-03 20:42:14 +01:00
|
|
|
- case SH_ACTIVE_ATTRIBUTES:
|
2016-03-10 19:44:30 +01:00
|
|
|
- symbol.symbolType = SHADER_SYMBOL_TYPE_ATTRIBUTE;
|
2016-02-03 20:42:14 +01:00
|
|
|
- ShGetActiveAttrib(compiler, i, &nameLength, &symbol.size, &symbol.dataType, nameBuffer.data(), mappedNameBuffer.data());
|
2016-03-10 19:44:30 +01:00
|
|
|
- break;
|
2016-02-03 20:42:14 +01:00
|
|
|
- case SH_ACTIVE_UNIFORMS:
|
2016-03-10 19:44:30 +01:00
|
|
|
- symbol.symbolType = SHADER_SYMBOL_TYPE_UNIFORM;
|
2016-02-03 20:42:14 +01:00
|
|
|
- ShGetActiveUniform(compiler, i, &nameLength, &symbol.size, &symbol.dataType, nameBuffer.data(), mappedNameBuffer.data());
|
2016-03-10 19:44:30 +01:00
|
|
|
- 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 @@
|
|
|
|
{
|
|
|
|
// Resources are (possibly) changing - cleanup compilers if we had them already
|
|
|
|
cleanupCompilers();
|
|
|
|
-
|
|
|
|
m_resources = resources;
|
|
|
|
}
|
|
|
|
|
2016-02-03 20:42:14 +01:00
|
|
|
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;
|
2016-03-10 19:44:30 +01:00
|
|
|
@@ -189,31 +115,17 @@
|
2016-02-03 20:42:14 +01:00
|
|
|
|
|
|
|
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) {
|
2016-03-10 19:44:30 +01:00
|
|
|
- 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;
|
2016-02-03 20:42:14 +01:00
|
|
|
}
|
2016-03-10 19:44:30 +01:00
|
|
|
|
|
|
|
- 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();
|
2016-02-03 20:42:14 +01:00
|
|
|
|
|
|
|
- if (!getSymbolInfo(compiler, SH_ACTIVE_ATTRIBUTES, symbols))
|
2016-03-10 19:44:30 +01:00
|
|
|
+ if (!readSymbols(ShGetAttributes(compiler), symbols))
|
2016-02-03 20:42:14 +01:00
|
|
|
return false;
|
|
|
|
- if (!getSymbolInfo(compiler, SH_ACTIVE_UNIFORMS, symbols))
|
2016-03-10 19:44:30 +01:00
|
|
|
+ if (!readSymbols(ShGetUniforms(compiler), symbols))
|
2016-02-03 20:42:14 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2016-03-10 19:44:30 +01:00
|
|
|
--- qtwebkit-opensource-src-5.5.1/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp.orig 2015-10-13 06:37:17.000000000 +0200
|
|
|
|
+++ qtwebkit-opensource-src-5.5.1/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp 2016-03-09 17:17:26.000000000 +0100
|
2016-02-03 20:42:14 +01:00
|
|
|
@@ -172,7 +172,7 @@
|
|
|
|
|
|
|
|
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;
|