1*8975f5c5SAndroid Build Coastguard Worker //
2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2015 The ANGLE Project Authors. All rights reserved.
3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file.
5*8975f5c5SAndroid Build Coastguard Worker //
6*8975f5c5SAndroid Build Coastguard Worker
7*8975f5c5SAndroid Build Coastguard Worker #include "test_utils/ANGLETest.h"
8*8975f5c5SAndroid Build Coastguard Worker
9*8975f5c5SAndroid Build Coastguard Worker using namespace angle;
10*8975f5c5SAndroid Build Coastguard Worker
11*8975f5c5SAndroid Build Coastguard Worker template <typename IndexType, GLenum IndexTypeName>
12*8975f5c5SAndroid Build Coastguard Worker class IndexedPointsTest : public ANGLETest<>
13*8975f5c5SAndroid Build Coastguard Worker {
14*8975f5c5SAndroid Build Coastguard Worker protected:
IndexedPointsTest()15*8975f5c5SAndroid Build Coastguard Worker IndexedPointsTest()
16*8975f5c5SAndroid Build Coastguard Worker {
17*8975f5c5SAndroid Build Coastguard Worker setWindowWidth(128);
18*8975f5c5SAndroid Build Coastguard Worker setWindowHeight(128);
19*8975f5c5SAndroid Build Coastguard Worker setConfigRedBits(8);
20*8975f5c5SAndroid Build Coastguard Worker setConfigGreenBits(8);
21*8975f5c5SAndroid Build Coastguard Worker setConfigBlueBits(8);
22*8975f5c5SAndroid Build Coastguard Worker setConfigAlphaBits(8);
23*8975f5c5SAndroid Build Coastguard Worker setConfigDepthBits(24);
24*8975f5c5SAndroid Build Coastguard Worker }
25*8975f5c5SAndroid Build Coastguard Worker
getIndexPositionX(size_t idx)26*8975f5c5SAndroid Build Coastguard Worker float getIndexPositionX(size_t idx) { return (idx == 0 || idx == 3) ? -0.5f : 0.5f; }
27*8975f5c5SAndroid Build Coastguard Worker
getIndexPositionY(size_t idx)28*8975f5c5SAndroid Build Coastguard Worker float getIndexPositionY(size_t idx) { return (idx == 2 || idx == 3) ? -0.5f : 0.5f; }
29*8975f5c5SAndroid Build Coastguard Worker
testSetUp()30*8975f5c5SAndroid Build Coastguard Worker void testSetUp() override
31*8975f5c5SAndroid Build Coastguard Worker {
32*8975f5c5SAndroid Build Coastguard Worker constexpr char kVS[] = R"(precision highp float;
33*8975f5c5SAndroid Build Coastguard Worker attribute vec2 position;
34*8975f5c5SAndroid Build Coastguard Worker
35*8975f5c5SAndroid Build Coastguard Worker void main() {
36*8975f5c5SAndroid Build Coastguard Worker gl_PointSize = 5.0;
37*8975f5c5SAndroid Build Coastguard Worker gl_Position = vec4(position, 0.0, 1.0);
38*8975f5c5SAndroid Build Coastguard Worker })";
39*8975f5c5SAndroid Build Coastguard Worker
40*8975f5c5SAndroid Build Coastguard Worker constexpr char kFS[] = R"(precision highp float;
41*8975f5c5SAndroid Build Coastguard Worker void main()
42*8975f5c5SAndroid Build Coastguard Worker {
43*8975f5c5SAndroid Build Coastguard Worker gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
44*8975f5c5SAndroid Build Coastguard Worker })";
45*8975f5c5SAndroid Build Coastguard Worker
46*8975f5c5SAndroid Build Coastguard Worker mProgram = CompileProgram(kVS, kFS);
47*8975f5c5SAndroid Build Coastguard Worker ASSERT_NE(0u, mProgram);
48*8975f5c5SAndroid Build Coastguard Worker
49*8975f5c5SAndroid Build Coastguard Worker constexpr char kVS2[] = R"(precision highp float;
50*8975f5c5SAndroid Build Coastguard Worker attribute vec2 position;
51*8975f5c5SAndroid Build Coastguard Worker attribute vec4 color;
52*8975f5c5SAndroid Build Coastguard Worker varying vec4 vcolor;
53*8975f5c5SAndroid Build Coastguard Worker
54*8975f5c5SAndroid Build Coastguard Worker void main() {
55*8975f5c5SAndroid Build Coastguard Worker gl_PointSize = 5.0;
56*8975f5c5SAndroid Build Coastguard Worker gl_Position = vec4(position, 0.0, 1.0);
57*8975f5c5SAndroid Build Coastguard Worker vcolor = color;
58*8975f5c5SAndroid Build Coastguard Worker })";
59*8975f5c5SAndroid Build Coastguard Worker
60*8975f5c5SAndroid Build Coastguard Worker constexpr char kFS2[] = R"(precision highp float;
61*8975f5c5SAndroid Build Coastguard Worker varying vec4 vcolor;
62*8975f5c5SAndroid Build Coastguard Worker
63*8975f5c5SAndroid Build Coastguard Worker void main()
64*8975f5c5SAndroid Build Coastguard Worker {
65*8975f5c5SAndroid Build Coastguard Worker gl_FragColor = vec4(vcolor.xyz, 1.0);
66*8975f5c5SAndroid Build Coastguard Worker })";
67*8975f5c5SAndroid Build Coastguard Worker
68*8975f5c5SAndroid Build Coastguard Worker mVertexWithColorBufferProgram = CompileProgram(kVS2, kFS2);
69*8975f5c5SAndroid Build Coastguard Worker ASSERT_NE(0u, mVertexWithColorBufferProgram);
70*8975f5c5SAndroid Build Coastguard Worker
71*8975f5c5SAndroid Build Coastguard Worker // Construct a vertex buffer of position values and color values
72*8975f5c5SAndroid Build Coastguard Worker // contained in a single structure
73*8975f5c5SAndroid Build Coastguard Worker const float verticesWithColor[] = {
74*8975f5c5SAndroid Build Coastguard Worker getIndexPositionX(0), getIndexPositionY(0), 0.0f, 1.0f, 0.0f,
75*8975f5c5SAndroid Build Coastguard Worker getIndexPositionX(2), getIndexPositionY(2), 0.0f, 1.0f, 0.0f,
76*8975f5c5SAndroid Build Coastguard Worker getIndexPositionX(1), getIndexPositionY(1), 0.0f, 1.0f, 0.0f,
77*8975f5c5SAndroid Build Coastguard Worker getIndexPositionX(3), getIndexPositionY(3), 0.0f, 1.0f, 0.0f,
78*8975f5c5SAndroid Build Coastguard Worker };
79*8975f5c5SAndroid Build Coastguard Worker
80*8975f5c5SAndroid Build Coastguard Worker glGenBuffers(1, &mVertexWithColorBuffer);
81*8975f5c5SAndroid Build Coastguard Worker glBindBuffer(GL_ARRAY_BUFFER, mVertexWithColorBuffer);
82*8975f5c5SAndroid Build Coastguard Worker glBufferData(GL_ARRAY_BUFFER, sizeof(verticesWithColor), &verticesWithColor[0],
83*8975f5c5SAndroid Build Coastguard Worker GL_STATIC_DRAW);
84*8975f5c5SAndroid Build Coastguard Worker
85*8975f5c5SAndroid Build Coastguard Worker // Construct a vertex buffer of position values only
86*8975f5c5SAndroid Build Coastguard Worker const GLfloat vertices[] = {
87*8975f5c5SAndroid Build Coastguard Worker getIndexPositionX(0), getIndexPositionY(0), getIndexPositionX(2), getIndexPositionY(2),
88*8975f5c5SAndroid Build Coastguard Worker getIndexPositionX(1), getIndexPositionY(1), getIndexPositionX(3), getIndexPositionY(3),
89*8975f5c5SAndroid Build Coastguard Worker };
90*8975f5c5SAndroid Build Coastguard Worker glGenBuffers(1, &mVertexBuffer);
91*8975f5c5SAndroid Build Coastguard Worker glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer);
92*8975f5c5SAndroid Build Coastguard Worker glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), &vertices[0], GL_STATIC_DRAW);
93*8975f5c5SAndroid Build Coastguard Worker
94*8975f5c5SAndroid Build Coastguard Worker // The indices buffer is shared between both variations of tests
95*8975f5c5SAndroid Build Coastguard Worker const IndexType indices[] = {0, 2, 1, 3};
96*8975f5c5SAndroid Build Coastguard Worker glGenBuffers(1, &mIndexBuffer);
97*8975f5c5SAndroid Build Coastguard Worker glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer);
98*8975f5c5SAndroid Build Coastguard Worker glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), &indices[0], GL_STATIC_DRAW);
99*8975f5c5SAndroid Build Coastguard Worker }
100*8975f5c5SAndroid Build Coastguard Worker
testTearDown()101*8975f5c5SAndroid Build Coastguard Worker void testTearDown() override
102*8975f5c5SAndroid Build Coastguard Worker {
103*8975f5c5SAndroid Build Coastguard Worker glDeleteBuffers(1, &mVertexBuffer);
104*8975f5c5SAndroid Build Coastguard Worker glDeleteBuffers(1, &mIndexBuffer);
105*8975f5c5SAndroid Build Coastguard Worker glDeleteProgram(mProgram);
106*8975f5c5SAndroid Build Coastguard Worker
107*8975f5c5SAndroid Build Coastguard Worker glDeleteBuffers(1, &mVertexWithColorBuffer);
108*8975f5c5SAndroid Build Coastguard Worker glDeleteProgram(mVertexWithColorBufferProgram);
109*8975f5c5SAndroid Build Coastguard Worker }
110*8975f5c5SAndroid Build Coastguard Worker
runTest(GLuint firstIndex,bool useVertexBufferWithColor=false)111*8975f5c5SAndroid Build Coastguard Worker void runTest(GLuint firstIndex, bool useVertexBufferWithColor = false)
112*8975f5c5SAndroid Build Coastguard Worker {
113*8975f5c5SAndroid Build Coastguard Worker glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
114*8975f5c5SAndroid Build Coastguard Worker glClear(GL_COLOR_BUFFER_BIT);
115*8975f5c5SAndroid Build Coastguard Worker
116*8975f5c5SAndroid Build Coastguard Worker GLint viewportSize[4];
117*8975f5c5SAndroid Build Coastguard Worker glGetIntegerv(GL_VIEWPORT, viewportSize);
118*8975f5c5SAndroid Build Coastguard Worker
119*8975f5c5SAndroid Build Coastguard Worker // Choose appropriate program to apply for the test
120*8975f5c5SAndroid Build Coastguard Worker GLuint program = useVertexBufferWithColor ? mVertexWithColorBufferProgram : mProgram;
121*8975f5c5SAndroid Build Coastguard Worker
122*8975f5c5SAndroid Build Coastguard Worker if (useVertexBufferWithColor)
123*8975f5c5SAndroid Build Coastguard Worker {
124*8975f5c5SAndroid Build Coastguard Worker glBindBuffer(GL_ARRAY_BUFFER, mVertexWithColorBuffer);
125*8975f5c5SAndroid Build Coastguard Worker GLint vertexLocation = glGetAttribLocation(program, "position");
126*8975f5c5SAndroid Build Coastguard Worker glVertexAttribPointer(vertexLocation, 2, GL_FLOAT, GL_FALSE,
127*8975f5c5SAndroid Build Coastguard Worker static_cast<const GLsizei>(VertexWithColorSize), 0);
128*8975f5c5SAndroid Build Coastguard Worker glEnableVertexAttribArray(vertexLocation);
129*8975f5c5SAndroid Build Coastguard Worker
130*8975f5c5SAndroid Build Coastguard Worker GLint vertexColorLocation = glGetAttribLocation(program, "color");
131*8975f5c5SAndroid Build Coastguard Worker glVertexAttribPointer(vertexColorLocation, 3, GL_FLOAT, GL_FALSE,
132*8975f5c5SAndroid Build Coastguard Worker static_cast<const GLsizei>(VertexWithColorSize),
133*8975f5c5SAndroid Build Coastguard Worker (void *)((sizeof(float) * 2)));
134*8975f5c5SAndroid Build Coastguard Worker glEnableVertexAttribArray(vertexColorLocation);
135*8975f5c5SAndroid Build Coastguard Worker }
136*8975f5c5SAndroid Build Coastguard Worker else
137*8975f5c5SAndroid Build Coastguard Worker {
138*8975f5c5SAndroid Build Coastguard Worker glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer);
139*8975f5c5SAndroid Build Coastguard Worker GLint vertexLocation = glGetAttribLocation(program, "position");
140*8975f5c5SAndroid Build Coastguard Worker glVertexAttribPointer(vertexLocation, 2, GL_FLOAT, GL_FALSE, 0, 0);
141*8975f5c5SAndroid Build Coastguard Worker glEnableVertexAttribArray(vertexLocation);
142*8975f5c5SAndroid Build Coastguard Worker }
143*8975f5c5SAndroid Build Coastguard Worker
144*8975f5c5SAndroid Build Coastguard Worker glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer);
145*8975f5c5SAndroid Build Coastguard Worker glUseProgram(program);
146*8975f5c5SAndroid Build Coastguard Worker
147*8975f5c5SAndroid Build Coastguard Worker glDrawElements(GL_POINTS, mPointCount - firstIndex, IndexTypeName,
148*8975f5c5SAndroid Build Coastguard Worker reinterpret_cast<void *>(firstIndex * sizeof(IndexType)));
149*8975f5c5SAndroid Build Coastguard Worker
150*8975f5c5SAndroid Build Coastguard Worker for (size_t i = 0; i < mPointCount; i++)
151*8975f5c5SAndroid Build Coastguard Worker {
152*8975f5c5SAndroid Build Coastguard Worker GLuint x =
153*8975f5c5SAndroid Build Coastguard Worker static_cast<GLuint>(viewportSize[0] + (getIndexPositionX(i) * 0.5f + 0.5f) *
154*8975f5c5SAndroid Build Coastguard Worker (viewportSize[2] - viewportSize[0]));
155*8975f5c5SAndroid Build Coastguard Worker GLuint y =
156*8975f5c5SAndroid Build Coastguard Worker static_cast<GLuint>(viewportSize[1] + (getIndexPositionY(i) * 0.5f + 0.5f) *
157*8975f5c5SAndroid Build Coastguard Worker (viewportSize[3] - viewportSize[1]));
158*8975f5c5SAndroid Build Coastguard Worker
159*8975f5c5SAndroid Build Coastguard Worker if (i < firstIndex)
160*8975f5c5SAndroid Build Coastguard Worker {
161*8975f5c5SAndroid Build Coastguard Worker EXPECT_PIXEL_COLOR_EQ(x, y, GLColor::black);
162*8975f5c5SAndroid Build Coastguard Worker }
163*8975f5c5SAndroid Build Coastguard Worker else
164*8975f5c5SAndroid Build Coastguard Worker {
165*8975f5c5SAndroid Build Coastguard Worker if (useVertexBufferWithColor)
166*8975f5c5SAndroid Build Coastguard Worker {
167*8975f5c5SAndroid Build Coastguard Worker EXPECT_PIXEL_COLOR_EQ(x, y, GLColor::green);
168*8975f5c5SAndroid Build Coastguard Worker }
169*8975f5c5SAndroid Build Coastguard Worker else
170*8975f5c5SAndroid Build Coastguard Worker {
171*8975f5c5SAndroid Build Coastguard Worker EXPECT_PIXEL_COLOR_EQ(x, y, GLColor::red);
172*8975f5c5SAndroid Build Coastguard Worker }
173*8975f5c5SAndroid Build Coastguard Worker }
174*8975f5c5SAndroid Build Coastguard Worker }
175*8975f5c5SAndroid Build Coastguard Worker swapBuffers();
176*8975f5c5SAndroid Build Coastguard Worker }
177*8975f5c5SAndroid Build Coastguard Worker
178*8975f5c5SAndroid Build Coastguard Worker GLuint mProgram;
179*8975f5c5SAndroid Build Coastguard Worker GLuint mVertexBuffer;
180*8975f5c5SAndroid Build Coastguard Worker GLuint mIndexBuffer;
181*8975f5c5SAndroid Build Coastguard Worker
182*8975f5c5SAndroid Build Coastguard Worker GLuint mVertexWithColorBufferProgram;
183*8975f5c5SAndroid Build Coastguard Worker GLuint mVertexWithColorBuffer;
184*8975f5c5SAndroid Build Coastguard Worker
185*8975f5c5SAndroid Build Coastguard Worker static const GLuint mPointCount = 4;
186*8975f5c5SAndroid Build Coastguard Worker
187*8975f5c5SAndroid Build Coastguard Worker private:
188*8975f5c5SAndroid Build Coastguard Worker const size_t VertexWithColorSize = sizeof(float) * 5;
189*8975f5c5SAndroid Build Coastguard Worker };
190*8975f5c5SAndroid Build Coastguard Worker
191*8975f5c5SAndroid Build Coastguard Worker typedef IndexedPointsTest<GLubyte, GL_UNSIGNED_BYTE> IndexedPointsTestUByte;
192*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUByte,UnsignedByteOffset0)193*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUByte, UnsignedByteOffset0)
194*8975f5c5SAndroid Build Coastguard Worker {
195*8975f5c5SAndroid Build Coastguard Worker runTest(0);
196*8975f5c5SAndroid Build Coastguard Worker }
197*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUByte,UnsignedByteOffset1)198*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUByte, UnsignedByteOffset1)
199*8975f5c5SAndroid Build Coastguard Worker {
200*8975f5c5SAndroid Build Coastguard Worker runTest(1);
201*8975f5c5SAndroid Build Coastguard Worker }
202*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUByte,UnsignedByteOffset2)203*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUByte, UnsignedByteOffset2)
204*8975f5c5SAndroid Build Coastguard Worker {
205*8975f5c5SAndroid Build Coastguard Worker runTest(2);
206*8975f5c5SAndroid Build Coastguard Worker }
207*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUByte,UnsignedByteOffset3)208*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUByte, UnsignedByteOffset3)
209*8975f5c5SAndroid Build Coastguard Worker {
210*8975f5c5SAndroid Build Coastguard Worker runTest(3);
211*8975f5c5SAndroid Build Coastguard Worker }
212*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUByte,VertexWithColorUnsignedByteOffset0)213*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUByte, VertexWithColorUnsignedByteOffset0)
214*8975f5c5SAndroid Build Coastguard Worker {
215*8975f5c5SAndroid Build Coastguard Worker runTest(0, true);
216*8975f5c5SAndroid Build Coastguard Worker }
217*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUByte,VertexWithColorUnsignedByteOffset1)218*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUByte, VertexWithColorUnsignedByteOffset1)
219*8975f5c5SAndroid Build Coastguard Worker {
220*8975f5c5SAndroid Build Coastguard Worker runTest(1, true);
221*8975f5c5SAndroid Build Coastguard Worker }
222*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUByte,VertexWithColorUnsignedByteOffset2)223*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUByte, VertexWithColorUnsignedByteOffset2)
224*8975f5c5SAndroid Build Coastguard Worker {
225*8975f5c5SAndroid Build Coastguard Worker runTest(2, true);
226*8975f5c5SAndroid Build Coastguard Worker }
227*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUByte,VertexWithColorUnsignedByteOffset3)228*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUByte, VertexWithColorUnsignedByteOffset3)
229*8975f5c5SAndroid Build Coastguard Worker {
230*8975f5c5SAndroid Build Coastguard Worker runTest(3, true);
231*8975f5c5SAndroid Build Coastguard Worker }
232*8975f5c5SAndroid Build Coastguard Worker
233*8975f5c5SAndroid Build Coastguard Worker typedef IndexedPointsTest<GLushort, GL_UNSIGNED_SHORT> IndexedPointsTestUShort;
234*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUShort,UnsignedShortOffset0)235*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUShort, UnsignedShortOffset0)
236*8975f5c5SAndroid Build Coastguard Worker {
237*8975f5c5SAndroid Build Coastguard Worker runTest(0);
238*8975f5c5SAndroid Build Coastguard Worker }
239*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUShort,UnsignedShortOffset1)240*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUShort, UnsignedShortOffset1)
241*8975f5c5SAndroid Build Coastguard Worker {
242*8975f5c5SAndroid Build Coastguard Worker runTest(1);
243*8975f5c5SAndroid Build Coastguard Worker }
244*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUShort,UnsignedShortOffset2)245*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUShort, UnsignedShortOffset2)
246*8975f5c5SAndroid Build Coastguard Worker {
247*8975f5c5SAndroid Build Coastguard Worker runTest(2);
248*8975f5c5SAndroid Build Coastguard Worker }
249*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUShort,UnsignedShortOffset3)250*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUShort, UnsignedShortOffset3)
251*8975f5c5SAndroid Build Coastguard Worker {
252*8975f5c5SAndroid Build Coastguard Worker runTest(3);
253*8975f5c5SAndroid Build Coastguard Worker }
254*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUShort,VertexWithColorUnsignedShortOffset0)255*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUShort, VertexWithColorUnsignedShortOffset0)
256*8975f5c5SAndroid Build Coastguard Worker {
257*8975f5c5SAndroid Build Coastguard Worker runTest(0, true);
258*8975f5c5SAndroid Build Coastguard Worker }
259*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUShort,VertexWithColorUnsignedShortOffset1)260*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUShort, VertexWithColorUnsignedShortOffset1)
261*8975f5c5SAndroid Build Coastguard Worker {
262*8975f5c5SAndroid Build Coastguard Worker runTest(1, true);
263*8975f5c5SAndroid Build Coastguard Worker }
264*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUShort,VertexWithColorUnsignedShortOffset2)265*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUShort, VertexWithColorUnsignedShortOffset2)
266*8975f5c5SAndroid Build Coastguard Worker {
267*8975f5c5SAndroid Build Coastguard Worker runTest(2, true);
268*8975f5c5SAndroid Build Coastguard Worker }
269*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUShort,VertexWithColorUnsignedShortOffset3)270*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUShort, VertexWithColorUnsignedShortOffset3)
271*8975f5c5SAndroid Build Coastguard Worker {
272*8975f5c5SAndroid Build Coastguard Worker runTest(3, true);
273*8975f5c5SAndroid Build Coastguard Worker }
274*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUShort,VertexWithColorUnsignedShortOffsetChangingIndices)275*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUShort, VertexWithColorUnsignedShortOffsetChangingIndices)
276*8975f5c5SAndroid Build Coastguard Worker {
277*8975f5c5SAndroid Build Coastguard Worker // TODO(fjhenigman): Figure out why this fails on Ozone Intel.
278*8975f5c5SAndroid Build Coastguard Worker ANGLE_SKIP_TEST_IF(IsOzone() && IsIntel() && IsOpenGLES());
279*8975f5c5SAndroid Build Coastguard Worker
280*8975f5c5SAndroid Build Coastguard Worker runTest(3, true);
281*8975f5c5SAndroid Build Coastguard Worker runTest(1, true);
282*8975f5c5SAndroid Build Coastguard Worker runTest(0, true);
283*8975f5c5SAndroid Build Coastguard Worker runTest(2, true);
284*8975f5c5SAndroid Build Coastguard Worker }
285*8975f5c5SAndroid Build Coastguard Worker
286*8975f5c5SAndroid Build Coastguard Worker typedef IndexedPointsTest<GLuint, GL_UNSIGNED_INT> IndexedPointsTestUInt;
287*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUInt,UnsignedIntOffset0)288*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUInt, UnsignedIntOffset0)
289*8975f5c5SAndroid Build Coastguard Worker {
290*8975f5c5SAndroid Build Coastguard Worker if (getClientMajorVersion() < 3 && !IsGLExtensionEnabled("GL_OES_element_index_uint"))
291*8975f5c5SAndroid Build Coastguard Worker {
292*8975f5c5SAndroid Build Coastguard Worker return;
293*8975f5c5SAndroid Build Coastguard Worker }
294*8975f5c5SAndroid Build Coastguard Worker runTest(0);
295*8975f5c5SAndroid Build Coastguard Worker }
296*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUInt,UnsignedIntOffset1)297*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUInt, UnsignedIntOffset1)
298*8975f5c5SAndroid Build Coastguard Worker {
299*8975f5c5SAndroid Build Coastguard Worker if (getClientMajorVersion() < 3 && !IsGLExtensionEnabled("GL_OES_element_index_uint"))
300*8975f5c5SAndroid Build Coastguard Worker {
301*8975f5c5SAndroid Build Coastguard Worker return;
302*8975f5c5SAndroid Build Coastguard Worker }
303*8975f5c5SAndroid Build Coastguard Worker runTest(1);
304*8975f5c5SAndroid Build Coastguard Worker }
305*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUInt,UnsignedIntOffset2)306*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUInt, UnsignedIntOffset2)
307*8975f5c5SAndroid Build Coastguard Worker {
308*8975f5c5SAndroid Build Coastguard Worker if (getClientMajorVersion() < 3 && !IsGLExtensionEnabled("GL_OES_element_index_uint"))
309*8975f5c5SAndroid Build Coastguard Worker {
310*8975f5c5SAndroid Build Coastguard Worker return;
311*8975f5c5SAndroid Build Coastguard Worker }
312*8975f5c5SAndroid Build Coastguard Worker runTest(2);
313*8975f5c5SAndroid Build Coastguard Worker }
314*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUInt,UnsignedIntOffset3)315*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUInt, UnsignedIntOffset3)
316*8975f5c5SAndroid Build Coastguard Worker {
317*8975f5c5SAndroid Build Coastguard Worker if (getClientMajorVersion() < 3 && !IsGLExtensionEnabled("GL_OES_element_index_uint"))
318*8975f5c5SAndroid Build Coastguard Worker {
319*8975f5c5SAndroid Build Coastguard Worker return;
320*8975f5c5SAndroid Build Coastguard Worker }
321*8975f5c5SAndroid Build Coastguard Worker runTest(3);
322*8975f5c5SAndroid Build Coastguard Worker }
323*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUInt,VertexWithColorUnsignedIntOffset0)324*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUInt, VertexWithColorUnsignedIntOffset0)
325*8975f5c5SAndroid Build Coastguard Worker {
326*8975f5c5SAndroid Build Coastguard Worker if (getClientMajorVersion() < 3 && !IsGLExtensionEnabled("GL_OES_element_index_uint"))
327*8975f5c5SAndroid Build Coastguard Worker {
328*8975f5c5SAndroid Build Coastguard Worker return;
329*8975f5c5SAndroid Build Coastguard Worker }
330*8975f5c5SAndroid Build Coastguard Worker runTest(0, true);
331*8975f5c5SAndroid Build Coastguard Worker }
332*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUInt,VertexWithColorUnsignedIntOffset1)333*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUInt, VertexWithColorUnsignedIntOffset1)
334*8975f5c5SAndroid Build Coastguard Worker {
335*8975f5c5SAndroid Build Coastguard Worker if (getClientMajorVersion() < 3 && !IsGLExtensionEnabled("GL_OES_element_index_uint"))
336*8975f5c5SAndroid Build Coastguard Worker {
337*8975f5c5SAndroid Build Coastguard Worker return;
338*8975f5c5SAndroid Build Coastguard Worker }
339*8975f5c5SAndroid Build Coastguard Worker runTest(1, true);
340*8975f5c5SAndroid Build Coastguard Worker }
341*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUInt,VertexWithColorUnsignedIntOffset2)342*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUInt, VertexWithColorUnsignedIntOffset2)
343*8975f5c5SAndroid Build Coastguard Worker {
344*8975f5c5SAndroid Build Coastguard Worker if (getClientMajorVersion() < 3 && !IsGLExtensionEnabled("GL_OES_element_index_uint"))
345*8975f5c5SAndroid Build Coastguard Worker {
346*8975f5c5SAndroid Build Coastguard Worker return;
347*8975f5c5SAndroid Build Coastguard Worker }
348*8975f5c5SAndroid Build Coastguard Worker runTest(2, true);
349*8975f5c5SAndroid Build Coastguard Worker }
350*8975f5c5SAndroid Build Coastguard Worker
TEST_P(IndexedPointsTestUInt,VertexWithColorUnsignedIntOffset3)351*8975f5c5SAndroid Build Coastguard Worker TEST_P(IndexedPointsTestUInt, VertexWithColorUnsignedIntOffset3)
352*8975f5c5SAndroid Build Coastguard Worker {
353*8975f5c5SAndroid Build Coastguard Worker if (getClientMajorVersion() < 3 && !IsGLExtensionEnabled("GL_OES_element_index_uint"))
354*8975f5c5SAndroid Build Coastguard Worker {
355*8975f5c5SAndroid Build Coastguard Worker return;
356*8975f5c5SAndroid Build Coastguard Worker }
357*8975f5c5SAndroid Build Coastguard Worker runTest(3, true);
358*8975f5c5SAndroid Build Coastguard Worker }
359*8975f5c5SAndroid Build Coastguard Worker
360*8975f5c5SAndroid Build Coastguard Worker // TODO(lucferron): Diagnose and fix the UByte tests below for Vulkan.
361*8975f5c5SAndroid Build Coastguard Worker // http://anglebug.com/42261353
362*8975f5c5SAndroid Build Coastguard Worker
363*8975f5c5SAndroid Build Coastguard Worker // TODO(geofflang): Figure out why this test fails on Intel OpenGL
364*8975f5c5SAndroid Build Coastguard Worker ANGLE_INSTANTIATE_TEST_ES2(IndexedPointsTestUByte);
365*8975f5c5SAndroid Build Coastguard Worker ANGLE_INSTANTIATE_TEST_ES2(IndexedPointsTestUShort);
366*8975f5c5SAndroid Build Coastguard Worker ANGLE_INSTANTIATE_TEST_ES2(IndexedPointsTestUInt);
367