Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation_unittest.cc

Issue 2379203002: implement getBufferSubDataAsync prototype (Closed)
Patch Set: small clarification Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Tests for GLES2Implementation. 5 // Tests for GLES2Implementation.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 4412 matching lines...) Expand 10 before | Expand all | Expand 10 after
4423 EXPECT_TRUE(mem != nullptr); 4423 EXPECT_TRUE(mem != nullptr);
4424 4424
4425 std::vector<uint8_t> data(16); 4425 std::vector<uint8_t> data(16);
4426 // DeleteBuffers unmaps the data store. 4426 // DeleteBuffers unmaps the data store.
4427 gl_->DeleteBuffers(1, &kBufferId); 4427 gl_->DeleteBuffers(1, &kBufferId);
4428 4428
4429 EXPECT_FALSE(gl_->UnmapBuffer(GL_ARRAY_BUFFER)); 4429 EXPECT_FALSE(gl_->UnmapBuffer(GL_ARRAY_BUFFER));
4430 EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); 4430 EXPECT_EQ(GL_INVALID_OPERATION, CheckError());
4431 } 4431 }
4432 4432
4433 TEST_F(GLES3ImplementationTest, GetBufferSubDataAsyncCHROMIUM) {
4434 const GLuint kBufferId = 123;
4435 void* mem;
4436
4437 const int TARGET_COUNT = 8;
4438 GLenum targets[TARGET_COUNT] = {
4439 GL_ARRAY_BUFFER,
4440 GL_ELEMENT_ARRAY_BUFFER,
4441 GL_COPY_READ_BUFFER,
4442 GL_COPY_WRITE_BUFFER,
4443 GL_TRANSFORM_FEEDBACK_BUFFER,
4444 GL_UNIFORM_BUFFER,
4445 GL_PIXEL_PACK_BUFFER,
4446 GL_PIXEL_UNPACK_BUFFER,
4447 };
4448
4449 // Positive tests
4450 for (int i = 0; i < TARGET_COUNT; i++) {
4451 gl_->BindBuffer(targets[i], kBufferId);
4452 mem = gl_->GetBufferSubDataAsyncCHROMIUM(targets[i], 10, 64);
4453 EXPECT_TRUE(mem != nullptr);
4454 EXPECT_EQ(GL_NO_ERROR, CheckError());
4455 gl_->FreeSharedMemory(mem);
4456 EXPECT_EQ(GL_NO_ERROR, CheckError());
4457 gl_->BindBuffer(targets[i], 0);
4458 }
4459
4460 // Negative tests: invalid target
4461 for (int i = 0; i < TARGET_COUNT; i++) {
4462 GLenum wrong_target = targets[(i + 1) % TARGET_COUNT];
4463 gl_->BindBuffer(targets[i], kBufferId);
4464 mem = gl_->GetBufferSubDataAsyncCHROMIUM(wrong_target, 10, 64);
4465 EXPECT_TRUE(mem == nullptr);
4466 EXPECT_EQ(GL_INVALID_OPERATION, CheckError());
4467 gl_->BindBuffer(targets[i], 0);
4468 }
4469 }
4470
4471 TEST_F(GLES3ImplementationTest, GetBufferSubDataAsyncCHROMIUMInvalidValue) {
4472 const GLuint kBufferId = 123;
4473 void* mem;
4474
4475 gl_->BindBuffer(GL_ARRAY_BUFFER, kBufferId);
4476
4477 mem = gl_->GetBufferSubDataAsyncCHROMIUM(GL_ARRAY_BUFFER, -1, 64);
4478 EXPECT_TRUE(mem == nullptr);
4479 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
4480
4481 mem = gl_->GetBufferSubDataAsyncCHROMIUM(GL_ARRAY_BUFFER, 0, -1);
4482 EXPECT_TRUE(mem == nullptr);
4483 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
4484 }
4485
4433 TEST_F(GLES2ImplementationTest, GetInternalformativ) { 4486 TEST_F(GLES2ImplementationTest, GetInternalformativ) {
4434 const GLint kNumSampleCounts = 8; 4487 const GLint kNumSampleCounts = 8;
4435 struct Cmds { 4488 struct Cmds {
4436 cmds::GetInternalformativ cmd; 4489 cmds::GetInternalformativ cmd;
4437 }; 4490 };
4438 typedef cmds::GetInternalformativ::Result::Type ResultType; 4491 typedef cmds::GetInternalformativ::Result::Type ResultType;
4439 ResultType result = 0; 4492 ResultType result = 0;
4440 Cmds expected; 4493 Cmds expected;
4441 ExpectedMemoryInfo result1 = 4494 ExpectedMemoryInfo result1 =
4442 GetExpectedResultMemory(sizeof(uint32_t) + sizeof(ResultType)); 4495 GetExpectedResultMemory(sizeof(uint32_t) + sizeof(ResultType));
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
4607 ContextInitOptions init_options; 4660 ContextInitOptions init_options;
4608 init_options.transfer_buffer_initialize_fail = true; 4661 init_options.transfer_buffer_initialize_fail = true;
4609 EXPECT_FALSE(Initialize(init_options)); 4662 EXPECT_FALSE(Initialize(init_options));
4610 } 4663 }
4611 4664
4612 #include "base/macros.h" 4665 #include "base/macros.h"
4613 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" 4666 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
4614 4667
4615 } // namespace gles2 4668 } // namespace gles2
4616 } // namespace gpu 4669 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_autogen.h ('k') | gpu/command_buffer/client/gles2_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698