Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [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 | |
Corentin Wallez | d3970de | 2015-05-14 11:07:48 -0400 | [diff] [blame] | 7 | #include "test_utils/ANGLETest.h" |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 8 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 9 | using namespace angle; |
| 10 | |
| 11 | template <typename IndexType, GLenum IndexTypeName> |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 12 | class IndexedPointsTest : public ANGLETest |
| 13 | { |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 14 | protected: |
| 15 | IndexedPointsTest() |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 16 | { |
| 17 | setWindowWidth(128); |
| 18 | setWindowHeight(128); |
| 19 | setConfigRedBits(8); |
| 20 | setConfigGreenBits(8); |
| 21 | setConfigBlueBits(8); |
| 22 | setConfigAlphaBits(8); |
| 23 | setConfigDepthBits(24); |
| 24 | } |
| 25 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 26 | float getIndexPositionX(size_t idx) { return (idx == 0 || idx == 3) ? -0.5f : 0.5f; } |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 27 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 28 | float getIndexPositionY(size_t idx) { return (idx == 2 || idx == 3) ? -0.5f : 0.5f; } |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 29 | |
| 30 | virtual void SetUp() |
| 31 | { |
| 32 | ANGLETest::SetUp(); |
| 33 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 34 | const std::string vertexShaderSource = |
| 35 | SHADER_SOURCE(precision highp float; attribute vec2 position; |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 36 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 37 | void main() { |
| 38 | gl_PointSize = 5.0; |
| 39 | gl_Position = vec4(position, 0.0, 1.0); |
| 40 | }); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 41 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 42 | const std::string fragmentShaderSource = |
| 43 | SHADER_SOURCE(precision highp float; |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 44 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 45 | void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); }); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 46 | |
Jamie Madill | 5599c8f | 2014-08-26 13:16:39 -0400 | [diff] [blame] | 47 | mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource); |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 48 | ASSERT_NE(0u, mProgram); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 49 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 50 | const std::string vertexShaderSource2 = |
| 51 | SHADER_SOURCE(precision highp float; attribute vec2 position; attribute vec4 color; |
| 52 | varying vec4 vcolor; |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 53 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 54 | void main() { |
| 55 | gl_PointSize = 5.0; |
| 56 | gl_Position = vec4(position, 0.0, 1.0); |
| 57 | vcolor = color; |
| 58 | }); |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 59 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 60 | const std::string fragmentShaderSource2 = |
| 61 | SHADER_SOURCE(precision highp float; varying vec4 vcolor; |
| 62 | void main() { gl_FragColor = vec4(vcolor.xyz, 1.0); }); |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 63 | |
| 64 | mVertexWithColorBufferProgram = CompileProgram(vertexShaderSource2, fragmentShaderSource2); |
| 65 | ASSERT_NE(0u, mVertexWithColorBufferProgram); |
| 66 | |
| 67 | // Construct a vertex buffer of position values and color values |
| 68 | // contained in a single structure |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 69 | const float verticesWithColor[] = { |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 70 | getIndexPositionX(0), getIndexPositionY(0), 0.0f, 1.0f, 0.0f, |
| 71 | getIndexPositionX(2), getIndexPositionY(2), 0.0f, 1.0f, 0.0f, |
| 72 | getIndexPositionX(1), getIndexPositionY(1), 0.0f, 1.0f, 0.0f, |
| 73 | getIndexPositionX(3), getIndexPositionY(3), 0.0f, 1.0f, 0.0f, |
| 74 | }; |
| 75 | |
| 76 | glGenBuffers(1, &mVertexWithColorBuffer); |
| 77 | glBindBuffer(GL_ARRAY_BUFFER, mVertexWithColorBuffer); |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 78 | glBufferData(GL_ARRAY_BUFFER, sizeof(verticesWithColor), &verticesWithColor[0], |
| 79 | GL_STATIC_DRAW); |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 80 | |
| 81 | // Construct a vertex buffer of position values only |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 82 | const GLfloat vertices[] = { |
| 83 | getIndexPositionX(0), getIndexPositionY(0), getIndexPositionX(2), getIndexPositionY(2), |
| 84 | getIndexPositionX(1), getIndexPositionY(1), getIndexPositionX(3), getIndexPositionY(3), |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 85 | }; |
| 86 | glGenBuffers(1, &mVertexBuffer); |
| 87 | glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer); |
Corentin Wallez | 91c2fad | 2015-05-15 10:34:14 -0400 | [diff] [blame] | 88 | glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), &vertices[0], GL_STATIC_DRAW); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 89 | |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 90 | // The indices buffer is shared between both variations of tests |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 91 | const IndexType indices[] = {0, 2, 1, 3}; |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 92 | glGenBuffers(1, &mIndexBuffer); |
| 93 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer); |
Corentin Wallez | 91c2fad | 2015-05-15 10:34:14 -0400 | [diff] [blame] | 94 | glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), &indices[0], GL_STATIC_DRAW); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | virtual void TearDown() |
| 98 | { |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 99 | glDeleteBuffers(1, &mVertexBuffer); |
| 100 | glDeleteBuffers(1, &mIndexBuffer); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 101 | glDeleteProgram(mProgram); |
| 102 | |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 103 | glDeleteBuffers(1, &mVertexWithColorBuffer); |
| 104 | glDeleteProgram(mVertexWithColorBufferProgram); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 105 | ANGLETest::TearDown(); |
| 106 | } |
| 107 | |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 108 | void runTest(GLuint firstIndex, bool useVertexBufferWithColor = false) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 109 | { |
| 110 | glClearColor(0.0f, 0.0f, 0.0f, 1.0f); |
| 111 | glClear(GL_COLOR_BUFFER_BIT); |
| 112 | |
| 113 | GLint viewportSize[4]; |
| 114 | glGetIntegerv(GL_VIEWPORT, viewportSize); |
| 115 | |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 116 | // Choose appropriate program to apply for the test |
| 117 | GLuint program = useVertexBufferWithColor ? mVertexWithColorBufferProgram : mProgram; |
| 118 | |
| 119 | if (useVertexBufferWithColor) |
| 120 | { |
| 121 | glBindBuffer(GL_ARRAY_BUFFER, mVertexWithColorBuffer); |
| 122 | GLint vertexLocation = glGetAttribLocation(program, "position"); |
Cooper Partin | 4d61f7e | 2015-08-12 10:56:50 -0700 | [diff] [blame] | 123 | glVertexAttribPointer(vertexLocation, 2, GL_FLOAT, GL_FALSE, |
| 124 | static_cast<const GLsizei>(VertexWithColorSize), 0); |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 125 | glEnableVertexAttribArray(vertexLocation); |
| 126 | |
| 127 | GLint vertexColorLocation = glGetAttribLocation(program, "color"); |
Cooper Partin | 4d61f7e | 2015-08-12 10:56:50 -0700 | [diff] [blame] | 128 | glVertexAttribPointer(vertexColorLocation, 3, GL_FLOAT, GL_FALSE, |
| 129 | static_cast<const GLsizei>(VertexWithColorSize), |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 130 | (void *)((sizeof(float) * 2))); |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 131 | glEnableVertexAttribArray(vertexColorLocation); |
| 132 | } |
| 133 | else |
| 134 | { |
| 135 | glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer); |
| 136 | GLint vertexLocation = glGetAttribLocation(program, "position"); |
| 137 | glVertexAttribPointer(vertexLocation, 2, GL_FLOAT, GL_FALSE, 0, 0); |
| 138 | glEnableVertexAttribArray(vertexLocation); |
| 139 | } |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 140 | |
| 141 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer); |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 142 | glUseProgram(program); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 143 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 144 | glDrawElements(GL_POINTS, mPointCount - firstIndex, IndexTypeName, |
| 145 | reinterpret_cast<void *>(firstIndex * sizeof(IndexType))); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 146 | |
| 147 | for (size_t i = 0; i < mPointCount; i++) |
| 148 | { |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 149 | GLuint x = |
| 150 | static_cast<GLuint>(viewportSize[0] + (getIndexPositionX(i) * 0.5f + 0.5f) * |
| 151 | (viewportSize[2] - viewportSize[0])); |
| 152 | GLuint y = |
| 153 | static_cast<GLuint>(viewportSize[1] + (getIndexPositionY(i) * 0.5f + 0.5f) * |
| 154 | (viewportSize[3] - viewportSize[1])); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 155 | |
| 156 | if (i < firstIndex) |
| 157 | { |
| 158 | EXPECT_PIXEL_EQ(x, y, 0, 0, 0, 255); |
| 159 | } |
| 160 | else |
| 161 | { |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 162 | if (useVertexBufferWithColor) |
| 163 | { |
| 164 | // Pixel data is assumed to be GREEN |
| 165 | EXPECT_PIXEL_EQ(x, y, 0, 255, 0, 255); |
| 166 | } |
| 167 | else |
| 168 | { |
| 169 | // Pixel data is assumed to be RED |
| 170 | EXPECT_PIXEL_EQ(x, y, 255, 0, 0, 255); |
| 171 | } |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 172 | } |
| 173 | } |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 174 | swapBuffers(); |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | GLuint mProgram; |
| 178 | GLuint mVertexBuffer; |
| 179 | GLuint mIndexBuffer; |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 180 | |
| 181 | GLuint mVertexWithColorBufferProgram; |
| 182 | GLuint mVertexWithColorBuffer; |
| 183 | |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 184 | static const GLuint mPointCount = 4; |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 185 | |
| 186 | private: |
| 187 | const size_t VertexWithColorSize = sizeof(float) * 5; |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 188 | }; |
| 189 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 190 | typedef IndexedPointsTest<GLubyte, GL_UNSIGNED_BYTE> IndexedPointsTestUByte; |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 191 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 192 | TEST_P(IndexedPointsTestUByte, UnsignedByteOffset0) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 193 | { |
| 194 | runTest(0); |
| 195 | } |
| 196 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 197 | TEST_P(IndexedPointsTestUByte, UnsignedByteOffset1) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 198 | { |
| 199 | runTest(1); |
| 200 | } |
| 201 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 202 | TEST_P(IndexedPointsTestUByte, UnsignedByteOffset2) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 203 | { |
| 204 | runTest(2); |
| 205 | } |
| 206 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 207 | TEST_P(IndexedPointsTestUByte, UnsignedByteOffset3) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 208 | { |
| 209 | runTest(3); |
| 210 | } |
| 211 | |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 212 | TEST_P(IndexedPointsTestUByte, VertexWithColorUnsignedByteOffset0) |
| 213 | { |
| 214 | runTest(0, true); |
| 215 | } |
| 216 | |
| 217 | TEST_P(IndexedPointsTestUByte, VertexWithColorUnsignedByteOffset1) |
| 218 | { |
| 219 | runTest(1, true); |
| 220 | } |
| 221 | |
| 222 | TEST_P(IndexedPointsTestUByte, VertexWithColorUnsignedByteOffset2) |
| 223 | { |
| 224 | runTest(2, true); |
| 225 | } |
| 226 | |
| 227 | TEST_P(IndexedPointsTestUByte, VertexWithColorUnsignedByteOffset3) |
| 228 | { |
| 229 | runTest(3, true); |
| 230 | } |
| 231 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 232 | typedef IndexedPointsTest<GLushort, GL_UNSIGNED_SHORT> IndexedPointsTestUShort; |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 233 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 234 | TEST_P(IndexedPointsTestUShort, UnsignedShortOffset0) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 235 | { |
| 236 | runTest(0); |
| 237 | } |
| 238 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 239 | TEST_P(IndexedPointsTestUShort, UnsignedShortOffset1) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 240 | { |
| 241 | runTest(1); |
| 242 | } |
| 243 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 244 | TEST_P(IndexedPointsTestUShort, UnsignedShortOffset2) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 245 | { |
| 246 | runTest(2); |
| 247 | } |
| 248 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 249 | TEST_P(IndexedPointsTestUShort, UnsignedShortOffset3) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 250 | { |
| 251 | runTest(3); |
| 252 | } |
| 253 | |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 254 | TEST_P(IndexedPointsTestUShort, VertexWithColorUnsignedShortOffset0) |
| 255 | { |
| 256 | runTest(0, true); |
| 257 | } |
| 258 | |
| 259 | TEST_P(IndexedPointsTestUShort, VertexWithColorUnsignedShortOffset1) |
| 260 | { |
| 261 | runTest(1, true); |
| 262 | } |
| 263 | |
| 264 | TEST_P(IndexedPointsTestUShort, VertexWithColorUnsignedShortOffset2) |
| 265 | { |
| 266 | runTest(2, true); |
| 267 | } |
| 268 | |
| 269 | TEST_P(IndexedPointsTestUShort, VertexWithColorUnsignedShortOffset3) |
| 270 | { |
| 271 | runTest(3, true); |
| 272 | } |
| 273 | |
| 274 | TEST_P(IndexedPointsTestUShort, VertexWithColorUnsignedShortOffsetChangingIndices) |
| 275 | { |
Frank Henigman | df55f25 | 2017-04-05 15:32:06 -0400 | [diff] [blame] | 276 | // TODO(fjhenigman): Figure out why this fails on Ozone Intel. |
| 277 | if (IsOzone() && IsIntel() && IsOpenGLES()) |
| 278 | { |
| 279 | std::cout << "Test skipped on Ozone Intel." << std::endl; |
| 280 | return; |
| 281 | } |
| 282 | |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 283 | runTest(3, true); |
| 284 | runTest(1, true); |
| 285 | runTest(0, true); |
| 286 | runTest(2, true); |
| 287 | } |
| 288 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 289 | typedef IndexedPointsTest<GLuint, GL_UNSIGNED_INT> IndexedPointsTestUInt; |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 290 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 291 | TEST_P(IndexedPointsTestUInt, UnsignedIntOffset0) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 292 | { |
Martin Radev | 1be913c | 2016-07-11 17:59:16 +0300 | [diff] [blame] | 293 | if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_element_index_uint")) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 294 | { |
| 295 | return; |
| 296 | } |
| 297 | |
| 298 | runTest(0); |
| 299 | } |
| 300 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 301 | TEST_P(IndexedPointsTestUInt, UnsignedIntOffset1) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 302 | { |
Martin Radev | 1be913c | 2016-07-11 17:59:16 +0300 | [diff] [blame] | 303 | if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_element_index_uint")) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 304 | { |
| 305 | return; |
| 306 | } |
| 307 | |
| 308 | runTest(1); |
| 309 | } |
| 310 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 311 | TEST_P(IndexedPointsTestUInt, UnsignedIntOffset2) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 312 | { |
Martin Radev | 1be913c | 2016-07-11 17:59:16 +0300 | [diff] [blame] | 313 | if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_element_index_uint")) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 314 | { |
| 315 | return; |
| 316 | } |
| 317 | |
| 318 | runTest(2); |
| 319 | } |
| 320 | |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 321 | TEST_P(IndexedPointsTestUInt, UnsignedIntOffset3) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 322 | { |
Martin Radev | 1be913c | 2016-07-11 17:59:16 +0300 | [diff] [blame] | 323 | if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_element_index_uint")) |
Geoff Lang | f8c2f5c | 2013-12-05 13:52:33 -0500 | [diff] [blame] | 324 | { |
| 325 | return; |
| 326 | } |
| 327 | |
| 328 | runTest(3); |
| 329 | } |
Jamie Madill | fa05f60 | 2015-05-07 13:47:11 -0400 | [diff] [blame] | 330 | |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 331 | TEST_P(IndexedPointsTestUInt, VertexWithColorUnsignedIntOffset0) |
| 332 | { |
Martin Radev | 1be913c | 2016-07-11 17:59:16 +0300 | [diff] [blame] | 333 | if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_element_index_uint")) |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 334 | { |
| 335 | return; |
| 336 | } |
| 337 | |
| 338 | runTest(0, false); |
| 339 | } |
| 340 | |
| 341 | TEST_P(IndexedPointsTestUInt, VertexWithColorUnsignedIntOffset1) |
| 342 | { |
Martin Radev | 1be913c | 2016-07-11 17:59:16 +0300 | [diff] [blame] | 343 | if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_element_index_uint")) |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 344 | { |
| 345 | return; |
| 346 | } |
| 347 | |
| 348 | runTest(1, false); |
| 349 | } |
| 350 | |
| 351 | TEST_P(IndexedPointsTestUInt, VertexWithColorUnsignedIntOffset2) |
| 352 | { |
Martin Radev | 1be913c | 2016-07-11 17:59:16 +0300 | [diff] [blame] | 353 | if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_element_index_uint")) |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 354 | { |
| 355 | return; |
| 356 | } |
| 357 | |
| 358 | runTest(2, false); |
| 359 | } |
| 360 | |
| 361 | TEST_P(IndexedPointsTestUInt, VertexWithColorUnsignedIntOffset3) |
| 362 | { |
Martin Radev | 1be913c | 2016-07-11 17:59:16 +0300 | [diff] [blame] | 363 | if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_element_index_uint")) |
Cooper Partin | 558f2b5 | 2015-06-02 09:34:11 -0700 | [diff] [blame] | 364 | { |
| 365 | return; |
| 366 | } |
| 367 | |
| 368 | runTest(3, false); |
| 369 | } |
| 370 | |
Geoff Lang | c422207 | 2015-05-25 13:19:48 -0400 | [diff] [blame] | 371 | // TODO(geofflang): Figure out why this test fails on Intel OpenGL |
Geoff Lang | e0cc2a4 | 2016-01-20 10:58:17 -0500 | [diff] [blame] | 372 | ANGLE_INSTANTIATE_TEST(IndexedPointsTestUByte, |
| 373 | ES2_D3D11(), |
| 374 | ES2_D3D11_FL9_3(), |
| 375 | ES2_OPENGL(), |
| 376 | ES2_OPENGLES()); |
| 377 | ANGLE_INSTANTIATE_TEST(IndexedPointsTestUShort, |
| 378 | ES2_D3D11(), |
| 379 | ES2_D3D11_FL9_3(), |
| 380 | ES2_OPENGL(), |
| 381 | ES2_OPENGLES()); |
| 382 | ANGLE_INSTANTIATE_TEST(IndexedPointsTestUInt, |
| 383 | ES2_D3D11(), |
| 384 | ES2_D3D11_FL9_3(), |
| 385 | ES2_OPENGL(), |
| 386 | ES2_OPENGLES()); |