• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // ContextNoErrorTest:
7 //   Tests pertaining to GL_KHR_no_error
8 //
9 
10 #include <gtest/gtest.h>
11 
12 #include "common/platform.h"
13 #include "test_utils/ANGLETest.h"
14 #include "test_utils/gl_raii.h"
15 
16 using namespace angle;
17 
18 class ContextNoErrorTest : public ANGLETest
19 {
20   protected:
ContextNoErrorTest()21     ContextNoErrorTest() : mNaughtyTexture(0) { setNoErrorEnabled(true); }
22 
testTearDown()23     void testTearDown() override
24     {
25         if (mNaughtyTexture != 0)
26         {
27             glDeleteTextures(1, &mNaughtyTexture);
28         }
29     }
30 
bindNaughtyTexture()31     void bindNaughtyTexture()
32     {
33         glGenTextures(1, &mNaughtyTexture);
34         ASSERT_GL_NO_ERROR();
35         glBindTexture(GL_TEXTURE_CUBE_MAP, mNaughtyTexture);
36         ASSERT_GL_NO_ERROR();
37 
38         // mNaughtyTexture should now be a GL_TEXTURE_CUBE_MAP texture, so rebinding it to
39         // GL_TEXTURE_2D is an error
40         glBindTexture(GL_TEXTURE_2D, mNaughtyTexture);
41     }
42 
43     GLuint mNaughtyTexture;
44 };
45 
46 // Tests that error reporting is suppressed when GL_KHR_no_error is enabled
TEST_P(ContextNoErrorTest,NoError)47 TEST_P(ContextNoErrorTest, NoError)
48 {
49     ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_KHR_no_error"));
50 
51     bindNaughtyTexture();
52     EXPECT_GL_NO_ERROR();
53 }
54 
55 ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(ContextNoErrorTest);
56