#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 {
namespace {
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 {
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) { … }
struct Droppable { … };
struct Slow { … };
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[] = …;
}
sk_sp<GrGLInterface> CreateGrGLInterface(
const gl::GLVersionInfo& version_info,
gl::ProgressReporter* progress_reporter) { … }
}