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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_buffers.cc

Issue 1905743002: Improve BindBufferBase/BindBufferRange in GPU command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 7 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
8 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" 8 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h"
9 9
10 using ::gfx::MockGLInterface; 10 using ::gfx::MockGLInterface;
11 using ::testing::_; 11 using ::testing::_;
12 using ::testing::Return; 12 using ::testing::Return;
13 using ::testing::SetArgPointee; 13 using ::testing::SetArgPointee;
14 14
15 namespace gpu { 15 namespace gpu {
16 namespace gles2 { 16 namespace gles2 {
17 17
18 using namespace cmds; 18 using namespace cmds;
19 19
20 namespace { 20 namespace {
21 21
22 } // namespace anonymous 22 } // namespace anonymous
23 23
24 TEST_P(GLES2DecoderTest, BindBufferBaseValidArgs) { 24 TEST_P(GLES2DecoderTest, BindBufferBaseValidArgs) {
25 EXPECT_CALL( 25 EXPECT_CALL(
26 *gl_, BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kServiceBufferId)); 26 *gl_, BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kServiceBufferId));
27 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, _))
28 .WillOnce(SetArgPointee<1>(4))
29 .RetiresOnSaturation();
30 SpecializedSetup<cmds::BindBufferBase, 0>(true); 27 SpecializedSetup<cmds::BindBufferBase, 0>(true);
31 cmds::BindBufferBase cmd; 28 cmds::BindBufferBase cmd;
32 cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, client_buffer_id_); 29 cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, client_buffer_id_);
33 decoder_->set_unsafe_es3_apis_enabled(true); 30 decoder_->set_unsafe_es3_apis_enabled(true);
34 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 31 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
35 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 32 EXPECT_EQ(GL_NO_ERROR, GetGLError());
36 decoder_->set_unsafe_es3_apis_enabled(false); 33 decoder_->set_unsafe_es3_apis_enabled(false);
37 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); 34 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
38 } 35 }
39 36
40 TEST_P(GLES2DecoderTest, BindBufferBaseValidArgsNewId) { 37 TEST_P(GLES2DecoderTest, BindBufferBaseValidArgsNewId) {
41 EXPECT_CALL(*gl_, 38 EXPECT_CALL(*gl_,
42 BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kNewServiceId)); 39 BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kNewServiceId));
43 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, _))
44 .WillOnce(SetArgPointee<1>(4))
45 .RetiresOnSaturation();
46 EXPECT_CALL(*gl_, GenBuffersARB(1, _)) 40 EXPECT_CALL(*gl_, GenBuffersARB(1, _))
47 .WillOnce(SetArgPointee<1>(kNewServiceId)); 41 .WillOnce(SetArgPointee<1>(kNewServiceId));
48 SpecializedSetup<cmds::BindBufferBase, 0>(true); 42 SpecializedSetup<cmds::BindBufferBase, 0>(true);
49 cmds::BindBufferBase cmd; 43 cmds::BindBufferBase cmd;
50 cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kNewClientId); 44 cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kNewClientId);
51 decoder_->set_unsafe_es3_apis_enabled(true); 45 decoder_->set_unsafe_es3_apis_enabled(true);
52 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 46 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
53 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 47 EXPECT_EQ(GL_NO_ERROR, GetGLError());
54 EXPECT_TRUE(GetBuffer(kNewClientId) != NULL); 48 EXPECT_TRUE(GetBuffer(kNewClientId) != NULL);
55 decoder_->set_unsafe_es3_apis_enabled(false); 49 decoder_->set_unsafe_es3_apis_enabled(false);
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 { // UnmapBuffer fails. 493 { // UnmapBuffer fails.
500 UnmapBuffer cmd; 494 UnmapBuffer cmd;
501 cmd.Init(kTarget); 495 cmd.Init(kTarget);
502 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 496 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
503 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 497 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
504 } 498 }
505 } 499 }
506 500
507 } // namespace gles2 501 } // namespace gles2
508 } // namespace gpu 502 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698