Edit

kc3-lang/angle/src/tests/gl_tests/ContextNoErrorTest.cpp

Branch :

  • Show log

    Commit

  • Author : Brandon Schade
    Date : 2020-02-06 08:53:16
    Hash : a8c947c7
    Message : Enabled GL_KHR_no_error Enabled GL_KHR_no_error added end2end tests for it Note that GL_KHR_no_error can only be enabled by setting the EGL attribute currently. Context flags are not currently supported. Bug: angleproject:1280 Test: angle_end2end_tests --gtest_filter=ContextNoErrorTest.* Change-Id: Ib5c73b8e284e3e4e5f800750ad6fcbef77be4285 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2068899 Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>

  • src/tests/gl_tests/ContextNoErrorTest.cpp
  • //
    // Copyright 2020 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.
    //
    // ContextNoErrorTest:
    //   Tests pertaining to GL_KHR_no_error
    //
    
    #include <gtest/gtest.h>
    
    #include "common/platform.h"
    #include "test_utils/ANGLETest.h"
    #include "test_utils/gl_raii.h"
    
    using namespace angle;
    
    class ContextNoErrorTest : public ANGLETest
    {
      protected:
        ContextNoErrorTest() : mNaughtyTexture(0) { setNoErrorEnabled(true); }
    
        void testTearDown() override
        {
            if (mNaughtyTexture != 0)
            {
                glDeleteTextures(1, &mNaughtyTexture);
            }
        }
    
        void bindNaughtyTexture()
        {
            glGenTextures(1, &mNaughtyTexture);
            ASSERT_GL_NO_ERROR();
            glBindTexture(GL_TEXTURE_CUBE_MAP, mNaughtyTexture);
            ASSERT_GL_NO_ERROR();
    
            // mNaughtyTexture should now be a GL_TEXTURE_CUBE_MAP texture, so rebinding it to
            // GL_TEXTURE_2D is an error
            glBindTexture(GL_TEXTURE_2D, mNaughtyTexture);
        }
    
        GLuint mNaughtyTexture;
    };
    
    // Tests that error reporting is suppressed when GL_KHR_no_error is enabled
    TEST_P(ContextNoErrorTest, NoError)
    {
        ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_KHR_no_error"));
    
        bindNaughtyTexture();
        EXPECT_GL_NO_ERROR();
    }
    
    ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(ContextNoErrorTest);