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

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

Issue 11275120: Virtual GL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "gpu/command_buffer/service/gl_context_virtual.h"
6
7 #include "gpu/command_buffer/service/gl_state_restorer_impl.h"
8 #include "ui/gl/gl_surface.h"
9
10 namespace gpu {
11
12 GLContextVirtual::GLContextVirtual(
13 gfx::GLShareGroup* share_group,
14 gfx::GLContext* shared_context,
15 gles2::GLES2Decoder* decoder)
16 : GLContext(share_group),
17 shared_context_(shared_context),
18 display_(NULL),
19 state_restorer_(new GLStateRestorerImpl(decoder)) {
20 shared_context_->SetupForVirtualization();
21 }
22
23 gfx::Display* GLContextVirtual::display() {
24 return display_;
25 }
26
27 bool GLContextVirtual::Initialize(
28 gfx::GLSurface* compatible_surface, gfx::GpuPreference gpu_preference) {
29 display_ = static_cast<gfx::Display*>(compatible_surface->GetDisplay());
30
31 return true;
32 }
33
34 void GLContextVirtual::Destroy() {
35 }
36
37 bool GLContextVirtual::MakeCurrent(gfx::GLSurface* surface) {
38 shared_context_->MakeVirtuallyCurrent(this, surface);
39 return true;
40 }
41
42 void GLContextVirtual::ReleaseCurrent(gfx::GLSurface* surface) {
43 shared_context_ = NULL;
44 display_ = NULL;
45 }
46
47 bool GLContextVirtual::IsCurrent(gfx::GLSurface* surface) {
48 return true;
49 }
50
51 void* GLContextVirtual::GetHandle() {
52 return NULL;
53 }
54
55 gfx::GLStateRestorer* GLContextVirtual::GetGLStateRestorer() {
56 return state_restorer_.get();
57 }
58
59 void GLContextVirtual::SetSwapInterval(int interval) {
60 shared_context_->SetSwapInterval(interval);
61 }
62
63 std::string GLContextVirtual::GetExtensions() {
64 return shared_context_->GetExtensions();
65 }
66
67 bool GLContextVirtual::GetTotalGpuMemory(size_t* bytes) {
68 return shared_context_->GetTotalGpuMemory(bytes);
69 }
70
71 bool GLContextVirtual::WasAllocatedUsingRobustnessExtension() {
72 return shared_context_->WasAllocatedUsingRobustnessExtension();
73 }
74
75 GLContextVirtual::~GLContextVirtual() {
76 Destroy();
77 }
78
79 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gl_context_virtual.h ('k') | gpu/command_buffer/service/gl_state_restorer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698