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

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

Issue 2379203002: implement getBufferSubDataAsync prototype (Closed)
Patch Set: hide getBufferSubDataAsync behind ExperimentalCanvasFeatures 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 4410 matching lines...) Expand 10 before | Expand all | Expand 10 after
4421 EXPECT_TRUE(mem != nullptr); 4421 EXPECT_TRUE(mem != nullptr);
4422 4422
4423 std::vector<uint8_t> data(16); 4423 std::vector<uint8_t> data(16);
4424 // DeleteBuffers unmaps the data store. 4424 // DeleteBuffers unmaps the data store.
4425 gl_->DeleteBuffers(1, &kBufferId); 4425 gl_->DeleteBuffers(1, &kBufferId);
4426 4426
4427 EXPECT_FALSE(gl_->UnmapBuffer(GL_ARRAY_BUFFER)); 4427 EXPECT_FALSE(gl_->UnmapBuffer(GL_ARRAY_BUFFER));
4428 EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); 4428 EXPECT_EQ(GL_INVALID_OPERATION, CheckError());
4429 } 4429 }
4430 4430
4431 TEST_F(GLES3ImplementationTest, GetBufferSubDataAsyncCHROMIUM) {
4432 const GLuint kBufferId = 123;
4433 void* mem;
4434
4435 const int TARGET_COUNT = 8;
4436 GLenum targets[TARGET_COUNT] = {
4437 GL_ARRAY_BUFFER,
4438 GL_ELEMENT_ARRAY_BUFFER,
4439 GL_COPY_READ_BUFFER,
4440 GL_COPY_WRITE_BUFFER,
4441 GL_TRANSFORM_FEEDBACK_BUFFER,
4442 GL_UNIFORM_BUFFER,
4443 GL_PIXEL_PACK_BUFFER,
4444 GL_PIXEL_UNPACK_BUFFER,
4445 };
4446
4447 // Positive tests
4448 for (int i = 0; i < TARGET_COUNT; i++) {
4449 gl_->BindBuffer(targets[i], kBufferId);
4450 mem = gl_->GetBufferSubDataAsyncCHROMIUM(targets[i], 10, 64);
4451 EXPECT_TRUE(mem != nullptr);
4452 EXPECT_EQ(GL_NO_ERROR, CheckError());
4453 gl_->FreeSharedMemory(mem);
4454 EXPECT_EQ(GL_NO_ERROR, CheckError());
4455 gl_->BindBuffer(targets[i], 0);
4456 }
4457
4458 // Negative tests: invalid target
4459 for (int i = 0; i < TARGET_COUNT; i++) {
4460 GLenum wrong_target = targets[(i + 1) % TARGET_COUNT];
4461 gl_->BindBuffer(targets[i], kBufferId);
4462 mem = gl_->GetBufferSubDataAsyncCHROMIUM(wrong_target, 10, 64);
4463 EXPECT_TRUE(mem == nullptr);
4464 EXPECT_EQ(GL_INVALID_OPERATION, CheckError());
4465 gl_->BindBuffer(targets[i], 0);
4466 }
4467 }
4468
4469 TEST_F(GLES3ImplementationTest, GetBufferSubDataAsyncCHROMIUMInvalidValue) {
4470 const GLuint kBufferId = 123;
4471 void* mem;
4472
4473 gl_->BindBuffer(GL_ARRAY_BUFFER, kBufferId);
4474
4475 mem = gl_->GetBufferSubDataAsyncCHROMIUM(GL_ARRAY_BUFFER, -1, 64);
4476 EXPECT_TRUE(mem == nullptr);
4477 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
4478
4479 mem = gl_->GetBufferSubDataAsyncCHROMIUM(GL_ARRAY_BUFFER, 0, -1);
4480 EXPECT_TRUE(mem == nullptr);
4481 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
4482 }
4483
4431 TEST_F(GLES2ImplementationTest, GetInternalformativ) { 4484 TEST_F(GLES2ImplementationTest, GetInternalformativ) {
4432 const GLint kNumSampleCounts = 8; 4485 const GLint kNumSampleCounts = 8;
4433 struct Cmds { 4486 struct Cmds {
4434 cmds::GetInternalformativ cmd; 4487 cmds::GetInternalformativ cmd;
4435 }; 4488 };
4436 typedef cmds::GetInternalformativ::Result::Type ResultType; 4489 typedef cmds::GetInternalformativ::Result::Type ResultType;
4437 ResultType result = 0; 4490 ResultType result = 0;
4438 Cmds expected; 4491 Cmds expected;
4439 ExpectedMemoryInfo result1 = 4492 ExpectedMemoryInfo result1 =
4440 GetExpectedResultMemory(sizeof(uint32_t) + sizeof(ResultType)); 4493 GetExpectedResultMemory(sizeof(uint32_t) + sizeof(ResultType));
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
4605 ContextInitOptions init_options; 4658 ContextInitOptions init_options;
4606 init_options.transfer_buffer_initialize_fail = true; 4659 init_options.transfer_buffer_initialize_fail = true;
4607 EXPECT_FALSE(Initialize(init_options)); 4660 EXPECT_FALSE(Initialize(init_options));
4608 } 4661 }
4609 4662
4610 #include "base/macros.h" 4663 #include "base/macros.h"
4611 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" 4664 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
4612 4665
4613 } // namespace gles2 4666 } // namespace gles2
4614 } // namespace gpu 4667 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698