OLD | NEW |
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 GrGpuGL_DEFINED | 8 #ifndef GrGpuGL_DEFINED |
9 #define GrGpuGL_DEFINED | 9 #define GrGpuGL_DEFINED |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 #endif | 27 #endif |
28 | 28 |
29 class GrGpuGL : public GrGpu { | 29 class GrGpuGL : public GrGpu { |
30 public: | 30 public: |
31 GrGpuGL(const GrGLContext& ctx, GrContext* context); | 31 GrGpuGL(const GrGLContext& ctx, GrContext* context); |
32 virtual ~GrGpuGL(); | 32 virtual ~GrGpuGL(); |
33 | 33 |
34 const GrGLContext& glContext() const { return fGLContext; } | 34 const GrGLContext& glContext() const { return fGLContext; } |
35 | 35 |
36 const GrGLInterface* glInterface() const { return fGLContext.interface(); } | 36 const GrGLInterface* glInterface() const { return fGLContext.interface(); } |
37 const GrGLContextInfo& ctxInfo() const { return fGLContext.info(); } | 37 const GrGLContextInfo& ctxInfo() const { return fGLContext; } |
38 GrGLStandard glStandard() const { return fGLContext.info().standard(); } | 38 GrGLStandard glStandard() const { return fGLContext.standard(); } |
39 GrGLVersion glVersion() const { return fGLContext.info().version(); } | 39 GrGLVersion glVersion() const { return fGLContext.version(); } |
40 GrGLSLGeneration glslGeneration() const { return fGLContext.info().glslGener
ation(); } | 40 GrGLSLGeneration glslGeneration() const { return fGLContext.glslGeneration()
; } |
| 41 const GrGLCaps& glCaps() const { return *fGLContext.caps(); } |
41 | 42 |
42 // Used by GrGLProgram and GrGLTexGenProgramEffects to configure OpenGL stat
e. | 43 // Used by GrGLProgram and GrGLTexGenProgramEffects to configure OpenGL stat
e. |
43 void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* te
xture); | 44 void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* te
xture); |
44 void setProjectionMatrix(const SkMatrix& matrix, | 45 void setProjectionMatrix(const SkMatrix& matrix, |
45 const SkISize& renderTargetSize, | 46 const SkISize& renderTargetSize, |
46 GrSurfaceOrigin renderTargetOrigin); | 47 GrSurfaceOrigin renderTargetOrigin); |
47 enum TexGenComponents { | 48 enum TexGenComponents { |
48 kS_TexGenComponents = 1, | 49 kS_TexGenComponents = 1, |
49 kST_TexGenComponents = 2, | 50 kST_TexGenComponents = 2, |
50 kSTR_TexGenComponents = 3 | 51 kSTR_TexGenComponents = 3 |
(...skipping 19 matching lines...) Expand all Loading... |
70 int left, int top, | 71 int left, int top, |
71 int width, int height, | 72 int width, int height, |
72 GrPixelConfig config, | 73 GrPixelConfig config, |
73 size_t rowBytes) const SK_OVERRIDE; | 74 size_t rowBytes) const SK_OVERRIDE; |
74 virtual bool fullReadPixelsIsFasterThanPartial() const SK_OVERRIDE; | 75 virtual bool fullReadPixelsIsFasterThanPartial() const SK_OVERRIDE; |
75 | 76 |
76 virtual void initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* des
c) SK_OVERRIDE; | 77 virtual void initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* des
c) SK_OVERRIDE; |
77 | 78 |
78 virtual void abandonResources() SK_OVERRIDE; | 79 virtual void abandonResources() SK_OVERRIDE; |
79 | 80 |
80 const GrGLCaps& glCaps() const { return *fGLContext.info().caps(); } | |
81 | |
82 // These functions should be used to bind GL objects. They track the GL stat
e and skip redundant | 81 // These functions should be used to bind GL objects. They track the GL stat
e and skip redundant |
83 // bindings. Making the equivalent glBind calls directly will confuse the st
ate tracking. | 82 // bindings. Making the equivalent glBind calls directly will confuse the st
ate tracking. |
84 void bindVertexArray(GrGLuint id) { | 83 void bindVertexArray(GrGLuint id) { |
85 fHWGeometryState.setVertexArrayID(this, id); | 84 fHWGeometryState.setVertexArrayID(this, id); |
86 } | 85 } |
87 void bindIndexBufferAndDefaultVertexArray(GrGLuint id) { | 86 void bindIndexBufferAndDefaultVertexArray(GrGLuint id) { |
88 fHWGeometryState.setIndexBufferIDOnDefaultVertexArray(this, id); | 87 fHWGeometryState.setIndexBufferIDOnDefaultVertexArray(this, id); |
89 } | 88 } |
90 void bindVertexBuffer(GrGLuint id) { | 89 void bindVertexBuffer(GrGLuint id) { |
91 fHWGeometryState.setVertexBufferID(this, id); | 90 fHWGeometryState.setVertexBufferID(this, id); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start | 169 // an into the index buffer. It does not account for drawInfo.startIndex() b
ut rather the start |
171 // index is relative to the returned offset. | 170 // index is relative to the returned offset. |
172 void setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes); | 171 void setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes); |
173 | 172 |
174 // Subclasses should call this to flush the blend state. | 173 // Subclasses should call this to flush the blend state. |
175 // The params should be the final coefficients to apply | 174 // The params should be the final coefficients to apply |
176 // (after any blending optimizations or dual source blending considerations | 175 // (after any blending optimizations or dual source blending considerations |
177 // have been accounted for). | 176 // have been accounted for). |
178 void flushBlend(bool isLines, GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff); | 177 void flushBlend(bool isLines, GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff); |
179 | 178 |
180 bool hasExtension(const char* ext) const { return fGLContext.info().hasExten
sion(ext); } | 179 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } |
181 | 180 |
182 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 181 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
183 | 182 |
184 class ProgramCache : public ::SkNoncopyable { | 183 class ProgramCache : public ::SkNoncopyable { |
185 public: | 184 public: |
186 ProgramCache(GrGpuGL* gpu); | 185 ProgramCache(GrGpuGL* gpu); |
187 ~ProgramCache(); | 186 ~ProgramCache(); |
188 | 187 |
189 void abandon(); | 188 void abandon(); |
190 GrGLProgram* getProgram(const GrGLProgramDesc& desc, | 189 GrGLProgram* getProgram(const GrGLProgramDesc& desc, |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 ///@} | 449 ///@} |
451 | 450 |
452 // we record what stencil format worked last time to hopefully exit early | 451 // we record what stencil format worked last time to hopefully exit early |
453 // from our loop that tries stencil formats and calls check fb status. | 452 // from our loop that tries stencil formats and calls check fb status. |
454 int fLastSuccessfulStencilFmtIdx; | 453 int fLastSuccessfulStencilFmtIdx; |
455 | 454 |
456 typedef GrGpu INHERITED; | 455 typedef GrGpu INHERITED; |
457 }; | 456 }; |
458 | 457 |
459 #endif | 458 #endif |
OLD | NEW |