OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 init.has_alpha = true; | 65 init.has_alpha = true; |
66 init.has_depth = true; | 66 init.has_depth = true; |
67 init.request_alpha = true; | 67 init.request_alpha = true; |
68 init.request_depth = true; | 68 init.request_depth = true; |
69 init.bind_generates_resource = true; | 69 init.bind_generates_resource = true; |
70 InitDecoder(init); | 70 InitDecoder(init); |
71 SetupDefaultProgram(); | 71 SetupDefaultProgram(); |
72 } | 72 } |
73 }; | 73 }; |
74 | 74 |
| 75 INSTANTIATE_TEST_CASE_P(Service, |
| 76 GLES2DecoderGeometryInstancingTest, |
| 77 ::testing::Bool()); |
| 78 |
| 79 void GLES2DecoderManualInitTest::DirtyStateMaskTest(GLuint color_bits, |
| 80 bool depth_mask, |
| 81 GLuint front_stencil_mask, |
| 82 GLuint back_stencil_mask) { |
| 83 ColorMask color_mask_cmd; |
| 84 color_mask_cmd.Init((color_bits & 0x1000) != 0, |
| 85 (color_bits & 0x0100) != 0, |
| 86 (color_bits & 0x0010) != 0, |
| 87 (color_bits & 0x0001) != 0); |
| 88 EXPECT_EQ(error::kNoError, ExecuteCmd(color_mask_cmd)); |
| 89 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 90 |
| 91 DepthMask depth_mask_cmd; |
| 92 depth_mask_cmd.Init(depth_mask); |
| 93 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_mask_cmd)); |
| 94 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 95 |
| 96 StencilMaskSeparate front_stencil_mask_cmd; |
| 97 front_stencil_mask_cmd.Init(GL_FRONT, front_stencil_mask); |
| 98 EXPECT_EQ(error::kNoError, ExecuteCmd(front_stencil_mask_cmd)); |
| 99 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 100 |
| 101 StencilMaskSeparate back_stencil_mask_cmd; |
| 102 back_stencil_mask_cmd.Init(GL_BACK, back_stencil_mask); |
| 103 EXPECT_EQ(error::kNoError, ExecuteCmd(back_stencil_mask_cmd)); |
| 104 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 105 |
| 106 SetupExpectationsForApplyingDirtyState( |
| 107 false, // Framebuffer is RGB |
| 108 true, // Framebuffer has depth |
| 109 true, // Framebuffer has stencil |
| 110 color_bits, // color bits |
| 111 depth_mask, // depth mask |
| 112 false, // depth enabled |
| 113 front_stencil_mask, // front stencil mask |
| 114 back_stencil_mask, // back stencil mask |
| 115 false); // stencil enabled |
| 116 |
| 117 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 118 .Times(1) |
| 119 .RetiresOnSaturation(); |
| 120 DrawArrays draw_cmd; |
| 121 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 122 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 123 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 124 } |
| 125 |
75 // Test that with an RGB backbuffer if we set the color mask to 1,1,1,1 it is | 126 // Test that with an RGB backbuffer if we set the color mask to 1,1,1,1 it is |
76 // set to 1,1,1,0 at Draw time but is 1,1,1,1 at query time. | 127 // set to 1,1,1,0 at Draw time but is 1,1,1,1 at query time. |
77 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMask) { | 128 TEST_P(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMask) { |
78 ColorMask cmd; | 129 ColorMask cmd; |
79 cmd.Init(true, true, true, true); | 130 cmd.Init(true, true, true, true); |
80 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 131 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
81 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 132 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
82 | 133 |
83 SetupTexture(); | 134 SetupTexture(); |
84 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 135 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
85 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB | 136 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
86 false, // Framebuffer has depth | 137 false, // Framebuffer has depth |
87 false, // Framebuffer has stencil | 138 false, // Framebuffer has stencil |
88 0x1110, // color bits | 139 0x1110, // color bits |
89 false, // depth mask | 140 false, // depth mask |
90 false, // depth enabled | 141 false, // depth enabled |
91 0, // front stencil mask | 142 0, // front stencil mask |
92 0, // back stencil mask | 143 0, // back stencil mask |
93 false, // stencil enabled | 144 false); // stencil enabled |
94 false, // cull_face_enabled | |
95 false, // scissor_test_enabled | |
96 false); // blend_enabled | |
97 | 145 |
98 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 146 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
99 .Times(1) | 147 .Times(1) |
100 .RetiresOnSaturation(); | 148 .RetiresOnSaturation(); |
101 DrawArrays draw_cmd; | 149 DrawArrays draw_cmd; |
102 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 150 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
103 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 151 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
104 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 152 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
105 | 153 |
106 EXPECT_CALL(*gl_, GetError()) | 154 EXPECT_CALL(*gl_, GetError()) |
(...skipping 13 matching lines...) Expand all Loading... |
120 result->GetNumResults()); | 168 result->GetNumResults()); |
121 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 169 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
122 EXPECT_EQ(1, result->GetData()[0]); | 170 EXPECT_EQ(1, result->GetData()[0]); |
123 EXPECT_EQ(1, result->GetData()[1]); | 171 EXPECT_EQ(1, result->GetData()[1]); |
124 EXPECT_EQ(1, result->GetData()[2]); | 172 EXPECT_EQ(1, result->GetData()[2]); |
125 EXPECT_EQ(1, result->GetData()[3]); | 173 EXPECT_EQ(1, result->GetData()[3]); |
126 } | 174 } |
127 | 175 |
128 // Test that with no depth if we set DepthMask true that it's set to false at | 176 // Test that with no depth if we set DepthMask true that it's set to false at |
129 // draw time but querying it returns true. | 177 // draw time but querying it returns true. |
130 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferDepthMask) { | 178 TEST_P(GLES2DecoderRGBBackbufferTest, RGBBackbufferDepthMask) { |
131 EXPECT_CALL(*gl_, DepthMask(true)).Times(0).RetiresOnSaturation(); | 179 EXPECT_CALL(*gl_, DepthMask(true)).Times(0).RetiresOnSaturation(); |
132 DepthMask cmd; | 180 DepthMask cmd; |
133 cmd.Init(true); | 181 cmd.Init(true); |
134 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 182 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
135 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 183 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
136 | 184 |
137 SetupTexture(); | 185 SetupTexture(); |
138 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 186 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
139 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB | 187 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
140 false, // Framebuffer has depth | 188 false, // Framebuffer has depth |
141 false, // Framebuffer has stencil | 189 false, // Framebuffer has stencil |
142 0x1110, // color bits | 190 0x1110, // color bits |
143 false, // depth mask | 191 false, // depth mask |
144 false, // depth enabled | 192 false, // depth enabled |
145 0, // front stencil mask | 193 0, // front stencil mask |
146 0, // back stencil mask | 194 0, // back stencil mask |
147 false, // stencil enabled | 195 false); // stencil enabled |
148 false, // cull_face_enabled | |
149 false, // scissor_test_enabled | |
150 false); // blend_enabled | |
151 | 196 |
152 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 197 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
153 .Times(1) | 198 .Times(1) |
154 .RetiresOnSaturation(); | 199 .RetiresOnSaturation(); |
155 DrawArrays draw_cmd; | 200 DrawArrays draw_cmd; |
156 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 201 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
157 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 202 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
158 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 203 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
159 | 204 |
160 EXPECT_CALL(*gl_, GetError()) | 205 EXPECT_CALL(*gl_, GetError()) |
(...skipping 10 matching lines...) Expand all Loading... |
171 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 216 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
172 EXPECT_EQ( | 217 EXPECT_EQ( |
173 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_WRITEMASK), | 218 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_WRITEMASK), |
174 result->GetNumResults()); | 219 result->GetNumResults()); |
175 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 220 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
176 EXPECT_EQ(1, result->GetData()[0]); | 221 EXPECT_EQ(1, result->GetData()[0]); |
177 } | 222 } |
178 | 223 |
179 // Test that with no stencil if we set the stencil mask it's still set to 0 at | 224 // Test that with no stencil if we set the stencil mask it's still set to 0 at |
180 // draw time but gets our value if we query. | 225 // draw time but gets our value if we query. |
181 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferStencilMask) { | 226 TEST_P(GLES2DecoderRGBBackbufferTest, RGBBackbufferStencilMask) { |
182 const GLint kMask = 123; | 227 const GLint kMask = 123; |
183 EXPECT_CALL(*gl_, StencilMask(kMask)).Times(0).RetiresOnSaturation(); | 228 EXPECT_CALL(*gl_, StencilMask(kMask)).Times(0).RetiresOnSaturation(); |
184 StencilMask cmd; | 229 StencilMask cmd; |
185 cmd.Init(kMask); | 230 cmd.Init(kMask); |
186 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 231 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
187 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 232 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
188 | 233 |
189 SetupTexture(); | 234 SetupTexture(); |
190 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 235 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
191 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB | 236 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
192 false, // Framebuffer has depth | 237 false, // Framebuffer has depth |
193 false, // Framebuffer has stencil | 238 false, // Framebuffer has stencil |
194 0x1110, // color bits | 239 0x1110, // color bits |
195 false, // depth mask | 240 false, // depth mask |
196 false, // depth enabled | 241 false, // depth enabled |
197 0, // front stencil mask | 242 0, // front stencil mask |
198 0, // back stencil mask | 243 0, // back stencil mask |
199 false, // stencil enabled | 244 false); // stencil enabled |
200 false, // cull_face_enabled | |
201 false, // scissor_test_enabled | |
202 false); // blend_enabled | |
203 | 245 |
204 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 246 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
205 .Times(1) | 247 .Times(1) |
206 .RetiresOnSaturation(); | 248 .RetiresOnSaturation(); |
207 DrawArrays draw_cmd; | 249 DrawArrays draw_cmd; |
208 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 250 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
209 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 251 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
210 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 252 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
211 | 253 |
212 EXPECT_CALL(*gl_, GetError()) | 254 EXPECT_CALL(*gl_, GetError()) |
213 .WillOnce(Return(GL_NO_ERROR)) | 255 .WillOnce(Return(GL_NO_ERROR)) |
214 .WillOnce(Return(GL_NO_ERROR)) | 256 .WillOnce(Return(GL_NO_ERROR)) |
215 .RetiresOnSaturation(); | 257 .RetiresOnSaturation(); |
216 typedef GetIntegerv::Result Result; | 258 typedef GetIntegerv::Result Result; |
217 Result* result = static_cast<Result*>(shared_memory_address_); | 259 Result* result = static_cast<Result*>(shared_memory_address_); |
218 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_WRITEMASK, result->GetData())) | 260 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_WRITEMASK, result->GetData())) |
219 .Times(0); | 261 .Times(0); |
220 result->size = 0; | 262 result->size = 0; |
221 GetIntegerv cmd2; | 263 GetIntegerv cmd2; |
222 cmd2.Init(GL_STENCIL_WRITEMASK, shared_memory_id_, shared_memory_offset_); | 264 cmd2.Init(GL_STENCIL_WRITEMASK, shared_memory_id_, shared_memory_offset_); |
223 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 265 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
224 EXPECT_EQ( | 266 EXPECT_EQ( |
225 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_WRITEMASK), | 267 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_WRITEMASK), |
226 result->GetNumResults()); | 268 result->GetNumResults()); |
227 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 269 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
228 EXPECT_EQ(kMask, result->GetData()[0]); | 270 EXPECT_EQ(kMask, result->GetData()[0]); |
229 } | 271 } |
230 | 272 |
231 // Test that if an FBO is bound we get the correct masks. | 273 // Test that if an FBO is bound we get the correct masks. |
232 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMaskFBO) { | 274 TEST_P(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMaskFBO) { |
233 ColorMask cmd; | 275 ColorMask cmd; |
234 cmd.Init(true, true, true, true); | 276 cmd.Init(true, true, true, true); |
235 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 277 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
236 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 278 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
237 | 279 |
238 SetupTexture(); | 280 SetupTexture(); |
239 SetupVertexBuffer(); | 281 SetupVertexBuffer(); |
240 DoEnableVertexAttribArray(0); | 282 DoEnableVertexAttribArray(0); |
241 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); | 283 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
242 DoEnableVertexAttribArray(1); | 284 DoEnableVertexAttribArray(1); |
243 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 285 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
244 DoEnableVertexAttribArray(2); | 286 DoEnableVertexAttribArray(2); |
245 DoVertexAttribPointer(2, 2, GL_FLOAT, 0, 0); | 287 DoVertexAttribPointer(2, 2, GL_FLOAT, 0, 0); |
246 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB | 288 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
247 false, // Framebuffer has depth | 289 false, // Framebuffer has depth |
248 false, // Framebuffer has stencil | 290 false, // Framebuffer has stencil |
249 0x1110, // color bits | 291 0x1110, // color bits |
250 false, // depth mask | 292 false, // depth mask |
251 false, // depth enabled | 293 false, // depth enabled |
252 0, // front stencil mask | 294 0, // front stencil mask |
253 0, // back stencil mask | 295 0, // back stencil mask |
254 false, // stencil enabled | 296 false); // stencil enabled |
255 false, // cull_face_enabled | |
256 false, // scissor_test_enabled | |
257 false); // blend_enabled | |
258 | 297 |
259 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 298 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
260 .Times(1) | 299 .Times(1) |
261 .RetiresOnSaturation(); | 300 .RetiresOnSaturation(); |
262 DrawArrays draw_cmd; | 301 DrawArrays draw_cmd; |
263 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 302 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
264 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 303 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
265 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 304 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
266 | 305 |
267 // Check that no extra calls are made on the next draw. | 306 // Check that no extra calls are made on the next draw. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 342 |
304 // This time state needs to be set. | 343 // This time state needs to be set. |
305 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB | 344 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
306 false, // Framebuffer has depth | 345 false, // Framebuffer has depth |
307 false, // Framebuffer has stencil | 346 false, // Framebuffer has stencil |
308 0x1110, // color bits | 347 0x1110, // color bits |
309 false, // depth mask | 348 false, // depth mask |
310 false, // depth enabled | 349 false, // depth enabled |
311 0, // front stencil mask | 350 0, // front stencil mask |
312 0, // back stencil mask | 351 0, // back stencil mask |
313 false, // stencil enabled | 352 false); // stencil enabled |
314 false, // cull_face_enabled | |
315 false, // scissor_test_enabled | |
316 false); // blend_enabled | |
317 | 353 |
318 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 354 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
319 .Times(1) | 355 .Times(1) |
320 .RetiresOnSaturation(); | 356 .RetiresOnSaturation(); |
321 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 357 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
322 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 358 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
323 | 359 |
324 // Check that no extra calls are made on the next draw. | 360 // Check that no extra calls are made on the next draw. |
325 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 361 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
326 .Times(1) | 362 .Times(1) |
327 .RetiresOnSaturation(); | 363 .RetiresOnSaturation(); |
328 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 364 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
329 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 365 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
330 | 366 |
331 // Unbind | 367 // Unbind |
332 DoBindFramebuffer(GL_FRAMEBUFFER, 0, 0); | 368 DoBindFramebuffer(GL_FRAMEBUFFER, 0, 0); |
333 | 369 |
334 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB | 370 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
335 false, // Framebuffer has depth | 371 false, // Framebuffer has depth |
336 false, // Framebuffer has stencil | 372 false, // Framebuffer has stencil |
337 0x1110, // color bits | 373 0x1110, // color bits |
338 false, // depth mask | 374 false, // depth mask |
339 false, // depth enabled | 375 false, // depth enabled |
340 0, // front stencil mask | 376 0, // front stencil mask |
341 0, // back stencil mask | 377 0, // back stencil mask |
342 false, // stencil enabled | 378 false); // stencil enabled |
343 false, // cull_face_enabled | |
344 false, // scissor_test_enabled | |
345 false); // blend_enabled | |
346 | 379 |
347 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 380 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
348 .Times(1) | 381 .Times(1) |
349 .RetiresOnSaturation(); | 382 .RetiresOnSaturation(); |
350 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 383 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
351 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 384 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
352 } | 385 } |
353 | 386 |
354 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithDepth) { | 387 TEST_P(GLES2DecoderManualInitTest, DepthEnableWithDepth) { |
355 InitState init; | 388 InitState init; |
356 init.gl_version = "3.0"; | 389 init.gl_version = "3.0"; |
357 init.has_depth = true; | 390 init.has_depth = true; |
358 init.request_depth = true; | 391 init.request_depth = true; |
359 init.bind_generates_resource = true; | 392 init.bind_generates_resource = true; |
360 InitDecoder(init); | 393 InitDecoder(init); |
361 | 394 |
362 Enable cmd; | 395 Enable cmd; |
363 cmd.Init(GL_DEPTH_TEST); | 396 cmd.Init(GL_DEPTH_TEST); |
364 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 397 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
365 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 398 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
366 | 399 |
367 SetupDefaultProgram(); | 400 SetupDefaultProgram(); |
368 SetupTexture(); | 401 SetupTexture(); |
369 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 402 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
370 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB | 403 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
371 true, // Framebuffer has depth | 404 true, // Framebuffer has depth |
372 false, // Framebuffer has stencil | 405 false, // Framebuffer has stencil |
373 0x1110, // color bits | 406 0x1110, // color bits |
374 true, // depth mask | 407 true, // depth mask |
375 true, // depth enabled | 408 true, // depth enabled |
376 0, // front stencil mask | 409 0, // front stencil mask |
377 0, // back stencil mask | 410 0, // back stencil mask |
378 false, // stencil enabled | 411 false); // stencil enabled |
379 false, // cull_face_enabled | |
380 false, // scissor_test_enabled | |
381 false); // blend_enabled | |
382 | 412 |
383 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 413 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
384 .Times(1) | 414 .Times(1) |
385 .RetiresOnSaturation(); | 415 .RetiresOnSaturation(); |
386 DrawArrays draw_cmd; | 416 DrawArrays draw_cmd; |
387 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 417 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
388 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 418 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
389 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 419 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
390 | 420 |
391 EXPECT_CALL(*gl_, GetError()) | 421 EXPECT_CALL(*gl_, GetError()) |
392 .WillOnce(Return(GL_NO_ERROR)) | 422 .WillOnce(Return(GL_NO_ERROR)) |
393 .WillOnce(Return(GL_NO_ERROR)) | 423 .WillOnce(Return(GL_NO_ERROR)) |
394 .RetiresOnSaturation(); | 424 .RetiresOnSaturation(); |
395 typedef GetIntegerv::Result Result; | 425 typedef GetIntegerv::Result Result; |
396 Result* result = static_cast<Result*>(shared_memory_address_); | 426 Result* result = static_cast<Result*>(shared_memory_address_); |
397 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_TEST, _)) | 427 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_TEST, _)) |
398 .Times(0) | 428 .Times(0) |
399 .RetiresOnSaturation(); | 429 .RetiresOnSaturation(); |
400 result->size = 0; | 430 result->size = 0; |
401 GetIntegerv cmd2; | 431 GetIntegerv cmd2; |
402 cmd2.Init(GL_DEPTH_TEST, shared_memory_id_, shared_memory_offset_); | 432 cmd2.Init(GL_DEPTH_TEST, shared_memory_id_, shared_memory_offset_); |
403 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 433 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
404 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_TEST), | 434 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_TEST), |
405 result->GetNumResults()); | 435 result->GetNumResults()); |
406 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 436 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
407 EXPECT_EQ(1, result->GetData()[0]); | 437 EXPECT_EQ(1, result->GetData()[0]); |
408 } | 438 } |
409 | 439 |
410 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithoutRequestedDepth) { | 440 TEST_P(GLES2DecoderManualInitTest, DepthEnableWithoutRequestedDepth) { |
411 InitState init; | 441 InitState init; |
412 init.gl_version = "3.0"; | 442 init.gl_version = "3.0"; |
413 init.has_depth = true; | 443 init.has_depth = true; |
414 init.bind_generates_resource = true; | 444 init.bind_generates_resource = true; |
415 InitDecoder(init); | 445 InitDecoder(init); |
416 | 446 |
417 Enable cmd; | 447 Enable cmd; |
418 cmd.Init(GL_DEPTH_TEST); | 448 cmd.Init(GL_DEPTH_TEST); |
419 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 449 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
420 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 450 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
421 | 451 |
422 SetupDefaultProgram(); | 452 SetupDefaultProgram(); |
423 SetupTexture(); | 453 SetupTexture(); |
424 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 454 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
425 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB | 455 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
426 false, // Framebuffer has depth | 456 false, // Framebuffer has depth |
427 false, // Framebuffer has stencil | 457 false, // Framebuffer has stencil |
428 0x1110, // color bits | 458 0x1110, // color bits |
429 false, // depth mask | 459 false, // depth mask |
430 false, // depth enabled | 460 false, // depth enabled |
431 0, // front stencil mask | 461 0, // front stencil mask |
432 0, // back stencil mask | 462 0, // back stencil mask |
433 false, // stencil enabled | 463 false); // stencil enabled |
434 false, // cull_face_enabled | |
435 false, // scissor_test_enabled | |
436 false); // blend_enabled | |
437 | 464 |
438 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 465 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
439 .Times(1) | 466 .Times(1) |
440 .RetiresOnSaturation(); | 467 .RetiresOnSaturation(); |
441 DrawArrays draw_cmd; | 468 DrawArrays draw_cmd; |
442 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 469 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
443 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 470 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
444 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 471 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
445 | 472 |
446 EXPECT_CALL(*gl_, GetError()) | 473 EXPECT_CALL(*gl_, GetError()) |
447 .WillOnce(Return(GL_NO_ERROR)) | 474 .WillOnce(Return(GL_NO_ERROR)) |
448 .WillOnce(Return(GL_NO_ERROR)) | 475 .WillOnce(Return(GL_NO_ERROR)) |
449 .RetiresOnSaturation(); | 476 .RetiresOnSaturation(); |
450 typedef GetIntegerv::Result Result; | 477 typedef GetIntegerv::Result Result; |
451 Result* result = static_cast<Result*>(shared_memory_address_); | 478 Result* result = static_cast<Result*>(shared_memory_address_); |
452 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_TEST, _)) | 479 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_TEST, _)) |
453 .Times(0) | 480 .Times(0) |
454 .RetiresOnSaturation(); | 481 .RetiresOnSaturation(); |
455 result->size = 0; | 482 result->size = 0; |
456 GetIntegerv cmd2; | 483 GetIntegerv cmd2; |
457 cmd2.Init(GL_DEPTH_TEST, shared_memory_id_, shared_memory_offset_); | 484 cmd2.Init(GL_DEPTH_TEST, shared_memory_id_, shared_memory_offset_); |
458 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 485 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
459 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_TEST), | 486 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_TEST), |
460 result->GetNumResults()); | 487 result->GetNumResults()); |
461 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 488 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
462 EXPECT_EQ(1, result->GetData()[0]); | 489 EXPECT_EQ(1, result->GetData()[0]); |
463 } | 490 } |
464 | 491 |
465 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithStencil) { | 492 TEST_P(GLES2DecoderManualInitTest, StencilEnableWithStencil) { |
466 InitState init; | 493 InitState init; |
467 init.gl_version = "3.0"; | 494 init.gl_version = "3.0"; |
468 init.has_stencil = true; | 495 init.has_stencil = true; |
469 init.request_stencil = true; | 496 init.request_stencil = true; |
470 init.bind_generates_resource = true; | 497 init.bind_generates_resource = true; |
471 InitDecoder(init); | 498 InitDecoder(init); |
472 | 499 |
473 Enable cmd; | 500 Enable cmd; |
474 cmd.Init(GL_STENCIL_TEST); | 501 cmd.Init(GL_STENCIL_TEST); |
475 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 502 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
476 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 503 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
477 | 504 |
478 SetupDefaultProgram(); | 505 SetupDefaultProgram(); |
479 SetupTexture(); | 506 SetupTexture(); |
480 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 507 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
481 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB | 508 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
482 false, // Framebuffer has depth | 509 false, // Framebuffer has depth |
483 true, // Framebuffer has stencil | 510 true, // Framebuffer has stencil |
484 0x1110, // color bits | 511 0x1110, // color bits |
485 false, // depth mask | 512 false, // depth mask |
486 false, // depth enabled | 513 false, // depth enabled |
487 -1, // front stencil mask | 514 -1, // front stencil mask |
488 -1, // back stencil mask | 515 -1, // back stencil mask |
489 true, // stencil enabled | 516 true); // stencil enabled |
490 false, // cull_face_enabled | |
491 false, // scissor_test_enabled | |
492 false); // blend_enabled | |
493 | 517 |
494 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 518 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
495 .Times(1) | 519 .Times(1) |
496 .RetiresOnSaturation(); | 520 .RetiresOnSaturation(); |
497 DrawArrays draw_cmd; | 521 DrawArrays draw_cmd; |
498 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 522 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
499 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 523 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
500 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 524 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
501 | 525 |
502 EXPECT_CALL(*gl_, GetError()) | 526 EXPECT_CALL(*gl_, GetError()) |
503 .WillOnce(Return(GL_NO_ERROR)) | 527 .WillOnce(Return(GL_NO_ERROR)) |
504 .WillOnce(Return(GL_NO_ERROR)) | 528 .WillOnce(Return(GL_NO_ERROR)) |
505 .RetiresOnSaturation(); | 529 .RetiresOnSaturation(); |
506 typedef GetIntegerv::Result Result; | 530 typedef GetIntegerv::Result Result; |
507 Result* result = static_cast<Result*>(shared_memory_address_); | 531 Result* result = static_cast<Result*>(shared_memory_address_); |
508 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_TEST, _)) | 532 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_TEST, _)) |
509 .Times(0) | 533 .Times(0) |
510 .RetiresOnSaturation(); | 534 .RetiresOnSaturation(); |
511 result->size = 0; | 535 result->size = 0; |
512 GetIntegerv cmd2; | 536 GetIntegerv cmd2; |
513 cmd2.Init(GL_STENCIL_TEST, shared_memory_id_, shared_memory_offset_); | 537 cmd2.Init(GL_STENCIL_TEST, shared_memory_id_, shared_memory_offset_); |
514 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 538 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
515 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_TEST), | 539 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_TEST), |
516 result->GetNumResults()); | 540 result->GetNumResults()); |
517 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 541 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
518 EXPECT_EQ(1, result->GetData()[0]); | 542 EXPECT_EQ(1, result->GetData()[0]); |
519 } | 543 } |
520 | 544 |
521 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithoutRequestedStencil) { | 545 TEST_P(GLES2DecoderManualInitTest, StencilEnableWithoutRequestedStencil) { |
522 InitState init; | 546 InitState init; |
523 init.gl_version = "3.0"; | 547 init.gl_version = "3.0"; |
524 init.has_stencil = true; | 548 init.has_stencil = true; |
525 init.bind_generates_resource = true; | 549 init.bind_generates_resource = true; |
526 InitDecoder(init); | 550 InitDecoder(init); |
527 | 551 |
528 Enable cmd; | 552 Enable cmd; |
529 cmd.Init(GL_STENCIL_TEST); | 553 cmd.Init(GL_STENCIL_TEST); |
530 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 554 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
531 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 555 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
532 | 556 |
533 SetupDefaultProgram(); | 557 SetupDefaultProgram(); |
534 SetupTexture(); | 558 SetupTexture(); |
535 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 559 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
536 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB | 560 SetupExpectationsForApplyingDirtyState(true, // Framebuffer is RGB |
537 false, // Framebuffer has depth | 561 false, // Framebuffer has depth |
538 false, // Framebuffer has stencil | 562 false, // Framebuffer has stencil |
539 0x1110, // color bits | 563 0x1110, // color bits |
540 false, // depth mask | 564 false, // depth mask |
541 false, // depth enabled | 565 false, // depth enabled |
542 0, // front stencil mask | 566 0, // front stencil mask |
543 0, // back stencil mask | 567 0, // back stencil mask |
544 false, // stencil enabled | 568 false); // stencil enabled |
545 false, // cull_face_enabled | |
546 false, // scissor_test_enabled | |
547 false); // blend_enabled | |
548 | 569 |
549 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 570 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
550 .Times(1) | 571 .Times(1) |
551 .RetiresOnSaturation(); | 572 .RetiresOnSaturation(); |
552 DrawArrays draw_cmd; | 573 DrawArrays draw_cmd; |
553 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 574 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
554 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 575 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
555 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 576 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
556 | 577 |
557 EXPECT_CALL(*gl_, GetError()) | 578 EXPECT_CALL(*gl_, GetError()) |
558 .WillOnce(Return(GL_NO_ERROR)) | 579 .WillOnce(Return(GL_NO_ERROR)) |
559 .WillOnce(Return(GL_NO_ERROR)) | 580 .WillOnce(Return(GL_NO_ERROR)) |
560 .RetiresOnSaturation(); | 581 .RetiresOnSaturation(); |
561 typedef GetIntegerv::Result Result; | 582 typedef GetIntegerv::Result Result; |
562 Result* result = static_cast<Result*>(shared_memory_address_); | 583 Result* result = static_cast<Result*>(shared_memory_address_); |
563 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_TEST, _)) | 584 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_TEST, _)) |
564 .Times(0) | 585 .Times(0) |
565 .RetiresOnSaturation(); | 586 .RetiresOnSaturation(); |
566 result->size = 0; | 587 result->size = 0; |
567 GetIntegerv cmd2; | 588 GetIntegerv cmd2; |
568 cmd2.Init(GL_STENCIL_TEST, shared_memory_id_, shared_memory_offset_); | 589 cmd2.Init(GL_STENCIL_TEST, shared_memory_id_, shared_memory_offset_); |
569 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 590 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
570 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_TEST), | 591 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_TEST), |
571 result->GetNumResults()); | 592 result->GetNumResults()); |
572 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 593 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
573 EXPECT_EQ(1, result->GetData()[0]); | 594 EXPECT_EQ(1, result->GetData()[0]); |
574 } | 595 } |
575 | 596 |
576 TEST_F(GLES2DecoderWithShaderTest, DrawArraysNoAttributesSucceeds) { | 597 TEST_P(GLES2DecoderManualInitTest, CachedColorMask) { |
| 598 InitState init; |
| 599 init.gl_version = "3.0"; |
| 600 init.has_alpha = true; |
| 601 init.has_depth = true; |
| 602 init.has_stencil = true; |
| 603 init.request_alpha = true; |
| 604 init.request_depth = true; |
| 605 init.request_stencil = true; |
| 606 init.bind_generates_resource = true; |
| 607 InitDecoder(init); |
| 608 |
| 609 SetupDefaultProgram(); |
| 610 SetupAllNeededVertexBuffers(); |
| 611 SetupTexture(); |
| 612 |
| 613 // Test all color_bits combinations twice. |
| 614 for (int i = 0; i < 32; i++) { |
| 615 GLuint color_bits = (i & 1 ? 0x0001 : 0x0000) | (i & 2 ? 0x0010 : 0x0000) | |
| 616 (i & 4 ? 0x0100 : 0x0000) | (i & 8 ? 0x1000 : 0x0000); |
| 617 |
| 618 // Toggle depth_test to force ApplyDirtyState each time. |
| 619 DirtyStateMaskTest(color_bits, false, 0xffffffff, 0xffffffff); |
| 620 DirtyStateMaskTest(color_bits, true, 0xffffffff, 0xffffffff); |
| 621 DirtyStateMaskTest(color_bits, false, 0xffffffff, 0xffffffff); |
| 622 } |
| 623 } |
| 624 |
| 625 TEST_P(GLES2DecoderManualInitTest, CachedDepthMask) { |
| 626 InitState init; |
| 627 init.gl_version = "3.0"; |
| 628 init.has_alpha = true; |
| 629 init.has_depth = true; |
| 630 init.has_stencil = true; |
| 631 init.request_alpha = true; |
| 632 init.request_depth = true; |
| 633 init.request_stencil = true; |
| 634 init.bind_generates_resource = true; |
| 635 InitDecoder(init); |
| 636 |
| 637 SetupDefaultProgram(); |
| 638 SetupAllNeededVertexBuffers(); |
| 639 SetupTexture(); |
| 640 |
| 641 // Test all depth_mask combinations twice. |
| 642 for (int i = 0; i < 4; i++) { |
| 643 bool depth_mask = (i & 1) == 1; |
| 644 |
| 645 // Toggle color masks to force ApplyDirtyState each time. |
| 646 DirtyStateMaskTest(0x1010, depth_mask, 0xffffffff, 0xffffffff); |
| 647 DirtyStateMaskTest(0x0101, depth_mask, 0xffffffff, 0xffffffff); |
| 648 DirtyStateMaskTest(0x1010, depth_mask, 0xffffffff, 0xffffffff); |
| 649 } |
| 650 } |
| 651 |
| 652 TEST_P(GLES2DecoderManualInitTest, CachedStencilMask) { |
| 653 InitState init; |
| 654 init.gl_version = "3.0"; |
| 655 init.has_alpha = true; |
| 656 init.has_depth = true; |
| 657 init.has_stencil = true; |
| 658 init.request_alpha = true; |
| 659 init.request_depth = true; |
| 660 init.request_stencil = true; |
| 661 init.bind_generates_resource = true; |
| 662 InitDecoder(init); |
| 663 |
| 664 SetupDefaultProgram(); |
| 665 SetupAllNeededVertexBuffers(); |
| 666 SetupTexture(); |
| 667 |
| 668 // Test all stencil_mask combinations twice. |
| 669 for (int i = 0; i < 4; i++) { |
| 670 GLuint stencil_mask = (i & 1) ? 0xf0f0f0f0 : 0x0f0f0f0f; |
| 671 |
| 672 // Toggle color masks to force ApplyDirtyState each time. |
| 673 DirtyStateMaskTest(0x1010, true, stencil_mask, 0xffffffff); |
| 674 DirtyStateMaskTest(0x0101, true, stencil_mask, 0xffffffff); |
| 675 DirtyStateMaskTest(0x1010, true, stencil_mask, 0xffffffff); |
| 676 } |
| 677 |
| 678 for (int i = 0; i < 4; i++) { |
| 679 GLuint stencil_mask = (i & 1) ? 0xf0f0f0f0 : 0x0f0f0f0f; |
| 680 |
| 681 // Toggle color masks to force ApplyDirtyState each time. |
| 682 DirtyStateMaskTest(0x1010, true, 0xffffffff, stencil_mask); |
| 683 DirtyStateMaskTest(0x0101, true, 0xffffffff, stencil_mask); |
| 684 DirtyStateMaskTest(0x1010, true, 0xffffffff, stencil_mask); |
| 685 } |
| 686 } |
| 687 |
| 688 TEST_P(GLES2DecoderWithShaderTest, DrawArraysNoAttributesSucceeds) { |
577 SetupTexture(); | 689 SetupTexture(); |
578 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 690 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
579 SetupExpectationsForApplyingDefaultDirtyState(); | 691 SetupExpectationsForApplyingDefaultDirtyState(); |
580 | 692 |
581 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 693 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
582 .Times(1) | 694 .Times(1) |
583 .RetiresOnSaturation(); | 695 .RetiresOnSaturation(); |
584 DrawArrays cmd; | 696 DrawArrays cmd; |
585 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 697 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
586 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 698 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
587 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 699 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
588 } | 700 } |
589 | 701 |
590 // Tests when the math overflows (0x40000000 * sizeof GLfloat) | 702 // Tests when the math overflows (0x40000000 * sizeof GLfloat) |
591 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OverflowFails) { | 703 TEST_P(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OverflowFails) { |
592 const GLsizei kLargeCount = 0x40000000; | 704 const GLsizei kLargeCount = 0x40000000; |
593 SetupTexture(); | 705 SetupTexture(); |
594 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); | 706 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
595 DrawArrays cmd; | 707 DrawArrays cmd; |
596 cmd.Init(GL_TRIANGLES, 0, kLargeCount); | 708 cmd.Init(GL_TRIANGLES, 0, kLargeCount); |
597 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 709 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
598 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 710 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
599 EXPECT_FALSE(GetDecoder()->WasContextLost()); | 711 EXPECT_FALSE(GetDecoder()->WasContextLost()); |
600 } | 712 } |
601 | 713 |
602 // Tests when the math overflows (0x7FFFFFFF + 1 = 0x8000000 verts) | 714 // Tests when the math overflows (0x7FFFFFFF + 1 = 0x8000000 verts) |
603 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0PosToNegFails) { | 715 TEST_P(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0PosToNegFails) { |
604 const GLsizei kLargeCount = 0x7FFFFFFF; | 716 const GLsizei kLargeCount = 0x7FFFFFFF; |
605 SetupTexture(); | 717 SetupTexture(); |
606 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); | 718 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
607 DrawArrays cmd; | 719 DrawArrays cmd; |
608 cmd.Init(GL_TRIANGLES, 0, kLargeCount); | 720 cmd.Init(GL_TRIANGLES, 0, kLargeCount); |
609 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 721 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
610 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 722 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
611 EXPECT_FALSE(GetDecoder()->WasContextLost()); | 723 EXPECT_FALSE(GetDecoder()->WasContextLost()); |
612 } | 724 } |
613 | 725 |
614 // Tests when the driver returns an error | 726 // Tests when the driver returns an error |
615 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OOMFails) { | 727 TEST_P(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OOMFails) { |
616 const GLsizei kFakeLargeCount = 0x1234; | 728 const GLsizei kFakeLargeCount = 0x1234; |
617 SetupTexture(); | 729 SetupTexture(); |
618 AddExpectationsForSimulatedAttrib0WithError( | 730 AddExpectationsForSimulatedAttrib0WithError( |
619 kFakeLargeCount, 0, GL_OUT_OF_MEMORY); | 731 kFakeLargeCount, 0, GL_OUT_OF_MEMORY); |
620 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); | 732 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
621 DrawArrays cmd; | 733 DrawArrays cmd; |
622 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount); | 734 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount); |
623 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 735 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
624 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 736 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
625 EXPECT_FALSE(GetDecoder()->WasContextLost()); | 737 EXPECT_FALSE(GetDecoder()->WasContextLost()); |
626 } | 738 } |
627 | 739 |
628 // Test that we lose context. | 740 // Test that we lose context. |
629 TEST_F(GLES2DecoderManualInitTest, LoseContextWhenOOM) { | 741 TEST_P(GLES2DecoderManualInitTest, LoseContextWhenOOM) { |
630 InitState init; | 742 InitState init; |
631 init.gl_version = "3.0"; | 743 init.gl_version = "3.0"; |
632 init.has_alpha = true; | 744 init.has_alpha = true; |
633 init.has_depth = true; | 745 init.has_depth = true; |
634 init.request_alpha = true; | 746 init.request_alpha = true; |
635 init.request_depth = true; | 747 init.request_depth = true; |
636 init.bind_generates_resource = true; | 748 init.bind_generates_resource = true; |
637 init.lose_context_when_out_of_memory = true; | 749 init.lose_context_when_out_of_memory = true; |
638 InitDecoder(init); | 750 InitDecoder(init); |
639 SetupDefaultProgram(); | 751 SetupDefaultProgram(); |
640 | 752 |
641 const GLsizei kFakeLargeCount = 0x1234; | 753 const GLsizei kFakeLargeCount = 0x1234; |
642 SetupTexture(); | 754 SetupTexture(); |
643 AddExpectationsForSimulatedAttrib0WithError( | 755 AddExpectationsForSimulatedAttrib0WithError( |
644 kFakeLargeCount, 0, GL_OUT_OF_MEMORY); | 756 kFakeLargeCount, 0, GL_OUT_OF_MEMORY); |
645 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); | 757 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
646 // Other contexts in the group should be lost also. | 758 // Other contexts in the group should be lost also. |
647 EXPECT_CALL(*mock_decoder_, LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB)) | 759 EXPECT_CALL(*mock_decoder_, LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB)) |
648 .Times(1) | 760 .Times(1) |
649 .RetiresOnSaturation(); | 761 .RetiresOnSaturation(); |
650 DrawArrays cmd; | 762 DrawArrays cmd; |
651 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount); | 763 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount); |
652 // This context should be lost. | 764 // This context should be lost. |
653 EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd)); | 765 EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd)); |
654 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 766 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
655 EXPECT_TRUE(decoder_->WasContextLost()); | 767 EXPECT_TRUE(decoder_->WasContextLost()); |
656 } | 768 } |
657 | 769 |
658 TEST_F(GLES2DecoderWithShaderTest, DrawArraysBadTextureUsesBlack) { | 770 TEST_P(GLES2DecoderWithShaderTest, DrawArraysBadTextureUsesBlack) { |
659 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 771 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
660 // This is an NPOT texture. As the default filtering requires mips | 772 // This is an NPOT texture. As the default filtering requires mips |
661 // this should trigger replacing with black textures before rendering. | 773 // this should trigger replacing with black textures before rendering. |
662 DoTexImage2D(GL_TEXTURE_2D, | 774 DoTexImage2D(GL_TEXTURE_2D, |
663 0, | 775 0, |
664 GL_RGBA, | 776 GL_RGBA, |
665 3, | 777 3, |
666 1, | 778 1, |
667 0, | 779 0, |
668 GL_RGBA, | 780 GL_RGBA, |
(...skipping 23 matching lines...) Expand all Loading... |
692 .Times(1) | 804 .Times(1) |
693 .RetiresOnSaturation(); | 805 .RetiresOnSaturation(); |
694 } | 806 } |
695 SetupExpectationsForApplyingDefaultDirtyState(); | 807 SetupExpectationsForApplyingDefaultDirtyState(); |
696 DrawArrays cmd; | 808 DrawArrays cmd; |
697 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 809 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
698 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 810 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
699 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 811 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
700 } | 812 } |
701 | 813 |
702 TEST_F(GLES2DecoderWithShaderTest, DrawArraysMissingAttributesFails) { | 814 TEST_P(GLES2DecoderWithShaderTest, DrawArraysMissingAttributesFails) { |
703 DoEnableVertexAttribArray(1); | 815 DoEnableVertexAttribArray(1); |
704 | 816 |
705 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); | 817 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); |
706 DrawArrays cmd; | 818 DrawArrays cmd; |
707 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 819 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
708 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 820 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
709 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 821 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
710 } | 822 } |
711 | 823 |
712 TEST_F(GLES2DecoderWithShaderTest, | 824 TEST_P(GLES2DecoderWithShaderTest, |
713 DrawArraysMissingAttributesZeroCountSucceeds) { | 825 DrawArraysMissingAttributesZeroCountSucceeds) { |
714 DoEnableVertexAttribArray(1); | 826 DoEnableVertexAttribArray(1); |
715 | 827 |
716 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); | 828 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); |
717 DrawArrays cmd; | 829 DrawArrays cmd; |
718 cmd.Init(GL_TRIANGLES, 0, 0); | 830 cmd.Init(GL_TRIANGLES, 0, 0); |
719 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 831 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
720 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 832 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
721 } | 833 } |
722 | 834 |
723 TEST_F(GLES2DecoderWithShaderTest, DrawArraysValidAttributesSucceeds) { | 835 TEST_P(GLES2DecoderWithShaderTest, DrawArraysValidAttributesSucceeds) { |
724 SetupTexture(); | 836 SetupTexture(); |
725 SetupVertexBuffer(); | 837 SetupVertexBuffer(); |
726 DoEnableVertexAttribArray(1); | 838 DoEnableVertexAttribArray(1); |
727 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 839 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
728 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); | 840 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
729 SetupExpectationsForApplyingDefaultDirtyState(); | 841 SetupExpectationsForApplyingDefaultDirtyState(); |
730 | 842 |
731 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 843 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
732 .Times(1) | 844 .Times(1) |
733 .RetiresOnSaturation(); | 845 .RetiresOnSaturation(); |
734 DrawArrays cmd; | 846 DrawArrays cmd; |
735 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 847 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
736 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 848 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
737 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 849 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
738 } | 850 } |
739 | 851 |
740 // Same as DrawArraysValidAttributesSucceeds, but with workaround | 852 // Same as DrawArraysValidAttributesSucceeds, but with workaround |
741 // |init_vertex_attributes|. | 853 // |init_vertex_attributes|. |
742 TEST_F(GLES2DecoderManualInitTest, InitVertexAttributes) { | 854 TEST_P(GLES2DecoderManualInitTest, InitVertexAttributes) { |
743 CommandLine command_line(0, NULL); | 855 CommandLine command_line(0, NULL); |
744 command_line.AppendSwitchASCII( | 856 command_line.AppendSwitchASCII( |
745 switches::kGpuDriverBugWorkarounds, | 857 switches::kGpuDriverBugWorkarounds, |
746 base::IntToString(gpu::INIT_VERTEX_ATTRIBUTES)); | 858 base::IntToString(gpu::INIT_VERTEX_ATTRIBUTES)); |
747 InitState init; | 859 InitState init; |
748 init.gl_version = "3.0"; | 860 init.gl_version = "3.0"; |
749 init.has_alpha = true; | 861 init.has_alpha = true; |
750 init.has_depth = true; | 862 init.has_depth = true; |
751 init.request_alpha = true; | 863 init.request_alpha = true; |
752 init.request_depth = true; | 864 init.request_depth = true; |
753 init.bind_generates_resource = true; | 865 init.bind_generates_resource = true; |
754 InitDecoderWithCommandLine(init, &command_line); | 866 InitDecoderWithCommandLine(init, &command_line); |
755 SetupDefaultProgram(); | 867 SetupDefaultProgram(); |
756 SetupTexture(); | 868 SetupTexture(); |
757 SetupVertexBuffer(); | 869 SetupVertexBuffer(); |
758 DoEnableVertexAttribArray(1); | 870 DoEnableVertexAttribArray(1); |
759 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 871 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
760 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); | 872 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
761 SetupExpectationsForApplyingDefaultDirtyState(); | 873 SetupExpectationsForApplyingDefaultDirtyState(); |
762 | 874 |
763 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 875 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
764 .Times(1) | 876 .Times(1) |
765 .RetiresOnSaturation(); | 877 .RetiresOnSaturation(); |
766 DrawArrays cmd; | 878 DrawArrays cmd; |
767 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 879 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
768 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 880 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
769 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 881 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
770 } | 882 } |
771 | 883 |
772 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedBufferFails) { | 884 TEST_P(GLES2DecoderWithShaderTest, DrawArraysDeletedBufferFails) { |
773 SetupVertexBuffer(); | 885 SetupVertexBuffer(); |
774 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 886 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
775 DeleteVertexBuffer(); | 887 DeleteVertexBuffer(); |
776 | 888 |
777 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); | 889 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); |
778 DrawArrays cmd; | 890 DrawArrays cmd; |
779 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 891 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
780 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 892 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
781 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 893 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
782 } | 894 } |
783 | 895 |
784 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedProgramSucceeds) { | 896 TEST_P(GLES2DecoderWithShaderTest, DrawArraysDeletedProgramSucceeds) { |
785 SetupTexture(); | 897 SetupTexture(); |
786 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 898 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
787 SetupExpectationsForApplyingDefaultDirtyState(); | 899 SetupExpectationsForApplyingDefaultDirtyState(); |
788 DoDeleteProgram(client_program_id_, kServiceProgramId); | 900 DoDeleteProgram(client_program_id_, kServiceProgramId); |
789 | 901 |
790 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(1).RetiresOnSaturation(); | 902 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(1).RetiresOnSaturation(); |
791 EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId)).Times(1); | 903 EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId)).Times(1); |
792 DrawArrays cmd; | 904 DrawArrays cmd; |
793 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 905 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
794 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 906 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
795 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 907 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
796 } | 908 } |
797 | 909 |
798 TEST_F(GLES2DecoderWithShaderTest, DrawArraysWithInvalidModeFails) { | 910 TEST_P(GLES2DecoderWithShaderTest, DrawArraysWithInvalidModeFails) { |
799 SetupVertexBuffer(); | 911 SetupVertexBuffer(); |
800 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 912 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
801 | 913 |
802 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); | 914 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); |
803 DrawArrays cmd; | 915 DrawArrays cmd; |
804 cmd.Init(GL_QUADS, 0, 1); | 916 cmd.Init(GL_QUADS, 0, 1); |
805 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 917 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
806 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 918 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
807 cmd.Init(GL_POLYGON, 0, 1); | 919 cmd.Init(GL_POLYGON, 0, 1); |
808 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 920 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
809 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 921 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
810 } | 922 } |
811 | 923 |
812 TEST_F(GLES2DecoderWithShaderTest, DrawArraysInvalidCountFails) { | 924 TEST_P(GLES2DecoderWithShaderTest, DrawArraysInvalidCountFails) { |
813 SetupVertexBuffer(); | 925 SetupVertexBuffer(); |
814 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 926 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
815 | 927 |
816 // Try start > 0 | 928 // Try start > 0 |
817 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); | 929 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0); |
818 DrawArrays cmd; | 930 DrawArrays cmd; |
819 cmd.Init(GL_TRIANGLES, 1, kNumVertices); | 931 cmd.Init(GL_TRIANGLES, 1, kNumVertices); |
820 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 932 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
821 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 933 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
822 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 934 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
(...skipping 17 matching lines...) Expand all Loading... |
840 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 952 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
841 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 953 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
842 | 954 |
843 // Try with stride > 8 (vec2 + vec2 byte) | 955 // Try with stride > 8 (vec2 + vec2 byte) |
844 DoVertexAttribPointer(1, 2, GL_FLOAT, sizeof(GLfloat) * 3, 0); | 956 DoVertexAttribPointer(1, 2, GL_FLOAT, sizeof(GLfloat) * 3, 0); |
845 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 957 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
846 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 958 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
847 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 959 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
848 } | 960 } |
849 | 961 |
850 TEST_F(GLES2DecoderWithShaderTest, DrawArraysInstancedANGLEFails) { | 962 TEST_P(GLES2DecoderWithShaderTest, DrawArraysInstancedANGLEFails) { |
851 SetupTexture(); | 963 SetupTexture(); |
852 SetupVertexBuffer(); | 964 SetupVertexBuffer(); |
853 DoEnableVertexAttribArray(1); | 965 DoEnableVertexAttribArray(1); |
854 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 966 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
855 | 967 |
856 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) | 968 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) |
857 .Times(0) | 969 .Times(0) |
858 .RetiresOnSaturation(); | 970 .RetiresOnSaturation(); |
859 DrawArraysInstancedANGLE cmd; | 971 DrawArraysInstancedANGLE cmd; |
860 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); | 972 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); |
861 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 973 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
862 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 974 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
863 } | 975 } |
864 | 976 |
865 TEST_F(GLES2DecoderGeometryInstancingTest, | 977 TEST_P(GLES2DecoderGeometryInstancingTest, |
866 DrawArraysInstancedANGLENoAttributesFails) { | 978 DrawArraysInstancedANGLENoAttributesFails) { |
867 SetupTexture(); | 979 SetupTexture(); |
868 | 980 |
869 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) | 981 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) |
870 .Times(0) | 982 .Times(0) |
871 .RetiresOnSaturation(); | 983 .RetiresOnSaturation(); |
872 DrawArraysInstancedANGLE cmd; | 984 DrawArraysInstancedANGLE cmd; |
873 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); | 985 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); |
874 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 986 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
875 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 987 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
876 } | 988 } |
877 | 989 |
878 TEST_F(GLES2DecoderGeometryInstancingTest, | 990 TEST_P(GLES2DecoderGeometryInstancingTest, |
879 DrawArraysInstancedANGLESimulatedAttrib0) { | 991 DrawArraysInstancedANGLESimulatedAttrib0) { |
880 SetupTexture(); | 992 SetupTexture(); |
881 SetupVertexBuffer(); | 993 SetupVertexBuffer(); |
882 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 994 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
883 | 995 |
884 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); | 996 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
885 SetupExpectationsForApplyingDefaultDirtyState(); | 997 SetupExpectationsForApplyingDefaultDirtyState(); |
886 | 998 |
887 DoVertexAttribDivisorANGLE(0, 1); | 999 DoVertexAttribDivisorANGLE(0, 1); |
888 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, 3)) | 1000 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, 3)) |
889 .Times(1) | 1001 .Times(1) |
890 .RetiresOnSaturation(); | 1002 .RetiresOnSaturation(); |
891 EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 0)) | 1003 EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 0)) |
892 .Times(1) | 1004 .Times(1) |
893 .RetiresOnSaturation(); | 1005 .RetiresOnSaturation(); |
894 EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 1)) | 1006 EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 1)) |
895 .Times(1) | 1007 .Times(1) |
896 .RetiresOnSaturation(); | 1008 .RetiresOnSaturation(); |
897 DrawArraysInstancedANGLE cmd; | 1009 DrawArraysInstancedANGLE cmd; |
898 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 3); | 1010 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 3); |
899 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1011 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
900 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1012 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
901 } | 1013 } |
902 | 1014 |
903 TEST_F(GLES2DecoderGeometryInstancingTest, | 1015 TEST_P(GLES2DecoderGeometryInstancingTest, |
904 DrawArraysInstancedANGLEMissingAttributesFails) { | 1016 DrawArraysInstancedANGLEMissingAttributesFails) { |
905 DoEnableVertexAttribArray(1); | 1017 DoEnableVertexAttribArray(1); |
906 | 1018 |
907 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); | 1019 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); |
908 DrawArraysInstancedANGLE cmd; | 1020 DrawArraysInstancedANGLE cmd; |
909 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); | 1021 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); |
910 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1022 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
911 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1023 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
912 } | 1024 } |
913 | 1025 |
914 TEST_F(GLES2DecoderGeometryInstancingTest, | 1026 TEST_P(GLES2DecoderGeometryInstancingTest, |
915 DrawArraysInstancedANGLEMissingAttributesZeroCountSucceeds) { | 1027 DrawArraysInstancedANGLEMissingAttributesZeroCountSucceeds) { |
916 DoEnableVertexAttribArray(1); | 1028 DoEnableVertexAttribArray(1); |
917 | 1029 |
918 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); | 1030 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); |
919 DrawArraysInstancedANGLE cmd; | 1031 DrawArraysInstancedANGLE cmd; |
920 cmd.Init(GL_TRIANGLES, 0, 0, 1); | 1032 cmd.Init(GL_TRIANGLES, 0, 0, 1); |
921 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1033 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
922 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1034 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
923 } | 1035 } |
924 | 1036 |
925 TEST_F(GLES2DecoderGeometryInstancingTest, | 1037 TEST_P(GLES2DecoderGeometryInstancingTest, |
926 DrawArraysInstancedANGLEValidAttributesSucceeds) { | 1038 DrawArraysInstancedANGLEValidAttributesSucceeds) { |
927 SetupTexture(); | 1039 SetupTexture(); |
928 SetupVertexBuffer(); | 1040 SetupVertexBuffer(); |
929 DoEnableVertexAttribArray(1); | 1041 DoEnableVertexAttribArray(1); |
930 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1042 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
931 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); | 1043 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
932 SetupExpectationsForApplyingDefaultDirtyState(); | 1044 SetupExpectationsForApplyingDefaultDirtyState(); |
933 | 1045 |
934 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, 1)) | 1046 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, 1)) |
935 .Times(1) | 1047 .Times(1) |
936 .RetiresOnSaturation(); | 1048 .RetiresOnSaturation(); |
937 DrawArraysInstancedANGLE cmd; | 1049 DrawArraysInstancedANGLE cmd; |
938 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); | 1050 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); |
939 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1051 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
940 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1052 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
941 } | 1053 } |
942 | 1054 |
943 TEST_F(GLES2DecoderGeometryInstancingTest, | 1055 TEST_P(GLES2DecoderGeometryInstancingTest, |
944 DrawArraysInstancedANGLEWithInvalidModeFails) { | 1056 DrawArraysInstancedANGLEWithInvalidModeFails) { |
945 SetupVertexBuffer(); | 1057 SetupVertexBuffer(); |
946 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1058 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
947 | 1059 |
948 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); | 1060 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); |
949 DrawArraysInstancedANGLE cmd; | 1061 DrawArraysInstancedANGLE cmd; |
950 cmd.Init(GL_QUADS, 0, 1, 1); | 1062 cmd.Init(GL_QUADS, 0, 1, 1); |
951 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1063 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
952 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 1064 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
953 cmd.Init(GL_POLYGON, 0, 1, 1); | 1065 cmd.Init(GL_POLYGON, 0, 1, 1); |
954 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1066 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
955 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 1067 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
956 } | 1068 } |
957 | 1069 |
958 TEST_F(GLES2DecoderGeometryInstancingTest, | 1070 TEST_P(GLES2DecoderGeometryInstancingTest, |
959 DrawArraysInstancedANGLEInvalidPrimcountFails) { | 1071 DrawArraysInstancedANGLEInvalidPrimcountFails) { |
960 SetupVertexBuffer(); | 1072 SetupVertexBuffer(); |
961 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1073 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
962 | 1074 |
963 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); | 1075 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)).Times(0); |
964 DrawArraysInstancedANGLE cmd; | 1076 DrawArraysInstancedANGLE cmd; |
965 cmd.Init(GL_TRIANGLES, 0, 1, -1); | 1077 cmd.Init(GL_TRIANGLES, 0, 1, -1); |
966 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1078 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
967 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1079 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
968 } | 1080 } |
969 | 1081 |
970 // Per-instance data is twice as large, but number of instances is half | 1082 // Per-instance data is twice as large, but number of instances is half |
971 TEST_F(GLES2DecoderGeometryInstancingTest, | 1083 TEST_P(GLES2DecoderGeometryInstancingTest, |
972 DrawArraysInstancedANGLELargeInstanceSucceeds) { | 1084 DrawArraysInstancedANGLELargeInstanceSucceeds) { |
973 SetupTexture(); | 1085 SetupTexture(); |
974 SetupVertexBuffer(); | 1086 SetupVertexBuffer(); |
975 SetupExpectationsForApplyingDefaultDirtyState(); | 1087 SetupExpectationsForApplyingDefaultDirtyState(); |
976 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1088 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
977 | 1089 |
978 DoEnableVertexAttribArray(0); | 1090 DoEnableVertexAttribArray(0); |
979 DoVertexAttribPointer(0, 4, GL_FLOAT, 0, 0); | 1091 DoVertexAttribPointer(0, 4, GL_FLOAT, 0, 0); |
980 DoVertexAttribDivisorANGLE(0, 1); | 1092 DoVertexAttribDivisorANGLE(0, 1); |
981 EXPECT_CALL( | 1093 EXPECT_CALL( |
982 *gl_, | 1094 *gl_, |
983 DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, kNumVertices / 2)) | 1095 DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, kNumVertices / 2)) |
984 .Times(1) | 1096 .Times(1) |
985 .RetiresOnSaturation(); | 1097 .RetiresOnSaturation(); |
986 DrawArraysInstancedANGLE cmd; | 1098 DrawArraysInstancedANGLE cmd; |
987 cmd.Init(GL_TRIANGLES, 0, kNumVertices, kNumVertices / 2); | 1099 cmd.Init(GL_TRIANGLES, 0, kNumVertices, kNumVertices / 2); |
988 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1100 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
989 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1101 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
990 } | 1102 } |
991 | 1103 |
992 // Per-instance data is twice as large, but divisor is twice | 1104 // Per-instance data is twice as large, but divisor is twice |
993 TEST_F(GLES2DecoderGeometryInstancingTest, | 1105 TEST_P(GLES2DecoderGeometryInstancingTest, |
994 DrawArraysInstancedANGLELargeDivisorSucceeds) { | 1106 DrawArraysInstancedANGLELargeDivisorSucceeds) { |
995 SetupTexture(); | 1107 SetupTexture(); |
996 SetupVertexBuffer(); | 1108 SetupVertexBuffer(); |
997 SetupExpectationsForApplyingDefaultDirtyState(); | 1109 SetupExpectationsForApplyingDefaultDirtyState(); |
998 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1110 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
999 | 1111 |
1000 DoEnableVertexAttribArray(0); | 1112 DoEnableVertexAttribArray(0); |
1001 DoVertexAttribPointer(0, 4, GL_FLOAT, 0, 0); | 1113 DoVertexAttribPointer(0, 4, GL_FLOAT, 0, 0); |
1002 DoVertexAttribDivisorANGLE(0, 2); | 1114 DoVertexAttribDivisorANGLE(0, 2); |
1003 EXPECT_CALL( | 1115 EXPECT_CALL( |
1004 *gl_, | 1116 *gl_, |
1005 DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, kNumVertices)) | 1117 DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, kNumVertices)) |
1006 .Times(1) | 1118 .Times(1) |
1007 .RetiresOnSaturation(); | 1119 .RetiresOnSaturation(); |
1008 DrawArraysInstancedANGLE cmd; | 1120 DrawArraysInstancedANGLE cmd; |
1009 cmd.Init(GL_TRIANGLES, 0, kNumVertices, kNumVertices); | 1121 cmd.Init(GL_TRIANGLES, 0, kNumVertices, kNumVertices); |
1010 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1122 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1011 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1123 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1012 } | 1124 } |
1013 | 1125 |
1014 TEST_F(GLES2DecoderGeometryInstancingTest, DrawArraysInstancedANGLELargeFails) { | 1126 TEST_P(GLES2DecoderGeometryInstancingTest, DrawArraysInstancedANGLELargeFails) { |
1015 SetupTexture(); | 1127 SetupTexture(); |
1016 SetupVertexBuffer(); | 1128 SetupVertexBuffer(); |
1017 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1129 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1018 | 1130 |
1019 DoEnableVertexAttribArray(0); | 1131 DoEnableVertexAttribArray(0); |
1020 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); | 1132 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
1021 DoVertexAttribDivisorANGLE(0, 1); | 1133 DoVertexAttribDivisorANGLE(0, 1); |
1022 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) | 1134 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) |
1023 .Times(0) | 1135 .Times(0) |
1024 .RetiresOnSaturation(); | 1136 .RetiresOnSaturation(); |
1025 DrawArraysInstancedANGLE cmd; | 1137 DrawArraysInstancedANGLE cmd; |
1026 cmd.Init(GL_TRIANGLES, 0, kNumVertices, kNumVertices + 1); | 1138 cmd.Init(GL_TRIANGLES, 0, kNumVertices, kNumVertices + 1); |
1027 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1139 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1028 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1140 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1029 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1141 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1030 | 1142 |
1031 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) | 1143 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) |
1032 .Times(0) | 1144 .Times(0) |
1033 .RetiresOnSaturation(); | 1145 .RetiresOnSaturation(); |
1034 cmd.Init(GL_TRIANGLES, 0, kNumVertices + 1, kNumVertices); | 1146 cmd.Init(GL_TRIANGLES, 0, kNumVertices + 1, kNumVertices); |
1035 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1147 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1036 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1148 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1037 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1149 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1038 } | 1150 } |
1039 | 1151 |
1040 // Per-index data is twice as large, but number of indices is half | 1152 // Per-index data is twice as large, but number of indices is half |
1041 TEST_F(GLES2DecoderGeometryInstancingTest, | 1153 TEST_P(GLES2DecoderGeometryInstancingTest, |
1042 DrawArraysInstancedANGLELargeIndexSucceeds) { | 1154 DrawArraysInstancedANGLELargeIndexSucceeds) { |
1043 SetupTexture(); | 1155 SetupTexture(); |
1044 SetupVertexBuffer(); | 1156 SetupVertexBuffer(); |
1045 SetupExpectationsForApplyingDefaultDirtyState(); | 1157 SetupExpectationsForApplyingDefaultDirtyState(); |
1046 DoVertexAttribPointer(1, 4, GL_FLOAT, 0, 0); | 1158 DoVertexAttribPointer(1, 4, GL_FLOAT, 0, 0); |
1047 | 1159 |
1048 DoEnableVertexAttribArray(0); | 1160 DoEnableVertexAttribArray(0); |
1049 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); | 1161 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
1050 DoVertexAttribDivisorANGLE(0, 1); | 1162 DoVertexAttribDivisorANGLE(0, 1); |
1051 EXPECT_CALL( | 1163 EXPECT_CALL( |
1052 *gl_, | 1164 *gl_, |
1053 DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices / 2, kNumVertices)) | 1165 DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices / 2, kNumVertices)) |
1054 .Times(1) | 1166 .Times(1) |
1055 .RetiresOnSaturation(); | 1167 .RetiresOnSaturation(); |
1056 DrawArraysInstancedANGLE cmd; | 1168 DrawArraysInstancedANGLE cmd; |
1057 cmd.Init(GL_TRIANGLES, 0, kNumVertices / 2, kNumVertices); | 1169 cmd.Init(GL_TRIANGLES, 0, kNumVertices / 2, kNumVertices); |
1058 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1170 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1059 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1171 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1060 } | 1172 } |
1061 | 1173 |
1062 TEST_F(GLES2DecoderGeometryInstancingTest, | 1174 TEST_P(GLES2DecoderGeometryInstancingTest, |
1063 DrawArraysInstancedANGLENoDivisor0Fails) { | 1175 DrawArraysInstancedANGLENoDivisor0Fails) { |
1064 SetupTexture(); | 1176 SetupTexture(); |
1065 SetupVertexBuffer(); | 1177 SetupVertexBuffer(); |
1066 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1178 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1067 | 1179 |
1068 DoEnableVertexAttribArray(0); | 1180 DoEnableVertexAttribArray(0); |
1069 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); | 1181 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
1070 DoVertexAttribDivisorANGLE(0, 1); | 1182 DoVertexAttribDivisorANGLE(0, 1); |
1071 DoVertexAttribDivisorANGLE(1, 1); | 1183 DoVertexAttribDivisorANGLE(1, 1); |
1072 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) | 1184 EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(_, _, _, _)) |
1073 .Times(0) | 1185 .Times(0) |
1074 .RetiresOnSaturation(); | 1186 .RetiresOnSaturation(); |
1075 DrawArraysInstancedANGLE cmd; | 1187 DrawArraysInstancedANGLE cmd; |
1076 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); | 1188 cmd.Init(GL_TRIANGLES, 0, kNumVertices, 1); |
1077 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1189 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1078 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1190 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1079 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1191 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1080 } | 1192 } |
1081 | 1193 |
1082 TEST_F(GLES2DecoderWithShaderTest, DrawElementsNoAttributesSucceeds) { | 1194 TEST_P(GLES2DecoderWithShaderTest, DrawElementsNoAttributesSucceeds) { |
1083 SetupTexture(); | 1195 SetupTexture(); |
1084 SetupIndexBuffer(); | 1196 SetupIndexBuffer(); |
1085 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); | 1197 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); |
1086 SetupExpectationsForApplyingDefaultDirtyState(); | 1198 SetupExpectationsForApplyingDefaultDirtyState(); |
1087 EXPECT_CALL(*gl_, | 1199 EXPECT_CALL(*gl_, |
1088 DrawElements(GL_TRIANGLES, | 1200 DrawElements(GL_TRIANGLES, |
1089 kValidIndexRangeCount, | 1201 kValidIndexRangeCount, |
1090 GL_UNSIGNED_SHORT, | 1202 GL_UNSIGNED_SHORT, |
1091 BufferOffset(kValidIndexRangeStart * 2))) | 1203 BufferOffset(kValidIndexRangeStart * 2))) |
1092 .Times(1) | 1204 .Times(1) |
1093 .RetiresOnSaturation(); | 1205 .RetiresOnSaturation(); |
1094 DrawElements cmd; | 1206 DrawElements cmd; |
1095 cmd.Init(GL_TRIANGLES, | 1207 cmd.Init(GL_TRIANGLES, |
1096 kValidIndexRangeCount, | 1208 kValidIndexRangeCount, |
1097 GL_UNSIGNED_SHORT, | 1209 GL_UNSIGNED_SHORT, |
1098 kValidIndexRangeStart * 2); | 1210 kValidIndexRangeStart * 2); |
1099 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1211 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1100 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1212 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1101 } | 1213 } |
1102 | 1214 |
1103 TEST_F(GLES2DecoderWithShaderTest, DrawElementsMissingAttributesFails) { | 1215 TEST_P(GLES2DecoderWithShaderTest, DrawElementsMissingAttributesFails) { |
1104 SetupIndexBuffer(); | 1216 SetupIndexBuffer(); |
1105 DoEnableVertexAttribArray(1); | 1217 DoEnableVertexAttribArray(1); |
1106 | 1218 |
1107 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); | 1219 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
1108 DrawElements cmd; | 1220 DrawElements cmd; |
1109 cmd.Init(GL_TRIANGLES, | 1221 cmd.Init(GL_TRIANGLES, |
1110 kValidIndexRangeCount, | 1222 kValidIndexRangeCount, |
1111 GL_UNSIGNED_SHORT, | 1223 GL_UNSIGNED_SHORT, |
1112 kValidIndexRangeStart * 2); | 1224 kValidIndexRangeStart * 2); |
1113 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1225 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1114 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1226 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1115 } | 1227 } |
1116 | 1228 |
1117 TEST_F(GLES2DecoderWithShaderTest, | 1229 TEST_P(GLES2DecoderWithShaderTest, |
1118 DrawElementsMissingAttributesZeroCountSucceeds) { | 1230 DrawElementsMissingAttributesZeroCountSucceeds) { |
1119 SetupIndexBuffer(); | 1231 SetupIndexBuffer(); |
1120 DoEnableVertexAttribArray(1); | 1232 DoEnableVertexAttribArray(1); |
1121 | 1233 |
1122 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); | 1234 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
1123 DrawElements cmd; | 1235 DrawElements cmd; |
1124 cmd.Init(GL_TRIANGLES, 0, GL_UNSIGNED_SHORT, kValidIndexRangeStart * 2); | 1236 cmd.Init(GL_TRIANGLES, 0, GL_UNSIGNED_SHORT, kValidIndexRangeStart * 2); |
1125 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1237 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1126 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1238 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1127 } | 1239 } |
1128 | 1240 |
1129 TEST_F(GLES2DecoderWithShaderTest, DrawElementsExtraAttributesFails) { | 1241 TEST_P(GLES2DecoderWithShaderTest, DrawElementsExtraAttributesFails) { |
1130 SetupIndexBuffer(); | 1242 SetupIndexBuffer(); |
1131 DoEnableVertexAttribArray(6); | 1243 DoEnableVertexAttribArray(6); |
1132 | 1244 |
1133 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); | 1245 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
1134 DrawElements cmd; | 1246 DrawElements cmd; |
1135 cmd.Init(GL_TRIANGLES, | 1247 cmd.Init(GL_TRIANGLES, |
1136 kValidIndexRangeCount, | 1248 kValidIndexRangeCount, |
1137 GL_UNSIGNED_SHORT, | 1249 GL_UNSIGNED_SHORT, |
1138 kValidIndexRangeStart * 2); | 1250 kValidIndexRangeStart * 2); |
1139 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1251 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1140 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1252 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1141 } | 1253 } |
1142 | 1254 |
1143 TEST_F(GLES2DecoderWithShaderTest, DrawElementsValidAttributesSucceeds) { | 1255 TEST_P(GLES2DecoderWithShaderTest, DrawElementsValidAttributesSucceeds) { |
1144 SetupTexture(); | 1256 SetupTexture(); |
1145 SetupVertexBuffer(); | 1257 SetupVertexBuffer(); |
1146 SetupIndexBuffer(); | 1258 SetupIndexBuffer(); |
1147 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1259 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1148 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); | 1260 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); |
1149 SetupExpectationsForApplyingDefaultDirtyState(); | 1261 SetupExpectationsForApplyingDefaultDirtyState(); |
1150 | 1262 |
1151 EXPECT_CALL(*gl_, | 1263 EXPECT_CALL(*gl_, |
1152 DrawElements(GL_TRIANGLES, | 1264 DrawElements(GL_TRIANGLES, |
1153 kValidIndexRangeCount, | 1265 kValidIndexRangeCount, |
1154 GL_UNSIGNED_SHORT, | 1266 GL_UNSIGNED_SHORT, |
1155 BufferOffset(kValidIndexRangeStart * 2))) | 1267 BufferOffset(kValidIndexRangeStart * 2))) |
1156 .Times(1) | 1268 .Times(1) |
1157 .RetiresOnSaturation(); | 1269 .RetiresOnSaturation(); |
1158 DrawElements cmd; | 1270 DrawElements cmd; |
1159 cmd.Init(GL_TRIANGLES, | 1271 cmd.Init(GL_TRIANGLES, |
1160 kValidIndexRangeCount, | 1272 kValidIndexRangeCount, |
1161 GL_UNSIGNED_SHORT, | 1273 GL_UNSIGNED_SHORT, |
1162 kValidIndexRangeStart * 2); | 1274 kValidIndexRangeStart * 2); |
1163 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1275 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1164 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1276 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1165 } | 1277 } |
1166 | 1278 |
1167 TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedBufferFails) { | 1279 TEST_P(GLES2DecoderWithShaderTest, DrawElementsDeletedBufferFails) { |
1168 SetupVertexBuffer(); | 1280 SetupVertexBuffer(); |
1169 SetupIndexBuffer(); | 1281 SetupIndexBuffer(); |
1170 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1282 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1171 DeleteIndexBuffer(); | 1283 DeleteIndexBuffer(); |
1172 | 1284 |
1173 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); | 1285 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
1174 DrawElements cmd; | 1286 DrawElements cmd; |
1175 cmd.Init(GL_TRIANGLES, | 1287 cmd.Init(GL_TRIANGLES, |
1176 kValidIndexRangeCount, | 1288 kValidIndexRangeCount, |
1177 GL_UNSIGNED_SHORT, | 1289 GL_UNSIGNED_SHORT, |
1178 kValidIndexRangeStart * 2); | 1290 kValidIndexRangeStart * 2); |
1179 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1291 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1180 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1292 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1181 } | 1293 } |
1182 | 1294 |
1183 TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedProgramSucceeds) { | 1295 TEST_P(GLES2DecoderWithShaderTest, DrawElementsDeletedProgramSucceeds) { |
1184 SetupTexture(); | 1296 SetupTexture(); |
1185 SetupIndexBuffer(); | 1297 SetupIndexBuffer(); |
1186 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); | 1298 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); |
1187 SetupExpectationsForApplyingDefaultDirtyState(); | 1299 SetupExpectationsForApplyingDefaultDirtyState(); |
1188 DoDeleteProgram(client_program_id_, kServiceProgramId); | 1300 DoDeleteProgram(client_program_id_, kServiceProgramId); |
1189 | 1301 |
1190 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(1); | 1302 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(1); |
1191 EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId)).Times(1); | 1303 EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId)).Times(1); |
1192 DrawElements cmd; | 1304 DrawElements cmd; |
1193 cmd.Init(GL_TRIANGLES, | 1305 cmd.Init(GL_TRIANGLES, |
1194 kValidIndexRangeCount, | 1306 kValidIndexRangeCount, |
1195 GL_UNSIGNED_SHORT, | 1307 GL_UNSIGNED_SHORT, |
1196 kValidIndexRangeStart * 2); | 1308 kValidIndexRangeStart * 2); |
1197 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1309 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1198 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1310 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1199 } | 1311 } |
1200 | 1312 |
1201 TEST_F(GLES2DecoderWithShaderTest, DrawElementsWithInvalidModeFails) { | 1313 TEST_P(GLES2DecoderWithShaderTest, DrawElementsWithInvalidModeFails) { |
1202 SetupVertexBuffer(); | 1314 SetupVertexBuffer(); |
1203 SetupIndexBuffer(); | 1315 SetupIndexBuffer(); |
1204 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1316 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1205 | 1317 |
1206 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); | 1318 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
1207 DrawElements cmd; | 1319 DrawElements cmd; |
1208 cmd.Init(GL_QUADS, | 1320 cmd.Init(GL_QUADS, |
1209 kValidIndexRangeCount, | 1321 kValidIndexRangeCount, |
1210 GL_UNSIGNED_SHORT, | 1322 GL_UNSIGNED_SHORT, |
1211 kValidIndexRangeStart * 2); | 1323 kValidIndexRangeStart * 2); |
1212 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1324 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1213 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 1325 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
1214 cmd.Init(GL_POLYGON, | 1326 cmd.Init(GL_POLYGON, |
1215 kValidIndexRangeCount, | 1327 kValidIndexRangeCount, |
1216 GL_UNSIGNED_SHORT, | 1328 GL_UNSIGNED_SHORT, |
1217 kValidIndexRangeStart); | 1329 kValidIndexRangeStart); |
1218 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1330 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1219 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 1331 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
1220 } | 1332 } |
1221 | 1333 |
1222 TEST_F(GLES2DecoderWithShaderTest, DrawElementsInvalidCountFails) { | 1334 TEST_P(GLES2DecoderWithShaderTest, DrawElementsInvalidCountFails) { |
1223 SetupVertexBuffer(); | 1335 SetupVertexBuffer(); |
1224 SetupIndexBuffer(); | 1336 SetupIndexBuffer(); |
1225 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1337 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1226 | 1338 |
1227 // Try start > 0 | 1339 // Try start > 0 |
1228 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); | 1340 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
1229 DrawElements cmd; | 1341 DrawElements cmd; |
1230 cmd.Init(GL_TRIANGLES, kNumIndices, GL_UNSIGNED_SHORT, 2); | 1342 cmd.Init(GL_TRIANGLES, kNumIndices, GL_UNSIGNED_SHORT, 2); |
1231 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1343 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1232 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1344 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1233 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1345 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1234 | 1346 |
1235 // Try with count > size | 1347 // Try with count > size |
1236 cmd.Init(GL_TRIANGLES, kNumIndices + 1, GL_UNSIGNED_SHORT, 0); | 1348 cmd.Init(GL_TRIANGLES, kNumIndices + 1, GL_UNSIGNED_SHORT, 0); |
1237 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1349 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1238 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1350 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1239 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1351 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1240 } | 1352 } |
1241 | 1353 |
1242 TEST_F(GLES2DecoderWithShaderTest, DrawElementsOutOfRangeIndicesFails) { | 1354 TEST_P(GLES2DecoderWithShaderTest, DrawElementsOutOfRangeIndicesFails) { |
1243 SetupVertexBuffer(); | 1355 SetupVertexBuffer(); |
1244 SetupIndexBuffer(); | 1356 SetupIndexBuffer(); |
1245 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1357 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1246 | 1358 |
1247 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); | 1359 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
1248 DrawElements cmd; | 1360 DrawElements cmd; |
1249 cmd.Init(GL_TRIANGLES, | 1361 cmd.Init(GL_TRIANGLES, |
1250 kInvalidIndexRangeCount, | 1362 kInvalidIndexRangeCount, |
1251 GL_UNSIGNED_SHORT, | 1363 GL_UNSIGNED_SHORT, |
1252 kInvalidIndexRangeStart * 2); | 1364 kInvalidIndexRangeStart * 2); |
1253 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1365 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1254 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1366 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1255 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1367 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1256 } | 1368 } |
1257 | 1369 |
1258 TEST_F(GLES2DecoderWithShaderTest, DrawElementsOddOffsetForUint16Fails) { | 1370 TEST_P(GLES2DecoderWithShaderTest, DrawElementsOddOffsetForUint16Fails) { |
1259 SetupVertexBuffer(); | 1371 SetupVertexBuffer(); |
1260 SetupIndexBuffer(); | 1372 SetupIndexBuffer(); |
1261 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1373 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1262 | 1374 |
1263 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); | 1375 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)).Times(0); |
1264 DrawElements cmd; | 1376 DrawElements cmd; |
1265 cmd.Init(GL_TRIANGLES, kInvalidIndexRangeCount, GL_UNSIGNED_SHORT, 1); | 1377 cmd.Init(GL_TRIANGLES, kInvalidIndexRangeCount, GL_UNSIGNED_SHORT, 1); |
1266 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1378 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1267 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1379 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1268 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1380 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1269 } | 1381 } |
1270 | 1382 |
1271 TEST_F(GLES2DecoderWithShaderTest, DrawElementsInstancedANGLEFails) { | 1383 TEST_P(GLES2DecoderWithShaderTest, DrawElementsInstancedANGLEFails) { |
1272 SetupTexture(); | 1384 SetupTexture(); |
1273 SetupVertexBuffer(); | 1385 SetupVertexBuffer(); |
1274 SetupIndexBuffer(); | 1386 SetupIndexBuffer(); |
1275 DoEnableVertexAttribArray(1); | 1387 DoEnableVertexAttribArray(1); |
1276 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1388 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1277 | 1389 |
1278 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) | 1390 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
1279 .Times(0) | 1391 .Times(0) |
1280 .RetiresOnSaturation(); | 1392 .RetiresOnSaturation(); |
1281 DrawElementsInstancedANGLE cmd; | 1393 DrawElementsInstancedANGLE cmd; |
1282 cmd.Init(GL_TRIANGLES, | 1394 cmd.Init(GL_TRIANGLES, |
1283 kValidIndexRangeCount, | 1395 kValidIndexRangeCount, |
1284 GL_UNSIGNED_SHORT, | 1396 GL_UNSIGNED_SHORT, |
1285 kValidIndexRangeStart * 2, | 1397 kValidIndexRangeStart * 2, |
1286 1); | 1398 1); |
1287 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1399 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1288 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1400 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1289 } | 1401 } |
1290 | 1402 |
1291 TEST_F(GLES2DecoderGeometryInstancingTest, | 1403 TEST_P(GLES2DecoderGeometryInstancingTest, |
1292 DrawElementsInstancedANGLENoAttributesFails) { | 1404 DrawElementsInstancedANGLENoAttributesFails) { |
1293 SetupTexture(); | 1405 SetupTexture(); |
1294 SetupIndexBuffer(); | 1406 SetupIndexBuffer(); |
1295 | 1407 |
1296 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) | 1408 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
1297 .Times(0) | 1409 .Times(0) |
1298 .RetiresOnSaturation(); | 1410 .RetiresOnSaturation(); |
1299 DrawElementsInstancedANGLE cmd; | 1411 DrawElementsInstancedANGLE cmd; |
1300 cmd.Init(GL_TRIANGLES, | 1412 cmd.Init(GL_TRIANGLES, |
1301 kValidIndexRangeCount, | 1413 kValidIndexRangeCount, |
1302 GL_UNSIGNED_SHORT, | 1414 GL_UNSIGNED_SHORT, |
1303 kValidIndexRangeStart * 2, | 1415 kValidIndexRangeStart * 2, |
1304 1); | 1416 1); |
1305 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1417 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1306 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1418 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1307 } | 1419 } |
1308 | 1420 |
1309 TEST_F(GLES2DecoderGeometryInstancingTest, | 1421 TEST_P(GLES2DecoderGeometryInstancingTest, |
1310 DrawElementsInstancedANGLESimulatedAttrib0) { | 1422 DrawElementsInstancedANGLESimulatedAttrib0) { |
1311 SetupTexture(); | 1423 SetupTexture(); |
1312 SetupVertexBuffer(); | 1424 SetupVertexBuffer(); |
1313 SetupIndexBuffer(); | 1425 SetupIndexBuffer(); |
1314 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1426 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1315 | 1427 |
1316 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); | 1428 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); |
1317 SetupExpectationsForApplyingDefaultDirtyState(); | 1429 SetupExpectationsForApplyingDefaultDirtyState(); |
1318 | 1430 |
1319 DoVertexAttribDivisorANGLE(0, 1); | 1431 DoVertexAttribDivisorANGLE(0, 1); |
(...skipping 15 matching lines...) Expand all Loading... |
1335 DrawElementsInstancedANGLE cmd; | 1447 DrawElementsInstancedANGLE cmd; |
1336 cmd.Init(GL_TRIANGLES, | 1448 cmd.Init(GL_TRIANGLES, |
1337 kValidIndexRangeCount, | 1449 kValidIndexRangeCount, |
1338 GL_UNSIGNED_SHORT, | 1450 GL_UNSIGNED_SHORT, |
1339 kValidIndexRangeStart * 2, | 1451 kValidIndexRangeStart * 2, |
1340 3); | 1452 3); |
1341 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1453 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1342 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1454 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1343 } | 1455 } |
1344 | 1456 |
1345 TEST_F(GLES2DecoderGeometryInstancingTest, | 1457 TEST_P(GLES2DecoderGeometryInstancingTest, |
1346 DrawElementsInstancedANGLEMissingAttributesFails) { | 1458 DrawElementsInstancedANGLEMissingAttributesFails) { |
1347 SetupIndexBuffer(); | 1459 SetupIndexBuffer(); |
1348 DoEnableVertexAttribArray(1); | 1460 DoEnableVertexAttribArray(1); |
1349 | 1461 |
1350 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)).Times(0); | 1462 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)).Times(0); |
1351 DrawElementsInstancedANGLE cmd; | 1463 DrawElementsInstancedANGLE cmd; |
1352 cmd.Init(GL_TRIANGLES, | 1464 cmd.Init(GL_TRIANGLES, |
1353 kValidIndexRangeCount, | 1465 kValidIndexRangeCount, |
1354 GL_UNSIGNED_SHORT, | 1466 GL_UNSIGNED_SHORT, |
1355 kValidIndexRangeStart * 2, | 1467 kValidIndexRangeStart * 2, |
1356 1); | 1468 1); |
1357 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1469 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1358 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1470 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1359 } | 1471 } |
1360 | 1472 |
1361 TEST_F(GLES2DecoderGeometryInstancingTest, | 1473 TEST_P(GLES2DecoderGeometryInstancingTest, |
1362 DrawElementsInstancedANGLEMissingAttributesZeroCountSucceeds) { | 1474 DrawElementsInstancedANGLEMissingAttributesZeroCountSucceeds) { |
1363 SetupIndexBuffer(); | 1475 SetupIndexBuffer(); |
1364 DoEnableVertexAttribArray(1); | 1476 DoEnableVertexAttribArray(1); |
1365 | 1477 |
1366 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)).Times(0); | 1478 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)).Times(0); |
1367 DrawElementsInstancedANGLE cmd; | 1479 DrawElementsInstancedANGLE cmd; |
1368 cmd.Init(GL_TRIANGLES, 0, GL_UNSIGNED_SHORT, kValidIndexRangeStart * 2, 1); | 1480 cmd.Init(GL_TRIANGLES, 0, GL_UNSIGNED_SHORT, kValidIndexRangeStart * 2, 1); |
1369 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1481 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1370 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1482 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1371 } | 1483 } |
1372 | 1484 |
1373 TEST_F(GLES2DecoderGeometryInstancingTest, | 1485 TEST_P(GLES2DecoderGeometryInstancingTest, |
1374 DrawElementsInstancedANGLEValidAttributesSucceeds) { | 1486 DrawElementsInstancedANGLEValidAttributesSucceeds) { |
1375 SetupIndexBuffer(); | 1487 SetupIndexBuffer(); |
1376 SetupTexture(); | 1488 SetupTexture(); |
1377 SetupVertexBuffer(); | 1489 SetupVertexBuffer(); |
1378 DoEnableVertexAttribArray(1); | 1490 DoEnableVertexAttribArray(1); |
1379 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1491 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1380 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); | 1492 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); |
1381 SetupExpectationsForApplyingDefaultDirtyState(); | 1493 SetupExpectationsForApplyingDefaultDirtyState(); |
1382 | 1494 |
1383 EXPECT_CALL( | 1495 EXPECT_CALL( |
1384 *gl_, | 1496 *gl_, |
1385 DrawElementsInstancedANGLE(GL_TRIANGLES, | 1497 DrawElementsInstancedANGLE(GL_TRIANGLES, |
1386 kValidIndexRangeCount, | 1498 kValidIndexRangeCount, |
1387 GL_UNSIGNED_SHORT, | 1499 GL_UNSIGNED_SHORT, |
1388 BufferOffset(kValidIndexRangeStart * 2), | 1500 BufferOffset(kValidIndexRangeStart * 2), |
1389 1)) | 1501 1)) |
1390 .Times(1) | 1502 .Times(1) |
1391 .RetiresOnSaturation(); | 1503 .RetiresOnSaturation(); |
1392 DrawElementsInstancedANGLE cmd; | 1504 DrawElementsInstancedANGLE cmd; |
1393 cmd.Init(GL_TRIANGLES, | 1505 cmd.Init(GL_TRIANGLES, |
1394 kValidIndexRangeCount, | 1506 kValidIndexRangeCount, |
1395 GL_UNSIGNED_SHORT, | 1507 GL_UNSIGNED_SHORT, |
1396 kValidIndexRangeStart * 2, | 1508 kValidIndexRangeStart * 2, |
1397 1); | 1509 1); |
1398 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1510 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1399 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1511 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1400 } | 1512 } |
1401 | 1513 |
1402 TEST_F(GLES2DecoderGeometryInstancingTest, | 1514 TEST_P(GLES2DecoderGeometryInstancingTest, |
1403 DrawElementsInstancedANGLEWithInvalidModeFails) { | 1515 DrawElementsInstancedANGLEWithInvalidModeFails) { |
1404 SetupIndexBuffer(); | 1516 SetupIndexBuffer(); |
1405 SetupVertexBuffer(); | 1517 SetupVertexBuffer(); |
1406 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1518 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1407 | 1519 |
1408 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)).Times(0); | 1520 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)).Times(0); |
1409 DrawElementsInstancedANGLE cmd; | 1521 DrawElementsInstancedANGLE cmd; |
1410 cmd.Init(GL_QUADS, | 1522 cmd.Init(GL_QUADS, |
1411 kValidIndexRangeCount, | 1523 kValidIndexRangeCount, |
1412 GL_UNSIGNED_SHORT, | 1524 GL_UNSIGNED_SHORT, |
1413 kValidIndexRangeStart * 2, | 1525 kValidIndexRangeStart * 2, |
1414 1); | 1526 1); |
1415 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1527 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1416 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 1528 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
1417 cmd.Init(GL_INVALID_ENUM, | 1529 cmd.Init(GL_INVALID_ENUM, |
1418 kValidIndexRangeCount, | 1530 kValidIndexRangeCount, |
1419 GL_UNSIGNED_SHORT, | 1531 GL_UNSIGNED_SHORT, |
1420 kValidIndexRangeStart * 2, | 1532 kValidIndexRangeStart * 2, |
1421 1); | 1533 1); |
1422 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1534 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1423 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 1535 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
1424 } | 1536 } |
1425 | 1537 |
1426 // Per-instance data is twice as large, but number of instances is half | 1538 // Per-instance data is twice as large, but number of instances is half |
1427 TEST_F(GLES2DecoderGeometryInstancingTest, | 1539 TEST_P(GLES2DecoderGeometryInstancingTest, |
1428 DrawElementsInstancedANGLELargeInstanceSucceeds) { | 1540 DrawElementsInstancedANGLELargeInstanceSucceeds) { |
1429 SetupTexture(); | 1541 SetupTexture(); |
1430 SetupIndexBuffer(); | 1542 SetupIndexBuffer(); |
1431 SetupVertexBuffer(); | 1543 SetupVertexBuffer(); |
1432 SetupExpectationsForApplyingDefaultDirtyState(); | 1544 SetupExpectationsForApplyingDefaultDirtyState(); |
1433 // Add offset so we're sure we're accessing data near the end of the buffer. | 1545 // Add offset so we're sure we're accessing data near the end of the buffer. |
1434 DoVertexAttribPointer( | 1546 DoVertexAttribPointer( |
1435 1, | 1547 1, |
1436 2, | 1548 2, |
1437 GL_FLOAT, | 1549 GL_FLOAT, |
(...skipping 16 matching lines...) Expand all Loading... |
1454 cmd.Init(GL_TRIANGLES, | 1566 cmd.Init(GL_TRIANGLES, |
1455 kValidIndexRangeCount, | 1567 kValidIndexRangeCount, |
1456 GL_UNSIGNED_SHORT, | 1568 GL_UNSIGNED_SHORT, |
1457 kValidIndexRangeStart * 2, | 1569 kValidIndexRangeStart * 2, |
1458 kNumVertices / 2); | 1570 kNumVertices / 2); |
1459 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1571 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1460 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1572 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1461 } | 1573 } |
1462 | 1574 |
1463 // Per-instance data is twice as large, but divisor is twice | 1575 // Per-instance data is twice as large, but divisor is twice |
1464 TEST_F(GLES2DecoderGeometryInstancingTest, | 1576 TEST_P(GLES2DecoderGeometryInstancingTest, |
1465 DrawElementsInstancedANGLELargeDivisorSucceeds) { | 1577 DrawElementsInstancedANGLELargeDivisorSucceeds) { |
1466 SetupTexture(); | 1578 SetupTexture(); |
1467 SetupIndexBuffer(); | 1579 SetupIndexBuffer(); |
1468 SetupVertexBuffer(); | 1580 SetupVertexBuffer(); |
1469 SetupExpectationsForApplyingDefaultDirtyState(); | 1581 SetupExpectationsForApplyingDefaultDirtyState(); |
1470 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1582 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1471 | 1583 |
1472 DoEnableVertexAttribArray(0); | 1584 DoEnableVertexAttribArray(0); |
1473 DoVertexAttribPointer(0, 4, GL_FLOAT, 0, 0); | 1585 DoVertexAttribPointer(0, 4, GL_FLOAT, 0, 0); |
1474 DoVertexAttribDivisorANGLE(0, 2); | 1586 DoVertexAttribDivisorANGLE(0, 2); |
1475 EXPECT_CALL( | 1587 EXPECT_CALL( |
1476 *gl_, | 1588 *gl_, |
1477 DrawElementsInstancedANGLE(GL_TRIANGLES, | 1589 DrawElementsInstancedANGLE(GL_TRIANGLES, |
1478 kValidIndexRangeCount, | 1590 kValidIndexRangeCount, |
1479 GL_UNSIGNED_SHORT, | 1591 GL_UNSIGNED_SHORT, |
1480 BufferOffset(kValidIndexRangeStart * 2), | 1592 BufferOffset(kValidIndexRangeStart * 2), |
1481 kNumVertices)) | 1593 kNumVertices)) |
1482 .Times(1) | 1594 .Times(1) |
1483 .RetiresOnSaturation(); | 1595 .RetiresOnSaturation(); |
1484 DrawElementsInstancedANGLE cmd; | 1596 DrawElementsInstancedANGLE cmd; |
1485 cmd.Init(GL_TRIANGLES, | 1597 cmd.Init(GL_TRIANGLES, |
1486 kValidIndexRangeCount, | 1598 kValidIndexRangeCount, |
1487 GL_UNSIGNED_SHORT, | 1599 GL_UNSIGNED_SHORT, |
1488 kValidIndexRangeStart * 2, | 1600 kValidIndexRangeStart * 2, |
1489 kNumVertices); | 1601 kNumVertices); |
1490 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1602 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1491 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1603 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1492 } | 1604 } |
1493 | 1605 |
1494 TEST_F(GLES2DecoderGeometryInstancingTest, | 1606 TEST_P(GLES2DecoderGeometryInstancingTest, |
1495 DrawElementsInstancedANGLELargeFails) { | 1607 DrawElementsInstancedANGLELargeFails) { |
1496 SetupTexture(); | 1608 SetupTexture(); |
1497 SetupIndexBuffer(); | 1609 SetupIndexBuffer(); |
1498 SetupVertexBuffer(); | 1610 SetupVertexBuffer(); |
1499 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1611 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1500 | 1612 |
1501 DoEnableVertexAttribArray(0); | 1613 DoEnableVertexAttribArray(0); |
1502 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); | 1614 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
1503 DoVertexAttribDivisorANGLE(0, 1); | 1615 DoVertexAttribDivisorANGLE(0, 1); |
1504 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) | 1616 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
(...skipping 15 matching lines...) Expand all Loading... |
1520 cmd.Init(GL_TRIANGLES, | 1632 cmd.Init(GL_TRIANGLES, |
1521 kInvalidIndexRangeCount, | 1633 kInvalidIndexRangeCount, |
1522 GL_UNSIGNED_SHORT, | 1634 GL_UNSIGNED_SHORT, |
1523 kInvalidIndexRangeStart * 2, | 1635 kInvalidIndexRangeStart * 2, |
1524 kNumVertices); | 1636 kNumVertices); |
1525 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1637 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1526 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1638 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1527 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1639 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1528 } | 1640 } |
1529 | 1641 |
1530 TEST_F(GLES2DecoderGeometryInstancingTest, | 1642 TEST_P(GLES2DecoderGeometryInstancingTest, |
1531 DrawElementsInstancedANGLEInvalidPrimcountFails) { | 1643 DrawElementsInstancedANGLEInvalidPrimcountFails) { |
1532 SetupTexture(); | 1644 SetupTexture(); |
1533 SetupIndexBuffer(); | 1645 SetupIndexBuffer(); |
1534 SetupVertexBuffer(); | 1646 SetupVertexBuffer(); |
1535 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1647 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1536 | 1648 |
1537 DoEnableVertexAttribArray(0); | 1649 DoEnableVertexAttribArray(0); |
1538 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); | 1650 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
1539 DoVertexAttribDivisorANGLE(0, 1); | 1651 DoVertexAttribDivisorANGLE(0, 1); |
1540 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) | 1652 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
1541 .Times(0) | 1653 .Times(0) |
1542 .RetiresOnSaturation(); | 1654 .RetiresOnSaturation(); |
1543 DrawElementsInstancedANGLE cmd; | 1655 DrawElementsInstancedANGLE cmd; |
1544 cmd.Init(GL_TRIANGLES, | 1656 cmd.Init(GL_TRIANGLES, |
1545 kValidIndexRangeCount, | 1657 kValidIndexRangeCount, |
1546 GL_UNSIGNED_SHORT, | 1658 GL_UNSIGNED_SHORT, |
1547 kValidIndexRangeStart * 2, | 1659 kValidIndexRangeStart * 2, |
1548 -1); | 1660 -1); |
1549 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1661 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1550 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1662 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
1551 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1663 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1552 } | 1664 } |
1553 | 1665 |
1554 // Per-index data is twice as large, but values of indices are smaller | 1666 // Per-index data is twice as large, but values of indices are smaller |
1555 TEST_F(GLES2DecoderGeometryInstancingTest, | 1667 TEST_P(GLES2DecoderGeometryInstancingTest, |
1556 DrawElementsInstancedANGLELargeIndexSucceeds) { | 1668 DrawElementsInstancedANGLELargeIndexSucceeds) { |
1557 SetupTexture(); | 1669 SetupTexture(); |
1558 SetupIndexBuffer(); | 1670 SetupIndexBuffer(); |
1559 SetupVertexBuffer(); | 1671 SetupVertexBuffer(); |
1560 SetupExpectationsForApplyingDefaultDirtyState(); | 1672 SetupExpectationsForApplyingDefaultDirtyState(); |
1561 DoVertexAttribPointer(1, 4, GL_FLOAT, 0, 0); | 1673 DoVertexAttribPointer(1, 4, GL_FLOAT, 0, 0); |
1562 | 1674 |
1563 DoEnableVertexAttribArray(0); | 1675 DoEnableVertexAttribArray(0); |
1564 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); | 1676 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
1565 DoVertexAttribDivisorANGLE(0, 1); | 1677 DoVertexAttribDivisorANGLE(0, 1); |
1566 EXPECT_CALL( | 1678 EXPECT_CALL( |
1567 *gl_, | 1679 *gl_, |
1568 DrawElementsInstancedANGLE(GL_TRIANGLES, | 1680 DrawElementsInstancedANGLE(GL_TRIANGLES, |
1569 kValidIndexRangeCount, | 1681 kValidIndexRangeCount, |
1570 GL_UNSIGNED_SHORT, | 1682 GL_UNSIGNED_SHORT, |
1571 BufferOffset(kValidIndexRangeStart * 2), | 1683 BufferOffset(kValidIndexRangeStart * 2), |
1572 kNumVertices)) | 1684 kNumVertices)) |
1573 .Times(1) | 1685 .Times(1) |
1574 .RetiresOnSaturation(); | 1686 .RetiresOnSaturation(); |
1575 DrawElementsInstancedANGLE cmd; | 1687 DrawElementsInstancedANGLE cmd; |
1576 cmd.Init(GL_TRIANGLES, | 1688 cmd.Init(GL_TRIANGLES, |
1577 kValidIndexRangeCount, | 1689 kValidIndexRangeCount, |
1578 GL_UNSIGNED_SHORT, | 1690 GL_UNSIGNED_SHORT, |
1579 kValidIndexRangeStart * 2, | 1691 kValidIndexRangeStart * 2, |
1580 kNumVertices); | 1692 kNumVertices); |
1581 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1693 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1582 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1694 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1583 } | 1695 } |
1584 | 1696 |
1585 TEST_F(GLES2DecoderGeometryInstancingTest, | 1697 TEST_P(GLES2DecoderGeometryInstancingTest, |
1586 DrawElementsInstancedANGLENoDivisor0Fails) { | 1698 DrawElementsInstancedANGLENoDivisor0Fails) { |
1587 SetupTexture(); | 1699 SetupTexture(); |
1588 SetupIndexBuffer(); | 1700 SetupIndexBuffer(); |
1589 SetupVertexBuffer(); | 1701 SetupVertexBuffer(); |
1590 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 1702 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
1591 | 1703 |
1592 DoEnableVertexAttribArray(0); | 1704 DoEnableVertexAttribArray(0); |
1593 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); | 1705 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
1594 DoVertexAttribDivisorANGLE(0, 1); | 1706 DoVertexAttribDivisorANGLE(0, 1); |
1595 DoVertexAttribDivisorANGLE(1, 1); | 1707 DoVertexAttribDivisorANGLE(1, 1); |
1596 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) | 1708 EXPECT_CALL(*gl_, DrawElementsInstancedANGLE(_, _, _, _, _)) |
1597 .Times(0) | 1709 .Times(0) |
1598 .RetiresOnSaturation(); | 1710 .RetiresOnSaturation(); |
1599 DrawElementsInstancedANGLE cmd; | 1711 DrawElementsInstancedANGLE cmd; |
1600 cmd.Init(GL_TRIANGLES, | 1712 cmd.Init(GL_TRIANGLES, |
1601 kValidIndexRangeCount, | 1713 kValidIndexRangeCount, |
1602 GL_UNSIGNED_SHORT, | 1714 GL_UNSIGNED_SHORT, |
1603 kValidIndexRangeStart * 2, | 1715 kValidIndexRangeStart * 2, |
1604 kNumVertices); | 1716 kNumVertices); |
1605 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1717 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1606 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1718 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1607 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1719 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1608 } | 1720 } |
1609 | 1721 |
1610 TEST_F(GLES2DecoderWithShaderTest, DrawArraysClearsAfterTexImage2DNULL) { | 1722 TEST_P(GLES2DecoderWithShaderTest, DrawArraysClearsAfterTexImage2DNULL) { |
1611 SetupAllNeededVertexBuffers(); | 1723 SetupAllNeededVertexBuffers(); |
1612 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 1724 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
1613 // Create an uncleared texture with 2 levels. | 1725 // Create an uncleared texture with 2 levels. |
1614 DoTexImage2D( | 1726 DoTexImage2D( |
1615 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1727 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
1616 DoTexImage2D( | 1728 DoTexImage2D( |
1617 GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1729 GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
1618 // Expect 2 levels will be cleared. | 1730 // Expect 2 levels will be cleared. |
1619 SetupClearTextureExpectations(kServiceTextureId, | 1731 SetupClearTextureExpectations(kServiceTextureId, |
1620 kServiceTextureId, | 1732 kServiceTextureId, |
(...skipping 25 matching lines...) Expand all Loading... |
1646 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1758 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1647 | 1759 |
1648 // But not again | 1760 // But not again |
1649 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 1761 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
1650 .Times(1) | 1762 .Times(1) |
1651 .RetiresOnSaturation(); | 1763 .RetiresOnSaturation(); |
1652 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1764 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1653 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1765 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1654 } | 1766 } |
1655 | 1767 |
1656 TEST_F(GLES2DecoderWithShaderTest, DrawElementsClearsAfterTexImage2DNULL) { | 1768 TEST_P(GLES2DecoderWithShaderTest, DrawElementsClearsAfterTexImage2DNULL) { |
1657 SetupAllNeededVertexBuffers(); | 1769 SetupAllNeededVertexBuffers(); |
1658 SetupIndexBuffer(); | 1770 SetupIndexBuffer(); |
1659 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 1771 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
1660 // Create an uncleared texture with 2 levels. | 1772 // Create an uncleared texture with 2 levels. |
1661 DoTexImage2D( | 1773 DoTexImage2D( |
1662 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1774 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
1663 DoTexImage2D( | 1775 DoTexImage2D( |
1664 GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1776 GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
1665 // Expect 2 levels will be cleared. | 1777 // Expect 2 levels will be cleared. |
1666 SetupClearTextureExpectations(kServiceTextureId, | 1778 SetupClearTextureExpectations(kServiceTextureId, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 DrawElements(GL_TRIANGLES, | 1817 DrawElements(GL_TRIANGLES, |
1706 kValidIndexRangeCount, | 1818 kValidIndexRangeCount, |
1707 GL_UNSIGNED_SHORT, | 1819 GL_UNSIGNED_SHORT, |
1708 BufferOffset(kValidIndexRangeStart * 2))) | 1820 BufferOffset(kValidIndexRangeStart * 2))) |
1709 .Times(1) | 1821 .Times(1) |
1710 .RetiresOnSaturation(); | 1822 .RetiresOnSaturation(); |
1711 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1823 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1712 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1824 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1713 } | 1825 } |
1714 | 1826 |
1715 TEST_F(GLES2DecoderWithShaderTest, DrawClearsAfterTexImage2DNULLInFBO) { | 1827 TEST_P(GLES2DecoderWithShaderTest, DrawClearsAfterTexImage2DNULLInFBO) { |
1716 const GLuint kFBOClientTextureId = 4100; | 1828 const GLuint kFBOClientTextureId = 4100; |
1717 const GLuint kFBOServiceTextureId = 4101; | 1829 const GLuint kFBOServiceTextureId = 4101; |
1718 | 1830 |
1719 SetupAllNeededVertexBuffers(); | 1831 SetupAllNeededVertexBuffers(); |
1720 // Register a texture id. | 1832 // Register a texture id. |
1721 EXPECT_CALL(*gl_, GenTextures(_, _)) | 1833 EXPECT_CALL(*gl_, GenTextures(_, _)) |
1722 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 1834 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
1723 .RetiresOnSaturation(); | 1835 .RetiresOnSaturation(); |
1724 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 1836 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
1725 | 1837 |
(...skipping 25 matching lines...) Expand all Loading... |
1751 false); // scissor test | 1863 false); // scissor test |
1752 | 1864 |
1753 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB | 1865 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
1754 false, // Framebuffer has depth | 1866 false, // Framebuffer has depth |
1755 false, // Framebuffer has stencil | 1867 false, // Framebuffer has stencil |
1756 0x1111, // color bits | 1868 0x1111, // color bits |
1757 false, // depth mask | 1869 false, // depth mask |
1758 false, // depth enabled | 1870 false, // depth enabled |
1759 0, // front stencil mask | 1871 0, // front stencil mask |
1760 0, // back stencil mask | 1872 0, // back stencil mask |
1761 false, // stencil enabled | 1873 false); // stencil enabled |
1762 false, // cull_face_enabled | |
1763 false, // scissor_test_enabled | |
1764 false); // blend_enabled | |
1765 | 1874 |
1766 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 1875 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
1767 .Times(1) | 1876 .Times(1) |
1768 .RetiresOnSaturation(); | 1877 .RetiresOnSaturation(); |
1769 DrawArrays cmd; | 1878 DrawArrays cmd; |
1770 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 1879 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
1771 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1880 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1772 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1881 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1773 | 1882 |
1774 // But not again. | 1883 // But not again. |
1775 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 1884 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
1776 .Times(1) | 1885 .Times(1) |
1777 .RetiresOnSaturation(); | 1886 .RetiresOnSaturation(); |
1778 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1887 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1779 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1888 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1780 } | 1889 } |
1781 | 1890 |
1782 TEST_F(GLES2DecoderWithShaderTest, DrawWitFBOThatCantClearDoesNotDraw) { | 1891 TEST_P(GLES2DecoderWithShaderTest, DrawWitFBOThatCantClearDoesNotDraw) { |
1783 const GLuint kFBOClientTextureId = 4100; | 1892 const GLuint kFBOClientTextureId = 4100; |
1784 const GLuint kFBOServiceTextureId = 4101; | 1893 const GLuint kFBOServiceTextureId = 4101; |
1785 | 1894 |
1786 // Register a texture id. | 1895 // Register a texture id. |
1787 EXPECT_CALL(*gl_, GenTextures(_, _)) | 1896 EXPECT_CALL(*gl_, GenTextures(_, _)) |
1788 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 1897 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
1789 .RetiresOnSaturation(); | 1898 .RetiresOnSaturation(); |
1790 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 1899 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
1791 | 1900 |
1792 // Setup "render to" texture. | 1901 // Setup "render to" texture. |
(...skipping 16 matching lines...) Expand all Loading... |
1809 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) | 1918 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) |
1810 .WillOnce(Return(GL_FRAMEBUFFER_UNSUPPORTED)) | 1919 .WillOnce(Return(GL_FRAMEBUFFER_UNSUPPORTED)) |
1811 .RetiresOnSaturation(); | 1920 .RetiresOnSaturation(); |
1812 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); | 1921 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
1813 DrawArrays cmd; | 1922 DrawArrays cmd; |
1814 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 1923 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
1815 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1924 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1816 EXPECT_EQ(GL_INVALID_FRAMEBUFFER_OPERATION, GetGLError()); | 1925 EXPECT_EQ(GL_INVALID_FRAMEBUFFER_OPERATION, GetGLError()); |
1817 } | 1926 } |
1818 | 1927 |
1819 TEST_F(GLES2DecoderWithShaderTest, DrawClearsAfterRenderbufferStorageInFBO) { | 1928 TEST_P(GLES2DecoderWithShaderTest, DrawClearsAfterRenderbufferStorageInFBO) { |
1820 SetupTexture(); | 1929 SetupTexture(); |
1821 DoBindRenderbuffer( | 1930 DoBindRenderbuffer( |
1822 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 1931 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
1823 DoBindFramebuffer( | 1932 DoBindFramebuffer( |
1824 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 1933 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
1825 DoRenderbufferStorage( | 1934 DoRenderbufferStorage( |
1826 GL_RENDERBUFFER, GL_RGBA4, GL_RGBA, 100, 50, GL_NO_ERROR); | 1935 GL_RENDERBUFFER, GL_RGBA4, GL_RGBA, 100, 50, GL_NO_ERROR); |
1827 DoFramebufferRenderbuffer(GL_FRAMEBUFFER, | 1936 DoFramebufferRenderbuffer(GL_FRAMEBUFFER, |
1828 GL_COLOR_ATTACHMENT0, | 1937 GL_COLOR_ATTACHMENT0, |
1829 GL_RENDERBUFFER, | 1938 GL_RENDERBUFFER, |
(...skipping 13 matching lines...) Expand all Loading... |
1843 | 1952 |
1844 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 1953 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
1845 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB | 1954 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
1846 false, // Framebuffer has depth | 1955 false, // Framebuffer has depth |
1847 false, // Framebuffer has stencil | 1956 false, // Framebuffer has stencil |
1848 0x1111, // color bits | 1957 0x1111, // color bits |
1849 false, // depth mask | 1958 false, // depth mask |
1850 false, // depth enabled | 1959 false, // depth enabled |
1851 0, // front stencil mask | 1960 0, // front stencil mask |
1852 0, // back stencil mask | 1961 0, // back stencil mask |
1853 false, // stencil enabled | 1962 false); // stencil enabled |
1854 false, // cull_face_enabled | |
1855 false, // scissor_test_enabled | |
1856 false); // blend_enabled | |
1857 | 1963 |
1858 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 1964 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
1859 .Times(1) | 1965 .Times(1) |
1860 .RetiresOnSaturation(); | 1966 .RetiresOnSaturation(); |
1861 DrawArrays cmd; | 1967 DrawArrays cmd; |
1862 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 1968 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
1863 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1969 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1864 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1970 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1865 } | 1971 } |
1866 | 1972 |
1867 TEST_F(GLES2DecoderManualInitTest, DrawArraysClearsAfterTexImage2DNULLCubemap) { | 1973 TEST_P(GLES2DecoderManualInitTest, DrawArraysClearsAfterTexImage2DNULLCubemap) { |
1868 InitState init; | 1974 InitState init; |
1869 init.gl_version = "opengl es 2.0"; | 1975 init.gl_version = "opengl es 2.0"; |
1870 init.has_alpha = true; | 1976 init.has_alpha = true; |
1871 init.has_depth = true; | 1977 init.has_depth = true; |
1872 init.request_alpha = true; | 1978 init.request_alpha = true; |
1873 init.request_depth = true; | 1979 init.request_depth = true; |
1874 InitDecoder(init); | 1980 InitDecoder(init); |
1875 | 1981 |
1876 static const GLenum faces[] = { | 1982 static const GLenum faces[] = { |
1877 GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, | 1983 GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 2038 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
1933 SetupExpectationsForApplyingDefaultDirtyState(); | 2039 SetupExpectationsForApplyingDefaultDirtyState(); |
1934 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 2040 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
1935 .Times(1) | 2041 .Times(1) |
1936 .RetiresOnSaturation(); | 2042 .RetiresOnSaturation(); |
1937 DrawArrays cmd; | 2043 DrawArrays cmd; |
1938 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 2044 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
1939 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2045 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1940 } | 2046 } |
1941 | 2047 |
1942 TEST_F(GLES2DecoderWithShaderTest, | 2048 TEST_P(GLES2DecoderWithShaderTest, |
1943 DrawClearsAfterRenderbuffersWithMultipleAttachments) { | 2049 DrawClearsAfterRenderbuffersWithMultipleAttachments) { |
1944 const GLuint kFBOClientTextureId = 4100; | 2050 const GLuint kFBOClientTextureId = 4100; |
1945 const GLuint kFBOServiceTextureId = 4101; | 2051 const GLuint kFBOServiceTextureId = 4101; |
1946 | 2052 |
1947 // Register a texture id. | 2053 // Register a texture id. |
1948 EXPECT_CALL(*gl_, GenTextures(_, _)) | 2054 EXPECT_CALL(*gl_, GenTextures(_, _)) |
1949 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 2055 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
1950 .RetiresOnSaturation(); | 2056 .RetiresOnSaturation(); |
1951 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 2057 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
1952 | 2058 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1995 | 2101 |
1996 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 2102 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
1997 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB | 2103 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
1998 true, // Framebuffer has depth | 2104 true, // Framebuffer has depth |
1999 false, // Framebuffer has stencil | 2105 false, // Framebuffer has stencil |
2000 0x1111, // color bits | 2106 0x1111, // color bits |
2001 true, // depth mask | 2107 true, // depth mask |
2002 false, // depth enabled | 2108 false, // depth enabled |
2003 0, // front stencil mask | 2109 0, // front stencil mask |
2004 0, // back stencil mask | 2110 0, // back stencil mask |
2005 false, // stencil enabled | 2111 false); // stencil enabled |
2006 false, // cull_face_enabled | |
2007 false, // scissor_test_enabled | |
2008 false); // blend_enabled | |
2009 | 2112 |
2010 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 2113 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
2011 .Times(1) | 2114 .Times(1) |
2012 .RetiresOnSaturation(); | 2115 .RetiresOnSaturation(); |
2013 DrawArrays cmd; | 2116 DrawArrays cmd; |
2014 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 2117 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
2015 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2118 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2016 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2119 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2017 } | 2120 } |
2018 | 2121 |
2019 TEST_F(GLES2DecoderWithShaderTest, | 2122 TEST_P(GLES2DecoderWithShaderTest, |
2020 DrawingWithFBOTwiceChecksForFBOCompleteOnce) { | 2123 DrawingWithFBOTwiceChecksForFBOCompleteOnce) { |
2021 const GLuint kFBOClientTextureId = 4100; | 2124 const GLuint kFBOClientTextureId = 4100; |
2022 const GLuint kFBOServiceTextureId = 4101; | 2125 const GLuint kFBOServiceTextureId = 4101; |
2023 | 2126 |
2024 SetupAllNeededVertexBuffers(); | 2127 SetupAllNeededVertexBuffers(); |
2025 | 2128 |
2026 // Register a texture id. | 2129 // Register a texture id. |
2027 EXPECT_CALL(*gl_, GenTextures(_, _)) | 2130 EXPECT_CALL(*gl_, GenTextures(_, _)) |
2028 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 2131 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
2029 .RetiresOnSaturation(); | 2132 .RetiresOnSaturation(); |
(...skipping 30 matching lines...) Expand all Loading... |
2060 .RetiresOnSaturation(); | 2163 .RetiresOnSaturation(); |
2061 | 2164 |
2062 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB | 2165 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
2063 false, // Framebuffer has depth | 2166 false, // Framebuffer has depth |
2064 false, // Framebuffer has stencil | 2167 false, // Framebuffer has stencil |
2065 0x1111, // color bits | 2168 0x1111, // color bits |
2066 false, // depth mask | 2169 false, // depth mask |
2067 false, // depth enabled | 2170 false, // depth enabled |
2068 0, // front stencil mask | 2171 0, // front stencil mask |
2069 0, // back stencil mask | 2172 0, // back stencil mask |
2070 false, // stencil enabled | 2173 false); // stencil enabled |
2071 false, // cull_face_enabled | |
2072 false, // scissor_test_enabled | |
2073 false); // blend_enabled | |
2074 | 2174 |
2075 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 2175 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
2076 .Times(1) | 2176 .Times(1) |
2077 .RetiresOnSaturation(); | 2177 .RetiresOnSaturation(); |
2078 DrawArrays cmd; | 2178 DrawArrays cmd; |
2079 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 2179 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
2080 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2180 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2081 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2181 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2082 | 2182 |
2083 // But not again. | 2183 // But not again. |
2084 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 2184 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
2085 .Times(1) | 2185 .Times(1) |
2086 .RetiresOnSaturation(); | 2186 .RetiresOnSaturation(); |
2087 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2187 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2088 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2188 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2089 } | 2189 } |
2090 | 2190 |
2091 TEST_F(GLES2DecoderManualInitTest, DrawClearsDepthTexture) { | 2191 TEST_P(GLES2DecoderManualInitTest, DrawClearsDepthTexture) { |
2092 InitState init; | 2192 InitState init; |
2093 init.extensions = "GL_ANGLE_depth_texture"; | 2193 init.extensions = "GL_ANGLE_depth_texture"; |
2094 init.gl_version = "opengl es 2.0"; | 2194 init.gl_version = "opengl es 2.0"; |
2095 init.has_alpha = true; | 2195 init.has_alpha = true; |
2096 init.has_depth = true; | 2196 init.has_depth = true; |
2097 init.request_alpha = true; | 2197 init.request_alpha = true; |
2098 init.request_depth = true; | 2198 init.request_depth = true; |
2099 init.bind_generates_resource = true; | 2199 init.bind_generates_resource = true; |
2100 InitDecoder(init); | 2200 InitDecoder(init); |
2101 | 2201 |
2102 SetupDefaultProgram(); | 2202 SetupDefaultProgram(); |
2103 SetupAllNeededVertexBuffers(); | 2203 SetupAllNeededVertexBuffers(); |
2104 const GLenum attachment = GL_DEPTH_ATTACHMENT; | 2204 const GLenum attachment = GL_DEPTH_ATTACHMENT; |
2105 const GLenum target = GL_TEXTURE_2D; | 2205 const GLenum target = GL_TEXTURE_2D; |
2106 const GLint level = 0; | 2206 const GLint level = 0; |
2107 DoBindTexture(target, client_texture_id_, kServiceTextureId); | 2207 DoBindTexture(target, client_texture_id_, kServiceTextureId); |
2108 | 2208 |
2109 // Create a depth texture. | 2209 // Create a depth texture. |
2110 DoTexImage2D(target, | 2210 DoTexImage2D(target, |
2111 level, | 2211 level, |
2112 GL_DEPTH_COMPONENT, | 2212 GL_DEPTH_COMPONENT, |
2113 1, | 2213 1, |
2114 1, | 2214 1, |
2115 0, | 2215 0, |
2116 GL_DEPTH_COMPONENT, | 2216 GL_DEPTH_COMPONENT, |
2117 GL_UNSIGNED_INT, | 2217 GL_UNSIGNED_INT, |
2118 0, | 2218 0, |
2119 0); | 2219 0); |
2120 | 2220 |
| 2221 // Enable GL_SCISSOR_TEST to make sure we disable it in the clear, |
| 2222 // then re-enable it. |
| 2223 DoEnableDisable(GL_SCISSOR_TEST, true); |
| 2224 |
2121 EXPECT_CALL(*gl_, GenFramebuffersEXT(1, _)).Times(1).RetiresOnSaturation(); | 2225 EXPECT_CALL(*gl_, GenFramebuffersEXT(1, _)).Times(1).RetiresOnSaturation(); |
2122 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, _)) | 2226 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, _)) |
2123 .Times(1) | 2227 .Times(1) |
2124 .RetiresOnSaturation(); | 2228 .RetiresOnSaturation(); |
2125 | 2229 |
2126 EXPECT_CALL(*gl_, | 2230 EXPECT_CALL(*gl_, |
2127 FramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, | 2231 FramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, |
2128 attachment, | 2232 attachment, |
2129 target, | 2233 target, |
2130 kServiceTextureId, | 2234 kServiceTextureId, |
2131 level)) | 2235 level)) |
2132 .Times(1) | 2236 .Times(1) |
2133 .RetiresOnSaturation(); | 2237 .RetiresOnSaturation(); |
2134 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT)) | 2238 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT)) |
2135 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | 2239 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
2136 .RetiresOnSaturation(); | 2240 .RetiresOnSaturation(); |
2137 | 2241 |
2138 EXPECT_CALL(*gl_, ClearStencil(0)).Times(1).RetiresOnSaturation(); | 2242 EXPECT_CALL(*gl_, ClearStencil(0)).Times(1).RetiresOnSaturation(); |
2139 EXPECT_CALL(*gl_, StencilMask(-1)).Times(1).RetiresOnSaturation(); | 2243 EXPECT_CALL(*gl_, StencilMask(-1)).Times(1).RetiresOnSaturation(); |
2140 EXPECT_CALL(*gl_, ClearDepth(1.0f)).Times(1).RetiresOnSaturation(); | 2244 EXPECT_CALL(*gl_, ClearDepth(1.0f)).Times(1).RetiresOnSaturation(); |
2141 EXPECT_CALL(*gl_, DepthMask(true)).Times(1).RetiresOnSaturation(); | 2245 SetupExpectationsForDepthMask(true); |
2142 EXPECT_CALL(*gl_, Disable(GL_SCISSOR_TEST)).Times(1).RetiresOnSaturation(); | 2246 SetupExpectationsForEnableDisable(GL_SCISSOR_TEST, false); |
2143 | 2247 |
2144 EXPECT_CALL(*gl_, Clear(GL_DEPTH_BUFFER_BIT)).Times(1).RetiresOnSaturation(); | 2248 EXPECT_CALL(*gl_, Clear(GL_DEPTH_BUFFER_BIT)).Times(1).RetiresOnSaturation(); |
2145 | 2249 |
2146 SetupExpectationsForRestoreClearState(0.0f, 0.0f, 0.0f, 0.0f, 0, 1.0f, false); | 2250 SetupExpectationsForRestoreClearState(0.0f, 0.0f, 0.0f, 0.0f, 0, 1.0f, true); |
2147 | 2251 |
2148 EXPECT_CALL(*gl_, DeleteFramebuffersEXT(1, _)).Times(1).RetiresOnSaturation(); | 2252 EXPECT_CALL(*gl_, DeleteFramebuffersEXT(1, _)).Times(1).RetiresOnSaturation(); |
2149 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0)) | 2253 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0)) |
2150 .Times(1) | 2254 .Times(1) |
2151 .RetiresOnSaturation(); | 2255 .RetiresOnSaturation(); |
2152 | 2256 |
2153 SetupExpectationsForApplyingDefaultDirtyState(); | 2257 SetupExpectationsForApplyingDefaultDirtyState(); |
2154 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 2258 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
2155 .Times(1) | 2259 .Times(1) |
2156 .RetiresOnSaturation(); | 2260 .RetiresOnSaturation(); |
2157 DrawArrays cmd; | 2261 DrawArrays cmd; |
2158 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 2262 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
2159 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2263 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2160 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2264 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2161 } | 2265 } |
2162 | 2266 |
2163 } // namespace gles2 | 2267 } // namespace gles2 |
2164 } // namespace gpu | 2268 } // namespace gpu |
OLD | NEW |