Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: include/gpu/gl/GrGLInterface.h

Issue 140823003: Move GrGLExtensions from GrGLContextInfo to GrGLInterface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix Android Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/gpu/gl/GrGLFunctions.h ('k') | include/gpu/gl/SkGLContextHelper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrGLInterface_DEFINED 8 #ifndef GrGLInterface_DEFINED
9 #define GrGLInterface_DEFINED 9 #define GrGLInterface_DEFINED
10 10
11 #include "GrGLFunctions.h" 11 #include "GrGLFunctions.h"
12 #include "GrGLExtensions.h"
12 #include "SkRefCnt.h" 13 #include "SkRefCnt.h"
13 14
14 //////////////////////////////////////////////////////////////////////////////// 15 ////////////////////////////////////////////////////////////////////////////////
15 16
16 /** 17 /**
17 * Classifies GL contexts by which standard they implement (currently as Desktop
18 * vs. ES).
19 */
20 enum GrGLStandard {
21 kNone_GrGLStandard,
22 kGL_GrGLStandard,
23 kGLES_GrGLStandard,
24 };
25
26 // Temporary aliases until Chromium can be updated.
27 typedef GrGLStandard GrGLBinding;
28 static const GrGLStandard kES2_GrGLBinding = kGLES_GrGLStandard;
29 static const GrGLStandard kDesktop_GrGLBinding = kGL_GrGLStandard;
30
31 ////////////////////////////////////////////////////////////////////////////////
32
33 /**
34 * Rather than depend on platform-specific GL headers and libraries, we require 18 * Rather than depend on platform-specific GL headers and libraries, we require
35 * the client to provide a struct of GL function pointers. This struct can be 19 * the client to provide a struct of GL function pointers. This struct can be
36 * specified per-GrContext as a parameter to GrContext::Create. If NULL is 20 * specified per-GrContext as a parameter to GrContext::Create. If NULL is
37 * passed to Create then a "default" GL interface is created. If the default is 21 * passed to Create then a "default" GL interface is created. If the default is
38 * also NULL GrContext creation will fail. 22 * also NULL GrContext creation will fail.
39 * 23 *
40 * The default interface is returned by GrGLDefaultInterface. This function's 24 * The default interface is returned by GrGLDefaultInterface. This function's
41 * implementation is platform-specific. Several have been provided, along with 25 * implementation is platform-specific. Several have been provided, along with
42 * an implementation that simply returns NULL. 26 * an implementation that simply returns NULL.
43 * 27 *
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // function pointers have been initialized for both the GL version and any a dvertised 106 // function pointers have been initialized for both the GL version and any a dvertised
123 // extensions. 107 // extensions.
124 bool validate() const; 108 bool validate() const;
125 109
126 // Indicates the type of GL implementation 110 // Indicates the type of GL implementation
127 union { 111 union {
128 GrGLStandard fStandard; 112 GrGLStandard fStandard;
129 GrGLStandard fBindingsExported; // Legacy name, will be remove when Chro mium is updated. 113 GrGLStandard fBindingsExported; // Legacy name, will be remove when Chro mium is updated.
130 }; 114 };
131 115
116 GrGLExtensions fExtensions;
117
118 // This wrapper and const hackery is necessary because the factories in Chro mium do not yet
119 // initialize fExtensions.
120 bool hasExtension(const char ext[]) const {
121 if (!fExtensions.isInitialized()) {
122 GrGLExtensions* extensions = const_cast<GrGLExtensions*>(&fExtension s);
123 if (!extensions->init(fStandard, fGetString, fGetStringi, fGetIntege rv)) {
124 return false;
125 }
126 }
127 return fExtensions.has(ext);
128 }
129
132 GLPtr<GrGLActiveTextureProc> fActiveTexture; 130 GLPtr<GrGLActiveTextureProc> fActiveTexture;
133 GLPtr<GrGLAttachShaderProc> fAttachShader; 131 GLPtr<GrGLAttachShaderProc> fAttachShader;
134 GLPtr<GrGLBeginQueryProc> fBeginQuery; 132 GLPtr<GrGLBeginQueryProc> fBeginQuery;
135 GLPtr<GrGLBindAttribLocationProc> fBindAttribLocation; 133 GLPtr<GrGLBindAttribLocationProc> fBindAttribLocation;
136 GLPtr<GrGLBindBufferProc> fBindBuffer; 134 GLPtr<GrGLBindBufferProc> fBindBuffer;
137 GLPtr<GrGLBindFragDataLocationProc> fBindFragDataLocation; 135 GLPtr<GrGLBindFragDataLocationProc> fBindFragDataLocation;
138 GLPtr<GrGLBindFragDataLocationIndexedProc> fBindFragDataLocationIndexed; 136 GLPtr<GrGLBindFragDataLocationIndexedProc> fBindFragDataLocationIndexed;
139 GLPtr<GrGLBindFramebufferProc> fBindFramebuffer; 137 GLPtr<GrGLBindFramebufferProc> fBindFramebuffer;
140 GLPtr<GrGLBindRenderbufferProc> fBindRenderbuffer; 138 GLPtr<GrGLBindRenderbufferProc> fBindRenderbuffer;
141 GLPtr<GrGLBindTextureProc> fBindTexture; 139 GLPtr<GrGLBindTextureProc> fBindTexture;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 343
346 // Per-GL func callback 344 // Per-GL func callback
347 #if GR_GL_PER_GL_FUNC_CALLBACK 345 #if GR_GL_PER_GL_FUNC_CALLBACK
348 GrGLInterfaceCallbackProc fCallback; 346 GrGLInterfaceCallbackProc fCallback;
349 GrGLInterfaceCallbackData fCallbackData; 347 GrGLInterfaceCallbackData fCallbackData;
350 #endif 348 #endif
351 349
352 }; 350 };
353 351
354 #endif 352 #endif
OLDNEW
« no previous file with comments | « include/gpu/gl/GrGLFunctions.h ('k') | include/gpu/gl/SkGLContextHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698