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

Side by Side Diff: gpu/command_buffer/tests/gl_manager.cc

Issue 10534173: GPU Program Caching (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: solid in-memory implementation Created 8 years, 6 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 (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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/memory/weak_ptr.h"
7 #include "gpu/command_buffer/client/gles2_implementation.h" 8 #include "gpu/command_buffer/client/gles2_implementation.h"
8 #include "gpu/command_buffer/client/gles2_lib.h" 9 #include "gpu/command_buffer/client/gles2_lib.h"
9 #include "gpu/command_buffer/client/transfer_buffer.h" 10 #include "gpu/command_buffer/client/transfer_buffer.h"
10 #include "gpu/command_buffer/common/constants.h" 11 #include "gpu/command_buffer/common/constants.h"
11 #include "gpu/command_buffer/service/command_buffer_service.h" 12 #include "gpu/command_buffer/service/command_buffer_service.h"
12 #include "gpu/command_buffer/service/context_group.h" 13 #include "gpu/command_buffer/service/context_group.h"
13 #include "gpu/command_buffer/service/gpu_scheduler.h" 14 #include "gpu/command_buffer/service/gpu_scheduler.h"
14 #include "gpu/command_buffer/service/mailbox_manager.h" 15 #include "gpu/command_buffer/service/mailbox_manager.h"
15 #include "gpu/command_buffer/tests/gl_manager.h" 16 #include "gpu/command_buffer/tests/gl_manager.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/gl/gl_context.h" 18 #include "ui/gl/gl_context.h"
18 #include "ui/gl/gl_share_group.h" 19 #include "ui/gl/gl_share_group.h"
19 #include "ui/gl/gl_surface.h" 20 #include "ui/gl/gl_surface.h"
20 21
21 namespace gpu { 22 namespace gpu {
23 namespace gles2 {
24 class ProgramCache;
25 }
22 26
23 GLManager::GLManager() { 27 GLManager::GLManager() {
24 } 28 }
25 29
26 GLManager::~GLManager() { 30 GLManager::~GLManager() {
27 } 31 }
28 32
29 void GLManager::Initialize(const gfx::Size& size) { 33 void GLManager::Initialize(const gfx::Size& size) {
30 Setup(size, NULL, NULL, NULL, NULL); 34 Setup(size, NULL, NULL, NULL, NULL);
31 } 35 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 attribs.push_back(EGL_BLUE_SIZE); 92 attribs.push_back(EGL_BLUE_SIZE);
89 attribs.push_back(8); 93 attribs.push_back(8);
90 attribs.push_back(EGL_ALPHA_SIZE); 94 attribs.push_back(EGL_ALPHA_SIZE);
91 attribs.push_back(8); 95 attribs.push_back(8);
92 attribs.push_back(EGL_DEPTH_SIZE); 96 attribs.push_back(EGL_DEPTH_SIZE);
93 attribs.push_back(16); 97 attribs.push_back(16);
94 attribs.push_back(EGL_NONE); 98 attribs.push_back(EGL_NONE);
95 99
96 if (!context_group) { 100 if (!context_group) {
97 context_group = new gles2::ContextGroup( 101 context_group = new gles2::ContextGroup(
98 mailbox_manager_.get(), kBindGeneratesResource); 102 mailbox_manager_.get(),
103 kBindGeneratesResource,
104 base::WeakPtr<gles2::ProgramCache>());
99 } 105 }
100 106
101 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); 107 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group));
102 108
103 command_buffer_.reset(new CommandBufferService( 109 command_buffer_.reset(new CommandBufferService(
104 decoder_->GetContextGroup()->transfer_buffer_manager())); 110 decoder_->GetContextGroup()->transfer_buffer_manager()));
105 ASSERT_TRUE(command_buffer_->Initialize()) 111 ASSERT_TRUE(command_buffer_->Initialize())
106 << "could not create command buffer service"; 112 << "could not create command buffer service";
107 113
108 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), 114 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 ::gpu::CommandBuffer::State state = command_buffer_->GetState(); 190 ::gpu::CommandBuffer::State state = command_buffer_->GetState();
185 ASSERT_EQ(::gpu::error::kNoError, state.error); 191 ASSERT_EQ(::gpu::error::kNoError, state.error);
186 } 192 }
187 193
188 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { 194 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) {
189 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); 195 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id);
190 } 196 }
191 197
192 } // namespace gpu 198 } // namespace gpu
193 199
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698