<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162317] releases/WebKitGTK/webkit-2.2/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162317">162317</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-20 01:57:50 -0800 (Mon, 20 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/160223">r160223</a> - Hook into some shader symbol logic following the ANGLE update in <a href="http://trac.webkit.org/projects/webkit/changeset/159533">r159533</a>.
https://bugs.webkit.org/show_bug.cgi?id=125332.

Reviewed by Brent Fulgham.

No new functionality added.

* html/canvas/WebGLRenderingContext.cpp: Add some error checking for errors related to
    shader symbols that exist across both vertex and fragment shaders.
(WebCore::WebGLRenderingContext::linkProgram):
* platform/graphics/ANGLEWebKitBridge.cpp: Add logic for handling varyings
    and add new fields to the ANGLEShaderSymbol struct.
(WebCore::getSymbolInfo):
* platform/graphics/ANGLEWebKitBridge.h:
* platform/graphics/GraphicsContext3D.h: Add those same fields to the SymbolInfo struct
    as well so that we can access them from our shader source map.
    Also add a map of varyings along side the uniforms and attributes.
(WebCore::GraphicsContext3D::SymbolInfo::SymbolInfo):
(WebCore::GraphicsContext3D::ShaderSourceEntry::symbolMap):
* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
(WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::areProgramSymbolsValid): Will be filled in later, this method
    will use the shader source map to check for issues with unused varyings and precisions
    mismatches of shader symbols that exist across both the vertex and fragment shaders.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCorehtmlcanvasWebGLRenderingContextcpp">releases/WebKitGTK/webkit-2.2/Source/WebCore/html/canvas/WebGLRenderingContext.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCoreplatformgraphicsANGLEWebKitBridgecpp">releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCoreplatformgraphicsANGLEWebKitBridgeh">releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h</a></li>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCoreplatformgraphicsGraphicsContext3Dh">releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/GraphicsContext3D.h</a></li>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCoreplatformgraphicsopenglExtensions3DOpenGLCommoncpp">releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit22SourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLCommoncpp">releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit22SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog (162316 => 162317)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog        2014-01-20 09:53:20 UTC (rev 162316)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog        2014-01-20 09:57:50 UTC (rev 162317)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2013-12-06  Roger Fong  &lt;roger_fong@apple.com&gt;
+
+        Hook into some shader symbol logic following the ANGLE update in r159533.
+        https://bugs.webkit.org/show_bug.cgi?id=125332.
+
+        Reviewed by Brent Fulgham.
+
+        No new functionality added.
+
+        * html/canvas/WebGLRenderingContext.cpp: Add some error checking for errors related to 
+            shader symbols that exist across both vertex and fragment shaders.
+        (WebCore::WebGLRenderingContext::linkProgram):
+        * platform/graphics/ANGLEWebKitBridge.cpp: Add logic for handling varyings 
+            and add new fields to the ANGLEShaderSymbol struct.
+        (WebCore::getSymbolInfo):
+        * platform/graphics/ANGLEWebKitBridge.h:
+        * platform/graphics/GraphicsContext3D.h: Add those same fields to the SymbolInfo struct 
+            as well so that we can access them from our shader source map.
+            Also add a map of varyings along side the uniforms and attributes.
+        (WebCore::GraphicsContext3D::SymbolInfo::SymbolInfo):
+        (WebCore::GraphicsContext3D::ShaderSourceEntry::symbolMap):
+        * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
+        (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::areProgramSymbolsValid): Will be filled in later, this method 
+            will use the shader source map to check for issues with unused varyings and precisions 
+            mismatches of shader symbols that exist across both the vertex and fragment shaders.
+
</ins><span class="cx"> 2013-10-04  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WebGL] program should not be able to link if a bad shader is attached
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit22SourceWebCorehtmlcanvasWebGLRenderingContextcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (162316 => 162317)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2014-01-20 09:53:20 UTC (rev 162316)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2014-01-20 09:57:50 UTC (rev 162317)
</span><span class="lines">@@ -3325,7 +3325,7 @@
</span><span class="cx">     if (!isGLES2Compliant()) {
</span><span class="cx">         WebGLShader* vertexShader = program-&gt;getAttachedShader(GraphicsContext3D::VERTEX_SHADER);
</span><span class="cx">         WebGLShader* fragmentShader = program-&gt;getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER);
</span><del>-        if (!vertexShader || !vertexShader-&gt;isValid() || !fragmentShader || !fragmentShader-&gt;isValid()) {
</del><ins>+        if (!vertexShader || !vertexShader-&gt;isValid() || !fragmentShader || !fragmentShader-&gt;isValid() || !m_context-&gt;areProgramSymbolsValid(objectOrZero(vertexShader), objectOrZero(fragmentShader))) {
</ins><span class="cx">             program-&gt;setLinkStatus(false);
</span><span class="cx">             return;
</span><span class="cx">         }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit22SourceWebCoreplatformgraphicsANGLEWebKitBridgecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp (162316 => 162317)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp        2014-01-20 09:53:20 UTC (rev 162316)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp        2014-01-20 09:57:50 UTC (rev 162317)
</span><span class="lines">@@ -57,6 +57,8 @@
</span><span class="cx">     case SH_ACTIVE_UNIFORMS:
</span><span class="cx">         symbolMaxNameLengthType = SH_ACTIVE_UNIFORM_MAX_LENGTH;
</span><span class="cx">         break;
</span><ins>+    case SH_VARYINGS:
+        symbolMaxNameLengthType = SH_VARYING_MAX_LENGTH;
</ins><span class="cx">     default:
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx">         return false;
</span><span class="lines">@@ -90,6 +92,10 @@
</span><span class="cx">             symbol.symbolType = SHADER_SYMBOL_TYPE_UNIFORM;
</span><span class="cx">             ShGetVariableInfo(compiler, symbolType, i, &amp;nameLength, &amp;symbol.size, &amp;symbol.dataType, &amp;precision, &amp;staticUse, nameBuffer.data(), mappedNameBuffer.data());
</span><span class="cx">             break;
</span><ins>+        case SH_VARYINGS:
+            symbol.symbolType = SHADER_SYMBOL_TYPE_VARYING;
+            ShGetVariableInfo(compiler, symbolType, i, &amp;nameLength, &amp;symbol.size, &amp;symbol.dataType, &amp;precision, &amp;staticUse, nameBuffer.data(), mappedNameBuffer.data());
+            break;
</ins><span class="cx">         default:
</span><span class="cx">             ASSERT_NOT_REACHED();
</span><span class="cx">             return false;
</span><span class="lines">@@ -117,6 +123,8 @@
</span><span class="cx"> 
</span><span class="cx">         symbol.name = name;
</span><span class="cx">         symbol.mappedName = mappedName;
</span><ins>+        symbol.precision = precision;
+        symbol.staticUse = staticUse;
</ins><span class="cx">         symbols.append(symbol);
</span><span class="cx">     
</span><span class="cx">         if (symbol.isArray) {
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit22SourceWebCoreplatformgraphicsANGLEWebKitBridgeh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h (162316 => 162317)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h        2014-01-20 09:53:20 UTC (rev 162316)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h        2014-01-20 09:57:50 UTC (rev 162317)
</span><span class="lines">@@ -46,7 +46,8 @@
</span><span class="cx"> 
</span><span class="cx"> enum ANGLEShaderSymbolType {
</span><span class="cx">     SHADER_SYMBOL_TYPE_ATTRIBUTE,
</span><del>-    SHADER_SYMBOL_TYPE_UNIFORM
</del><ins>+    SHADER_SYMBOL_TYPE_UNIFORM,
+    SHADER_SYMBOL_TYPE_VARYING
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct ANGLEShaderSymbol {
</span><span class="lines">@@ -56,6 +57,8 @@
</span><span class="cx">     ShDataType dataType;
</span><span class="cx">     int size;
</span><span class="cx">     bool isArray;
</span><ins>+    ShPrecisionType precision;
+    int staticUse;
</ins><span class="cx"> 
</span><span class="cx">     bool isSampler() const
</span><span class="cx">     {
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit22SourceWebCoreplatformgraphicsGraphicsContext3Dh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/GraphicsContext3D.h (162316 => 162317)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/GraphicsContext3D.h        2014-01-20 09:53:20 UTC (rev 162316)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/GraphicsContext3D.h        2014-01-20 09:57:50 UTC (rev 162317)
</span><span class="lines">@@ -758,6 +758,7 @@
</span><span class="cx"> 
</span><span class="cx">     void useProgram(Platform3DObject);
</span><span class="cx">     void validateProgram(Platform3DObject);
</span><ins>+    bool areProgramSymbolsValid(Platform3DObject vertexShader, Platform3DObject fragmentShader) const;
</ins><span class="cx"> 
</span><span class="cx">     void vertexAttrib1f(GC3Duint index, GC3Dfloat x);
</span><span class="cx">     void vertexAttrib1fv(GC3Duint index, GC3Dfloat* values);
</span><span class="lines">@@ -968,13 +969,17 @@
</span><span class="cx">         SymbolInfo()
</span><span class="cx">             : type(0)
</span><span class="cx">             , size(0)
</span><ins>+            , precision(SH_PRECISION_UNDEFINED)
+            , staticUse(0)
</ins><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        SymbolInfo(GC3Denum type, int size, const String&amp; mappedName)
</del><ins>+        SymbolInfo(GC3Denum type, int size, const String&amp; mappedName, ShPrecisionType precision, int staticUse)
</ins><span class="cx">             : type(type)
</span><span class="cx">             , size(size)
</span><span class="cx">             , mappedName(mappedName)
</span><ins>+            , precision(precision)
+            , staticUse(staticUse)
</ins><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -986,6 +991,8 @@
</span><span class="cx">         GC3Denum type;
</span><span class="cx">         int size;
</span><span class="cx">         String mappedName;
</span><ins>+        ShPrecisionType precision;
+        int staticUse;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     typedef HashMap&lt;String, SymbolInfo&gt; ShaderSymbolMap;
</span><span class="lines">@@ -998,6 +1005,7 @@
</span><span class="cx">         bool isValid;
</span><span class="cx">         ShaderSymbolMap attributeMap;
</span><span class="cx">         ShaderSymbolMap uniformMap;
</span><ins>+        ShaderSymbolMap varyingMap;
</ins><span class="cx">         ShaderSourceEntry()
</span><span class="cx">             : type(VERTEX_SHADER)
</span><span class="cx">             , isValid(false)
</span><span class="lines">@@ -1006,9 +1014,11 @@
</span><span class="cx">         
</span><span class="cx">         ShaderSymbolMap&amp; symbolMap(enum ANGLEShaderSymbolType symbolType)
</span><span class="cx">         {
</span><del>-            ASSERT(symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE || symbolType == SHADER_SYMBOL_TYPE_UNIFORM);
</del><ins>+            ASSERT(symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE || symbolType == SHADER_SYMBOL_TYPE_UNIFORM || symbolType == SHADER_SYMBOL_TYPE_VARYING);
</ins><span class="cx">             if (symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE)
</span><span class="cx">                 return attributeMap;
</span><ins>+            if (symbolType == SHADER_SYMBOL_TYPE_VARYING)
+                return varyingMap;
</ins><span class="cx">             return uniformMap;
</span><span class="cx">         }
</span><span class="cx">     };
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit22SourceWebCoreplatformgraphicsopenglExtensions3DOpenGLCommoncpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp (162316 => 162317)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp        2014-01-20 09:53:20 UTC (rev 162316)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp        2014-01-20 09:57:50 UTC (rev 162317)
</span><span class="lines">@@ -184,7 +184,7 @@
</span><span class="cx">     size_t numSymbols = symbols.size();
</span><span class="cx">     for (size_t i = 0; i &lt; numSymbols; ++i) {
</span><span class="cx">         ANGLEShaderSymbol shaderSymbol = symbols[i];
</span><del>-        GraphicsContext3D::SymbolInfo symbolInfo(shaderSymbol.dataType, shaderSymbol.size, shaderSymbol.mappedName);
</del><ins>+        GraphicsContext3D::SymbolInfo symbolInfo(shaderSymbol.dataType, shaderSymbol.size, shaderSymbol.mappedName, shaderSymbol.precision, shaderSymbol.staticUse);
</ins><span class="cx">         entry.symbolMap(shaderSymbol.symbolType).set(shaderSymbol.name, symbolInfo);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit22SourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLCommoncpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (162316 => 162317)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp        2014-01-20 09:53:20 UTC (rev 162316)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp        2014-01-20 09:57:50 UTC (rev 162317)
</span><span class="lines">@@ -290,6 +290,14 @@
</span><span class="cx">     ::glFlush();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool GraphicsContext3D::areProgramSymbolsValid(Platform3DObject vertexShader, Platform3DObject fragmentShader) const
+{
+    UNUSED_PARAM(vertexShader);
+    UNUSED_PARAM(fragmentShader);
+    // TODO: Fill me in.
+    return true;
+}
+
</ins><span class="cx"> IntSize GraphicsContext3D::getInternalFramebufferSize() const
</span><span class="cx"> {
</span><span class="cx">     return IntSize(m_currentWidth, m_currentHeight);
</span></span></pre>
</div>
</div>

</body>
</html>