1 //
2 // Copyright 2020 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 // PrimtestTests.cpp:
7 // GLES1 conformance primtest tests.
8 //
9
10 #include "GLES/gl.h"
11 #include "test_utils/ANGLETest.h"
12 #include "test_utils/gl_raii.h"
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 // ES 1.0
19 extern void DrawPrims(void);
20
21 #include "primtest/driver.h"
22 #include "primtest/tproto.h"
23
24 #ifdef __cplusplus
25 }
26
27 #endif
28
29 namespace angle
30 {
31 class GLES1PrimtestTest : public ANGLETest
32 {
33 protected:
GLES1PrimtestTest()34 GLES1PrimtestTest()
35 {
36 setWindowWidth(48);
37 setWindowHeight(48);
38 setConfigRedBits(8);
39 setConfigGreenBits(8);
40 setConfigBlueBits(8);
41 setConfigAlphaBits(8);
42 setConfigDepthBits(24);
43 setConfigStencilBits(8);
44 }
45
testTearDown()46 void testTearDown() override
47 {
48 if (mTestData != nullptr)
49 {
50 free(mTestData);
51 }
52 }
53
execTest(long test)54 void execTest(long test)
55 {
56 long i;
57 for (i = 0; driver[i].test != TEST_NULL; i++)
58 {
59 if (driver[i].test == test)
60 {
61 break;
62 }
63 }
64
65 ASSERT_NE(TEST_NULL, driver[i].test);
66
67 driverRec &op = driver[i];
68
69 op.funcInit((void *)&mTestData);
70 op.finish = 0;
71 ASSERT_GL_NO_ERROR();
72
73 for (;;)
74 {
75 op.funcStatus(1, mTestData);
76 ASSERT_GL_NO_ERROR();
77
78 op.funcSet(1, mTestData);
79 ASSERT_GL_NO_ERROR();
80
81 DrawPrims();
82 ASSERT_GL_NO_ERROR();
83
84 long finish = op.funcUpdate(mTestData);
85 ASSERT_GL_NO_ERROR();
86 if (finish)
87 {
88 break;
89 }
90 };
91 }
92
93 protected:
94 void *mTestData;
95 };
96
TEST_P(GLES1PrimtestTest,Hint)97 TEST_P(GLES1PrimtestTest, Hint)
98 {
99 execTest(TEST_HINT);
100 }
101
TEST_P(GLES1PrimtestTest,Alias)102 TEST_P(GLES1PrimtestTest, Alias)
103 {
104 execTest(TEST_ALIAS);
105 }
106
TEST_P(GLES1PrimtestTest,Alpha)107 TEST_P(GLES1PrimtestTest, Alpha)
108 {
109 execTest(TEST_ALPHA);
110 }
111
TEST_P(GLES1PrimtestTest,Blend)112 TEST_P(GLES1PrimtestTest, Blend)
113 {
114 execTest(TEST_BLEND);
115 }
116
TEST_P(GLES1PrimtestTest,Depth)117 TEST_P(GLES1PrimtestTest, Depth)
118 {
119 execTest(TEST_DEPTH);
120 }
121
TEST_P(GLES1PrimtestTest,Dither)122 TEST_P(GLES1PrimtestTest, Dither)
123 {
124 execTest(TEST_DITHER);
125 }
126
TEST_P(GLES1PrimtestTest,Fog)127 TEST_P(GLES1PrimtestTest, Fog)
128 {
129 execTest(TEST_FOG);
130 }
131
TEST_P(GLES1PrimtestTest,Light)132 TEST_P(GLES1PrimtestTest, Light)
133 {
134 execTest(TEST_LIGHT);
135 }
136
TEST_P(GLES1PrimtestTest,Logic)137 TEST_P(GLES1PrimtestTest, Logic)
138 {
139 execTest(TEST_LOGICOP);
140 }
141
TEST_P(GLES1PrimtestTest,Scissor)142 TEST_P(GLES1PrimtestTest, Scissor)
143 {
144 execTest(TEST_SCISSOR);
145 }
146
TEST_P(GLES1PrimtestTest,Shade)147 TEST_P(GLES1PrimtestTest, Shade)
148 {
149 execTest(TEST_SHADE);
150 }
151
TEST_P(GLES1PrimtestTest,Stencil)152 TEST_P(GLES1PrimtestTest, Stencil)
153 {
154 execTest(TEST_STENCIL);
155 }
156
TEST_P(GLES1PrimtestTest,Texture)157 TEST_P(GLES1PrimtestTest, Texture)
158 {
159 execTest(TEST_TEXTURE);
160 }
161
162 ANGLE_INSTANTIATE_TEST(GLES1PrimtestTest, ES1_OPENGL(), ES1_VULKAN());
163 } // namespace angle
164
165 // Included here to fix a compile error due to white box tests using angle_end2end_tests_main.
RegisterContextCompatibilityTests()166 void RegisterContextCompatibilityTests() {}