| 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; | |
| 30 using ::testing::SetArgumentPointee; | 29 using ::testing::SetArgumentPointee; |
| 31 using ::testing::StrEq; | 30 using ::testing::StrEq; |
| 32 using ::testing::StrictMock; | 31 using ::testing::StrictMock; |
| 33 | 32 |
| 34 namespace gpu { | 33 namespace gpu { |
| 35 namespace gles2 { | 34 namespace gles2 { |
| 36 | 35 |
| 37 GLES2DecoderTestBase::GLES2DecoderTestBase() | 36 GLES2DecoderTestBase::GLES2DecoderTestBase() |
| 38 : surface_(NULL), | 37 : surface_(NULL), |
| 39 context_(NULL), | 38 context_(NULL), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 57 "", // extensions | 56 "", // extensions |
| 58 true, // has alpha | 57 true, // has alpha |
| 59 true, // has depth | 58 true, // has depth |
| 60 false, // has stencil | 59 false, // has stencil |
| 61 true, // request alpha | 60 true, // request alpha |
| 62 true, // request depth | 61 true, // request depth |
| 63 false, // request stencil | 62 false, // request stencil |
| 64 true); // bind generates resource | 63 true); // bind generates resource |
| 65 } | 64 } |
| 66 | 65 |
| 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 | |
| 186 void GLES2DecoderTestBase::InitDecoder( | 66 void GLES2DecoderTestBase::InitDecoder( |
| 187 const char* extensions, | 67 const char* extensions, |
| 188 bool has_alpha, | 68 bool has_alpha, |
| 189 bool has_depth, | 69 bool has_depth, |
| 190 bool has_stencil, | 70 bool has_stencil, |
| 191 bool request_alpha, | 71 bool request_alpha, |
| 192 bool request_depth, | 72 bool request_depth, |
| 193 bool request_stencil, | 73 bool request_stencil, |
| 194 bool bind_generates_resource) { | 74 bool bind_generates_resource) { |
| 195 gl_.reset(new StrictMock<MockGLInterface>()); | 75 gl_.reset(new StrictMock<MockGLInterface>()); |
| 196 ::gfx::GLInterface::SetGLInterface(gl_.get()); | 76 ::gfx::GLInterface::SetGLInterface(gl_.get()); |
| 197 group_ = ContextGroup::Ref(new ContextGroup(bind_generates_resource)); | 77 group_ = ContextGroup::Ref(new ContextGroup(bind_generates_resource)); |
| 198 | 78 |
| 199 InSequence sequence; | 79 InSequence sequence; |
| 200 | 80 |
| 201 TestHelper::SetupContextGroupInitExpectations(gl_.get(), | 81 TestHelper::SetupContextGroupInitExpectations(gl_.get(), |
| 202 DisallowedFeatures(), extensions); | 82 DisallowedFeatures(), extensions); |
| 203 | 83 |
| 204 EXPECT_TRUE(group_->Initialize(DisallowedFeatures(), NULL)); | 84 EXPECT_TRUE(group_->Initialize(DisallowedFeatures(), NULL)); |
| 205 | 85 |
| 206 AddExpectationsForCopyTextureCHROMIUM(); | |
| 207 | |
| 208 EXPECT_CALL(*gl_, EnableVertexAttribArray(0)) | 86 EXPECT_CALL(*gl_, EnableVertexAttribArray(0)) |
| 209 .Times(1) | 87 .Times(1) |
| 210 .RetiresOnSaturation(); | 88 .RetiresOnSaturation(); |
| 211 static GLuint attrib_0_id[] = { | 89 static GLuint attrib_0_id[] = { |
| 212 kServiceAttrib0BufferId, | 90 kServiceAttrib0BufferId, |
| 213 }; | 91 }; |
| 214 static GLuint fixed_attrib_buffer_id[] = { | 92 static GLuint fixed_attrib_buffer_id[] = { |
| 215 kServiceFixedAttribBufferId, | 93 kServiceFixedAttribBufferId, |
| 216 }; | 94 }; |
| 217 EXPECT_CALL(*gl_, GenBuffersARB(arraysize(attrib_0_id), _)) | 95 EXPECT_CALL(*gl_, GenBuffersARB(arraysize(attrib_0_id), _)) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 EXPECT_CALL(*gl_, Enable(GL_POINT_SPRITE)) | 164 EXPECT_CALL(*gl_, Enable(GL_POINT_SPRITE)) |
| 287 .Times(1) | 165 .Times(1) |
| 288 .RetiresOnSaturation(); | 166 .RetiresOnSaturation(); |
| 289 | 167 |
| 290 #if defined(OS_MACOSX) | 168 #if defined(OS_MACOSX) |
| 291 EXPECT_CALL(*gl_, GetString(GL_VENDOR)) | 169 EXPECT_CALL(*gl_, GetString(GL_VENDOR)) |
| 292 .Times(1) | 170 .Times(1) |
| 293 .RetiresOnSaturation(); | 171 .RetiresOnSaturation(); |
| 294 #endif | 172 #endif |
| 295 | 173 |
| 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 | |
| 316 engine_.reset(new StrictMock<MockCommandBufferEngine>()); | 174 engine_.reset(new StrictMock<MockCommandBufferEngine>()); |
| 317 Buffer buffer = engine_->GetSharedMemoryBuffer(kSharedMemoryId); | 175 Buffer buffer = engine_->GetSharedMemoryBuffer(kSharedMemoryId); |
| 318 shared_memory_offset_ = kSharedMemoryOffset; | 176 shared_memory_offset_ = kSharedMemoryOffset; |
| 319 shared_memory_address_ = reinterpret_cast<int8*>(buffer.ptr) + | 177 shared_memory_address_ = reinterpret_cast<int8*>(buffer.ptr) + |
| 320 shared_memory_offset_; | 178 shared_memory_offset_; |
| 321 shared_memory_id_ = kSharedMemoryId; | 179 shared_memory_id_ = kSharedMemoryId; |
| 322 shared_memory_base_ = buffer.ptr; | 180 shared_memory_base_ = buffer.ptr; |
| 323 | 181 |
| 324 surface_ = new gfx::GLSurfaceStub; | 182 surface_ = new gfx::GLSurfaceStub; |
| 325 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); | 183 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 .RetiresOnSaturation(); | 224 .RetiresOnSaturation(); |
| 367 GenHelper<GenBuffersImmediate>(client_element_buffer_id_); | 225 GenHelper<GenBuffersImmediate>(client_element_buffer_id_); |
| 368 | 226 |
| 369 DoCreateProgram(client_program_id_, kServiceProgramId); | 227 DoCreateProgram(client_program_id_, kServiceProgramId); |
| 370 DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); | 228 DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); |
| 371 | 229 |
| 372 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 230 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 373 } | 231 } |
| 374 | 232 |
| 375 void GLES2DecoderTestBase::TearDown() { | 233 void GLES2DecoderTestBase::TearDown() { |
| 376 InSequence sequence; | |
| 377 | |
| 378 // All Tests should have read all their GLErrors before getting here. | 234 // All Tests should have read all their GLErrors before getting here. |
| 379 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 235 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 | |
| 393 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)) | 236 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)) |
| 394 .Times(2) | 237 .Times(2) |
| 395 .RetiresOnSaturation(); | 238 .RetiresOnSaturation(); |
| 396 | |
| 397 decoder_->Destroy(); | 239 decoder_->Destroy(); |
| 398 decoder_.reset(); | 240 decoder_.reset(); |
| 399 group_->Destroy(false); | 241 group_->Destroy(false); |
| 400 engine_.reset(); | 242 engine_.reset(); |
| 401 ::gfx::GLInterface::SetGLInterface(NULL); | 243 ::gfx::GLInterface::SetGLInterface(NULL); |
| 402 gl_.reset(); | 244 gl_.reset(); |
| 403 } | 245 } |
| 404 | 246 |
| 405 GLint GLES2DecoderTestBase::GetGLError() { | 247 GLint GLES2DecoderTestBase::GetGLError() { |
| 406 EXPECT_CALL(*gl_, GetError()) | 248 EXPECT_CALL(*gl_, GetError()) |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 | 498 |
| 657 void GLES2DecoderTestBase::SetupExpectationsForApplyingDirtyState( | 499 void GLES2DecoderTestBase::SetupExpectationsForApplyingDirtyState( |
| 658 bool framebuffer_is_rgb, | 500 bool framebuffer_is_rgb, |
| 659 bool framebuffer_has_depth, | 501 bool framebuffer_has_depth, |
| 660 bool framebuffer_has_stencil, | 502 bool framebuffer_has_stencil, |
| 661 GLuint color_bits, | 503 GLuint color_bits, |
| 662 bool depth_mask, | 504 bool depth_mask, |
| 663 bool depth_enabled, | 505 bool depth_enabled, |
| 664 GLuint front_stencil_mask, | 506 GLuint front_stencil_mask, |
| 665 GLuint back_stencil_mask, | 507 GLuint back_stencil_mask, |
| 666 bool stencil_enabled, | 508 bool stencil_enabled) { |
| 667 bool cull_face_enabled, | |
| 668 bool scissor_test_enabled) { | |
| 669 EXPECT_CALL(*gl_, ColorMask( | 509 EXPECT_CALL(*gl_, ColorMask( |
| 670 (color_bits & 0x1000) != 0, | 510 (color_bits & 0x1000) != 0, |
| 671 (color_bits & 0x0100) != 0, | 511 (color_bits & 0x0100) != 0, |
| 672 (color_bits & 0x0010) != 0, | 512 (color_bits & 0x0010) != 0, |
| 673 (color_bits & 0x0001) && !framebuffer_is_rgb)) | 513 (color_bits & 0x0001) && !framebuffer_is_rgb)) |
| 674 .Times(1) | 514 .Times(1) |
| 675 .RetiresOnSaturation(); | 515 .RetiresOnSaturation(); |
| 676 EXPECT_CALL(*gl_, DepthMask(depth_mask)) | 516 EXPECT_CALL(*gl_, DepthMask(depth_mask)) |
| 677 .Times(1) | 517 .Times(1) |
| 678 .RetiresOnSaturation(); | 518 .RetiresOnSaturation(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 693 .RetiresOnSaturation(); | 533 .RetiresOnSaturation(); |
| 694 if (framebuffer_has_stencil && stencil_enabled) { | 534 if (framebuffer_has_stencil && stencil_enabled) { |
| 695 EXPECT_CALL(*gl_, Enable(GL_STENCIL_TEST)) | 535 EXPECT_CALL(*gl_, Enable(GL_STENCIL_TEST)) |
| 696 .Times(1) | 536 .Times(1) |
| 697 .RetiresOnSaturation(); | 537 .RetiresOnSaturation(); |
| 698 } else { | 538 } else { |
| 699 EXPECT_CALL(*gl_, Disable(GL_STENCIL_TEST)) | 539 EXPECT_CALL(*gl_, Disable(GL_STENCIL_TEST)) |
| 700 .Times(1) | 540 .Times(1) |
| 701 .RetiresOnSaturation(); | 541 .RetiresOnSaturation(); |
| 702 } | 542 } |
| 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 } | |
| 721 } | 543 } |
| 722 | 544 |
| 723 void GLES2DecoderTestBase::SetupExpectationsForApplyingDefaultDirtyState() { | 545 void GLES2DecoderTestBase::SetupExpectationsForApplyingDefaultDirtyState() { |
| 724 SetupExpectationsForApplyingDirtyState( | 546 SetupExpectationsForApplyingDirtyState( |
| 725 false, // Framebuffer is RGB | 547 false, // Framebuffer is RGB |
| 726 false, // Framebuffer has depth | 548 false, // Framebuffer has depth |
| 727 false, // Framebuffer has stencil | 549 false, // Framebuffer has stencil |
| 728 0x1111, // color bits | 550 0x1111, // color bits |
| 729 true, // depth mask | 551 true, // depth mask |
| 730 false, // depth enabled | 552 false, // depth enabled |
| 731 0, // front stencil mask | 553 0, // front stencil mask |
| 732 0, // back stencil mask | 554 0, // back stencil mask |
| 733 false, // stencil enabled | 555 false); // stencil enabled |
| 734 false, // cull_face_enabled | |
| 735 false); // scissor_test_enabled | |
| 736 } | 556 } |
| 737 | 557 |
| 738 void GLES2DecoderTestBase::DoBindFramebuffer( | 558 void GLES2DecoderTestBase::DoBindFramebuffer( |
| 739 GLenum target, GLuint client_id, GLuint service_id) { | 559 GLenum target, GLuint client_id, GLuint service_id) { |
| 740 EXPECT_CALL(*gl_, BindFramebufferEXT(target, service_id)) | 560 EXPECT_CALL(*gl_, BindFramebufferEXT(target, service_id)) |
| 741 .Times(1) | 561 .Times(1) |
| 742 .RetiresOnSaturation(); | 562 .RetiresOnSaturation(); |
| 743 BindFramebuffer cmd; | 563 BindFramebuffer cmd; |
| 744 cmd.Init(target, client_id); | 564 cmd.Init(target, client_id); |
| 745 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 565 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 VertexAttribDivisorANGLE(index, divisor)) | 769 VertexAttribDivisorANGLE(index, divisor)) |
| 950 .Times(1) | 770 .Times(1) |
| 951 .RetiresOnSaturation(); | 771 .RetiresOnSaturation(); |
| 952 VertexAttribDivisorANGLE cmd; | 772 VertexAttribDivisorANGLE cmd; |
| 953 cmd.Init(index, divisor); | 773 cmd.Init(index, divisor); |
| 954 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 774 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 955 } | 775 } |
| 956 | 776 |
| 957 // GCC requires these declarations, but MSVC requires they not be present | 777 // GCC requires these declarations, but MSVC requires they not be present |
| 958 #ifndef COMPILER_MSVC | 778 #ifndef COMPILER_MSVC |
| 959 const int GLES2DecoderTestBase::kBackBufferWidth; | |
| 960 const int GLES2DecoderTestBase::kBackBufferHeight; | |
| 961 | |
| 962 const GLint GLES2DecoderTestBase::kMaxTextureSize; | 779 const GLint GLES2DecoderTestBase::kMaxTextureSize; |
| 963 const GLint GLES2DecoderTestBase::kMaxCubeMapTextureSize; | 780 const GLint GLES2DecoderTestBase::kMaxCubeMapTextureSize; |
| 964 const GLint GLES2DecoderTestBase::kNumVertexAttribs; | 781 const GLint GLES2DecoderTestBase::kNumVertexAttribs; |
| 965 const GLint GLES2DecoderTestBase::kNumTextureUnits; | 782 const GLint GLES2DecoderTestBase::kNumTextureUnits; |
| 966 const GLint GLES2DecoderTestBase::kMaxTextureImageUnits; | 783 const GLint GLES2DecoderTestBase::kMaxTextureImageUnits; |
| 967 const GLint GLES2DecoderTestBase::kMaxVertexTextureImageUnits; | 784 const GLint GLES2DecoderTestBase::kMaxVertexTextureImageUnits; |
| 968 const GLint GLES2DecoderTestBase::kMaxFragmentUniformVectors; | 785 const GLint GLES2DecoderTestBase::kMaxFragmentUniformVectors; |
| 969 const GLint GLES2DecoderTestBase::kMaxVaryingVectors; | 786 const GLint GLES2DecoderTestBase::kMaxVaryingVectors; |
| 970 const GLint GLES2DecoderTestBase::kMaxVertexUniformVectors; | 787 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; | |
| 978 | 788 |
| 979 const GLuint GLES2DecoderTestBase::kServiceAttrib0BufferId; | 789 const GLuint GLES2DecoderTestBase::kServiceAttrib0BufferId; |
| 980 const GLuint GLES2DecoderTestBase::kServiceFixedAttribBufferId; | 790 const GLuint GLES2DecoderTestBase::kServiceFixedAttribBufferId; |
| 981 | 791 |
| 982 const GLuint GLES2DecoderTestBase::kServiceBufferId; | 792 const GLuint GLES2DecoderTestBase::kServiceBufferId; |
| 983 const GLuint GLES2DecoderTestBase::kServiceFramebufferId; | 793 const GLuint GLES2DecoderTestBase::kServiceFramebufferId; |
| 984 const GLuint GLES2DecoderTestBase::kServiceRenderbufferId; | 794 const GLuint GLES2DecoderTestBase::kServiceRenderbufferId; |
| 985 const GLuint GLES2DecoderTestBase::kServiceTextureId; | 795 const GLuint GLES2DecoderTestBase::kServiceTextureId; |
| 986 const GLuint GLES2DecoderTestBase::kServiceProgramId; | 796 const GLuint GLES2DecoderTestBase::kServiceProgramId; |
| 987 const GLuint GLES2DecoderTestBase::kServiceShaderId; | 797 const GLuint GLES2DecoderTestBase::kServiceShaderId; |
| 988 const GLuint GLES2DecoderTestBase::kServiceElementBufferId; | 798 const GLuint GLES2DecoderTestBase::kServiceElementBufferId; |
| 989 const GLuint GLES2DecoderTestBase::kServiceQueryId; | 799 const GLuint GLES2DecoderTestBase::kServiceQueryId; |
| 990 | 800 |
| 991 const int32 GLES2DecoderTestBase::kSharedMemoryId; | 801 const int32 GLES2DecoderTestBase::kSharedMemoryId; |
| 992 const size_t GLES2DecoderTestBase::kSharedBufferSize; | 802 const size_t GLES2DecoderTestBase::kSharedBufferSize; |
| 993 const uint32 GLES2DecoderTestBase::kSharedMemoryOffset; | 803 const uint32 GLES2DecoderTestBase::kSharedMemoryOffset; |
| 994 const int32 GLES2DecoderTestBase::kInvalidSharedMemoryId; | 804 const int32 GLES2DecoderTestBase::kInvalidSharedMemoryId; |
| 995 const uint32 GLES2DecoderTestBase::kInvalidSharedMemoryOffset; | 805 const uint32 GLES2DecoderTestBase::kInvalidSharedMemoryOffset; |
| 996 const uint32 GLES2DecoderTestBase::kInitialResult; | 806 const uint32 GLES2DecoderTestBase::kInitialResult; |
| 997 const uint8 GLES2DecoderTestBase::kInitialMemoryValue; | 807 const uint8 GLES2DecoderTestBase::kInitialMemoryValue; |
| 998 | 808 |
| 999 const uint32 GLES2DecoderTestBase::kNewClientId; | 809 const uint32 GLES2DecoderTestBase::kNewClientId; |
| 1000 const uint32 GLES2DecoderTestBase::kNewServiceId; | 810 const uint32 GLES2DecoderTestBase::kNewServiceId; |
| 1001 const uint32 GLES2DecoderTestBase::kInvalidClientId; | 811 const uint32 GLES2DecoderTestBase::kInvalidClientId; |
| 1002 | 812 |
| 813 const int GLES2DecoderTestBase::kBackBufferWidth; |
| 814 const int GLES2DecoderTestBase::kBackBufferHeight; |
| 815 |
| 1003 const GLuint GLES2DecoderTestBase::kServiceVertexShaderId; | 816 const GLuint GLES2DecoderTestBase::kServiceVertexShaderId; |
| 1004 const GLuint GLES2DecoderTestBase::kServiceFragmentShaderId; | 817 const GLuint GLES2DecoderTestBase::kServiceFragmentShaderId; |
| 1005 | 818 |
| 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 | |
| 1016 const GLsizei GLES2DecoderTestBase::kNumVertices; | 819 const GLsizei GLES2DecoderTestBase::kNumVertices; |
| 1017 const GLsizei GLES2DecoderTestBase::kNumIndices; | 820 const GLsizei GLES2DecoderTestBase::kNumIndices; |
| 1018 const int GLES2DecoderTestBase::kValidIndexRangeStart; | 821 const int GLES2DecoderTestBase::kValidIndexRangeStart; |
| 1019 const int GLES2DecoderTestBase::kValidIndexRangeCount; | 822 const int GLES2DecoderTestBase::kValidIndexRangeCount; |
| 1020 const int GLES2DecoderTestBase::kInvalidIndexRangeStart; | 823 const int GLES2DecoderTestBase::kInvalidIndexRangeStart; |
| 1021 const int GLES2DecoderTestBase::kInvalidIndexRangeCount; | 824 const int GLES2DecoderTestBase::kInvalidIndexRangeCount; |
| 1022 const int GLES2DecoderTestBase::kOutOfRangeIndexRangeEnd; | 825 const int GLES2DecoderTestBase::kOutOfRangeIndexRangeEnd; |
| 1023 const GLuint GLES2DecoderTestBase::kMaxValidIndex; | 826 const GLuint GLES2DecoderTestBase::kMaxValidIndex; |
| 1024 | 827 |
| 1025 const GLint GLES2DecoderTestBase::kMaxAttribLength; | 828 const GLint GLES2DecoderTestBase::kMaxAttribLength; |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 .RetiresOnSaturation(); | 1167 .RetiresOnSaturation(); |
| 1365 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, 0)) | 1168 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, 0)) |
| 1366 .Times(1) | 1169 .Times(1) |
| 1367 .RetiresOnSaturation(); | 1170 .RetiresOnSaturation(); |
| 1368 EXPECT_CALL(*gl_, VertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL)) | 1171 EXPECT_CALL(*gl_, VertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL)) |
| 1369 .Times(1) | 1172 .Times(1) |
| 1370 .RetiresOnSaturation(); | 1173 .RetiresOnSaturation(); |
| 1371 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, buffer_id)) | 1174 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, buffer_id)) |
| 1372 .Times(1) | 1175 .Times(1) |
| 1373 .RetiresOnSaturation(); | 1176 .RetiresOnSaturation(); |
| 1374 | |
| 1375 EXPECT_CALL(*gl_, DisableVertexAttribArray(0)) | |
| 1376 .Times(1) | |
| 1377 .RetiresOnSaturation(); | |
| 1378 } | 1177 } |
| 1379 } | 1178 } |
| 1380 | 1179 |
| 1381 void GLES2DecoderTestBase::AddExpectationsForSimulatedAttrib0( | 1180 void GLES2DecoderTestBase::AddExpectationsForSimulatedAttrib0( |
| 1382 GLsizei num_vertices, GLuint buffer_id) { | 1181 GLsizei num_vertices, GLuint buffer_id) { |
| 1383 AddExpectationsForSimulatedAttrib0WithError( | 1182 AddExpectationsForSimulatedAttrib0WithError( |
| 1384 num_vertices, buffer_id, GL_NO_ERROR); | 1183 num_vertices, buffer_id, GL_NO_ERROR); |
| 1385 } | 1184 } |
| 1386 | 1185 |
| 1387 void GLES2DecoderWithShaderTestBase::SetUp() { | 1186 void GLES2DecoderWithShaderTestBase::SetUp() { |
| 1388 GLES2DecoderTestBase::SetUp(); | 1187 GLES2DecoderTestBase::SetUp(); |
| 1389 SetupDefaultProgram(); | 1188 SetupDefaultProgram(); |
| 1390 } | 1189 } |
| 1391 | 1190 |
| 1392 } // namespace gles2 | 1191 } // namespace gles2 |
| 1393 } // namespace gpu | 1192 } // namespace gpu |
| OLD | NEW |