Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
graphicsmanager.cc
Go to the documentation of this file.
1 
19 
20 #include <string.h> // For strcmp().
21 
22 #include <vector>
23 
25 #include "ion/base/logging.h"
26 #include "ion/base/once.h"
28 #include "ion/base/stringutils.h"
30 #include "ion/base/variant.h"
33 
34 namespace ion {
35 namespace gfx {
36 
38 
43 
44 
45 class CapabilityValue {
46  public:
47  typedef base::Variant<GLint, GLfloat, math::Range1f, math::Range1i,
48  GraphicsManager::ShaderPrecision,
49  std::vector<GLint> > CapabilityVariant;
50  typedef void(*Getter)(GraphicsManager* gm, CapabilityValue* cv);
51 
52  CapabilityValue() : uninitialized_(true) {}
53  CapabilityValue(GLenum enum1_in, GLenum enum2_in, const Getter& getter_in)
54  : enum1_(enum1_in),
55  enum2_(enum2_in),
56  getter_(getter_in),
57  uninitialized_(false) {}
58 
59  CapabilityValue& operator=(const CapabilityValue& other) {
64  DCHECK(uninitialized_ && !other.uninitialized_);
65  enum1_ = other.enum1_;
66  enum2_ = other.enum2_;
67  getter_ = other.getter_;
68  uninitialized_ = false;
69  return *this;
70  }
71 
74  const CapabilityVariant& GetValue(GraphicsManager* gm) {
75  DCHECK(!uninitialized_);
76  populated_flag_.CallOnce(std::bind(getter_, gm, this));
77  return value_;
78  }
79 
81  static void GetIntVector(GraphicsManager* gm, CapabilityValue* cv) {
82  GLint count = 0;
83  gm->GetIntegerv(cv->enum2_, &count);
84  std::vector<GLint> values(count);
85  if (count)
86  gm->GetIntegerv(cv->enum1_, &values[0]);
87  cv->value_.Set(values);
88  }
89 
90  static void GetFloat(GraphicsManager* gm, CapabilityValue* cv) {
91  GLfloat val = 0;
92  gm->GetFloatv(cv->enum1_, &val);
93  cv->value_.Set(val);
94  }
95 
96  static void GetFloatRange(GraphicsManager* gm, CapabilityValue* cv) {
97  GLfloat val[2];
98  val[0] = val[1] = 0;
99  gm->GetFloatv(cv->enum1_, val);
100  cv->value_.Set(math::Range1f(val[0], val[1]));
101  }
102 
103  static void GetInt(GraphicsManager* gm, CapabilityValue* cv) {
104  GLint val = 0;
105  gm->GetIntegerv(cv->enum1_, &val);
106  cv->value_.Set(val);
107  }
108 
109  static void GetIntRange(GraphicsManager* gm, CapabilityValue* cv) {
110  GLint val[2];
111  val[0] = val[1] = 0;
112  gm->GetIntegerv(cv->enum1_, val);
113  cv->value_.Set(math::Range1i(val[0], val[1]));
114  }
115 
116  static void GetShaderPrecision(GraphicsManager* gm, CapabilityValue* cv) {
117  GLint range[2], precision = 0;
118  range[0] = range[1] = 0;
119  gm->GetShaderPrecisionFormat(cv->enum1_, cv->enum2_, range,
120  &precision);
121  cv->value_.Set(GraphicsManager::ShaderPrecision(
122  math::Range1i(range[0], range[1]), precision));
123  }
124 
125  private:
126  GLenum enum1_;
127  GLenum enum2_; // Second enum for shader precision, count enum for vectors.
128  CapabilityVariant value_;
129  Getter getter_;
130  base::OnceFlag populated_flag_;
131  bool uninitialized_;
132 };
133 
134 class GraphicsManager::CapabilityHelper {
135  public:
136  CapabilityHelper() {
137 #define ION_SINGLE_CAP(index, enum, getter) \
138  capabilities_[index] = CapabilityValue(enum, GL_NONE, CapabilityValue::getter)
139 #define ION_DOUBLE_CAP(index, enum1, enum2, getter) \
140  capabilities_[index] = CapabilityValue(enum1, enum2, CapabilityValue::getter)
141 
142  ION_SINGLE_CAP(kAliasedLineWidthRange, GL_ALIASED_LINE_WIDTH_RANGE,
143  GetFloatRange);
145  GetFloatRange);
146  ION_DOUBLE_CAP(kCompressedTextureFormats, GL_COMPRESSED_TEXTURE_FORMATS,
147  GL_NUM_COMPRESSED_TEXTURE_FORMATS, GetIntVector);
149  GL_IMPLEMENTATION_COLOR_READ_FORMAT, GetInt);
151  GL_IMPLEMENTATION_COLOR_READ_TYPE, GetInt);
153  GL_MAX_COLOR_ATTACHMENTS, GetInt);
155  GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, GetInt);
156  ION_SINGLE_CAP(kMaxCubeMapTextureSize, GL_MAX_CUBE_MAP_TEXTURE_SIZE,
157  GetInt);
158  ION_SINGLE_CAP(kMaxDrawBuffers, GL_MAX_DRAW_BUFFERS, GetInt);
160  GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, GetInt);
161  ION_SINGLE_CAP(kMaxFragmentUniformVectors, GL_MAX_FRAGMENT_UNIFORM_VECTORS,
162  GetInt);
163  ION_SINGLE_CAP(kMaxRenderbufferSize, GL_MAX_RENDERBUFFER_SIZE, GetInt);
164  ION_SINGLE_CAP(kMaxSampleMaskWords, GL_MAX_SAMPLE_MASK_WORDS, GetInt);
165  ION_SINGLE_CAP(kMaxTextureImageUnits, GL_MAX_TEXTURE_IMAGE_UNITS, GetInt);
166  ION_SINGLE_CAP(kMaxTextureMaxAnisotropy, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
167  GetFloat);
168  ION_SINGLE_CAP(kMaxTextureSize, GL_MAX_TEXTURE_SIZE, GetInt);
170  GL_MAX_TRANSFORM_FEEDBACK_BUFFERS, GetInt);
172  GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, GetInt);
174  GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, GetInt);
176  GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, GetInt);
177  ION_SINGLE_CAP(kMaxVaryingVectors, GL_MAX_VARYING_VECTORS, GetInt);
178  ION_SINGLE_CAP(kMaxVertexAttribs, GL_MAX_VERTEX_ATTRIBS, GetInt);
180  GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, GetInt);
182  GL_MAX_VERTEX_UNIFORM_COMPONENTS, GetInt);
183  ION_SINGLE_CAP(kMaxVertexUniformVectors, GL_MAX_VERTEX_UNIFORM_VECTORS,
184  GetInt);
185  ION_SINGLE_CAP(kMaxViewportDims, GL_MAX_VIEWPORT_DIMS, GetIntRange);
186  ION_DOUBLE_CAP(kShaderBinaryFormats, GL_SHADER_BINARY_FORMATS,
187  GL_NUM_SHADER_BINARY_FORMATS, GetIntVector);
189  GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, GetInt);
190  ION_SINGLE_CAP(kMaxDebugLoggedMessages, GL_MAX_DEBUG_LOGGED_MESSAGES,
191  GetInt);
192  ION_SINGLE_CAP(kMaxDebugMessageLength, GL_MAX_DEBUG_MESSAGE_LENGTH, GetInt);
194  GL_HIGH_FLOAT, GetShaderPrecision);
196  GL_HIGH_INT, GetShaderPrecision);
198  GL_LOW_FLOAT, GetShaderPrecision);
200  GL_LOW_INT, GetShaderPrecision);
202  GL_FRAGMENT_SHADER, GL_MEDIUM_FLOAT, GetShaderPrecision);
204  GL_MEDIUM_INT, GetShaderPrecision);
206  GL_HIGH_FLOAT, GetShaderPrecision);
208  GL_HIGH_INT, GetShaderPrecision);
210  GL_LOW_FLOAT, GetShaderPrecision);
212  GL_LOW_INT, GetShaderPrecision);
214  GL_MEDIUM_FLOAT, GetShaderPrecision);
216  GL_MEDIUM_INT, GetShaderPrecision);
217 
218 #undef ION_SINGLE_CAP
219 #undef ION_DOUBLE_CAP
220  }
221 
222  ~CapabilityHelper() {}
223  const CapabilityValue::CapabilityVariant& GetCapabilityValue(
225  return capabilities_[cap].GetValue(gm);
226  }
227 
228  private:
229  CapabilityValue capabilities_[GraphicsManager::kCapabilityCount];
230 };
231 
233 
240 
241 
242 class GraphicsManager::FunctionGroup {
243  public:
244  FunctionGroup()
245  : complete_(true),
246  enabled_(true),
247  available_functions_(),
248  missing_functions_() {}
249  ~FunctionGroup() {}
250  void AddFunction(const std::string& name, void* function) {
251 #if defined(ION_COVERAGE)
252  available_functions_.push_back(name);
253 #else // COV_NF_START
254  if (function == NULL)
255  missing_functions_.push_back(name);
256  else
257  available_functions_.push_back(name);
258 #endif // COV_NF_END
259  complete_ = complete_ && (function != NULL);
260  }
261  bool IsComplete() const { return complete_ && enabled_; }
262  bool IsEnabled() const { return enabled_; }
263  void SetEnabled(bool enable) { enabled_ = enable; }
264 #if !defined(ION_COVERAGE) // COV_NF_START
265  const std::vector<std::string>& GetMissingFunctions() const {
266  return missing_functions_;
267  }
268 #endif // COV_NF_END
269 
270  private:
271  bool complete_;
272  bool enabled_;
273  std::vector<std::string> available_functions_;
274  std::vector<std::string> missing_functions_;
275 };
276 
278 
283 
284 
285 class GraphicsManager::WrapperVecHolder : public base::Allocatable {
286  public:
287  WrapperVecHolder() : wrappers_(GetAllocator()) {}
288  WrapperVec& GetWrappers() { return wrappers_; }
289 
290  private:
291  WrapperVec wrappers_;
292 };
293 
294 GraphicsManager::WrapperVecHolder* GraphicsManager::GetWrapperVecHolder() {
296  base::ThreadLocalObject<WrapperVecHolder>, s_helper);
297  return s_helper->Get();
298 }
299 
301 
306 
307 
309  : wrappers_(GetAllocator()),
310  function_groups_(GetAllocator()),
311  capability_helper_(new CapabilityHelper),
312  wrapped_function_names_(*this),
313  is_error_checking_enabled_(false),
314  tracing_ostream_(NULL),
315  gl_version_(20),
316  gl_api_standard_(kEs),
317  gl_profile_type_(kCompatibilityProfile) {
318  Init(true);
319 }
320 
322  : wrappers_(GetAllocator()),
323  function_groups_(GetAllocator()),
324  capability_helper_(new CapabilityHelper),
325  wrapped_function_names_(*this),
326  is_error_checking_enabled_(false),
327  tracing_ostream_(NULL),
328  gl_version_(20),
329  gl_api_standard_(kEs),
330  gl_profile_type_(kCompatibilityProfile) {
331  Init(false);
332 }
333 
335 }
336 
337 void GraphicsManager::Init(bool init_functions_from_gl) {
338  WrapperVecHolder* wrapper_holder = GetWrapperVecHolder();
341  DCHECK(wrapper_holder != NULL);
342  WrapperVec& thread_wrappers = wrapper_holder->GetWrappers();
343  DCHECK(!thread_wrappers.empty());
344 
346  wrappers_ = thread_wrappers;
347  thread_wrappers.clear();
348  thread_wrappers.reserve(0U);
349 
350  if (init_functions_from_gl) {
351  InitFunctions();
352 
353 #if !defined(ION_COVERAGE) // COV_NF_START
354  if (!function_groups_[kCore].IsComplete()) {
355  LOG(ERROR) << "***ION: Some required OpenGL functions could not be "
356  << "found. Either there is no valid OpenGL context, or the "
357  << "following functions are missing from your OpenGL "
358  << "installation:";
359  const std::vector<std::string>& missing =
360  function_groups_[kCore].GetMissingFunctions();
361  for (size_t i = 0; i < missing.size(); i++) {
362  LOG(ERROR) << " " << missing[i].c_str();
363  }
364  }
365 #endif // COV_NF_END
366  }
367 }
368 
369 template <typename T>
372  capability_helper_->GetCapabilityValue(this, cap);
373  const T& val = value.Get<T>();
374  if (base::IsInvalidReference(val))
375  LOG(WARNING) << "Invalid type requested for capability " << cap;
376  return val;
377 }
379 template const int GraphicsManager::GetCapabilityValue<int>(
380  Capability cap);
381 template const float GraphicsManager::GetCapabilityValue<float>(
382  Capability cap);
383 template const math::Range1f
384  GraphicsManager::GetCapabilityValue<math::Range1f>(Capability cap);
385 template const math::Range1i
386  GraphicsManager::GetCapabilityValue<math::Range1i>(Capability cap);
388  GraphicsManager::GetCapabilityValue<GraphicsManager::ShaderPrecision>(
389  Capability cap);
390 template const std::vector<int>
391  GraphicsManager::GetCapabilityValue<std::vector<int> >(Capability cap);
392 
394  return function_groups_.size() > 0 && function_groups_[group].IsComplete();
395 }
396 
397 bool GraphicsManager::IsExtensionSupported(const std::string& name) const {
398  return portgfx::IsExtensionSupported(name, extensions_);
399 }
400 
401 void GraphicsManager::AddWrapper(WrapperBase* wrapper) {
402  WrapperVecHolder* holder = GetWrapperVecHolder();
403  WrapperVec& thread_wrappers = holder->GetWrappers();
404  if (thread_wrappers.capacity() < 64U) {
405  thread_wrappers.reserve(64U);
406  }
407  thread_wrappers.push_back(wrapper);
408 }
409 
410 void GraphicsManager::AddFunctionToGroup(FunctionGroupId group,
411  const char* func_name,
412  void* function) {
413  if (function_groups_.size() == 0) {
414  function_groups_.resize(kNumFunctionGroupIds);
415  }
416  function_groups_[group].AddFunction(func_name, function);
417 }
418 
420  FunctionGroupId group, bool enable) {
421  if (function_groups_.size() > 0)
422  function_groups_[group].SetEnabled(enable);
423 
426  switch (group) {
427  case kDebugOutput:
428  valid_statetable_caps_.set(StateTable::kDebugOutputSynchronous, enable);
429  break;
431  valid_statetable_caps_.set(StateTable::kMultisample, enable);
432  break;
433  default:
434  break;
435  }
436 }
437 
438 void GraphicsManager::InitFunctions() {
439  const size_t num_wrappers = wrappers_.size();
440  for (size_t i = 0; i < num_wrappers; ++i) {
441  if (wrappers_[i]->Init(this))
442  AddWrappedFunctionName(wrappers_[i]->GetFuncName());
443  }
444  InitGlInfo();
445 }
446 
453  const char* version_string =
454  reinterpret_cast<const char*>(GetString(GL_VERSION));
455  if (version_string) {
456  std::string version(version_string);
457  gl_version_string_ = version;
458  if (version.find("WebGL") != std::string::npos) {
459  version = "2.0";
460  gl_api_standard_ = kWeb;
461  } else if (version.find("GL ES") != std::string::npos ||
462  version.find("GL/ES") != std::string::npos ||
463  version.find("GL / ES") != std::string::npos) {
464  gl_api_standard_ = kEs;
465  } else {
466  gl_api_standard_ = kDesktop;
467  }
468  const size_t dot_pos = version.find('.');
469  if (dot_pos != std::string::npos && dot_pos > 0U) {
470  int major = 0;
471  int minor = 0;
472  major = version[dot_pos - 1U] - '0';
473  minor = version[dot_pos + 1U] - '0';
474  gl_version_ = major * 10U + minor;
475  }
476  }
477 
478  if (const char* renderer_string =
479  reinterpret_cast<const char*>(GetString(GL_RENDERER)))
480  gl_renderer_ = renderer_string;
481 
482  GLint mask = 0;
483  GetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
486  GetError();
487  gl_profile_type_ = kCompatibilityProfile;
488  if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
489  gl_profile_type_ = kCoreProfile;
490 
491  if (const char* extensions =
492  reinterpret_cast<const char*>(GetString(GL_EXTENSIONS)))
493  extensions_ = extensions;
494 
496  valid_statetable_caps_.reset();
497  valid_statetable_caps_.flip();
498 
501  "copy_buffer", "");
503  "debug_label", "");
505  "debug_marker", "");
507  "debug_output,debug", "");
509  "framebuffer_blit", "");
511  GlVersions(20U, 30U, 0U),
512  "framebuffer_multisample", "");
514  "gpu_shader4", "");
515  EnableFunctionGroupIfAvailable(kEglImage, GlVersions(0U, 0U, 0U), "EGL_image",
516  "");
517  EnableFunctionGroupIfAvailable(kGetString, GlVersions(30U, 30U, 0U), "", "");
519  "mapbuffer,vertex_buffer_object",
520  "Vivante GC1000,VideoCore IV HW");
522  "map_buffer_range",
523  "Vivante GC1000,VideoCore IV HW");
525  "sampler_objects", "Mali ,Mali-");
527  "texture_3d", "");
529  "texture_multisample", "");
531  "texture_storage", "");
533  GlVersions(42U, 30U, 0U),
534  "texture_storage_multisample", "");
536  "vertex_array_object", "Internet Explorer");
538  "instanced_drawing", "");
539  EnableFunctionGroupIfAvailable(kSync, GlVersions(32U, 30U, 2U), "sync", "");
540  EnableFunctionGroupIfAvailable(kRaw, GlVersions(0U, 0U, 0U), "", "");
542  "transform_feedback", "");
543 
544  if (extensions_.empty() && IsFunctionGroupAvailable(kGetString)) {
545  GLint count = 0;
546  GetIntegerv(GL_NUM_EXTENSIONS, &count);
547  std::vector<std::string> extension_list;
548  for (GLint i = 0; i < count; ++i) {
549  if (const char* extension =
550  reinterpret_cast<const char*>(GetStringi(GL_EXTENSIONS, i))) {
551  extension_list.push_back(std::string(extension));
552  }
553  }
554  extensions_ = base::JoinStrings(extension_list, " ");
555  }
556 
562  GLuint id = 0U;
563  GenVertexArrays(1U, &id);
565  if (id)
566  DeleteVertexArrays(1U, &id);
567  else
569  }
570 
572  GetError();
573 }
574 
575 const char* GraphicsManager::ErrorString(GLenum error_code) {
576  switch (error_code) {
577  case GL_INVALID_ENUM: return "invalid enumerant";
578  case GL_INVALID_VALUE: return "invalid value";
579  case GL_INVALID_OPERATION: return "invalid operation";
580  case GL_OUT_OF_MEMORY: return "out of memory";
581  case GL_INVALID_FRAMEBUFFER_OPERATION:
582  return "invalid framebuffer operation";
583  default: return "unknown error";
584  }
585 }
586 
588  const size_t num_wrappers = wrappers_.size();
590  for (size_t i = 0; i < num_wrappers; ++i)
591  wrappers_[i]->Reset();
592  wrapped_function_names_.clear();
593  if (function_groups_.size() > 0) {
594  function_groups_.clear();
595  function_groups_.resize(kNumFunctionGroupIds);
596  }
597  InitFunctions();
598 }
599 
600 void GraphicsManager::CheckForErrors(const char* when,
601  const std::string& func_call) {
604  if (func_call.find("GetError") == std::string::npos) {
605  GLenum error = this->GetError();
606  if (error != GL_NO_ERROR) {
607  if (tracing_ostream_) {
608  *tracing_ostream_ << "*** GL error " << when << " call to "
609  << func_call << ": " << ErrorString(error) << "\n";
610  }
611  LOG(ERROR) << "*** GL error " << when << " call to "
612  << func_call << ": " << ErrorString(error) << "\n";
613  }
614  }
615 }
616 
617 void* GraphicsManager::Lookup(const char* name, bool is_core) {
618  return portgfx::GetGlProcAddress(name, is_core);
619 }
620 
622  GraphicsManager::FunctionGroupId group, const GlVersions& versions,
623  const std::string& extensions, const std::string& disabled_renderers) {
624  EnableFunctionGroup(group, true);
625  if (IsFunctionGroupAvailable(group)) {
626  const std::vector<std::string> renderers =
627  base::SplitString(disabled_renderers, ",");
628  const size_t renderer_count = renderers.size();
630  for (size_t i = 0; i < renderer_count; ++i) {
631  if (gl_renderer_.find(renderers[i]) != std::string::npos) {
632  EnableFunctionGroup(group, false);
633  return;
634  }
635  }
636 
637  const std::vector<std::string> names = base::SplitString(extensions, ",");
638  const size_t count = names.size();
641  for (size_t i = 0; i < count; ++i) {
642  if (portgfx::IsExtensionIncomplete(names[i].c_str())) {
643  EnableFunctionGroup(group, false);
644  return;
645  }
646  }
648  if (versions[gl_api_standard_] && gl_version_ >= versions[gl_api_standard_])
649  return;
650 
652  for (size_t i = 0; i < count; ++i) {
653  if (IsExtensionSupported(names[i]))
654  return;
655  }
656  }
657  EnableFunctionGroup(group, false);
658 }
659 
660 } // namespace gfx
661 } // namespace ion
GraphicsManager manages the graphics library for an application.
bool IsInvalidReference(const T &value)
IsInvalidReference() returns true if a passed const reference of type T has an address of InvalidRefe...
Definition: invalid.h:41
See https://www.opengl.org/registry/specs/EXT/gpu_shader4.txt.
Capability
GraphicsManager supports queries on local GL platform capabilities, such as the maximum texture size ...
const T & Get() const
If this contains an object of type T (which must be one of the defined types), this returns a const r...
Definition: variant.h:364
#define ION_DECLARE_SAFE_STATIC_POINTER(type, variable)
Declare a static non-array pointer and calls a default constructor.
framebuffer alpha dfactor const GLvoid usage alpha const GLvoid data border const GLuint buffers const GLuint renderbuffers count renderbuffer GLuint framebuffers GLsizei GLint GLenum GLchar name GLsizei count
bool IsFunctionGroupAvailable(FunctionGroupId group) const
Returns true if the named function group is available. Thread-safe.
~GraphicsManager() override
The destructor is protected because all base::Referent classes must have protected or private destruc...
ION_API bool IsExtensionIncomplete(const char *unprefixed_extension)
Returns whether the passed extension is known to be incomplete for the current platform.
framebuffer alpha dfactor const GLvoid usage alpha const GLvoid data border const GLuint buffers const GLuint renderbuffers count renderbuffer GLuint framebuffers GLsizei GLint GLenum GLchar name GLsizei GLuint shaders value
Range< 1, int32 > Range1i
Definition: range.h:363
#define DCHECK(expr)
Definition: logging.h:331
Simple wrapper for a set of GL versions.
#define LOG(severity)
Logs the streamed message unconditionally with a severity of severity.
Definition: logging.h:216
#define ION_DOUBLE_CAP(index, enum1, enum2, getter)
std::vector< std::string > ION_API SplitString(const std::string &str, const std::string &delimiters)
Splits a string into a vector of substrings, given a set of delimiter characters (expressed as a stri...
Definition: stringutils.cc:187
void InitGlInfo()
Initializes local GL information such as version and platform api standard.
Information about shader precision, see below.
framebuffer alpha dfactor const GLvoid usage alpha GLint
The below are returned as a ShaderPrecision struct.
framebuffer alpha dfactor const GLvoid usage alpha const GLvoid data border const GLuint buffers const GLuint renderbuffers count renderbuffer GLuint framebuffers GLsizei GLint GLenum GLchar name GLsizei GLuint shaders GLint data GLsizei GLchar info_log GLint params GLint GLint precision GLint params GLint params GLint params GLfloat params GLvoid pointer height height const GLchar const GLint length mask dppass param param const GLvoid data const GLint1 value const GLfloat2 value v2 v2 v3 v3 const GLmatrix2 value const GLmatrix4 value v1 v2 v3 const GLvoid pointer GLsizei GLchar label const GLchar marker const void userParam const GLchar buf void params height const GLuint1 value const GLuint2 value const GLuint3 value const GLuint4 value void image primCount divisor length size sampler GLuint samplers GLint params const GLfloat params const GLint params flags timeout const GLvoid data const GLvoid pixels fixed_sample_locations GLfloat val height fixed_sample_locations primitive_mode const GLuint ids GLsizei GLsizei GLenum GLchar name const GLchar buffer_mode GenVertexArrays
void * GetGlProcAddress(const char *name, bool is_core)
Returns a generic pointer to an OpenGL function or OpenGL extension function with the given name...
#define GL_ALIASED_POINT_SIZE_RANGE
These constants are not always defined in OpenGL header files.
Definition: glheaders.h:138
bool IsExtensionSupported(const std::string &name) const
Checks if the passed extension is supported by this manager.
static const char * ErrorString(GLenum error_code)
Returns a terse string description of an OpenGL error code.
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.
void ReinitFunctions()
This is used by MockGraphicsManager to install its own versions of the OpenGL functions.
std::string name
Definition: printer.cc:324
GraphicsManager()
GraphicsManager implementation.
#define ION_SINGLE_CAP(index, enum, getter)
This covers both OES_EGL_image and OES_EGL_image_external.
std::string JoinStrings(const std::vector< std::string > &strings, const std::string &glue)
Joins the strings in the passed vector together with the passed glue.
Definition: stringutils.h:89
Copyright 2016 Google Inc.
virtual void EnableFunctionGroupIfAvailable(FunctionGroupId group, const GlVersions &versions, const std::string &extensions, const std::string &disabled_renderers)
Verifies that a function group is available by checking if the GL version for the current API is high...
const AllocatorPtr & GetAllocator() const
Returns the Allocator that was used for the instance.
Definition: allocatable.h:68
int precision
const T GetCapabilityValue(Capability cap)
Returns the value of the passed Capability.
void EnableFunctionGroup(FunctionGroupId group, bool enable)
Enables or disables a specific function group.
Range< 1, float > Range1f
Definition: range.h:365