OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 #include <GLES2/gl2ext.h> | 6 #include <GLES2/gl2ext.h> |
7 #include <GLES2/gl2extchromium.h> | 7 #include <GLES2/gl2extchromium.h> |
8 #include <GLES3/gl3.h> | 8 #include <GLES3/gl3.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 gl_.Initialize(options); | 23 gl_.Initialize(options); |
24 } | 24 } |
25 | 25 |
26 void TearDown() override { gl_.Destroy(); } | 26 void TearDown() override { gl_.Destroy(); } |
27 bool IsApplicable() const { return gl_.IsInitialized(); } | 27 bool IsApplicable() const { return gl_.IsInitialized(); } |
28 | 28 |
29 GLManager gl_; | 29 GLManager gl_; |
30 }; | 30 }; |
31 | 31 |
32 TEST_F(ObjectBindingsTest, Buffers) { | 32 TEST_F(ObjectBindingsTest, Buffers) { |
| 33 if (!IsApplicable()) { |
| 34 return; |
| 35 } |
| 36 |
33 const std::pair<GLenum, GLenum> buffer_bindings[] = { | 37 const std::pair<GLenum, GLenum> buffer_bindings[] = { |
34 {GL_ARRAY_BUFFER, GL_ARRAY_BUFFER_BINDING}, | 38 {GL_ARRAY_BUFFER, GL_ARRAY_BUFFER_BINDING}, |
35 {GL_ELEMENT_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER_BINDING}, | 39 {GL_ELEMENT_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER_BINDING}, |
36 {GL_PIXEL_PACK_BUFFER, GL_PIXEL_PACK_BUFFER_BINDING}, | 40 {GL_PIXEL_PACK_BUFFER, GL_PIXEL_PACK_BUFFER_BINDING}, |
37 {GL_PIXEL_UNPACK_BUFFER, GL_PIXEL_UNPACK_BUFFER_BINDING}, | 41 {GL_PIXEL_UNPACK_BUFFER, GL_PIXEL_UNPACK_BUFFER_BINDING}, |
38 {GL_TRANSFORM_FEEDBACK_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER_BINDING}, | 42 {GL_TRANSFORM_FEEDBACK_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER_BINDING}, |
39 {GL_COPY_READ_BUFFER, GL_COPY_READ_BUFFER_BINDING}, | 43 {GL_COPY_READ_BUFFER, GL_COPY_READ_BUFFER_BINDING}, |
40 {GL_COPY_WRITE_BUFFER, GL_COPY_WRITE_BUFFER_BINDING}, | 44 {GL_COPY_WRITE_BUFFER, GL_COPY_WRITE_BUFFER_BINDING}, |
41 {GL_UNIFORM_BUFFER, GL_UNIFORM_BUFFER_BINDING}, | 45 {GL_UNIFORM_BUFFER, GL_UNIFORM_BUFFER_BINDING}, |
42 }; | 46 }; |
(...skipping 16 matching lines...) Expand all Loading... |
59 } | 63 } |
60 | 64 |
61 glBindBuffer(binding.first, 0); | 65 glBindBuffer(binding.first, 0); |
62 glDeleteBuffers(1, &buffer); | 66 glDeleteBuffers(1, &buffer); |
63 } | 67 } |
64 | 68 |
65 GLTestHelper::CheckGLError("no errors", __LINE__); | 69 GLTestHelper::CheckGLError("no errors", __LINE__); |
66 } | 70 } |
67 | 71 |
68 TEST_F(ObjectBindingsTest, FramebufferAttachments) { | 72 TEST_F(ObjectBindingsTest, FramebufferAttachments) { |
| 73 if (!IsApplicable()) { |
| 74 return; |
| 75 } |
| 76 |
69 GLuint texture = 0; | 77 GLuint texture = 0; |
70 glGenTextures(1, &texture); | 78 glGenTextures(1, &texture); |
71 glBindTexture(GL_TEXTURE_2D, texture); | 79 glBindTexture(GL_TEXTURE_2D, texture); |
72 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 80 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
73 nullptr); | 81 nullptr); |
74 | 82 |
75 GLuint renderbuffer = 0; | 83 GLuint renderbuffer = 0; |
76 glGenRenderbuffers(1, &renderbuffer); | 84 glGenRenderbuffers(1, &renderbuffer); |
77 glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer); | 85 glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer); |
78 glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 1, 1); | 86 glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 1, 1); |
(...skipping 19 matching lines...) Expand all Loading... |
98 glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 106 glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
99 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, | 107 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, |
100 &result); | 108 &result); |
101 EXPECT_EQ(static_cast<GLuint>(result), renderbuffer); | 109 EXPECT_EQ(static_cast<GLuint>(result), renderbuffer); |
102 } | 110 } |
103 | 111 |
104 GLTestHelper::CheckGLError("no errors", __LINE__); | 112 GLTestHelper::CheckGLError("no errors", __LINE__); |
105 } | 113 } |
106 | 114 |
107 } // namespace gpu | 115 } // namespace gpu |
OLD | NEW |