Diff
Modified: trunk/LayoutTests/ChangeLog (161842 => 161843)
--- trunk/LayoutTests/ChangeLog 2014-01-13 00:57:43 UTC (rev 161842)
+++ trunk/LayoutTests/ChangeLog 2014-01-13 01:26:11 UTC (rev 161843)
@@ -1,3 +1,14 @@
+2014-01-12 Brent Fulgham <[email protected]>
+
+ [WebGL] Error messages should use source code labels, not internal mangled symbols.
+ https://bugs.webkit.org/show_bug.cgi?id=126832
+
+ Reviewed by Dean Jackson.
+
+ * fast/canvas/webgl/glsl-conformance.html: Add log to program output
+ showing error message to confirm proper labels are being used.
+ * fast/canvas/webgl/glsl-conformance-expected.txt: updated.
+
2014-01-12 Benjamin Poulain <[email protected]>
Use the Selector Code Generator for matching in SelectorQuery
Modified: trunk/LayoutTests/fast/canvas/webgl/glsl-conformance-expected.txt (161842 => 161843)
--- trunk/LayoutTests/fast/canvas/webgl/glsl-conformance-expected.txt 2014-01-13 00:57:43 UTC (rev 161842)
+++ trunk/LayoutTests/fast/canvas/webgl/glsl-conformance-expected.txt 2014-01-13 01:26:11 UTC (rev 161843)
@@ -28,6 +28,9 @@
PASS [vshaderWithVersion130/fshader]: vertex shader uses the #version not 100 directive should fail
PASS [vshaderWithVersion120/fshader]: vertex shader uses the #version not 100 directive should fail
PASS [vshaderWithVersion100/fshader]: vertex shader uses the #version 100 directive should succeed
+Program link log:ERROR: Input of fragment shader 'v_varying' not written by vertex shader
+
+PASS [vshaderWithVersion100/fragmentShaderUsedVarying]: vertex shader with no varying and fragment shader with used varying must fail
PASS [shaders/implicit/add_int_float.vert/fshader]: implicit cast adding integer to float should fail
PASS [shaders/implicit/add_int_mat2.vert/fshader]: implicit cast adding integer to mat2 should fail
PASS [shaders/implicit/add_int_mat3.vert/fshader]: implicit cast adding integer to mat3 should fail
Modified: trunk/LayoutTests/fast/canvas/webgl/glsl-conformance.html (161842 => 161843)
--- trunk/LayoutTests/fast/canvas/webgl/glsl-conformance.html 2014-01-13 00:57:43 UTC (rev 161842)
+++ trunk/LayoutTests/fast/canvas/webgl/glsl-conformance.html 2014-01-13 01:26:11 UTC (rev 161843)
@@ -211,6 +211,16 @@
gl_Position = vPosition;
}
</script>
+<script id="fragmentShaderUsedVarying" type="text/something-not-_javascript_">
+precision mediump float;
+
+varying vec4 v_varying;
+
+void main()
+{
+ gl_FragColor = v_varying;
+}
+</script>
<script id="vshaderWith__FILE__" type="text/something-not-_javascript_">
__FILE__
</script>
@@ -403,6 +413,13 @@
linkSuccess: true,
passMsg: 'vertex shader uses the #version 100 directive should succeed',
},
+ { vShaderId: 'vshaderWithVersion100',
+ vShaderSuccess: true,
+ fShaderId: 'fragmentShaderUsedVarying',
+ fShaderSuccess: true,
+ linkSuccess: false,
+ passMsg: 'vertex shader with no varying and fragment shader with used varying must fail',
+ },
];
// Read in all the shader source.
@@ -498,13 +515,17 @@
gl.linkProgram(program);
var linked = (gl.getProgramParameter(program, gl.LINK_STATUS) != 0);
if (!linked) {
- var error = gl.getProgramInfoLog(shader);
+ var error = gl.getProgramInfoLog(program);
log("*** Error linking program '"+program+"':"+error);
}
if (linked != info.linkSuccess) {
testFailed(passMsg);
continue;
}
+ if (!info.linkSuccess) {
+ var error = gl.getProgramInfoLog(program);
+ debug("Program link log:" + error);
+ }
} else {
if (info.linkSuccess) {
testFailed(passMsg);
Modified: trunk/Source/WebCore/ChangeLog (161842 => 161843)
--- trunk/Source/WebCore/ChangeLog 2014-01-13 00:57:43 UTC (rev 161842)
+++ trunk/Source/WebCore/ChangeLog 2014-01-13 01:26:11 UTC (rev 161843)
@@ -1,3 +1,24 @@
+2014-01-12 Brent Fulgham <[email protected]>
+
+ [WebGL] Error messages should use source code labels, not internal mangled symbols.
+ https://bugs.webkit.org/show_bug.cgi?id=126832
+
+ Reviewed by Dean Jackson.
+
+ Revised fast/canvas/webgl/glsl-conformance.html.
+
+ * platform/graphics/ANGLEWebKitBridge.cpp:
+ (WebCore::getSymbolInfo): Correct missing 'break'.
+ (WebCore::ANGLEWebKitBridge::compileShaderSource): Call 'getSymbolInfo'
+ for SH_VARYINGS.
+ * platform/graphics/GraphicsContext3D.h: Add new declarations.
+ * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+ (WebCore::GraphicsContext3D::compileShader): Demangle log output.
+ (WebCore::GraphicsContext3D::mappedSymbolName): Added.
+ (WebCore::GraphicsContext3D::getUnmangledInfoLog): Added.
+ (WebCore::GraphicsContext3D::getProgramInfoLog): Demangle log output.
+ (WebCore::GraphicsContext3D::getShaderInfoLog): Demangle log output.
+
2014-01-12 Dan Bernstein <[email protected]>
Try to fix the Windows build after r161839.
Modified: trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp (161842 => 161843)
--- trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp 2014-01-13 00:57:43 UTC (rev 161842)
+++ trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp 2014-01-13 01:26:11 UTC (rev 161843)
@@ -60,6 +60,7 @@
break;
case SH_VARYINGS:
symbolMaxNameLengthType = SH_VARYING_MAX_LENGTH;
+ break;
default:
ASSERT_NOT_REACHED();
return false;
@@ -227,6 +228,8 @@
return false;
if (!getSymbolInfo(compiler, SH_ACTIVE_UNIFORMS, symbols))
return false;
+ if (!getSymbolInfo(compiler, SH_VARYINGS, symbols))
+ return false;
return true;
}
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (161842 => 161843)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2014-01-13 00:57:43 UTC (rev 161842)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2014-01-13 01:26:11 UTC (rev 161843)
@@ -739,6 +739,7 @@
void getProgramiv(Platform3DObject program, GC3Denum pname, GC3Dint* value);
void getNonBuiltInActiveSymbolCount(Platform3DObject program, GC3Denum pname, GC3Dint* value);
String getProgramInfoLog(Platform3DObject);
+ String getUnmangledInfoLog(Platform3DObject[2], GC3Dsizei, const String&);
void getRenderbufferParameteriv(GC3Denum target, GC3Denum pname, GC3Dint* value);
void getShaderiv(Platform3DObject, GC3Denum pname, GC3Dint* value);
String getShaderInfoLog(Platform3DObject);
@@ -1084,6 +1085,7 @@
std::unique_ptr<ActiveShaderSymbolCounts> m_shaderSymbolCount;
String mappedSymbolName(Platform3DObject program, ANGLEShaderSymbolType, const String& name);
+ String mappedSymbolName(Platform3DObject shaders[2], size_t count, const String& name);
String originalSymbolName(Platform3DObject program, ANGLEShaderSymbolType, const String& name);
ANGLEWebKitBridge m_compiler;
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (161842 => 161843)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2014-01-13 00:57:43 UTC (rev 161842)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2014-01-13 01:26:11 UTC (rev 161843)
@@ -47,6 +47,7 @@
#include "IntSize.h"
#include "Logging.h"
#include "NotImplemented.h"
+#include "RegularExpression.h"
#include "TemporaryOpenGLSetting.h"
#include <cstring>
#include <runtime/ArrayBuffer.h>
@@ -546,7 +547,8 @@
auto info = std::make_unique<GLchar[]>(length);
::glGetShaderInfoLog(shader, length, &size, info.get());
- entry.log = info.get();
+ Platform3DObject shaders[2] = { shader, 0 };
+ entry.log = getUnmangledInfoLog(shaders, 1, String(info.get()));
}
if (GLCompileSuccess != GL_TRUE) {
@@ -806,6 +808,24 @@
return name;
}
+String GraphicsContext3D::mappedSymbolName(Platform3DObject shaders[2], size_t count, const String& name)
+{
+ for (size_t symbolType = 0; symbolType <= static_cast<size_t>(SHADER_SYMBOL_TYPE_VARYING); ++symbolType) {
+ for (size_t i = 0; i < count; ++i) {
+ ShaderSourceMap::iterator result = m_shaderSourceMap.find(shaders[i]);
+ if (result == m_shaderSourceMap.end())
+ continue;
+
+ const ShaderSymbolMap& symbolMap = result->value.symbolMap(static_cast<enum ANGLEShaderSymbolType>(symbolType));
+ for (const auto& symbolEntry : symbolMap) {
+ if (symbolEntry.value.mappedName == name)
+ return symbolEntry.key;
+ }
+ }
+ }
+ return name;
+}
+
int GraphicsContext3D::getAttribLocation(Platform3DObject program, const String& name)
{
if (!program)
@@ -1278,6 +1298,36 @@
*value = m_shaderSymbolCount->countForType(pname);
}
+String GraphicsContext3D::getUnmangledInfoLog(Platform3DObject shaders[2], GC3Dsizei count, const String& log)
+{
+ LOG(WebGL, "Was: %s", log.utf8().data());
+
+ RegularExpression regExp("webgl_[0123456789abcdefABCDEF]+", TextCaseSensitive);
+
+ String processedLog;
+
+ int startFrom = 0;
+ int matchedLength = 0;
+ do {
+ int start = regExp.match(log, startFrom, &matchedLength);
+ if (start == -1)
+ break;
+
+ processedLog.append(log.substring(startFrom, start - startFrom));
+ startFrom = start + matchedLength;
+
+ const String& mangledSymbol = log.substring(start, matchedLength);
+ const String& mappedSymbol = mappedSymbolName(shaders, count, mangledSymbol);
+ LOG(WebGL, "Demangling: %s to %s", mangledSymbol.utf8().data(), mappedSymbol.utf8().data());
+ processedLog.append(mappedSymbol);
+ } while (startFrom < static_cast<int>(log.length()));
+
+ processedLog.append(log.substring(startFrom, log.length() - startFrom));
+
+ LOG(WebGL, "-->: %s", processedLog.utf8().data());
+ return processedLog;
+}
+
String GraphicsContext3D::getProgramInfoLog(Platform3DObject program)
{
ASSERT(program);
@@ -1292,7 +1342,11 @@
auto info = std::make_unique<GLchar[]>(length);
::glGetProgramInfoLog(program, length, &size, info.get());
- return String(info.get());
+ GC3Dsizei count;
+ Platform3DObject shaders[2];
+ getAttachedShaders(program, 2, &count, shaders);
+
+ return getUnmangledInfoLog(shaders, count, String(info.get()));
}
void GraphicsContext3D::getRenderbufferParameteriv(GC3Denum target, GC3Denum pname, GC3Dint* value)
@@ -1359,7 +1413,8 @@
auto info = std::make_unique<GLchar[]>(length);
::glGetShaderInfoLog(shader, length, &size, info.get());
- return String(info.get());
+ Platform3DObject shaders[2] = { shader, 0 };
+ return getUnmangledInfoLog(shaders, 1, String(info.get()));
}
String GraphicsContext3D::getShaderSource(Platform3DObject shader)