Title: [160223] trunk/Source/WebCore
Revision
160223
Author
[email protected]
Date
2013-12-06 09:28:44 -0800 (Fri, 06 Dec 2013)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160222 => 160223)


--- trunk/Source/WebCore/ChangeLog	2013-12-06 17:18:32 UTC (rev 160222)
+++ trunk/Source/WebCore/ChangeLog	2013-12-06 17:28:44 UTC (rev 160223)
@@ -1,3 +1,31 @@
+2013-12-06  Roger Fong  <[email protected]>
+
+        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.
+
 2013-12-06  Lukasz Gajowy  <[email protected]>
 
         [ATK] Missing aria roles mappings

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (160222 => 160223)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2013-12-06 17:18:32 UTC (rev 160222)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2013-12-06 17:28:44 UTC (rev 160223)
@@ -3349,7 +3349,7 @@
     if (!isGLES2Compliant()) {
         WebGLShader* vertexShader = program->getAttachedShader(GraphicsContext3D::VERTEX_SHADER);
         WebGLShader* fragmentShader = program->getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER);
-        if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid()) {
+        if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid() || !m_context->areProgramSymbolsValid(objectOrZero(vertexShader), objectOrZero(fragmentShader))) {
             program->setLinkStatus(false);
             return;
         }

Modified: trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp (160222 => 160223)


--- trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp	2013-12-06 17:18:32 UTC (rev 160222)
+++ trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp	2013-12-06 17:28:44 UTC (rev 160223)
@@ -58,6 +58,8 @@
     case SH_ACTIVE_UNIFORMS:
         symbolMaxNameLengthType = SH_ACTIVE_UNIFORM_MAX_LENGTH;
         break;
+    case SH_VARYINGS:
+        symbolMaxNameLengthType = SH_VARYING_MAX_LENGTH;
     default:
         ASSERT_NOT_REACHED();
         return false;
@@ -91,6 +93,10 @@
             symbol.symbolType = SHADER_SYMBOL_TYPE_UNIFORM;
             ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &precision, &staticUse, nameBuffer.data(), mappedNameBuffer.data());
             break;
+        case SH_VARYINGS:
+            symbol.symbolType = SHADER_SYMBOL_TYPE_VARYING;
+            ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &precision, &staticUse, nameBuffer.data(), mappedNameBuffer.data());
+            break;
         default:
             ASSERT_NOT_REACHED();
             return false;
@@ -119,6 +125,8 @@
 
         symbol.name = name;
         symbol.mappedName = mappedName;
+        symbol.precision = precision;
+        symbol.staticUse = staticUse;
         symbols.append(symbol);
     
         if (symbol.isArray) {

Modified: trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h (160222 => 160223)


--- trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h	2013-12-06 17:18:32 UTC (rev 160222)
+++ trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h	2013-12-06 17:28:44 UTC (rev 160223)
@@ -46,7 +46,8 @@
 
 enum ANGLEShaderSymbolType {
     SHADER_SYMBOL_TYPE_ATTRIBUTE,
-    SHADER_SYMBOL_TYPE_UNIFORM
+    SHADER_SYMBOL_TYPE_UNIFORM,
+    SHADER_SYMBOL_TYPE_VARYING
 };
 
 struct ANGLEShaderSymbol {
@@ -56,6 +57,8 @@
     ShDataType dataType;
     int size;
     bool isArray;
+    ShPrecisionType precision;
+    int staticUse;
 
     bool isSampler() const
     {

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (160222 => 160223)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2013-12-06 17:18:32 UTC (rev 160222)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2013-12-06 17:28:44 UTC (rev 160223)
@@ -758,6 +758,7 @@
 
     void useProgram(Platform3DObject);
     void validateProgram(Platform3DObject);
+    bool areProgramSymbolsValid(Platform3DObject vertexShader, Platform3DObject fragmentShader) const;
 
     void vertexAttrib1f(GC3Duint index, GC3Dfloat x);
     void vertexAttrib1fv(GC3Duint index, GC3Dfloat* values);
@@ -963,13 +964,17 @@
         SymbolInfo()
             : type(0)
             , size(0)
+            , precision(SH_PRECISION_UNDEFINED)
+            , staticUse(0)
         {
         }
 
-        SymbolInfo(GC3Denum type, int size, const String& mappedName)
+        SymbolInfo(GC3Denum type, int size, const String& mappedName, ShPrecisionType precision, int staticUse)
             : type(type)
             , size(size)
             , mappedName(mappedName)
+            , precision(precision)
+            , staticUse(staticUse)
         {
         }
 
@@ -981,6 +986,8 @@
         GC3Denum type;
         int size;
         String mappedName;
+        ShPrecisionType precision;
+        int staticUse;
     };
 
     typedef HashMap<String, SymbolInfo> ShaderSymbolMap;
@@ -993,6 +1000,7 @@
         bool isValid;
         ShaderSymbolMap attributeMap;
         ShaderSymbolMap uniformMap;
+        ShaderSymbolMap varyingMap;
         ShaderSourceEntry()
             : type(VERTEX_SHADER)
             , isValid(false)
@@ -1001,9 +1009,11 @@
         
         ShaderSymbolMap& symbolMap(enum ANGLEShaderSymbolType symbolType)
         {
-            ASSERT(symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE || symbolType == SHADER_SYMBOL_TYPE_UNIFORM);
+            ASSERT(symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE || symbolType == SHADER_SYMBOL_TYPE_UNIFORM || symbolType == SHADER_SYMBOL_TYPE_VARYING);
             if (symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE)
                 return attributeMap;
+            if (symbolType == SHADER_SYMBOL_TYPE_VARYING)
+                return varyingMap;
             return uniformMap;
         }
     };

Modified: trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp (160222 => 160223)


--- trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp	2013-12-06 17:18:32 UTC (rev 160222)
+++ trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp	2013-12-06 17:28:44 UTC (rev 160223)
@@ -184,7 +184,7 @@
     size_t numSymbols = symbols.size();
     for (size_t i = 0; i < numSymbols; ++i) {
         ANGLEShaderSymbol shaderSymbol = symbols[i];
-        GraphicsContext3D::SymbolInfo symbolInfo(shaderSymbol.dataType, shaderSymbol.size, shaderSymbol.mappedName);
+        GraphicsContext3D::SymbolInfo symbolInfo(shaderSymbol.dataType, shaderSymbol.size, shaderSymbol.mappedName, shaderSymbol.precision, shaderSymbol.staticUse);
         entry.symbolMap(shaderSymbol.symbolType).set(shaderSymbol.name, symbolInfo);
     }
 

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (160222 => 160223)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2013-12-06 17:18:32 UTC (rev 160222)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2013-12-06 17:28:44 UTC (rev 160223)
@@ -326,6 +326,14 @@
     ::glFlush();
 }
 
+bool GraphicsContext3D::areProgramSymbolsValid(Platform3DObject vertexShader, Platform3DObject fragmentShader) const
+{
+    UNUSED_PARAM(vertexShader);
+    UNUSED_PARAM(fragmentShader);
+    // TODO: Fill me in.
+    return true;
+}
+
 IntSize GraphicsContext3D::getInternalFramebufferSize() const
 {
     return IntSize(m_currentWidth, m_currentHeight);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to