| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 base::LazyInstance<base::ThreadLocalPointer<gpu::gles2::GLES2Interface> >::Leaky | 25 base::LazyInstance<base::ThreadLocalPointer<gpu::gles2::GLES2Interface> >::Leaky |
| 26 g_gpu_interface; | 26 g_gpu_interface; |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 extern "C" { | 30 extern "C" { |
| 31 MojoGLES2Context MojoGLES2CreateContext(MojoHandle handle, | 31 MojoGLES2Context MojoGLES2CreateContext(MojoHandle handle, |
| 32 const int32_t* attrib_list, | 32 const int32_t* attrib_list, |
| 33 MojoGLES2ContextLost lost_callback, | 33 MojoGLES2ContextLost lost_callback, |
| 34 void* closure, | 34 void* closure) { |
| 35 const MojoAsyncWaiter* async_waiter) { | |
| 36 mojo::MessagePipeHandle mph(handle); | 35 mojo::MessagePipeHandle mph(handle); |
| 37 mojo::ScopedMessagePipeHandle scoped_handle(mph); | 36 mojo::ScopedMessagePipeHandle scoped_handle(mph); |
| 38 std::vector<int32_t> attribs; | 37 std::vector<int32_t> attribs; |
| 39 if (attrib_list) { | 38 if (attrib_list) { |
| 40 for (int32_t const* p = attrib_list; *p != kNone;) { | 39 for (int32_t const* p = attrib_list; *p != kNone;) { |
| 41 attribs.push_back(*p++); | 40 attribs.push_back(*p++); |
| 42 attribs.push_back(*p++); | 41 attribs.push_back(*p++); |
| 43 } | 42 } |
| 44 } | 43 } |
| 45 attribs.push_back(kNone); | 44 attribs.push_back(kNone); |
| 46 scoped_ptr<GLES2Context> client(new GLES2Context( | 45 scoped_ptr<GLES2Context> client(new GLES2Context( |
| 47 attribs, async_waiter, std::move(scoped_handle), lost_callback, closure)); | 46 attribs, std::move(scoped_handle), lost_callback, closure)); |
| 48 if (!client->Initialize()) | 47 if (!client->Initialize()) |
| 49 client.reset(); | 48 client.reset(); |
| 50 return client.release(); | 49 return client.release(); |
| 51 } | 50 } |
| 52 | 51 |
| 53 void MojoGLES2DestroyContext(MojoGLES2Context context) { | 52 void MojoGLES2DestroyContext(MojoGLES2Context context) { |
| 54 delete static_cast<GLES2Context*>(context); | 53 delete static_cast<GLES2Context*>(context); |
| 55 } | 54 } |
| 56 | 55 |
| 57 void MojoGLES2MakeCurrent(MojoGLES2Context context) { | 56 void MojoGLES2MakeCurrent(MojoGLES2Context context) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 80 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ | 79 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ |
| 81 ReturnType GL_APIENTRY gl##Function PARAMETERS { \ | 80 ReturnType GL_APIENTRY gl##Function PARAMETERS { \ |
| 82 DCHECK(g_gpu_interface.Get().Get()); \ | 81 DCHECK(g_gpu_interface.Get().Get()); \ |
| 83 return g_gpu_interface.Get().Get()->Function ARGUMENTS; \ | 82 return g_gpu_interface.Get().Get()->Function ARGUMENTS; \ |
| 84 } | 83 } |
| 85 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" | 84 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" |
| 86 #include "mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h" | 85 #include "mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h" |
| 87 #undef VISIT_GL_CALL | 86 #undef VISIT_GL_CALL |
| 88 | 87 |
| 89 } // extern "C" | 88 } // extern "C" |
| OLD | NEW |