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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // itself. Necessary because vertex_array_objects are not sharable, and thus | 253 // itself. Necessary because vertex_array_objects are not sharable, and thus |
254 // not managed in the ContextGroup, meaning they will be destroyed during | 254 // not managed in the ContextGroup, meaning they will be destroyed during |
255 // test tear down | 255 // test tear down |
256 if (!vertex_array_deleted_manually_) { | 256 if (!vertex_array_deleted_manually_) { |
257 AddExpectationsForDeleteVertexArraysOES(); | 257 AddExpectationsForDeleteVertexArraysOES(); |
258 } | 258 } |
259 | 259 |
260 GLES2DecoderWithShaderTest::TearDown(); | 260 GLES2DecoderWithShaderTest::TearDown(); |
261 } | 261 } |
262 | 262 |
263 void GenVertexArraysOESValidArgs() { | |
264 AddExpectationsForGenVertexArraysOES(); | |
265 GetSharedMemoryAs<GLuint*>()[0] = kNewClientId; | |
266 GenVertexArraysOES cmd; | |
267 cmd.Init(1, shared_memory_id_, shared_memory_offset_); | |
268 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
269 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
270 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId) != NULL); | |
271 AddExpectationsForDeleteVertexArraysOES(); | |
272 } | |
273 | |
274 void GenVertexArraysOESInvalidArgs() { | |
275 EXPECT_CALL(*gl_, GenVertexArraysOES(_, _)).Times(0); | |
276 GetSharedMemoryAs<GLuint*>()[0] = client_vertexarray_id_; | |
277 GenVertexArraysOES cmd; | |
278 cmd.Init(1, shared_memory_id_, shared_memory_offset_); | |
279 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd)); | |
280 } | |
281 | |
282 void GenVertexArraysOESImmediateValidArgs() { | 263 void GenVertexArraysOESImmediateValidArgs() { |
283 AddExpectationsForGenVertexArraysOES(); | 264 AddExpectationsForGenVertexArraysOES(); |
284 GenVertexArraysOESImmediate* cmd = | 265 GenVertexArraysOESImmediate* cmd = |
285 GetImmediateAs<GenVertexArraysOESImmediate>(); | 266 GetImmediateAs<GenVertexArraysOESImmediate>(); |
286 GLuint temp = kNewClientId; | 267 GLuint temp = kNewClientId; |
287 cmd->Init(1, &temp); | 268 cmd->Init(1, &temp); |
288 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp))); | 269 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp))); |
289 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 270 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
290 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId) != NULL); | 271 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId) != NULL); |
291 AddExpectationsForDeleteVertexArraysOES(); | 272 AddExpectationsForDeleteVertexArraysOES(); |
292 } | 273 } |
293 | 274 |
294 void GenVertexArraysOESImmediateInvalidArgs() { | 275 void GenVertexArraysOESImmediateInvalidArgs() { |
295 EXPECT_CALL(*gl_, GenVertexArraysOES(_, _)).Times(0); | 276 EXPECT_CALL(*gl_, GenVertexArraysOES(_, _)).Times(0); |
296 GenVertexArraysOESImmediate* cmd = | 277 GenVertexArraysOESImmediate* cmd = |
297 GetImmediateAs<GenVertexArraysOESImmediate>(); | 278 GetImmediateAs<GenVertexArraysOESImmediate>(); |
298 cmd->Init(1, &client_vertexarray_id_); | 279 cmd->Init(1, &client_vertexarray_id_); |
299 EXPECT_EQ(error::kInvalidArguments, | 280 EXPECT_EQ(error::kInvalidArguments, |
300 ExecuteImmediateCmd(*cmd, sizeof(&client_vertexarray_id_))); | 281 ExecuteImmediateCmd(*cmd, sizeof(&client_vertexarray_id_))); |
301 } | 282 } |
302 | 283 |
303 void DeleteVertexArraysOESValidArgs() { | |
304 AddExpectationsForDeleteVertexArraysOES(); | |
305 GetSharedMemoryAs<GLuint*>()[0] = client_vertexarray_id_; | |
306 DeleteVertexArraysOES cmd; | |
307 cmd.Init(1, shared_memory_id_, shared_memory_offset_); | |
308 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
309 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
310 EXPECT_TRUE(GetVertexArrayInfo(client_vertexarray_id_) == NULL); | |
311 vertex_array_deleted_manually_ = true; | |
312 } | |
313 | |
314 void DeleteVertexArraysOESInvalidArgs() { | |
315 GetSharedMemoryAs<GLuint*>()[0] = kInvalidClientId; | |
316 DeleteVertexArraysOES cmd; | |
317 cmd.Init(1, shared_memory_id_, shared_memory_offset_); | |
318 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
319 } | |
320 | |
321 void DeleteVertexArraysOESImmediateValidArgs() { | 284 void DeleteVertexArraysOESImmediateValidArgs() { |
322 AddExpectationsForDeleteVertexArraysOES(); | 285 AddExpectationsForDeleteVertexArraysOES(); |
323 DeleteVertexArraysOESImmediate& cmd = | 286 DeleteVertexArraysOESImmediate& cmd = |
324 *GetImmediateAs<DeleteVertexArraysOESImmediate>(); | 287 *GetImmediateAs<DeleteVertexArraysOESImmediate>(); |
325 cmd.Init(1, &client_vertexarray_id_); | 288 cmd.Init(1, &client_vertexarray_id_); |
326 EXPECT_EQ(error::kNoError, | 289 EXPECT_EQ(error::kNoError, |
327 ExecuteImmediateCmd(cmd, sizeof(client_vertexarray_id_))); | 290 ExecuteImmediateCmd(cmd, sizeof(client_vertexarray_id_))); |
328 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 291 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
329 EXPECT_TRUE(GetVertexArrayInfo(client_vertexarray_id_) == NULL); | 292 EXPECT_TRUE(GetVertexArrayInfo(client_vertexarray_id_) == NULL); |
330 vertex_array_deleted_manually_ = true; | 293 vertex_array_deleted_manually_ = true; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 369 |
407 vertex_array_deleted_manually_ = false; | 370 vertex_array_deleted_manually_ = false; |
408 } | 371 } |
409 }; | 372 }; |
410 | 373 |
411 INSTANTIATE_TEST_CASE_P(Service, | 374 INSTANTIATE_TEST_CASE_P(Service, |
412 GLES2DecoderEmulatedVertexArraysOESTest, | 375 GLES2DecoderEmulatedVertexArraysOESTest, |
413 ::testing::Bool()); | 376 ::testing::Bool()); |
414 | 377 |
415 // Test vertex array objects with native support | 378 // Test vertex array objects with native support |
416 TEST_P(GLES2DecoderVertexArraysOESTest, GenVertexArraysOESValidArgs) { | |
417 GenVertexArraysOESValidArgs(); | |
418 } | |
419 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, GenVertexArraysOESValidArgs) { | |
420 GenVertexArraysOESValidArgs(); | |
421 } | |
422 | |
423 TEST_P(GLES2DecoderVertexArraysOESTest, GenVertexArraysOESInvalidArgs) { | |
424 GenVertexArraysOESInvalidArgs(); | |
425 } | |
426 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, ) { | |
427 GenVertexArraysOESInvalidArgs(); | |
428 } | |
429 | |
430 TEST_P(GLES2DecoderVertexArraysOESTest, GenVertexArraysOESImmediateValidArgs) { | 379 TEST_P(GLES2DecoderVertexArraysOESTest, GenVertexArraysOESImmediateValidArgs) { |
431 GenVertexArraysOESImmediateValidArgs(); | 380 GenVertexArraysOESImmediateValidArgs(); |
432 } | 381 } |
433 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, | 382 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, |
434 GenVertexArraysOESImmediateValidArgs) { | 383 GenVertexArraysOESImmediateValidArgs) { |
435 GenVertexArraysOESImmediateValidArgs(); | 384 GenVertexArraysOESImmediateValidArgs(); |
436 } | 385 } |
437 | 386 |
438 TEST_P(GLES2DecoderVertexArraysOESTest, | 387 TEST_P(GLES2DecoderVertexArraysOESTest, |
439 GenVertexArraysOESImmediateInvalidArgs) { | 388 GenVertexArraysOESImmediateInvalidArgs) { |
440 GenVertexArraysOESImmediateInvalidArgs(); | 389 GenVertexArraysOESImmediateInvalidArgs(); |
441 } | 390 } |
442 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, | 391 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, |
443 GenVertexArraysOESImmediateInvalidArgs) { | 392 GenVertexArraysOESImmediateInvalidArgs) { |
444 GenVertexArraysOESImmediateInvalidArgs(); | 393 GenVertexArraysOESImmediateInvalidArgs(); |
445 } | 394 } |
446 | 395 |
447 TEST_P(GLES2DecoderVertexArraysOESTest, DeleteVertexArraysOESValidArgs) { | |
448 DeleteVertexArraysOESValidArgs(); | |
449 } | |
450 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, | |
451 DeleteVertexArraysOESValidArgs) { | |
452 DeleteVertexArraysOESValidArgs(); | |
453 } | |
454 | |
455 TEST_P(GLES2DecoderVertexArraysOESTest, DeleteVertexArraysOESInvalidArgs) { | |
456 DeleteVertexArraysOESInvalidArgs(); | |
457 } | |
458 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, | |
459 DeleteVertexArraysOESInvalidArgs) { | |
460 DeleteVertexArraysOESInvalidArgs(); | |
461 } | |
462 | |
463 TEST_P(GLES2DecoderVertexArraysOESTest, | 396 TEST_P(GLES2DecoderVertexArraysOESTest, |
464 DeleteVertexArraysOESImmediateValidArgs) { | 397 DeleteVertexArraysOESImmediateValidArgs) { |
465 DeleteVertexArraysOESImmediateValidArgs(); | 398 DeleteVertexArraysOESImmediateValidArgs(); |
466 } | 399 } |
467 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, | 400 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, |
468 DeleteVertexArraysOESImmediateValidArgs) { | 401 DeleteVertexArraysOESImmediateValidArgs) { |
469 DeleteVertexArraysOESImmediateValidArgs(); | 402 DeleteVertexArraysOESImmediateValidArgs(); |
470 } | 403 } |
471 | 404 |
472 TEST_P(GLES2DecoderVertexArraysOESTest, | 405 TEST_P(GLES2DecoderVertexArraysOESTest, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 // TODO(gman): BufferData | 476 // TODO(gman): BufferData |
544 | 477 |
545 // TODO(gman): BufferDataImmediate | 478 // TODO(gman): BufferDataImmediate |
546 | 479 |
547 // TODO(gman): BufferSubData | 480 // TODO(gman): BufferSubData |
548 | 481 |
549 // TODO(gman): BufferSubDataImmediate | 482 // TODO(gman): BufferSubDataImmediate |
550 | 483 |
551 } // namespace gles2 | 484 } // namespace gles2 |
552 } // namespace gpu | 485 } // namespace gpu |
OLD | NEW |