Edit

kc3-lang/angle/src/tests/test_utils/ConstantFoldingTest.cpp

Branch :

  • Show log

    Commit

  • Author : Olli Etuaho
    Date : 2017-01-29 16:15:44
    Hash : 25aef453
    Message : Add new ESSL 3.10 pack/unpack builtins This adds new built-ins found in ESSL 3.10 section 8.4 Floating-Point Pack and Unpack Functions. This includes constant folding support and support for both GLSL and HLSL output. In HLSL all of these functions need to be emulated. BUG=angleproject:1730 TEST=angle_unittests TEST=dEQP-GLES31.functional.shaders.*pack*norm4x8* Change-Id: Ibed60286a366cd35c4faafd405e79af562a02a06 Reviewed-on: https://chromium-review.googlesource.com/434170 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

  • src/tests/test_utils/ConstantFoldingTest.cpp
  • //
    // 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.
    //
    // ConstantFoldingTest.cpp:
    //   Utilities for constant folding tests.
    //
    
    #include "tests/test_utils/ConstantFoldingTest.h"
    
    #include "angle_gl.h"
    #include "compiler/translator/TranslatorESSL.h"
    #include "GLSLANG/ShaderLang.h"
    
    using namespace sh;
    
    void ConstantFoldingExpressionTest::evaluateFloat(const std::string &floatExpression)
    {
        std::stringstream shaderStream;
        shaderStream << "#version 310 es\n"
                        "precision mediump float;\n"
                        "out float my_FragColor;\n"
                        "void main()\n"
                        "{\n"
                     << "    my_FragColor = " << floatExpression << ";\n"
                     << "}\n";
        compileAssumeSuccess(shaderStream.str());
    }
    
    void ConstantFoldingExpressionTest::evaluateInt(const std::string &intExpression)
    {
        std::stringstream shaderStream;
        shaderStream << "#version 310 es\n"
                        "precision mediump int;\n"
                        "out int my_FragColor;\n"
                        "void main()\n"
                        "{\n"
                     << "    my_FragColor = " << intExpression << ";\n"
                     << "}\n";
        compileAssumeSuccess(shaderStream.str());
    }
    
    void ConstantFoldingExpressionTest::evaluateUint(const std::string &uintExpression)
    {
        std::stringstream shaderStream;
        shaderStream << "#version 310 es\n"
                        "precision mediump int;\n"
                        "out uint my_FragColor;\n"
                        "void main()\n"
                        "{\n"
                     << "    my_FragColor = " << uintExpression << ";\n"
                     << "}\n";
        compileAssumeSuccess(shaderStream.str());
    }