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

Side by Side Diff: mojo/public/bindings/gles2_client/gles2_client_impl.cc

Issue 101413002: [Mojo] Remove dependency between mojo/public and gpu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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
« no previous file with comments | « mojo/public/bindings/gles2_client/gles2_client_impl.h ('k') | mojo/public/gles2/gles2.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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 "mojo/public/bindings/gles2_client/gles2_client_impl.h"
6
7 #include <assert.h>
8
9 #include "gpu/command_buffer/client/gles2_lib.h"
10
11 namespace mojo {
12 namespace {
13
14 bool g_gles2_initialized = false;
15
16 } // namespace
17
18 GLES2Delegate::~GLES2Delegate() {
19 }
20
21 void GLES2Delegate::DidCreateContext(
22 GLES2ClientImpl* gl, uint32_t width, uint32_t height) {
23 }
24
25 void GLES2Delegate::ContextLost(GLES2ClientImpl* gl) {
26 }
27
28 GLES2ClientImpl::GLES2ClientImpl(GLES2Delegate* delegate,
29 ScopedMessagePipeHandle gl)
30 : delegate_(delegate),
31 gl_(gl.Pass()) {
32 assert(g_gles2_initialized);
33 gl_.SetPeer(this);
34 }
35
36 GLES2ClientImpl::~GLES2ClientImpl() {
37 gl_->Destroy();
38 }
39
40 void GLES2ClientImpl::Initialize() {
41 assert(!g_gles2_initialized);
42 gles2::Initialize();
43 g_gles2_initialized = true;
44 }
45
46 void GLES2ClientImpl::Terminate() {
47 assert(g_gles2_initialized);
48 gles2::Terminate();
49 g_gles2_initialized = false;
50 }
51
52 void GLES2ClientImpl::SwapBuffers() {
53 gles2::GetGLContext()->SwapBuffers();
54 }
55
56 void GLES2ClientImpl::DidCreateContext(
57 uint64_t encoded, uint32_t width, uint32_t height) {
58 // Ack, Hans! It's the giant hack.
59 // TODO(abarth): Replace this hack with something more disciplined. Most
60 // likley, we should receive a MojoHandle that we use to wire up the
61 // client side of an out-of-process command buffer. Given that we're
62 // still in-process, we just reinterpret_cast the value into a GL interface.
63 gpu::gles2::GLES2Interface* gl_interface =
64 reinterpret_cast<gpu::gles2::GLES2Interface*>(
65 static_cast<uintptr_t>(encoded));
66 gles2::SetGLContext(gl_interface);
67
68 delegate_->DidCreateContext(this, width, height);
69 }
70
71 void GLES2ClientImpl::ContextLost() {
72 delegate_->ContextLost(this);
73 }
74
75 } // mojo
OLDNEW
« no previous file with comments | « mojo/public/bindings/gles2_client/gles2_client_impl.h ('k') | mojo/public/gles2/gles2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698