| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 const SkIRect& srcRect, | 99 const SkIRect& srcRect, |
| 100 const SkIPoint& dstPoint) SK_OVERRIDE; | 100 const SkIPoint& dstPoint) SK_OVERRIDE; |
| 101 | 101 |
| 102 bool canCopySurface(const GrSurface* dst, | 102 bool canCopySurface(const GrSurface* dst, |
| 103 const GrSurface* src, | 103 const GrSurface* src, |
| 104 const SkIRect& srcRect, | 104 const SkIRect& srcRect, |
| 105 const SkIPoint& dstPoint) SK_OVERRIDE; | 105 const SkIPoint& dstPoint) SK_OVERRIDE; |
| 106 | 106 |
| 107 protected: | 107 protected: |
| 108 virtual void buildProgramDesc(const GrOptDrawState&, | 108 virtual void buildProgramDesc(const GrOptDrawState&, |
| 109 const GrProgramDesc::DescInfo&, | |
| 110 GrGpu::DrawType, | 109 GrGpu::DrawType, |
| 111 GrProgramDesc*) SK_OVERRIDE; | 110 GrProgramDesc*) SK_OVERRIDE; |
| 112 | 111 |
| 113 private: | 112 private: |
| 114 // GrGpu overrides | 113 // GrGpu overrides |
| 115 virtual void onResetContext(uint32_t resetBits) SK_OVERRIDE; | 114 virtual void onResetContext(uint32_t resetBits) SK_OVERRIDE; |
| 116 | 115 |
| 117 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, | 116 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, |
| 118 const void* srcData, | 117 const void* srcData, |
| 119 size_t rowBytes) SK_OVERRIDE; | 118 size_t rowBytes) SK_OVERRIDE; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 148 int left, int top, int width, int height, | 147 int left, int top, int width, int height, |
| 149 GrPixelConfig config, const void* buffer, | 148 GrPixelConfig config, const void* buffer, |
| 150 size_t rowBytes) SK_OVERRIDE; | 149 size_t rowBytes) SK_OVERRIDE; |
| 151 | 150 |
| 152 virtual void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE; | 151 virtual void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE; |
| 153 | 152 |
| 154 virtual void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) SK
_OVERRIDE; | 153 virtual void onDraw(const GrOptDrawState&, const GrDrawTarget::DrawInfo&) SK
_OVERRIDE; |
| 155 | 154 |
| 156 | 155 |
| 157 virtual void clearStencil(GrRenderTarget*) SK_OVERRIDE; | 156 virtual void clearStencil(GrRenderTarget*) SK_OVERRIDE; |
| 158 virtual bool flushGraphicsState(const GrOptDrawState&, DrawType) SK_OVERRIDE
; | 157 virtual bool flushGraphicsState(const GrOptDrawState&, |
| 158 const GrProgramDesc&, |
| 159 DrawType) SK_OVERRIDE; |
| 159 | 160 |
| 160 // GrDrawTarget overrides | 161 // GrDrawTarget overrides |
| 161 virtual void didAddGpuTraceMarker() SK_OVERRIDE; | 162 virtual void didAddGpuTraceMarker() SK_OVERRIDE; |
| 162 virtual void didRemoveGpuTraceMarker() SK_OVERRIDE; | 163 virtual void didRemoveGpuTraceMarker() SK_OVERRIDE; |
| 163 | 164 |
| 164 // binds texture unit in GL | 165 // binds texture unit in GL |
| 165 void setTextureUnit(int unitIdx); | 166 void setTextureUnit(int unitIdx); |
| 166 | 167 |
| 167 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset | 168 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset |
| 168 // 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 181 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } | 182 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } |
| 182 | 183 |
| 183 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 184 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
| 184 | 185 |
| 185 class ProgramCache : public ::SkNoncopyable { | 186 class ProgramCache : public ::SkNoncopyable { |
| 186 public: | 187 public: |
| 187 ProgramCache(GrGpuGL* gpu); | 188 ProgramCache(GrGpuGL* gpu); |
| 188 ~ProgramCache(); | 189 ~ProgramCache(); |
| 189 | 190 |
| 190 void abandon(); | 191 void abandon(); |
| 191 GrGLProgram* getProgram(const GrOptDrawState&, DrawType); | 192 GrGLProgram* getProgram(const GrOptDrawState&, const GrProgramDesc&, Dra
wType); |
| 192 | 193 |
| 193 private: | 194 private: |
| 194 enum { | 195 enum { |
| 195 // We may actually have kMaxEntries+1 shaders in the GL context beca
use we create a new | 196 // We may actually have kMaxEntries+1 shaders in the GL context beca
use we create a new |
| 196 // shader before evicting from the cache. | 197 // shader before evicting from the cache. |
| 197 kMaxEntries = 128, | 198 kMaxEntries = 128, |
| 198 kHashBits = 6, | 199 kHashBits = 6, |
| 199 }; | 200 }; |
| 200 | 201 |
| 201 struct Entry; | 202 struct Entry; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 449 |
| 449 // we record what stencil format worked last time to hopefully exit early | 450 // we record what stencil format worked last time to hopefully exit early |
| 450 // from our loop that tries stencil formats and calls check fb status. | 451 // from our loop that tries stencil formats and calls check fb status. |
| 451 int fLastSuccessfulStencilFmtIdx; | 452 int fLastSuccessfulStencilFmtIdx; |
| 452 | 453 |
| 453 typedef GrGpu INHERITED; | 454 typedef GrGpu INHERITED; |
| 454 friend class GrGLPathRendering; // For accessing setTextureUnit. | 455 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 455 }; | 456 }; |
| 456 | 457 |
| 457 #endif | 458 #endif |
| OLD | NEW |