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

Side by Side Diff: include/gpu/gl/SkGLContextHelper.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/GrGLInterface.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #ifndef SkGLContextHelper_DEFINED 8 #ifndef SkGLContextHelper_DEFINED
9 #define SkGLContextHelper_DEFINED 9 #define SkGLContextHelper_DEFINED
10 10
11 #include "GrGLExtensions.h"
12 #include "GrGLInterface.h" 11 #include "GrGLInterface.h"
13 12
14 /** 13 /**
15 * Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO. 14 * Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO.
16 * Provides a GrGLInterface struct of function pointers for the context. 15 * Provides a GrGLInterface struct of function pointers for the context.
17 */ 16 */
18 17
19 class SkGLContextHelper : public SkRefCnt { 18 class SkGLContextHelper : public SkRefCnt {
20 public: 19 public:
21 SK_DECLARE_INST_COUNT(SkGLContextHelper) 20 SK_DECLARE_INST_COUNT(SkGLContextHelper)
(...skipping 19 matching lines...) Expand all
41 * 40 *
42 * If the drawing surface provided by the platform is double buffered this 41 * If the drawing surface provided by the platform is double buffered this
43 * call will cause the platform to swap which buffer is currently being 42 * call will cause the platform to swap which buffer is currently being
44 * targeted. If the current surface does not include a back buffer, this 43 * targeted. If the current surface does not include a back buffer, this
45 * call has no effect. 44 * call has no effect.
46 */ 45 */
47 virtual void swapBuffers() const = 0; 46 virtual void swapBuffers() const = 0;
48 47
49 bool hasExtension(const char* extensionName) const { 48 bool hasExtension(const char* extensionName) const {
50 SkASSERT(NULL != fGL); 49 SkASSERT(NULL != fGL);
51 return fExtensions.has(extensionName); 50 return fGL->hasExtension(extensionName);
52 } 51 }
53 52
54 protected: 53 protected:
55 /** 54 /**
56 * Subclass implements this to make a GL context. The returned GrGLInterface 55 * Subclass implements this to make a GL context. The returned GrGLInterface
57 * should be populated with functions compatible with the context. The 56 * should be populated with functions compatible with the context. The
58 * format and size of backbuffers does not matter since an FBO will be 57 * format and size of backbuffers does not matter since an FBO will be
59 * created. 58 * created.
60 */ 59 */
61 virtual const GrGLInterface* createGLContext() = 0; 60 virtual const GrGLInterface* createGLContext() = 0;
62 61
63 /** 62 /**
64 * Subclass should destroy the underlying GL context. 63 * Subclass should destroy the underlying GL context.
65 */ 64 */
66 virtual void destroyGLContext() = 0; 65 virtual void destroyGLContext() = 0;
67 66
68 private: 67 private:
69 GrGLExtensions fExtensions;
70 GrGLuint fFBO; 68 GrGLuint fFBO;
71 GrGLuint fColorBufferID; 69 GrGLuint fColorBufferID;
72 GrGLuint fDepthStencilBufferID; 70 GrGLuint fDepthStencilBufferID;
73 const GrGLInterface* fGL; 71 const GrGLInterface* fGL;
74 72
75 typedef SkRefCnt INHERITED; 73 typedef SkRefCnt INHERITED;
76 }; 74 };
77 75
78 /** 76 /**
79 * Helper macros for using the GL context through the GrGLInterface. Example: 77 * Helper macros for using the GL context through the GrGLInterface. Example:
80 * SK_GL(glCtx, GenTextures(1, &texID)); 78 * SK_GL(glCtx, GenTextures(1, &texID));
81 */ 79 */
82 #define SK_GL(ctx, X) (ctx).gl()->f ## X; \ 80 #define SK_GL(ctx, X) (ctx).gl()->f ## X; \
83 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError()) 81 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError())
84 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->f ## X; \ 82 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->f ## X; \
85 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError()) 83 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError())
86 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->f ## X 84 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->f ## X
87 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->f ## X 85 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->f ## X
88 86
89 #endif 87 #endif
OLDNEW
« no previous file with comments | « include/gpu/gl/GrGLInterface.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698