Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mojo/gles2/control_thunks_impl.h" | 5 #include "mojo/gles2/control_thunks_impl.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_lib.h" | |
| 7 #include "mojo/gles2/gles2_context.h" | 8 #include "mojo/gles2/gles2_context.h" |
| 8 #include "mojo/public/cpp/system/message_pipe.h" | 9 #include "mojo/public/cpp/system/message_pipe.h" |
| 9 | 10 |
| 10 namespace gles2 { | 11 namespace gles2 { |
| 11 | 12 |
| 12 // static | 13 // static |
| 13 ControlThunksImpl* ControlThunksImpl::Get() { | 14 ControlThunksImpl* ControlThunksImpl::Get() { |
| 14 static base::LazyInstance<ControlThunksImpl>::Leaky thunks; | 15 static base::LazyInstance<ControlThunksImpl>::Leaky thunks; |
| 15 return thunks.Pointer(); | 16 return thunks.Pointer(); |
| 16 } | 17 } |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 45 } | 46 } |
| 46 | 47 |
| 47 void ControlThunksImpl::ResizeSurface(uint32_t width, uint32_t height) { | 48 void ControlThunksImpl::ResizeSurface(uint32_t width, uint32_t height) { |
| 48 current_context_tls_.Get()->interface()->ResizeCHROMIUM(width, height, 1.f); | 49 current_context_tls_.Get()->interface()->ResizeCHROMIUM(width, height, 1.f); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void ControlThunksImpl::SwapBuffers() { | 52 void ControlThunksImpl::SwapBuffers() { |
| 52 current_context_tls_.Get()->interface()->SwapBuffers(); | 53 current_context_tls_.Get()->interface()->SwapBuffers(); |
| 53 } | 54 } |
| 54 | 55 |
| 56 MGLFunctionPointerType ControlThunksImpl::GetProcAddress(const char* name) { | |
| 57 return gles2::GetGLFunctionPointer(name); | |
|
jamesr
2015/09/21 19:38:50
this will return things that the underlying librar
Petr Hosek
2015/09/22 20:06:54
Done.
| |
| 58 } | |
| 59 | |
| 55 void* ControlThunksImpl::GetGLES2Interface(MGLContext context) { | 60 void* ControlThunksImpl::GetGLES2Interface(MGLContext context) { |
| 56 GLES2Context* client = reinterpret_cast<GLES2Context*>(context); | 61 GLES2Context* client = reinterpret_cast<GLES2Context*>(context); |
| 57 DCHECK(client); | 62 DCHECK(client); |
| 58 return client->interface(); | 63 return client->interface(); |
| 59 } | 64 } |
| 60 | 65 |
| 61 void ControlThunksImpl::SignalSyncPoint( | 66 void ControlThunksImpl::SignalSyncPoint( |
| 62 uint32_t sync_point, | 67 uint32_t sync_point, |
| 63 MGLSignalSyncPointCallback callback, | 68 MGLSignalSyncPointCallback callback, |
| 64 void* closure) { | 69 void* closure) { |
| 65 current_context_tls_.Get()->context_support()->SignalSyncPoint( | 70 current_context_tls_.Get()->context_support()->SignalSyncPoint( |
| 66 sync_point, base::Bind(callback, closure)); | 71 sync_point, base::Bind(callback, closure)); |
| 67 } | 72 } |
| 68 | 73 |
| 69 gpu::gles2::GLES2Interface* ControlThunksImpl::CurrentGLES2Interface() { | 74 gpu::gles2::GLES2Interface* ControlThunksImpl::CurrentGLES2Interface() { |
| 70 if (!current_context_tls_.Get()) | 75 if (!current_context_tls_.Get()) |
| 71 return nullptr; | 76 return nullptr; |
| 72 return current_context_tls_.Get()->interface(); | 77 return current_context_tls_.Get()->interface(); |
| 73 } | 78 } |
| 74 | 79 |
| 75 ControlThunksImpl::ControlThunksImpl() { | 80 ControlThunksImpl::ControlThunksImpl() { |
| 76 } | 81 } |
| 77 | 82 |
| 78 ControlThunksImpl::~ControlThunksImpl() { | 83 ControlThunksImpl::~ControlThunksImpl() { |
| 79 } | 84 } |
| 80 | 85 |
| 81 } // namespace gles2 | 86 } // namespace gles2 |
| OLD | NEW |