#ifndef GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_
#define GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_
#include <string>
#include "build/build_config.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/gpu_gles2_export.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rrect_f.h"
#include "ui/gfx/geometry/transform.h"
#include "ui/gfx/overlay_transform.h"
#include "ui/gl/gl_bindings.h"
#ifdef GL_ERROR_DEBUGGING
#define CHECK_GL_ERROR …
#else
#define CHECK_GL_ERROR() …
#endif
namespace gpu {
struct Capabilities;
struct GLCapabilities;
namespace gles2 {
class ErrorState;
class FeatureInfo;
class Logger;
class Texture;
enum class CopyTextureMethod;
constexpr GLfloat kIdentityMatrix[16] = …;
struct CALayerSharedState { … };
bool PrecisionMeetsSpecForHighpFloat(GLint rangeMin,
GLint rangeMax,
GLint precision);
void QueryShaderPrecisionFormat(GLenum shader_type,
GLenum precision_type,
GLint* range,
GLint* precision);
void PopulateNumericCapabilities(Capabilities* caps,
const FeatureInfo* feature_info);
void PopulateGLCapabilities(GLCapabilities* caps,
const FeatureInfo* feature_info);
#if BUILDFLAG(IS_CHROMEOS_ASH)
void PopulateDRMCapabilities(Capabilities* caps,
const FeatureInfo* feature_info);
#endif
bool CheckUniqueAndNonNullIds(GLsizei n, const GLuint* client_ids);
const char* GetServiceVersionString(const FeatureInfo* feature_info);
const char* GetServiceShadingLanguageVersionString(
const FeatureInfo* feature_info);
void LogGLDebugMessage(GLenum source,
GLenum type,
GLuint id,
GLenum severity,
GLsizei length,
const GLchar* message,
Logger* error_logger);
GPU_GLES2_EXPORT void InitializeGLDebugLogging(bool log_non_errors,
GLDEBUGPROC callback,
const void* user_param);
bool ValidContextLostReason(GLenum reason);
error::ContextLostReason GetContextLostReasonFromResetStatus(
GLenum reset_status);
bool GetCompressedTexSizeInBytes(const char* function_name,
GLsizei width,
GLsizei height,
GLsizei depth,
GLenum format,
GLsizei* size_in_bytes,
ErrorState* error_state);
bool ValidateCompressedFormatTarget(GLenum target, GLenum format);
bool ValidateCompressedTexSubDimensions(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint zoffset,
GLsizei width,
GLsizei height,
GLsizei depth,
GLenum format,
Texture* texture,
const char** error_message);
bool ValidateCompressedTexDimensions(GLenum target,
GLint level,
GLsizei width,
GLsizei height,
GLsizei depth,
GLenum format,
const char** error_message);
bool ValidateCopyTexFormatHelper(const FeatureInfo* feature_info,
GLenum internal_format,
GLenum read_format,
GLenum read_type,
std::string* output_error_msg);
CopyTextureMethod GetCopyTextureCHROMIUMMethod(const FeatureInfo* feature_info,
GLenum source_target,
GLint source_level,
GLenum source_internal_format,
GLenum source_type,
GLenum dest_target,
GLint dest_level,
GLenum dest_internal_format,
bool flip_y,
bool premultiply_alpha,
bool unpremultiply_alpha);
bool ValidateCopyTextureCHROMIUMInternalFormats(const FeatureInfo* feature_info,
GLenum source_internal_format,
GLenum dest_internal_format,
std::string* output_error_msg);
GLenum GetTextureBindingQuery(GLenum texture_type);
gfx::OverlayTransform GetGFXOverlayTransform(GLenum plane_transform);
bool IsASTCFormat(GLenum internal_format);
bool IsCompressedTextureFormat(GLenum internal_format);
Texture* CreateGLES2TextureWithLightRef(GLuint service_id, GLenum target);
}
}
#endif