Chromium Code Reviews| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 cached_depth_mask_(true), | 62 cached_depth_mask_(true), |
| 63 cached_stencil_front_mask_(0xFFFFFFFFU), | 63 cached_stencil_front_mask_(0xFFFFFFFFU), |
| 64 cached_stencil_back_mask_(0xFFFFFFFFU) { | 64 cached_stencil_back_mask_(0xFFFFFFFFU) { |
| 65 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); | 65 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} | 68 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} |
| 69 | 69 |
| 70 void GLES2DecoderTestBase::SetUp() { | 70 void GLES2DecoderTestBase::SetUp() { |
| 71 InitState init; | 71 InitState init; |
| 72 init.gl_version = "3.0"; | 72 // By default, test with VAO support. |
| 73 init.extensions = "GL_OES_vertex_array_object"; | |
|
vmiura
2014/05/27 18:18:08
Many of the tests override this SetUp().
Could we
Zhenyao Mo
2014/05/27 21:22:49
Done.
| |
| 74 init.gl_version = "opengl es 2.0"; | |
|
Ken Russell (switch to Gerrit)
2014/05/27 18:24:32
Is the change of the assumed GL_VERSION in the tes
| |
| 73 init.has_alpha = true; | 75 init.has_alpha = true; |
| 74 init.has_depth = true; | 76 init.has_depth = true; |
| 75 init.request_alpha = true; | 77 init.request_alpha = true; |
| 76 init.request_depth = true; | 78 init.request_depth = true; |
| 77 init.bind_generates_resource = true; | 79 init.bind_generates_resource = true; |
| 78 InitDecoder(init); | 80 InitDecoder(init); |
| 79 } | 81 } |
| 80 | 82 |
| 81 void GLES2DecoderTestBase::AddExpectationsForVertexAttribManager() { | 83 void GLES2DecoderTestBase::AddExpectationsForVertexAttribManager() { |
| 82 for (GLint ii = 0; ii < kNumVertexAttribs; ++ii) { | 84 for (GLint ii = 0; ii < kNumVertexAttribs; ++ii) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 init.bind_generates_resource); | 151 init.bind_generates_resource); |
| 150 | 152 |
| 151 // We initialize the ContextGroup with a MockGLES2Decoder so that | 153 // We initialize the ContextGroup with a MockGLES2Decoder so that |
| 152 // we can use the ContextGroup to figure out how the real GLES2Decoder | 154 // we can use the ContextGroup to figure out how the real GLES2Decoder |
| 153 // will initialize itself. | 155 // will initialize itself. |
| 154 mock_decoder_.reset(new MockGLES2Decoder()); | 156 mock_decoder_.reset(new MockGLES2Decoder()); |
| 155 EXPECT_TRUE( | 157 EXPECT_TRUE( |
| 156 group_->Initialize(mock_decoder_.get(), DisallowedFeatures())); | 158 group_->Initialize(mock_decoder_.get(), DisallowedFeatures())); |
| 157 | 159 |
| 158 if (group_->feature_info()->feature_flags().native_vertex_array_object) { | 160 if (group_->feature_info()->feature_flags().native_vertex_array_object) { |
| 159 EXPECT_CALL(*gl_, GenVertexArraysOES(1, _)).Times(1).RetiresOnSaturation(); | 161 EXPECT_CALL(*gl_, GenVertexArraysOES(1, _)) |
| 162 .WillOnce(SetArgumentPointee<1>(kServiceVertexArrayId)) | |
| 163 .RetiresOnSaturation(); | |
| 160 EXPECT_CALL(*gl_, BindVertexArrayOES(_)).Times(1).RetiresOnSaturation(); | 164 EXPECT_CALL(*gl_, BindVertexArrayOES(_)).Times(1).RetiresOnSaturation(); |
| 161 } | 165 } |
| 162 | 166 |
| 163 if (group_->feature_info()->workarounds().init_vertex_attributes) | 167 if (group_->feature_info()->workarounds().init_vertex_attributes) |
| 164 AddExpectationsForVertexAttribManager(); | 168 AddExpectationsForVertexAttribManager(); |
| 165 | 169 |
| 166 AddExpectationsForBindVertexArrayOES(); | 170 AddExpectationsForBindVertexArrayOES(); |
| 167 | 171 |
| 168 EXPECT_CALL(*gl_, EnableVertexAttribArray(0)) | 172 EXPECT_CALL(*gl_, EnableVertexAttribArray(0)) |
| 169 .Times(1) | 173 .Times(1) |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 void GLES2DecoderTestBase::ResetDecoder() { | 362 void GLES2DecoderTestBase::ResetDecoder() { |
| 359 if (!decoder_.get()) | 363 if (!decoder_.get()) |
| 360 return; | 364 return; |
| 361 // All Tests should have read all their GLErrors before getting here. | 365 // All Tests should have read all their GLErrors before getting here. |
| 362 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 366 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 363 | 367 |
| 364 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)) | 368 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)) |
| 365 .Times(2) | 369 .Times(2) |
| 366 .RetiresOnSaturation(); | 370 .RetiresOnSaturation(); |
| 367 | 371 |
| 372 if (group_->feature_info()->feature_flags().native_vertex_array_object) { | |
| 373 EXPECT_CALL(*gl_, DeleteVertexArraysOES(1, Pointee(kServiceVertexArrayId))) | |
| 374 .Times(1) | |
| 375 .RetiresOnSaturation(); | |
| 376 } | |
| 377 | |
| 368 decoder_->EndDecoding(); | 378 decoder_->EndDecoding(); |
| 369 decoder_->Destroy(true); | 379 decoder_->Destroy(true); |
| 370 decoder_.reset(); | 380 decoder_.reset(); |
| 371 group_->Destroy(mock_decoder_.get(), false); | 381 group_->Destroy(mock_decoder_.get(), false); |
| 372 engine_.reset(); | 382 engine_.reset(); |
| 373 ::gfx::MockGLInterface::SetGLInterface(NULL); | 383 ::gfx::MockGLInterface::SetGLInterface(NULL); |
| 374 gl_.reset(); | 384 gl_.reset(); |
| 375 } | 385 } |
| 376 | 386 |
| 377 void GLES2DecoderTestBase::TearDown() { | 387 void GLES2DecoderTestBase::TearDown() { |
| (...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1559 SetupDefaultProgram(); | 1569 SetupDefaultProgram(); |
| 1560 } | 1570 } |
| 1561 | 1571 |
| 1562 // Include the auto-generated part of this file. We split this because it means | 1572 // Include the auto-generated part of this file. We split this because it means |
| 1563 // we can easily edit the non-auto generated parts right here in this file | 1573 // we can easily edit the non-auto generated parts right here in this file |
| 1564 // instead of having to edit some template or the code generator. | 1574 // instead of having to edit some template or the code generator. |
| 1565 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1575 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
| 1566 | 1576 |
| 1567 } // namespace gles2 | 1577 } // namespace gles2 |
| 1568 } // namespace gpu | 1578 } // namespace gpu |
| OLD | NEW |