Edit

kc3-lang/angle/src/tests/test_utils/ShaderCompileTreeTest.h

Branch :

  • Show log

    Commit

  • Author : Martin Radev
    Date : 2017-07-05 17:11:06
    Hash : 115fc55e
    Message : Populate gl_InstanceID attribute information explicitly While compiling ESSL1 shaders, with the compiler having both SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW and SH_VARIABLES set, variable collection terminates with an assertion failure. The reason behind this is that SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW adds gl_InstanceID to the AST to initialize the multiview builtins, but the variable collection pass cannot find gl_InstanceID information in the symbol table because the builtin is only available in ESSL 3.00 and greater. To address this the patch populates the gl_InstanceID attribute information explicitly in the variable collection pass instead of retrieving it from the symbol table. BUG=angleproject:2062 TEST=angle_unittests Change-Id: I5ecb9967ebe6658e956d17a2637090f9b685ef33 Reviewed-on: https://chromium-review.googlesource.com/559669 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>

  • src/tests/test_utils/ShaderCompileTreeTest.h
  • //
    // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    // ShaderCompileTreeTest.h:
    //   Test that shader validation results in the correct compile status.
    //
    
    #ifndef TESTS_TEST_UTILS_SHADER_COMPILE_TREE_TEST_H_
    #define TESTS_TEST_UTILS_SHADER_COMPILE_TREE_TEST_H_
    
    #include "angle_gl.h"
    #include "compiler/translator/PoolAlloc.h"
    #include "gtest/gtest.h"
    #include "GLSLANG/ShaderLang.h"
    
    namespace sh
    {
    
    class TIntermBlock;
    class TIntermNode;
    class TranslatorESSL;
    
    class ShaderCompileTreeTest : public testing::Test
    {
      public:
        ShaderCompileTreeTest() : mExtraCompileOptions(0) {}
    
      protected:
        void SetUp() override;
    
        void TearDown() override;
    
        // Return true when compilation succeeds
        bool compile(const std::string &shaderString);
        void compileAssumeSuccess(const std::string &shaderString);
    
        bool hasWarning() const;
    
        const std::vector<sh::Uniform> &getUniforms() const;
        const std::vector<sh::Attribute> &getAttributes() const;
    
        virtual void initResources(ShBuiltInResources *resources) {}
        virtual ::GLenum getShaderType() const     = 0;
        virtual ShShaderSpec getShaderSpec() const = 0;
    
        std::string mInfoLog;
        ShCompileOptions mExtraCompileOptions;
    
        TIntermBlock *mASTRoot;
    
      private:
        TranslatorESSL *mTranslator;
    
        TPoolAllocator mAllocator;
    };
    
    // Returns true if the node is some kind of a zero node - either constructor or a constant union
    // node.
    bool IsZero(TIntermNode *node);
    
    }  // namespace sh
    
    #endif  // TESTS_TEST_UTILS_SHADER_COMPILE_TREE_TEST_H_