OLD | NEW |
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 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "gpu/command_buffer/common/gl_mock.h" | 11 #include "gpu/command_buffer/common/gl_mock.h" |
12 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 12 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
13 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 13 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
14 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 14 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
15 #include "gpu/command_buffer/service/context_group.h" | 15 #include "gpu/command_buffer/service/context_group.h" |
16 #include "gpu/command_buffer/service/program_manager.h" | 16 #include "gpu/command_buffer/service/program_manager.h" |
17 #include "gpu/command_buffer/service/test_helper.h" | 17 #include "gpu/command_buffer/service/test_helper.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "ui/gfx/gl/gl_implementation.h" | 19 #include "ui/gfx/gl/gl_implementation.h" |
20 | 20 |
21 using ::gfx::MockGLInterface; | 21 using ::gfx::MockGLInterface; |
22 using ::testing::_; | 22 using ::testing::_; |
23 using ::testing::DoAll; | 23 using ::testing::DoAll; |
24 using ::testing::InSequence; | 24 using ::testing::InSequence; |
25 using ::testing::MatcherCast; | 25 using ::testing::MatcherCast; |
26 using ::testing::Pointee; | 26 using ::testing::Pointee; |
27 using ::testing::Return; | 27 using ::testing::Return; |
28 using ::testing::SetArrayArgument; | 28 using ::testing::SetArrayArgument; |
| 29 using ::testing::SetArgPointee; |
29 using ::testing::SetArgumentPointee; | 30 using ::testing::SetArgumentPointee; |
30 using ::testing::StrEq; | 31 using ::testing::StrEq; |
31 using ::testing::StrictMock; | 32 using ::testing::StrictMock; |
32 | 33 |
33 namespace gpu { | 34 namespace gpu { |
34 namespace gles2 { | 35 namespace gles2 { |
35 | 36 |
36 GLES2DecoderTestBase::GLES2DecoderTestBase() | 37 GLES2DecoderTestBase::GLES2DecoderTestBase() |
37 : surface_(NULL), | 38 : surface_(NULL), |
38 context_(NULL), | 39 context_(NULL), |
(...skipping 17 matching lines...) Expand all Loading... |
56 "", // extensions | 57 "", // extensions |
57 true, // has alpha | 58 true, // has alpha |
58 true, // has depth | 59 true, // has depth |
59 false, // has stencil | 60 false, // has stencil |
60 true, // request alpha | 61 true, // request alpha |
61 true, // request depth | 62 true, // request depth |
62 false, // request stencil | 63 false, // request stencil |
63 true); // bind generates resource | 64 true); // bind generates resource |
64 } | 65 } |
65 | 66 |
| 67 // Setup the expectations required for the inialiazation of the resources |
| 68 // used by the GL_CHROMIUM_copy_texture extension. |
| 69 void GLES2DecoderTestBase::AddExpectationsForCopyTextureCHROMIUM() { |
| 70 static GLuint copy_texture_chromium_buffer_ids[] = { |
| 71 kServiceCopyTextureChromiumVertexBufferId, |
| 72 kServiceCopyTextureChromiumTextureBufferId |
| 73 }; |
| 74 EXPECT_CALL(*gl_, GenBuffersARB(arraysize(copy_texture_chromium_buffer_ids), |
| 75 _)) |
| 76 .WillOnce(SetArrayArgument<1>(copy_texture_chromium_buffer_ids, |
| 77 copy_texture_chromium_buffer_ids + arraysize( |
| 78 copy_texture_chromium_buffer_ids))) |
| 79 .RetiresOnSaturation(); |
| 80 |
| 81 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, |
| 82 kServiceCopyTextureChromiumVertexBufferId)) |
| 83 .Times(1) |
| 84 .RetiresOnSaturation(); |
| 85 |
| 86 EXPECT_CALL(*gl_, BufferData(GL_ARRAY_BUFFER, 16 * sizeof(GLfloat), _, |
| 87 GL_STATIC_DRAW)) |
| 88 .Times(1) |
| 89 .RetiresOnSaturation(); |
| 90 |
| 91 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, |
| 92 kServiceCopyTextureChromiumTextureBufferId)) |
| 93 .Times(1) |
| 94 .RetiresOnSaturation(); |
| 95 |
| 96 EXPECT_CALL(*gl_, BufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), _, |
| 97 GL_STATIC_DRAW)) |
| 98 .Times(1) |
| 99 .RetiresOnSaturation(); |
| 100 |
| 101 static GLuint copy_texture_chromium_fbo_ids[] = { |
| 102 kServiceCopyTextureChromiumFBOId |
| 103 }; |
| 104 EXPECT_CALL(*gl_, GenFramebuffersEXT(arraysize(copy_texture_chromium_fbo_ids), |
| 105 _)) |
| 106 .WillOnce(SetArrayArgument<1>(copy_texture_chromium_fbo_ids, |
| 107 copy_texture_chromium_fbo_ids + arraysize( |
| 108 copy_texture_chromium_fbo_ids))) |
| 109 .RetiresOnSaturation(); |
| 110 |
| 111 for (int shader = 0; shader < 5; ++shader) { |
| 112 EXPECT_CALL(*gl_, CreateShader( |
| 113 shader == 0 ? GL_VERTEX_SHADER : GL_FRAGMENT_SHADER)) |
| 114 .WillOnce(Return(kServiceCopyTextureChromiumShaderId + shader)) |
| 115 .RetiresOnSaturation(); |
| 116 |
| 117 EXPECT_CALL(*gl_, ShaderSource(kServiceCopyTextureChromiumShaderId + shader, |
| 118 1, _, 0)) |
| 119 .Times(1) |
| 120 .RetiresOnSaturation(); |
| 121 |
| 122 EXPECT_CALL(*gl_, CompileShader( |
| 123 kServiceCopyTextureChromiumShaderId + shader)) |
| 124 .Times(1) |
| 125 .RetiresOnSaturation(); |
| 126 #ifndef NDEBUG |
| 127 EXPECT_CALL(*gl_, GetShaderiv(kServiceCopyTextureChromiumShaderId + shader, |
| 128 GL_COMPILE_STATUS, _)) |
| 129 .WillOnce(SetArgPointee<2>(GL_TRUE)) |
| 130 .RetiresOnSaturation(); |
| 131 #endif |
| 132 } |
| 133 |
| 134 for (int program = 0; program < 4; ++program) { |
| 135 EXPECT_CALL(*gl_, CreateProgram()) |
| 136 .WillOnce(Return(kServiceCopyTextureChromiumProgramId + program)) |
| 137 .RetiresOnSaturation(); |
| 138 |
| 139 EXPECT_CALL(*gl_, AttachShader( |
| 140 kServiceCopyTextureChromiumProgramId + program, |
| 141 kServiceCopyTextureChromiumShaderId)) |
| 142 .Times(1) |
| 143 .RetiresOnSaturation(); |
| 144 |
| 145 EXPECT_CALL(*gl_, AttachShader( |
| 146 kServiceCopyTextureChromiumProgramId + program, |
| 147 kServiceCopyTextureChromiumShaderId + program + 1)) |
| 148 .Times(1) |
| 149 .RetiresOnSaturation(); |
| 150 |
| 151 EXPECT_CALL(*gl_, BindAttribLocation( |
| 152 kServiceCopyTextureChromiumProgramId + program, 0, _)) |
| 153 .Times(1) |
| 154 .RetiresOnSaturation(); |
| 155 |
| 156 EXPECT_CALL(*gl_, BindAttribLocation( |
| 157 kServiceCopyTextureChromiumProgramId + program, 1, _)) |
| 158 .Times(1) |
| 159 .RetiresOnSaturation(); |
| 160 |
| 161 EXPECT_CALL(*gl_, LinkProgram( |
| 162 kServiceCopyTextureChromiumProgramId + program)) |
| 163 .Times(1) |
| 164 .RetiresOnSaturation(); |
| 165 |
| 166 #ifndef NDEBUG |
| 167 EXPECT_CALL(*gl_, GetProgramiv( |
| 168 kServiceCopyTextureChromiumProgramId + program, GL_LINK_STATUS, _)) |
| 169 .WillOnce(SetArgPointee<2>(true)) |
| 170 .RetiresOnSaturation(); |
| 171 #endif |
| 172 |
| 173 EXPECT_CALL(*gl_, GetUniformLocation( |
| 174 kServiceCopyTextureChromiumProgramId + program, _)) |
| 175 .WillOnce(Return(kServiceCopyTextureChromiumSamplerLocation)) |
| 176 .RetiresOnSaturation(); |
| 177 } |
| 178 |
| 179 for (int shader = 0; shader < 5; ++shader) |
| 180 EXPECT_CALL(*gl_, |
| 181 DeleteShader(kServiceCopyTextureChromiumShaderId + shader)) |
| 182 .Times(1) |
| 183 .RetiresOnSaturation(); |
| 184 } |
| 185 |
66 void GLES2DecoderTestBase::InitDecoder( | 186 void GLES2DecoderTestBase::InitDecoder( |
67 const char* extensions, | 187 const char* extensions, |
68 bool has_alpha, | 188 bool has_alpha, |
69 bool has_depth, | 189 bool has_depth, |
70 bool has_stencil, | 190 bool has_stencil, |
71 bool request_alpha, | 191 bool request_alpha, |
72 bool request_depth, | 192 bool request_depth, |
73 bool request_stencil, | 193 bool request_stencil, |
74 bool bind_generates_resource) { | 194 bool bind_generates_resource) { |
75 gl_.reset(new StrictMock<MockGLInterface>()); | 195 gl_.reset(new StrictMock<MockGLInterface>()); |
76 ::gfx::GLInterface::SetGLInterface(gl_.get()); | 196 ::gfx::GLInterface::SetGLInterface(gl_.get()); |
77 group_ = ContextGroup::Ref(new ContextGroup(bind_generates_resource)); | 197 group_ = ContextGroup::Ref(new ContextGroup(bind_generates_resource)); |
78 | 198 |
79 InSequence sequence; | 199 InSequence sequence; |
80 | 200 |
81 TestHelper::SetupContextGroupInitExpectations(gl_.get(), | 201 TestHelper::SetupContextGroupInitExpectations(gl_.get(), |
82 DisallowedFeatures(), extensions); | 202 DisallowedFeatures(), extensions); |
83 | 203 |
84 EXPECT_TRUE(group_->Initialize(DisallowedFeatures(), NULL)); | 204 EXPECT_TRUE(group_->Initialize(DisallowedFeatures(), NULL)); |
85 | 205 |
| 206 AddExpectationsForCopyTextureCHROMIUM(); |
| 207 |
86 EXPECT_CALL(*gl_, EnableVertexAttribArray(0)) | 208 EXPECT_CALL(*gl_, EnableVertexAttribArray(0)) |
87 .Times(1) | 209 .Times(1) |
88 .RetiresOnSaturation(); | 210 .RetiresOnSaturation(); |
89 static GLuint attrib_0_id[] = { | 211 static GLuint attrib_0_id[] = { |
90 kServiceAttrib0BufferId, | 212 kServiceAttrib0BufferId, |
91 }; | 213 }; |
92 static GLuint fixed_attrib_buffer_id[] = { | 214 static GLuint fixed_attrib_buffer_id[] = { |
93 kServiceFixedAttribBufferId, | 215 kServiceFixedAttribBufferId, |
94 }; | 216 }; |
95 EXPECT_CALL(*gl_, GenBuffersARB(arraysize(attrib_0_id), _)) | 217 EXPECT_CALL(*gl_, GenBuffersARB(arraysize(attrib_0_id), _)) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 EXPECT_CALL(*gl_, Enable(GL_POINT_SPRITE)) | 286 EXPECT_CALL(*gl_, Enable(GL_POINT_SPRITE)) |
165 .Times(1) | 287 .Times(1) |
166 .RetiresOnSaturation(); | 288 .RetiresOnSaturation(); |
167 | 289 |
168 #if defined(OS_MACOSX) | 290 #if defined(OS_MACOSX) |
169 EXPECT_CALL(*gl_, GetString(GL_VENDOR)) | 291 EXPECT_CALL(*gl_, GetString(GL_VENDOR)) |
170 .Times(1) | 292 .Times(1) |
171 .RetiresOnSaturation(); | 293 .RetiresOnSaturation(); |
172 #endif | 294 #endif |
173 | 295 |
| 296 static GLint viewport_dims[] = { |
| 297 kViewportX, |
| 298 kViewportY, |
| 299 kViewportWidth, |
| 300 kViewportHeight, |
| 301 }; |
| 302 EXPECT_CALL(*gl_, GetIntegerv(GL_VIEWPORT, _)) |
| 303 .WillOnce(SetArrayArgument<1>(viewport_dims, |
| 304 viewport_dims + arraysize(viewport_dims))) |
| 305 .RetiresOnSaturation(); |
| 306 |
| 307 static GLint max_viewport_dims[] = { |
| 308 kMaxViewportWidth, |
| 309 kMaxViewportHeight |
| 310 }; |
| 311 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_VIEWPORT_DIMS, _)) |
| 312 .WillOnce(SetArrayArgument<1>( |
| 313 max_viewport_dims, max_viewport_dims + arraysize(max_viewport_dims))) |
| 314 .RetiresOnSaturation(); |
| 315 |
174 engine_.reset(new StrictMock<MockCommandBufferEngine>()); | 316 engine_.reset(new StrictMock<MockCommandBufferEngine>()); |
175 Buffer buffer = engine_->GetSharedMemoryBuffer(kSharedMemoryId); | 317 Buffer buffer = engine_->GetSharedMemoryBuffer(kSharedMemoryId); |
176 shared_memory_offset_ = kSharedMemoryOffset; | 318 shared_memory_offset_ = kSharedMemoryOffset; |
177 shared_memory_address_ = reinterpret_cast<int8*>(buffer.ptr) + | 319 shared_memory_address_ = reinterpret_cast<int8*>(buffer.ptr) + |
178 shared_memory_offset_; | 320 shared_memory_offset_; |
179 shared_memory_id_ = kSharedMemoryId; | 321 shared_memory_id_ = kSharedMemoryId; |
180 shared_memory_base_ = buffer.ptr; | 322 shared_memory_base_ = buffer.ptr; |
181 | 323 |
182 surface_ = new gfx::GLSurfaceStub; | 324 surface_ = new gfx::GLSurfaceStub; |
183 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); | 325 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 .RetiresOnSaturation(); | 366 .RetiresOnSaturation(); |
225 GenHelper<GenBuffersImmediate>(client_element_buffer_id_); | 367 GenHelper<GenBuffersImmediate>(client_element_buffer_id_); |
226 | 368 |
227 DoCreateProgram(client_program_id_, kServiceProgramId); | 369 DoCreateProgram(client_program_id_, kServiceProgramId); |
228 DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); | 370 DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); |
229 | 371 |
230 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 372 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
231 } | 373 } |
232 | 374 |
233 void GLES2DecoderTestBase::TearDown() { | 375 void GLES2DecoderTestBase::TearDown() { |
| 376 InSequence sequence; |
| 377 |
234 // All Tests should have read all their GLErrors before getting here. | 378 // All Tests should have read all their GLErrors before getting here. |
235 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 379 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 380 EXPECT_CALL(*gl_, DeleteFramebuffersEXT(1, |
| 381 Pointee(kServiceCopyTextureChromiumFBOId))) |
| 382 .Times(1) |
| 383 .RetiresOnSaturation(); |
| 384 |
| 385 EXPECT_CALL(*gl_, DeleteProgram(_)) |
| 386 .Times(4) |
| 387 .RetiresOnSaturation(); |
| 388 |
| 389 EXPECT_CALL(*gl_, DeleteBuffersARB(2, _)) |
| 390 .Times(1) |
| 391 .RetiresOnSaturation(); |
| 392 |
236 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)) | 393 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)) |
237 .Times(2) | 394 .Times(2) |
238 .RetiresOnSaturation(); | 395 .RetiresOnSaturation(); |
| 396 |
239 decoder_->Destroy(); | 397 decoder_->Destroy(); |
240 decoder_.reset(); | 398 decoder_.reset(); |
241 group_->Destroy(false); | 399 group_->Destroy(false); |
242 engine_.reset(); | 400 engine_.reset(); |
243 ::gfx::GLInterface::SetGLInterface(NULL); | 401 ::gfx::GLInterface::SetGLInterface(NULL); |
244 gl_.reset(); | 402 gl_.reset(); |
245 } | 403 } |
246 | 404 |
247 GLint GLES2DecoderTestBase::GetGLError() { | 405 GLint GLES2DecoderTestBase::GetGLError() { |
248 EXPECT_CALL(*gl_, GetError()) | 406 EXPECT_CALL(*gl_, GetError()) |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 656 |
499 void GLES2DecoderTestBase::SetupExpectationsForApplyingDirtyState( | 657 void GLES2DecoderTestBase::SetupExpectationsForApplyingDirtyState( |
500 bool framebuffer_is_rgb, | 658 bool framebuffer_is_rgb, |
501 bool framebuffer_has_depth, | 659 bool framebuffer_has_depth, |
502 bool framebuffer_has_stencil, | 660 bool framebuffer_has_stencil, |
503 GLuint color_bits, | 661 GLuint color_bits, |
504 bool depth_mask, | 662 bool depth_mask, |
505 bool depth_enabled, | 663 bool depth_enabled, |
506 GLuint front_stencil_mask, | 664 GLuint front_stencil_mask, |
507 GLuint back_stencil_mask, | 665 GLuint back_stencil_mask, |
508 bool stencil_enabled) { | 666 bool stencil_enabled, |
| 667 bool cull_face_enabled, |
| 668 bool scissor_test_enabled) { |
509 EXPECT_CALL(*gl_, ColorMask( | 669 EXPECT_CALL(*gl_, ColorMask( |
510 (color_bits & 0x1000) != 0, | 670 (color_bits & 0x1000) != 0, |
511 (color_bits & 0x0100) != 0, | 671 (color_bits & 0x0100) != 0, |
512 (color_bits & 0x0010) != 0, | 672 (color_bits & 0x0010) != 0, |
513 (color_bits & 0x0001) && !framebuffer_is_rgb)) | 673 (color_bits & 0x0001) && !framebuffer_is_rgb)) |
514 .Times(1) | 674 .Times(1) |
515 .RetiresOnSaturation(); | 675 .RetiresOnSaturation(); |
516 EXPECT_CALL(*gl_, DepthMask(depth_mask)) | 676 EXPECT_CALL(*gl_, DepthMask(depth_mask)) |
517 .Times(1) | 677 .Times(1) |
518 .RetiresOnSaturation(); | 678 .RetiresOnSaturation(); |
(...skipping 14 matching lines...) Expand all Loading... |
533 .RetiresOnSaturation(); | 693 .RetiresOnSaturation(); |
534 if (framebuffer_has_stencil && stencil_enabled) { | 694 if (framebuffer_has_stencil && stencil_enabled) { |
535 EXPECT_CALL(*gl_, Enable(GL_STENCIL_TEST)) | 695 EXPECT_CALL(*gl_, Enable(GL_STENCIL_TEST)) |
536 .Times(1) | 696 .Times(1) |
537 .RetiresOnSaturation(); | 697 .RetiresOnSaturation(); |
538 } else { | 698 } else { |
539 EXPECT_CALL(*gl_, Disable(GL_STENCIL_TEST)) | 699 EXPECT_CALL(*gl_, Disable(GL_STENCIL_TEST)) |
540 .Times(1) | 700 .Times(1) |
541 .RetiresOnSaturation(); | 701 .RetiresOnSaturation(); |
542 } | 702 } |
| 703 if (cull_face_enabled) { |
| 704 EXPECT_CALL(*gl_, Enable(GL_CULL_FACE)) |
| 705 .Times(1) |
| 706 .RetiresOnSaturation(); |
| 707 } else { |
| 708 EXPECT_CALL(*gl_, Disable(GL_CULL_FACE)) |
| 709 .Times(1) |
| 710 .RetiresOnSaturation(); |
| 711 } |
| 712 if (scissor_test_enabled) { |
| 713 EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST)) |
| 714 .Times(1) |
| 715 .RetiresOnSaturation(); |
| 716 } else { |
| 717 EXPECT_CALL(*gl_, Disable(GL_SCISSOR_TEST)) |
| 718 .Times(1) |
| 719 .RetiresOnSaturation(); |
| 720 } |
543 } | 721 } |
544 | 722 |
545 void GLES2DecoderTestBase::SetupExpectationsForApplyingDefaultDirtyState() { | 723 void GLES2DecoderTestBase::SetupExpectationsForApplyingDefaultDirtyState() { |
546 SetupExpectationsForApplyingDirtyState( | 724 SetupExpectationsForApplyingDirtyState( |
547 false, // Framebuffer is RGB | 725 false, // Framebuffer is RGB |
548 false, // Framebuffer has depth | 726 false, // Framebuffer has depth |
549 false, // Framebuffer has stencil | 727 false, // Framebuffer has stencil |
550 0x1111, // color bits | 728 0x1111, // color bits |
551 true, // depth mask | 729 true, // depth mask |
552 false, // depth enabled | 730 false, // depth enabled |
553 0, // front stencil mask | 731 0, // front stencil mask |
554 0, // back stencil mask | 732 0, // back stencil mask |
555 false); // stencil enabled | 733 false, // stencil enabled |
| 734 false, // cull_face_enabled |
| 735 false); // scissor_test_enabled |
556 } | 736 } |
557 | 737 |
558 void GLES2DecoderTestBase::DoBindFramebuffer( | 738 void GLES2DecoderTestBase::DoBindFramebuffer( |
559 GLenum target, GLuint client_id, GLuint service_id) { | 739 GLenum target, GLuint client_id, GLuint service_id) { |
560 EXPECT_CALL(*gl_, BindFramebufferEXT(target, service_id)) | 740 EXPECT_CALL(*gl_, BindFramebufferEXT(target, service_id)) |
561 .Times(1) | 741 .Times(1) |
562 .RetiresOnSaturation(); | 742 .RetiresOnSaturation(); |
563 BindFramebuffer cmd; | 743 BindFramebuffer cmd; |
564 cmd.Init(target, client_id); | 744 cmd.Init(target, client_id); |
565 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 745 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 VertexAttribDivisorANGLE(index, divisor)) | 949 VertexAttribDivisorANGLE(index, divisor)) |
770 .Times(1) | 950 .Times(1) |
771 .RetiresOnSaturation(); | 951 .RetiresOnSaturation(); |
772 VertexAttribDivisorANGLE cmd; | 952 VertexAttribDivisorANGLE cmd; |
773 cmd.Init(index, divisor); | 953 cmd.Init(index, divisor); |
774 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 954 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
775 } | 955 } |
776 | 956 |
777 // GCC requires these declarations, but MSVC requires they not be present | 957 // GCC requires these declarations, but MSVC requires they not be present |
778 #ifndef COMPILER_MSVC | 958 #ifndef COMPILER_MSVC |
| 959 const int GLES2DecoderTestBase::kBackBufferWidth; |
| 960 const int GLES2DecoderTestBase::kBackBufferHeight; |
| 961 |
779 const GLint GLES2DecoderTestBase::kMaxTextureSize; | 962 const GLint GLES2DecoderTestBase::kMaxTextureSize; |
780 const GLint GLES2DecoderTestBase::kMaxCubeMapTextureSize; | 963 const GLint GLES2DecoderTestBase::kMaxCubeMapTextureSize; |
781 const GLint GLES2DecoderTestBase::kNumVertexAttribs; | 964 const GLint GLES2DecoderTestBase::kNumVertexAttribs; |
782 const GLint GLES2DecoderTestBase::kNumTextureUnits; | 965 const GLint GLES2DecoderTestBase::kNumTextureUnits; |
783 const GLint GLES2DecoderTestBase::kMaxTextureImageUnits; | 966 const GLint GLES2DecoderTestBase::kMaxTextureImageUnits; |
784 const GLint GLES2DecoderTestBase::kMaxVertexTextureImageUnits; | 967 const GLint GLES2DecoderTestBase::kMaxVertexTextureImageUnits; |
785 const GLint GLES2DecoderTestBase::kMaxFragmentUniformVectors; | 968 const GLint GLES2DecoderTestBase::kMaxFragmentUniformVectors; |
786 const GLint GLES2DecoderTestBase::kMaxVaryingVectors; | 969 const GLint GLES2DecoderTestBase::kMaxVaryingVectors; |
787 const GLint GLES2DecoderTestBase::kMaxVertexUniformVectors; | 970 const GLint GLES2DecoderTestBase::kMaxVertexUniformVectors; |
| 971 const GLint GLES2DecoderTestBase::kMaxViewportWidth; |
| 972 const GLint GLES2DecoderTestBase::kMaxViewportHeight; |
| 973 |
| 974 const GLint GLES2DecoderTestBase::kViewportX; |
| 975 const GLint GLES2DecoderTestBase::kViewportY; |
| 976 const GLint GLES2DecoderTestBase::kViewportWidth; |
| 977 const GLint GLES2DecoderTestBase::kViewportHeight; |
788 | 978 |
789 const GLuint GLES2DecoderTestBase::kServiceAttrib0BufferId; | 979 const GLuint GLES2DecoderTestBase::kServiceAttrib0BufferId; |
790 const GLuint GLES2DecoderTestBase::kServiceFixedAttribBufferId; | 980 const GLuint GLES2DecoderTestBase::kServiceFixedAttribBufferId; |
791 | 981 |
792 const GLuint GLES2DecoderTestBase::kServiceBufferId; | 982 const GLuint GLES2DecoderTestBase::kServiceBufferId; |
793 const GLuint GLES2DecoderTestBase::kServiceFramebufferId; | 983 const GLuint GLES2DecoderTestBase::kServiceFramebufferId; |
794 const GLuint GLES2DecoderTestBase::kServiceRenderbufferId; | 984 const GLuint GLES2DecoderTestBase::kServiceRenderbufferId; |
795 const GLuint GLES2DecoderTestBase::kServiceTextureId; | 985 const GLuint GLES2DecoderTestBase::kServiceTextureId; |
796 const GLuint GLES2DecoderTestBase::kServiceProgramId; | 986 const GLuint GLES2DecoderTestBase::kServiceProgramId; |
797 const GLuint GLES2DecoderTestBase::kServiceShaderId; | 987 const GLuint GLES2DecoderTestBase::kServiceShaderId; |
798 const GLuint GLES2DecoderTestBase::kServiceElementBufferId; | 988 const GLuint GLES2DecoderTestBase::kServiceElementBufferId; |
799 const GLuint GLES2DecoderTestBase::kServiceQueryId; | 989 const GLuint GLES2DecoderTestBase::kServiceQueryId; |
800 | 990 |
801 const int32 GLES2DecoderTestBase::kSharedMemoryId; | 991 const int32 GLES2DecoderTestBase::kSharedMemoryId; |
802 const size_t GLES2DecoderTestBase::kSharedBufferSize; | 992 const size_t GLES2DecoderTestBase::kSharedBufferSize; |
803 const uint32 GLES2DecoderTestBase::kSharedMemoryOffset; | 993 const uint32 GLES2DecoderTestBase::kSharedMemoryOffset; |
804 const int32 GLES2DecoderTestBase::kInvalidSharedMemoryId; | 994 const int32 GLES2DecoderTestBase::kInvalidSharedMemoryId; |
805 const uint32 GLES2DecoderTestBase::kInvalidSharedMemoryOffset; | 995 const uint32 GLES2DecoderTestBase::kInvalidSharedMemoryOffset; |
806 const uint32 GLES2DecoderTestBase::kInitialResult; | 996 const uint32 GLES2DecoderTestBase::kInitialResult; |
807 const uint8 GLES2DecoderTestBase::kInitialMemoryValue; | 997 const uint8 GLES2DecoderTestBase::kInitialMemoryValue; |
808 | 998 |
809 const uint32 GLES2DecoderTestBase::kNewClientId; | 999 const uint32 GLES2DecoderTestBase::kNewClientId; |
810 const uint32 GLES2DecoderTestBase::kNewServiceId; | 1000 const uint32 GLES2DecoderTestBase::kNewServiceId; |
811 const uint32 GLES2DecoderTestBase::kInvalidClientId; | 1001 const uint32 GLES2DecoderTestBase::kInvalidClientId; |
812 | 1002 |
813 const int GLES2DecoderTestBase::kBackBufferWidth; | |
814 const int GLES2DecoderTestBase::kBackBufferHeight; | |
815 | |
816 const GLuint GLES2DecoderTestBase::kServiceVertexShaderId; | 1003 const GLuint GLES2DecoderTestBase::kServiceVertexShaderId; |
817 const GLuint GLES2DecoderTestBase::kServiceFragmentShaderId; | 1004 const GLuint GLES2DecoderTestBase::kServiceFragmentShaderId; |
818 | 1005 |
| 1006 const GLuint GLES2DecoderTestBase::kServiceCopyTextureChromiumShaderId; |
| 1007 const GLuint GLES2DecoderTestBase::kServiceCopyTextureChromiumProgramId; |
| 1008 |
| 1009 const GLuint GLES2DecoderTestBase::kServiceCopyTextureChromiumTextureBufferId; |
| 1010 const GLuint GLES2DecoderTestBase::kServiceCopyTextureChromiumVertexBufferId; |
| 1011 const GLuint GLES2DecoderTestBase::kServiceCopyTextureChromiumFBOId; |
| 1012 const GLuint GLES2DecoderTestBase::kServiceCopyTextureChromiumPositionAttrib; |
| 1013 const GLuint GLES2DecoderTestBase::kServiceCopyTextureChromiumTexAttrib; |
| 1014 const GLuint GLES2DecoderTestBase::kServiceCopyTextureChromiumSamplerLocation; |
| 1015 |
819 const GLsizei GLES2DecoderTestBase::kNumVertices; | 1016 const GLsizei GLES2DecoderTestBase::kNumVertices; |
820 const GLsizei GLES2DecoderTestBase::kNumIndices; | 1017 const GLsizei GLES2DecoderTestBase::kNumIndices; |
821 const int GLES2DecoderTestBase::kValidIndexRangeStart; | 1018 const int GLES2DecoderTestBase::kValidIndexRangeStart; |
822 const int GLES2DecoderTestBase::kValidIndexRangeCount; | 1019 const int GLES2DecoderTestBase::kValidIndexRangeCount; |
823 const int GLES2DecoderTestBase::kInvalidIndexRangeStart; | 1020 const int GLES2DecoderTestBase::kInvalidIndexRangeStart; |
824 const int GLES2DecoderTestBase::kInvalidIndexRangeCount; | 1021 const int GLES2DecoderTestBase::kInvalidIndexRangeCount; |
825 const int GLES2DecoderTestBase::kOutOfRangeIndexRangeEnd; | 1022 const int GLES2DecoderTestBase::kOutOfRangeIndexRangeEnd; |
826 const GLuint GLES2DecoderTestBase::kMaxValidIndex; | 1023 const GLuint GLES2DecoderTestBase::kMaxValidIndex; |
827 | 1024 |
828 const GLint GLES2DecoderTestBase::kMaxAttribLength; | 1025 const GLint GLES2DecoderTestBase::kMaxAttribLength; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 .RetiresOnSaturation(); | 1364 .RetiresOnSaturation(); |
1168 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, 0)) | 1365 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, 0)) |
1169 .Times(1) | 1366 .Times(1) |
1170 .RetiresOnSaturation(); | 1367 .RetiresOnSaturation(); |
1171 EXPECT_CALL(*gl_, VertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL)) | 1368 EXPECT_CALL(*gl_, VertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL)) |
1172 .Times(1) | 1369 .Times(1) |
1173 .RetiresOnSaturation(); | 1370 .RetiresOnSaturation(); |
1174 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, buffer_id)) | 1371 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, buffer_id)) |
1175 .Times(1) | 1372 .Times(1) |
1176 .RetiresOnSaturation(); | 1373 .RetiresOnSaturation(); |
| 1374 |
| 1375 EXPECT_CALL(*gl_, DisableVertexAttribArray(0)) |
| 1376 .Times(1) |
| 1377 .RetiresOnSaturation(); |
1177 } | 1378 } |
1178 } | 1379 } |
1179 | 1380 |
1180 void GLES2DecoderTestBase::AddExpectationsForSimulatedAttrib0( | 1381 void GLES2DecoderTestBase::AddExpectationsForSimulatedAttrib0( |
1181 GLsizei num_vertices, GLuint buffer_id) { | 1382 GLsizei num_vertices, GLuint buffer_id) { |
1182 AddExpectationsForSimulatedAttrib0WithError( | 1383 AddExpectationsForSimulatedAttrib0WithError( |
1183 num_vertices, buffer_id, GL_NO_ERROR); | 1384 num_vertices, buffer_id, GL_NO_ERROR); |
1184 } | 1385 } |
1185 | 1386 |
1186 void GLES2DecoderWithShaderTestBase::SetUp() { | 1387 void GLES2DecoderWithShaderTestBase::SetUp() { |
1187 GLES2DecoderTestBase::SetUp(); | 1388 GLES2DecoderTestBase::SetUp(); |
1188 SetupDefaultProgram(); | 1389 SetupDefaultProgram(); |
1189 } | 1390 } |
1190 | 1391 |
1191 } // namespace gles2 | 1392 } // namespace gles2 |
1192 } // namespace gpu | 1393 } // namespace gpu |
OLD | NEW |