| 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 |
| 11 #include "GrDrawState.h" | 11 #include "GrDrawState.h" |
| 12 #include "GrGLContext.h" | 12 #include "GrGLContext.h" |
| 13 #include "GrGLIRect.h" | 13 #include "GrGLIRect.h" |
| 14 #include "GrGLIndexBuffer.h" | 14 #include "GrGLIndexBuffer.h" |
| 15 #include "GrGLProgram.h" | 15 #include "GrGLProgram.h" |
| 16 #include "GrGLStencilBuffer.h" | 16 #include "GrGLStencilBuffer.h" |
| 17 #include "GrGLTexture.h" | 17 #include "GrGLTexture.h" |
| 18 #include "GrGLVertexArray.h" | 18 #include "GrGLVertexArray.h" |
| 19 #include "GrGLVertexBuffer.h" | 19 #include "GrGLVertexBuffer.h" |
| 20 #include "GrGpu.h" | 20 #include "GrGpu.h" |
| 21 #include "SkTypes.h" | 21 #include "SkTypes.h" |
| 22 | 22 |
| 23 #ifdef SK_DEVELOPER | 23 #ifdef SK_DEVELOPER |
| 24 #define PROGRAM_CACHE_STATS | 24 #define PROGRAM_CACHE_STATS |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 class GrGLNameAllocator; | 27 class GrGLPathRendering; |
| 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; } | 37 const GrGLContextInfo& ctxInfo() const { return fGLContext; } |
| 38 GrGLStandard glStandard() const { return fGLContext.standard(); } | 38 GrGLStandard glStandard() const { return fGLContext.standard(); } |
| 39 GrGLVersion glVersion() const { return fGLContext.version(); } | 39 GrGLVersion glVersion() const { return fGLContext.version(); } |
| 40 GrGLSLGeneration glslGeneration() const { return fGLContext.glslGeneration()
; } | 40 GrGLSLGeneration glslGeneration() const { return fGLContext.glslGeneration()
; } |
| 41 const GrGLCaps& glCaps() const { return *fGLContext.caps(); } | 41 const GrGLCaps& glCaps() const { return *fGLContext.caps(); } |
| 42 | 42 |
| 43 GrGLPathRendering* pathRendering() const { |
| 44 SkASSERT(glCaps().pathRenderingSupport()); |
| 45 return fPathRendering.get(); |
| 46 } |
| 47 |
| 43 virtual void discard(GrRenderTarget*) SK_OVERRIDE; | 48 virtual void discard(GrRenderTarget*) SK_OVERRIDE; |
| 44 | 49 |
| 45 // Used by GrGLProgram and GrGLPathTexGenProgramEffects to configure OpenGL | 50 // Used by GrGLProgram and GrGLPathTexGenProgramEffects to configure OpenGL |
| 46 // state. | 51 // state. |
| 47 void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* te
xture); | 52 void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* te
xture); |
| 48 void setProjectionMatrix(const SkMatrix& matrix, | 53 void setProjectionMatrix(const SkMatrix& matrix, |
| 49 const SkISize& renderTargetSize, | 54 const SkISize& renderTargetSize, |
| 50 GrSurfaceOrigin renderTargetOrigin); | 55 GrSurfaceOrigin renderTargetOrigin); |
| 51 enum PathTexGenComponents { | 56 enum PathTexGenComponents { |
| 52 kS_PathTexGenComponents = 1, | 57 kS_PathTexGenComponents = 1, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void notifyVertexArrayDelete(GrGLuint id) { | 102 void notifyVertexArrayDelete(GrGLuint id) { |
| 98 fHWGeometryState.notifyVertexArrayDelete(id); | 103 fHWGeometryState.notifyVertexArrayDelete(id); |
| 99 } | 104 } |
| 100 void notifyVertexBufferDelete(GrGLuint id) { | 105 void notifyVertexBufferDelete(GrGLuint id) { |
| 101 fHWGeometryState.notifyVertexBufferDelete(id); | 106 fHWGeometryState.notifyVertexBufferDelete(id); |
| 102 } | 107 } |
| 103 void notifyIndexBufferDelete(GrGLuint id) { | 108 void notifyIndexBufferDelete(GrGLuint id) { |
| 104 fHWGeometryState.notifyIndexBufferDelete(id); | 109 fHWGeometryState.notifyIndexBufferDelete(id); |
| 105 } | 110 } |
| 106 | 111 |
| 107 // These functions should be used to generate and delete GL path names. They
have their own | |
| 108 // allocator that runs on the client side, so they are much faster than goin
g through GenPaths. | |
| 109 GrGLuint createGLPathObject(); | |
| 110 void deleteGLPathObject(GrGLuint); | |
| 111 | |
| 112 protected: | 112 protected: |
| 113 virtual bool onCopySurface(GrSurface* dst, | 113 virtual bool onCopySurface(GrSurface* dst, |
| 114 GrSurface* src, | 114 GrSurface* src, |
| 115 const SkIRect& srcRect, | 115 const SkIRect& srcRect, |
| 116 const SkIPoint& dstPoint) SK_OVERRIDE; | 116 const SkIPoint& dstPoint) SK_OVERRIDE; |
| 117 | 117 |
| 118 virtual bool onCanCopySurface(GrSurface* dst, | 118 virtual bool onCanCopySurface(GrSurface* dst, |
| 119 GrSurface* src, | 119 GrSurface* src, |
| 120 const SkIRect& srcRect, | 120 const SkIRect& srcRect, |
| 121 const SkIPoint& dstPoint) SK_OVERRIDE; | 121 const SkIPoint& dstPoint) SK_OVERRIDE; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 GrGLfloat fCoefficients[3 * 3]; | 463 GrGLfloat fCoefficients[3 * 3]; |
| 464 }; | 464 }; |
| 465 int fHWActivePathTexGenSets; | 465 int fHWActivePathTexGenSets; |
| 466 SkTArray<PathTexGenData, true> fHWPathTexGenSettings; | 466 SkTArray<PathTexGenData, true> fHWPathTexGenSettings; |
| 467 ///@} | 467 ///@} |
| 468 | 468 |
| 469 // we record what stencil format worked last time to hopefully exit early | 469 // we record what stencil format worked last time to hopefully exit early |
| 470 // from our loop that tries stencil formats and calls check fb status. | 470 // from our loop that tries stencil formats and calls check fb status. |
| 471 int fLastSuccessfulStencilFmtIdx; | 471 int fLastSuccessfulStencilFmtIdx; |
| 472 | 472 |
| 473 SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator; | 473 SkAutoTDelete<GrGLPathRendering> fPathRendering; |
| 474 | 474 |
| 475 typedef GrGpu INHERITED; | 475 typedef GrGpu INHERITED; |
| 476 }; | 476 }; |
| 477 | 477 |
| 478 #endif | 478 #endif |
| OLD | NEW |