blob: b0e59f7fcfcbca2a6b4a9f4b707b9754a23f671e [file] [log] [blame]
Jamie Madill5bf9ff42016-02-01 11:13:03 -05001//
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
12using namespace angle;
13
14namespace
15{
16
17class ObjectAllocationTest : public ANGLETest
18{
19 protected:
20 ObjectAllocationTest() {}
21};
22
23// Test that we don't re-allocate a bound framebuffer ID.
24TEST_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.
35TEST_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
54ANGLE_INSTANTIATE_TEST(ObjectAllocationTest, ES3_OPENGL(), ES3_D3D11());