⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 173527 in webkit


Ignore:
Timestamp:
Sep 11, 2014, 12:22:06 PM (12 years ago)
Author:
roger_fong@apple.com
Message:

Check for varying packing restrictions per program instead of per shader.
​https://bugs.webkit.org/show_bug.cgi?id=136585.
<rdar://problem/16308409>.

Reviewed by Dean Jackson.

Covered by webgl/1.0.2/conformance/ogles/GL/build/build_009_to_016.html.

  • html/canvas/WebGLRenderingContext.cpp:

(WebCore::WebGLRenderingContext::linkProgram):
Check for varying packing restrictions when linking the program.

  • platform/graphics/GraphicsContext3D.h:
  • platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:

(WebCore::GraphicsContext3D::checkVaryingsPacking):
Checks varyings shared by both vertex and fragment shaders and makes sure
they satisfy packing restrictions.

Remove varying packing restrictions checks from ANGLE.

  • src/compiler/translator/Compiler.cpp:

(TCompiler::compile):
(TCompiler::enforcePackingRestrictions):

  • src/compiler/translator/ShHandle.h:
  • platform/mac/TestExpectations:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r173523 r173527  
     12014-09-10  Roger Fong  <roger_fong@apple.com>
     2
     3        Check for varying packing restrictions per program instead of per shader.
     4        https://bugs.webkit.org/show_bug.cgi?id=136585.
     5        <rdar://problem/16308409>.
     6
     7        Reviewed by Dean Jackson.
     8
     9        * platform/mac/TestExpectations:
     10
    1112014-09-11  Beth Dakin  <bdakin@apple.com>
    212
  • trunk/LayoutTests/platform/mac/TestExpectations

    r173519 r173527  
    551551webgl/1.0.1/conformance/textures/origin-clean-conformance.html [ Skip ]
    552552webgl/1.0.1/conformance/context/context-lost-restored.html [ Failure ]
    553 webgl/1.0.2/conformance/ogles/GL/build/build_009_to_016.html [ Failure ]
    554553webgl/1.0.2/conformance/context/context-creation-and-destruction.html [ Failure Timeout ]
    555554webgl/1.0.2/conformance/rendering/multisample-corruption.html [ Failure Timeout ]
  • trunk/Source/ThirdParty/ANGLE/ChangeLog

    r173364 r173527  
     12014-09-10  Roger Fong  <roger_fong@apple.com>
     2
     3        Check for varying packing restrictions per program instead of per shader.
     4        https://bugs.webkit.org/show_bug.cgi?id=136585.
     5        <rdar://problem/16308409>.
     6
     7        Reviewed by Dean Jackson.
     8
     9        Remove varying packing restrictions checks from ANGLE.
     10        * src/compiler/translator/Compiler.cpp:
     11        (TCompiler::compile):
     12        (TCompiler::enforcePackingRestrictions):
     13        * src/compiler/translator/ShHandle.h:
     14
    1152014-09-06  Darin Adler  <darin@apple.com>
    216
  • trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.cpp

    r173352 r173527  
    240240        {
    241241            collectVariables(root);
    242             if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS)
     242            if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {
    243243                success = enforcePackingRestrictions();
     244                if (!success) {
     245                    infoSink.info.prefix(EPrefixError);
     246                    infoSink.info << "too many uniforms";
     247                    return false;
     248                }
     249            }
     250
    244251            if (success && shaderType == SH_VERTEX_SHADER &&
    245252                (compileOptions & SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
    … …  
    454461{
    455462    VariablePacker packer;
    456     bool success = packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
    457     if (!success) {
    458         infoSink.info.prefix(EPrefixError);
    459         infoSink.info << "too many uniforms";
    460         return false;
    461     }
    462 
    463     success = packer.CheckVariablesWithinPackingLimits(maxVaryingVectors, varyings);
    464 
    465     if (!success) {
    466         infoSink.info.prefix(EPrefixError);
    467         infoSink.info << "too many varyings";
    468         return false;
    469     }
    470     return true;
     463    return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
    471464}
    472465
  • trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShHandle.h

    r168055 r173527  
    9696    virtual void translate(TIntermNode* root) = 0;
    9797    // Returns true if, after applying the packing rules in the GLSL 1.017 spec
    98     // Appendix A, section 7, the shader does not use too many uniforms or varyings.
     98    // Appendix A, section 7, the shader does not use too many uniforms
    9999    bool enforcePackingRestrictions();
    100100    // Insert statements to initialize varyings without static use in the beginning
  • trunk/Source/WebCore/ChangeLog

    r173523 r173527  
     12014-09-10  Roger Fong  <roger_fong@apple.com>
     2
     3        Check for varying packing restrictions per program instead of per shader.
     4        https://bugs.webkit.org/show_bug.cgi?id=136585.
     5        <rdar://problem/16308409>.
     6
     7        Reviewed by Dean Jackson.
     8
     9        Covered by webgl/1.0.2/conformance/ogles/GL/build/build_009_to_016.html.
     10
     11        * html/canvas/WebGLRenderingContext.cpp:
     12        (WebCore::WebGLRenderingContext::linkProgram):
     13        Check for varying packing restrictions when linking the program.
     14
     15        * platform/graphics/GraphicsContext3D.h:
     16        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
     17        (WebCore::GraphicsContext3D::checkVaryingsPacking):
     18        Checks varyings shared by both vertex and fragment shaders and makes sure
     19        they satisfy packing restrictions.
     20
    1212014-09-11  Beth Dakin  <bdakin@apple.com>
    222
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r173256 r173527  
    34543454        WebGLShader* vertexShader = program->getAttachedShader(GraphicsContext3D::VERTEX_SHADER);
    34553455        WebGLShader* fragmentShader = program->getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER);
    3456         if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid() || !m_context->precisionsMatch(objectOrZero(vertexShader), objectOrZero(fragmentShader))) {
     3456        if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid() || !m_context->precisionsMatch(objectOrZero(vertexShader), objectOrZero(fragmentShader)) || !m_context->checkVaryingsPacking(objectOrZero(vertexShader), objectOrZero(fragmentShader))) {
    34573457            program->setLinkStatus(false);
    34583458            return;
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r170302 r173527  
    810810    void useProgram(Platform3DObject);
    811811    void validateProgram(Platform3DObject);
     812    bool checkVaryingsPacking(Platform3DObject vertexShader, Platform3DObject fragmentShader) const;
    812813    bool precisionsMatch(Platform3DObject vertexShader, Platform3DObject fragmentShader) const;
    813814
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp

    r169467 r173527  
    4141#include "Extensions3DOpenGL.h"
    4242#endif
     43#include "ANGLEWebKitBridge.h"
    4344#include "GraphicsContext.h"
    4445#include "ImageBuffer.h"
    … …  
    335336}
    336337
     338bool GraphicsContext3D::checkVaryingsPacking(Platform3DObject vertexShader, Platform3DObject fragmentShader) const
     339{
     340    ASSERT(m_shaderSourceMap.contains(vertexShader));
     341    ASSERT(m_shaderSourceMap.contains(fragmentShader));
     342    const auto& vertexEntry = m_shaderSourceMap.find(vertexShader)->value;
     343    const auto& fragmentEntry = m_shaderSourceMap.find(fragmentShader)->value;
     344
     345    HashMap<String, ShVariableInfo> combinedVaryings;
     346    for (const auto& vertexSymbol : vertexEntry.varyingMap) {
     347        const String& symbolName = vertexSymbol.key;
     348        // The varying map includes variables for each index of an array variable.
     349        // We only want a single variable to represent the array.
     350        if (symbolName.endsWith("]"))
     351            continue;
     352
     353        // Don't count built in varyings.
     354        if (symbolName == "gl_FragCoord" || symbolName == "gl_FrontFacing" || symbolName == "gl_PointCoord")
     355            continue;
     356
     357        const auto& fragmentSymbol = fragmentEntry.varyingMap.find(symbolName);
     358        if (fragmentSymbol != fragmentEntry.varyingMap.end()) {
     359            ShVariableInfo symbolInfo;
     360            symbolInfo.type = static_cast<ShDataType>((fragmentSymbol->value).type);
     361            // The arrays are already split up.
     362            symbolInfo.size = (fragmentSymbol->value).size;
     363            combinedVaryings.add(symbolName, symbolInfo);
     364        }
     365    }
     366
     367    size_t numVaryings = combinedVaryings.size();
     368    if (!numVaryings)
     369        return true;
     370
     371    ShVariableInfo* variables = new ShVariableInfo[numVaryings];
     372    int index = 0;
     373    for (const auto& varyingSymbol : combinedVaryings) {
     374        variables[index] = varyingSymbol.value;
     375        index++;
     376    }
     377   
     378    GC3Dint maxVaryingFloats = 0;
     379    ::glGetIntegerv(GL_MAX_VARYING_FLOATS, &maxVaryingFloats);
     380    int result = ShCheckVariablesWithinPackingLimits(maxVaryingFloats / 4, variables, numVaryings);
     381
     382    delete[] variables;
     383    return result;
     384}
    337385
    338386bool GraphicsContext3D::precisionsMatch(Platform3DObject vertexShader, Platform3DObject fragmentShader) const
Note: See TracChangeset for help on using the changeset viewer.