16e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 26e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 36e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// found in the LICENSE file. 46e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 56e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_THUNKS_H_ 66e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_THUNKS_H_ 76e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 86e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include <stddef.h> 96e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 106e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "mojo/public/c/gles2/gles2.h" 116e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 126e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Like MojoGLES2ControlThunks, but specifies the frozen GLES2 API. Separated 136e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// out as MojoGLES2ControlThunks may be modified and added to, but this 146e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// interface is frozen. 156e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#pragma pack(push, 8) 166e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)struct MojoGLES2ImplThunks { 176e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) size_t size; // Should be set to sizeof(MojoGLES2ImplThunks). 186e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 196e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ 206e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) ReturnType(*Function) PARAMETERS; 216e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" 226e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#undef VISIT_GL_CALL 236e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}; 246e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#pragma pack(pop) 256e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 266e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Intended to be called from the embedder to get the embedder's implementation 276e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// of GLES2. 286e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)inline MojoGLES2ImplThunks MojoMakeGLES2ImplThunks() { 296e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) MojoGLES2ImplThunks gles2_impl_thunks = { 306e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) sizeof(MojoGLES2ImplThunks), 316e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) gl##Function, 326e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" 336e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#undef VISIT_GL_CALL 346e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) }; 356e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 366e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) return gles2_impl_thunks; 376e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)} 386e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 396e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Use this type for the function found by dynamically discovering it in 406e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// a DSO linked with mojo_system. For example: 416e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// MojoSetGLES2ImplThunksFn mojo_set_gles2_impl_thunks_fn = 426e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// reinterpret_cast<MojoSetGLES2ImplThunksFn>( 436e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// app_library.GetFunctionPointer("MojoSetGLES2ImplThunks")); 446e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// The expected size of |gles2_impl_thunks| is returned. 456e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// The contents of |gles2_impl_thunks| are copied. 466e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)typedef size_t (*MojoSetGLES2ImplThunksFn)( 476e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) const MojoGLES2ImplThunks* gles2_impl_thunks); 486e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 496e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#endif // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_THUNKS_H_ 50