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

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

Issue 351583002: Revert of Support using OpenGL ES context on desktop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « include/gpu/gl/SkDebugGLContext.h ('k') | include/gpu/gl/SkMesaGLContext.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 /* 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 "GrGLInterface.h" 11 #include "GrGLInterface.h"
12 12
13 /** 13 /**
14 * Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO. 14 * Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO.
15 * Provides a GrGLInterface struct of function pointers for the context. 15 * Provides a GrGLInterface struct of function pointers for the context.
16 */ 16 */
17 17
18 class SK_API SkGLContextHelper : public SkRefCnt { 18 class SK_API SkGLContextHelper : public SkRefCnt {
19 public: 19 public:
20 SK_DECLARE_INST_COUNT(SkGLContextHelper) 20 SK_DECLARE_INST_COUNT(SkGLContextHelper)
21 21
22 SkGLContextHelper(); 22 SkGLContextHelper();
23 virtual ~SkGLContextHelper(); 23 virtual ~SkGLContextHelper();
24 24
25 /** 25 /**
26 * Initializes the context and makes it current. 26 * Initializes the context and makes it current.
27 */ 27 */
28 bool init(GrGLStandard forcedGpuAPI, const int width, const int height); 28 bool init(const int width, const int height);
29 29
30 int getFBOID() const { return fFBO; } 30 int getFBOID() const { return fFBO; }
31 31
32 const GrGLInterface* gl() const { return fGL; } 32 const GrGLInterface* gl() const { return fGL; }
33 33
34 virtual void makeCurrent() const = 0; 34 virtual void makeCurrent() const = 0;
35 35
36 /** 36 /**
37 * The primary purpose of this function it to provide a means of scheduling 37 * The primary purpose of this function it to provide a means of scheduling
38 * work on the GPU (since all of the subclasses create primary buffers for 38 * work on the GPU (since all of the subclasses create primary buffers for
(...skipping 11 matching lines...) Expand all
50 return fGL->hasExtension(extensionName); 50 return fGL->hasExtension(extensionName);
51 } 51 }
52 52
53 protected: 53 protected:
54 /** 54 /**
55 * Subclass implements this to make a GL context. The returned GrGLInterface 55 * Subclass implements this to make a GL context. The returned GrGLInterface
56 * should be populated with functions compatible with the context. The 56 * should be populated with functions compatible with the context. The
57 * 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
58 * created. 58 * created.
59 */ 59 */
60 virtual const GrGLInterface* createGLContext(GrGLStandard forcedGpuAPI) = 0; 60 virtual const GrGLInterface* createGLContext() = 0;
61 61
62 /** 62 /**
63 * Subclass should destroy the underlying GL context. 63 * Subclass should destroy the underlying GL context.
64 */ 64 */
65 virtual void destroyGLContext() = 0; 65 virtual void destroyGLContext() = 0;
66 66
67 private: 67 private:
68 GrGLuint fFBO; 68 GrGLuint fFBO;
69 GrGLuint fColorBufferID; 69 GrGLuint fColorBufferID;
70 GrGLuint fDepthStencilBufferID; 70 GrGLuint fDepthStencilBufferID;
71 const GrGLInterface* fGL; 71 const GrGLInterface* fGL;
72 72
73 typedef SkRefCnt INHERITED; 73 typedef SkRefCnt INHERITED;
74 }; 74 };
75 75
76 /** 76 /**
77 * Helper macros for using the GL context through the GrGLInterface. Example: 77 * Helper macros for using the GL context through the GrGLInterface. Example:
78 * SK_GL(glCtx, GenTextures(1, &texID)); 78 * SK_GL(glCtx, GenTextures(1, &texID));
79 */ 79 */
80 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \ 80 #define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \
81 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fFunctions.fGetErro r()) 81 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fFunctions.fGetErro r())
82 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \ 82 #define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \
83 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fFunctions.fGetError()) 83 SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fFunctions.fGetError())
84 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X 84 #define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X
85 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X 85 #define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X
86 86
87 #endif 87 #endif
OLDNEW
« no previous file with comments | « include/gpu/gl/SkDebugGLContext.h ('k') | include/gpu/gl/SkMesaGLContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698