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

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

Issue 10388131: Allow GLES2CmdDecoder to change the GLSurface associated with the default FBO. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
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 #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"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 shared_memory_address_ = reinterpret_cast<int8*>(buffer.ptr) + 316 shared_memory_address_ = reinterpret_cast<int8*>(buffer.ptr) +
317 shared_memory_offset_; 317 shared_memory_offset_;
318 shared_memory_id_ = kSharedMemoryId; 318 shared_memory_id_ = kSharedMemoryId;
319 shared_memory_base_ = buffer.ptr; 319 shared_memory_base_ = buffer.ptr;
320 320
321 surface_ = new gfx::GLSurfaceStub; 321 surface_ = new gfx::GLSurfaceStub;
322 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); 322 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight));
323 323
324 context_ = new gfx::GLContextStub; 324 context_ = new gfx::GLContextStub;
325 325
326 context_->MakeCurrent(surface_);
327
326 // From <EGL/egl.h>. 328 // From <EGL/egl.h>.
327 const int32 EGL_ALPHA_SIZE = 0x3021; 329 const int32 EGL_ALPHA_SIZE = 0x3021;
328 const int32 EGL_DEPTH_SIZE = 0x3025; 330 const int32 EGL_DEPTH_SIZE = 0x3025;
329 const int32 EGL_STENCIL_SIZE = 0x3026; 331 const int32 EGL_STENCIL_SIZE = 0x3026;
330 332
331 int32 attributes[] = { 333 int32 attributes[] = {
332 EGL_ALPHA_SIZE, request_alpha ? 8 : 0, 334 EGL_ALPHA_SIZE, request_alpha ? 8 : 0,
333 EGL_DEPTH_SIZE, request_depth ? 24 : 0, 335 EGL_DEPTH_SIZE, request_depth ? 24 : 0,
334 EGL_STENCIL_SIZE, request_stencil ? 8 : 0, 336 EGL_STENCIL_SIZE, request_stencil ? 8 : 0,
335 }; 337 };
336 std::vector<int32> attribs(attributes, attributes + arraysize(attributes)); 338 std::vector<int32> attribs(attributes, attributes + arraysize(attributes));
337 339
338 decoder_.reset(GLES2Decoder::Create(group_.get())); 340 decoder_.reset(GLES2Decoder::Create(group_.get()));
339 decoder_->set_log_synthesized_gl_errors(false); 341 decoder_->set_log_synthesized_gl_errors(false);
340 decoder_->Initialize( 342 decoder_->Initialize(
341 surface_, context_, false, surface_->GetSize(), DisallowedFeatures(), 343 surface_, context_, false, surface_->GetSize(), DisallowedFeatures(),
342 NULL, attribs); 344 NULL, attribs);
345 decoder_->MakeCurrent();
343 decoder_->set_engine(engine_.get()); 346 decoder_->set_engine(engine_.get());
344 347
345 EXPECT_CALL(*gl_, GenBuffersARB(_, _)) 348 EXPECT_CALL(*gl_, GenBuffersARB(_, _))
346 .WillOnce(SetArgumentPointee<1>(kServiceBufferId)) 349 .WillOnce(SetArgumentPointee<1>(kServiceBufferId))
347 .RetiresOnSaturation(); 350 .RetiresOnSaturation();
348 GenHelper<GenBuffersImmediate>(client_buffer_id_); 351 GenHelper<GenBuffersImmediate>(client_buffer_id_);
349 EXPECT_CALL(*gl_, GenFramebuffersEXT(_, _)) 352 EXPECT_CALL(*gl_, GenFramebuffersEXT(_, _))
350 .WillOnce(SetArgumentPointee<1>(kServiceFramebufferId)) 353 .WillOnce(SetArgumentPointee<1>(kServiceFramebufferId))
351 .RetiresOnSaturation(); 354 .RetiresOnSaturation();
352 GenHelper<GenFramebuffersImmediate>(client_framebuffer_id_); 355 GenHelper<GenFramebuffersImmediate>(client_framebuffer_id_);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 .RetiresOnSaturation(); 387 .RetiresOnSaturation();
385 388
386 EXPECT_CALL(*gl_, DeleteBuffersARB(2, _)) 389 EXPECT_CALL(*gl_, DeleteBuffersARB(2, _))
387 .Times(1) 390 .Times(1)
388 .RetiresOnSaturation(); 391 .RetiresOnSaturation();
389 392
390 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)) 393 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _))
391 .Times(2) 394 .Times(2)
392 .RetiresOnSaturation(); 395 .RetiresOnSaturation();
393 396
394 decoder_->Destroy(); 397 decoder_->Destroy(true);
395 decoder_.reset(); 398 decoder_.reset();
396 group_->Destroy(false); 399 group_->Destroy(false);
397 engine_.reset(); 400 engine_.reset();
398 ::gfx::GLInterface::SetGLInterface(NULL); 401 ::gfx::GLInterface::SetGLInterface(NULL);
399 gl_.reset(); 402 gl_.reset();
400 } 403 }
401 404
402 GLint GLES2DecoderTestBase::GetGLError() { 405 GLint GLES2DecoderTestBase::GetGLError() {
403 EXPECT_CALL(*gl_, GetError()) 406 EXPECT_CALL(*gl_, GetError())
404 .WillOnce(Return(GL_NO_ERROR)) 407 .WillOnce(Return(GL_NO_ERROR))
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 num_vertices, buffer_id, GL_NO_ERROR); 1314 num_vertices, buffer_id, GL_NO_ERROR);
1312 } 1315 }
1313 1316
1314 void GLES2DecoderWithShaderTestBase::SetUp() { 1317 void GLES2DecoderWithShaderTestBase::SetUp() {
1315 GLES2DecoderTestBase::SetUp(); 1318 GLES2DecoderTestBase::SetUp();
1316 SetupDefaultProgram(); 1319 SetupDefaultProgram();
1317 } 1320 }
1318 1321
1319 } // namespace gles2 1322 } // namespace gles2
1320 } // namespace gpu 1323 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc ('k') | gpu/command_buffer/tests/gl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698