18 #ifndef ION_GFX_GRAPHICSMANAGER_H_
19 #define ION_GFX_GRAPHICSMANAGER_H_
57 struct ShaderPrecision {
59 : range(range_in),
precision(precision_in) {}
65 return range == other.range &&
precision == other.precision;
95 kMaxTransformFeedbackSeparateAttribs,
106 kMaxDebugMessageLength,
118 kVertexShaderLowIntPrecisionFormat,
182 WrapperBase(
const char* func_name, FunctionGroupId group)
184 func_name_(func_name),
187 GraphicsManager::AddWrapper(
this);
189 const char* GetFuncName()
const {
return func_name_; }
190 bool Init(GraphicsManager* gm) {
191 const std::string gl_name =
"gl" + std::string(func_name_);
192 ptr_ = gm->Lookup(gl_name.c_str(), group_ == kCore);
194 gm->AddFunctionToGroup(group_, func_name_, ptr_);
197 void Reset() { ptr_ = NULL; }
203 const char* func_name_;
204 FunctionGroupId group_;
217 template <
typename T>
const T GetCapabilityValue(Capability cap);
222 return wrapped_function_names_.count(function_name) > 0;
226 bool IsFunctionGroupAvailable(FunctionGroupId group)
const;
229 void EnableFunctionGroup(FunctionGroupId group,
bool enable);
259 GlProfile GetGlProfileType()
const {
return gl_profile_type_; }
264 return valid_statetable_caps_.test(cap);
271 static const char* ErrorString(GLenum error_code);
282 versions[kDesktop] = desktop;
284 versions[kWeb] = web;
287 GLuint versions[kNumApis];
300 void ReinitFunctions();
315 virtual void EnableFunctionGroupIfAvailable(
317 const std::string& extensions,
const std::string& disabled_renderers);
326 class WrapperVecHolder;
329 class CapabilityHelper;
340 : graphics_manager_(gm),
341 func_call_(func_call) {
342 graphics_manager_->CheckForErrors(
"before", func_call_);
345 graphics_manager_->CheckForErrors(
"after", func_call_);
349 const std::string func_call_;
354 static WrapperVecHolder* GetWrapperVecHolder();
358 static void AddWrapper(WrapperBase* wrapper);
361 void AddFunctionToGroup(
366 void Init(
bool init_functions_from_gl);
370 void InitFunctions();
373 void AddWrappedFunctionName(
const std::string& function_name) {
374 wrapped_function_names_.insert(function_name);
378 void CheckForErrors(
const char* when,
const std::string& func_call);
383 virtual void* Lookup(
const char*
name,
bool is_core);
393 std::unique_ptr<CapabilityHelper> capability_helper_;
400 std::string extensions_;
403 bool is_error_checking_enabled_;
406 std::ostream* tracing_ostream_;
409 std::string tracing_prefix_;
415 std::string gl_renderer_;
418 std::string gl_version_string_;
431 std::bitset<StateTable::kNumCapabilities> valid_statetable_caps_;
442 #endif // ION_GFX_GRAPHICSMANAGER_H_
GraphicsManager manages the graphics library for an application.
See https://www.opengl.org/registry/specs/EXT/gpu_shader4.txt.
This is used for Apple devices running pre-es-3.0 device with the APPLE_framebuffer_multisample exten...
bool IsErrorCheckingEnabled() const
Range< 1, int32 > Range1i
const std::string & GetGlRenderer() const
Returns the GL renderer string. Thread-safe.
Simple wrapper for a set of GL versions.
bool operator==(const ShaderPrecision &other) const
void SetTracingStream(std::ostream *s)
Sets an output stream to use for tracing OpenGL calls.
void EnableErrorChecking(bool enable)
Sets/returns a flag indicating whether glGetError() should be called after every OpenGL call to check...
GlApi GetGlApiStandard() const
Returns the GL API standard. Thread-safe.
GlApi
OpenGL platform SDK standard.
bool IsValid() const
Returns true if the requested precision is unsupported.
Capability
Enumerated types for StateTable items.
Information about shader precision, see below.
GLuint operator[](GlApi i) const
std::ostream * GetTracingStream() const
Thread-safe abstract base class.
const std::string & GetTracingPrefix() const
The below are returned as a ShaderPrecision struct.
void SetTracingPrefix(const std::string &s)
Sets a prefix to be printed when tracing OpenGL calls.
ION_API bool IsExtensionSupported(const std::string &unprefixed_extension, const std::string &extensions_string)
Returns whether the currently bound OpenGL implementation supports the named extension.
This internal class is used by the GraphicsManager to print argument values when tracing OpenGL calls...
This covers both OES_EGL_image and OES_EGL_image_external.
Copyright 2016 Google Inc.
base::ReferentPtr< GraphicsManager >::Type GraphicsManagerPtr
Convenience typedef for shared pointer to a GraphicsManager.
const std::string & GetGlVersionString() const
Returns the GL version string. Thread-safe.
GlProfile
OpenGL profile type.
GLuint GetGlVersion() const
Returns the GL version as an integer. Thread-safe.
bool IsFunctionAvailable(const std::string &function_name) const
Returns true if the named function is available.
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
bool IsValidStateTableCapability(const StateTable::Capability cap) const
Returns whether the given state table capability is valid given the capabilities of the local GL plat...
ShaderPrecision(const math::Range1i &range_in, const int precision_in)