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)#include "mojo/public/platform/native/gles2_impl_thunks.h"
66e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
76e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include <assert.h>
86e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
96e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "mojo/public/platform/native/thunk_export.h"
106e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
116e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)extern "C" {
126e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)static MojoGLES2ImplThunks g_impl_thunks = {0};
136e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
146e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
156e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  ReturnType gl##Function PARAMETERS {                             \
166e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)    assert(g_impl_thunks.Function);                                \
176e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)    return g_impl_thunks.Function ARGUMENTS;                       \
186e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  }
196e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
206e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#undef VISIT_GL_CALL
216e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
226e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)extern "C" THUNK_EXPORT size_t
236e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)MojoSetGLES2ImplThunks(const MojoGLES2ImplThunks* gles2_impl_thunks) {
246e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  if (gles2_impl_thunks->size >= sizeof(g_impl_thunks))
256e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)    g_impl_thunks = *gles2_impl_thunks;
266e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  return sizeof(g_impl_thunks);
276e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}
286e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
296e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}  // extern "C"
30