chromium/third_party/skia/include/gpu/ganesh/gl/GrGLInterface.h

/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrGLInterface_DEFINED
#define GrGLInterface_DEFINED

#include "include/core/SkRefCnt.h"
#include "include/gpu/ganesh/gl/GrGLExtensions.h"
#include "include/gpu/ganesh/gl/GrGLFunctions.h"

////////////////////////////////////////////////////////////////////////////////

GrGLFuncPtr;
struct GrGLInterface;


#if !defined(SK_DISABLE_LEGACY_GL_MAKE_NATIVE_INTERFACE)
/**
 * Rather than depend on platform-specific GL headers and libraries, we require
 * the client to provide a struct of GL function pointers. This struct can be
 * specified per-GrContext as a parameter to GrContext::MakeGL. If no interface is
 * passed to MakeGL then a default GL interface is created using GrGLMakeNativeInterface().
 * If this returns nullptr then GrContext::MakeGL() will fail.
 *
 * The implementation of GrGLMakeNativeInterface is platform-specific. Several
 * implementations have been provided (for GLX, WGL, EGL, etc), along with an
 * implementation that simply returns nullptr. Clients should select the most
 * appropriate one to build.
 */
SK_API sk_sp<const GrGLInterface> GrGLMakeNativeInterface();
#endif

/**
 * GrContext uses the following interface to make all calls into OpenGL. When a
 * GrContext is created it is given a GrGLInterface. The interface's function
 * pointers must be valid for the OpenGL context associated with the GrContext.
 * On some platforms, such as Windows, function pointers for OpenGL extensions
 * may vary between OpenGL contexts. So the caller must be careful to use a
 * GrGLInterface initialized for the correct context. All functions that should
 * be available based on the OpenGL's version and extension string must be
 * non-NULL or GrContext creation will fail. This can be tested with the
 * validate() method when the OpenGL context has been made current.
 */
struct SK_API GrGLInterface : public SkRefCnt {};

#endif