chromium/ui/gl/init/create_gr_gl_interface.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/gl/init/create_gr_gl_interface.h"

#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/trace_event/trace_event.h"
#include "base/traits_bag.h"
#include "build/build_config.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_display.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_utils.h"
#include "ui/gl/gl_version_info.h"
#include "ui/gl/progress_reporter.h"

#if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h"
#endif

namespace gl::init {

// This code emulates GL fences (GL_APPLE_sync or GL_ARB_sync) via
// EGL_KHR_fence_sync extension. It's used to provide Skia ways of
// synchronization on platforms that does not have GL fences but support EGL
namespace {

// If enabled, adds a delay to GL program link whose value is given by the
// feature param. Used for an ablation study.
BASE_FEATURE();
constexpr base::FeatureParam<int> kGLProgramLinkDelayMicroseconds{};

struct EGLFenceData {};

GLsync glFenceSyncEmulateEGL(GLenum condition, GLbitfield flags) {}

void glDeleteSyncEmulateEGL(GLsync sync) {}

GLenum glClientWaitSyncEmulateEGL(GLsync sync,
                                  GLbitfield flags,
                                  GLuint64 timeout) {}

void glWaitSyncEmulateEGL(GLsync sync, GLbitfield flags, GLuint64 timeout) {}

GLboolean glIsSyncEmulateEGL(GLsync sync) {}

}  // namespace

namespace {

template <typename R, typename... Args>
GrGLFunction<R GR_GL_FUNCTION_TYPE(Args...)> bind_with_api(
    R (gl::GLApi::*func)(Args...),
    gl::GLApi* api) {}

struct FlushHelper {};

template <bool droppable,
          bool slow,
          bool need_flush,
          typename R,
          typename... Args>
GrGLFunction<R GR_GL_FUNCTION_TYPE(Args...)> bind_impl(
    R(GL_BINDING_CALL* func)(Args...),
    gl::ProgressReporter* progress_reporter) {}

template <typename R, typename... Args>
GrGLFunction<R GR_GL_FUNCTION_TYPE(GLuint, Args...)>
bind_timed_compile_function(R(GL_BINDING_CALL* func)(GLuint shader, Args...),
                            glGetShaderivProc get_shader_iv,
                            gl::ProgressReporter* progress_reporter) {}

template <typename R, typename... Args>
GrGLFunction<R GR_GL_FUNCTION_TYPE(GLuint, Args...)> bind_timed_link_function(
    R(GL_BINDING_CALL* func)(GLuint program, Args...),
    glGetProgramivProc get_program_iv,
    gl::ProgressReporter* progress_reporter) {}

// Call can be dropped for tests that setup null draw gl bindings.
struct Droppable {};
// Call needs to be wrapped with ProgressReporter.
struct Slow {};
// Call needs to be wrapped with glFlush call, used on MacOS.
struct NeedFlush {};

#if BUILDFLAG(IS_MAC)
using SlowOnMac = Slow;
using NeedFlushOnMac = NeedFlush;
#else
SlowOnMac;
NeedFlushOnMac;
#endif

template <typename... Traits>
struct BindWithTraits {};

const GLubyte* GetStringHook(const char* gl_version_string,
                             const char* glsl_version_string,
                             GLenum name) {}

const char* kBlocklistExtensions[] =;

}  // anonymous namespace

sk_sp<GrGLInterface> CreateGrGLInterface(
    const gl::GLVersionInfo& version_info,
    gl::ProgressReporter* progress_reporter) {}

}  // namespace gl::init