David Ghandehari | b153652 | 2017-05-24 00:01:15 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright 2015 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 | // ObjectAllocationTest |
| 7 | // Tests for object allocations and lifetimes. |
| 8 | // |
| 9 | |
| 10 | #include "test_utils/ANGLETest.h" |
| 11 | |
| 12 | using namespace angle; |
| 13 | |
| 14 | namespace |
| 15 | { |
| 16 | |
| 17 | class ObjectAllocationTest : public ANGLETest |
| 18 | { |
| 19 | protected: |
| 20 | ObjectAllocationTest() {} |
| 21 | }; |
| 22 | |
| 23 | // Test that we don't re-allocate a bound framebuffer ID. |
| 24 | TEST_P(ObjectAllocationTest, BindFramebufferBeforeGen) |
| 25 | { |
| 26 | glBindFramebuffer(GL_FRAMEBUFFER, 1); |
| 27 | GLuint fbo = 0; |
| 28 | glGenFramebuffers(1, &fbo); |
| 29 | EXPECT_NE(1u, fbo); |
| 30 | glDeleteFramebuffers(1, &fbo); |
| 31 | EXPECT_GL_NO_ERROR(); |
| 32 | } |
| 33 | |
| 34 | // Test that we don't re-allocate a bound framebuffer ID, other pattern. |
| 35 | TEST_P(ObjectAllocationTest, BindFramebufferAfterGen) |
| 36 | { |
| 37 | GLuint firstFBO = 0; |
| 38 | glGenFramebuffers(1, &firstFBO); |
| 39 | glBindFramebuffer(GL_FRAMEBUFFER, 1); |
| 40 | glDeleteFramebuffers(1, &firstFBO); |
| 41 | |
| 42 | glBindFramebuffer(GL_FRAMEBUFFER, 2); |
| 43 | GLuint secondFBOs[2] = {0}; |
| 44 | glGenFramebuffers(2, secondFBOs); |
| 45 | EXPECT_NE(2u, secondFBOs[0]); |
| 46 | EXPECT_NE(2u, secondFBOs[1]); |
| 47 | glDeleteFramebuffers(2, secondFBOs); |
| 48 | |
| 49 | EXPECT_GL_NO_ERROR(); |
| 50 | } |
| 51 | |
| 52 | } // anonymous namespace |
| 53 | |
Kaido Kert | 612c020 | 2020-01-22 10:28:42 -0800 | [diff] [blame] | 54 | ANGLE_INSTANTIATE_TEST_ES3(ObjectAllocationTest); |