reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
jvanverth | 39edf76 | 2014-12-22 11:44:19 -0800 | [diff] [blame] | 8 | #ifndef GrGLGpu_DEFINED |
| 9 | #define GrGLGpu_DEFINED |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 10 | |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 11 | #include "GrGLContext.h" |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 12 | #include "GrGLIRect.h" |
commit-bot@chromium.org | a0b4028 | 2013-09-18 13:00:55 +0000 | [diff] [blame] | 13 | #include "GrGLIndexBuffer.h" |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 14 | #include "GrGLPathRendering.h" |
bsalomon@google.com | 5739d2c | 2012-05-31 15:07:19 +0000 | [diff] [blame] | 15 | #include "GrGLProgram.h" |
bsalomon | 37dd331 | 2014-11-03 08:47:23 -0800 | [diff] [blame] | 16 | #include "GrGLRenderTarget.h" |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 17 | #include "GrGLStencilBuffer.h" |
| 18 | #include "GrGLTexture.h" |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 19 | #include "GrGLVertexArray.h" |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 20 | #include "GrGLVertexBuffer.h" |
commit-bot@chromium.org | a0b4028 | 2013-09-18 13:00:55 +0000 | [diff] [blame] | 21 | #include "GrGpu.h" |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 22 | #include "GrPipelineBuilder.h" |
egdaniel | 080e673 | 2014-12-22 07:35:52 -0800 | [diff] [blame] | 23 | #include "GrXferProcessor.h" |
commit-bot@chromium.org | a0b4028 | 2013-09-18 13:00:55 +0000 | [diff] [blame] | 24 | #include "SkTypes.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 25 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 26 | class GrPipeline; |
| 27 | |
commit-bot@chromium.org | 174db77 | 2013-03-21 12:46:01 +0000 | [diff] [blame] | 28 | #ifdef SK_DEVELOPER |
jvanverth@google.com | 9487877 | 2013-03-12 16:00:54 +0000 | [diff] [blame] | 29 | #define PROGRAM_CACHE_STATS |
| 30 | #endif |
| 31 | |
bsalomon | 861e103 | 2014-12-16 07:33:49 -0800 | [diff] [blame] | 32 | class GrGLGpu : public GrGpu { |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 33 | public: |
bsalomon | 861e103 | 2014-12-16 07:33:49 -0800 | [diff] [blame] | 34 | GrGLGpu(const GrGLContext& ctx, GrContext* context); |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 35 | ~GrGLGpu() SK_OVERRIDE; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 36 | |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 37 | void contextAbandoned() SK_OVERRIDE; |
bsalomon | c8dc1f7 | 2014-08-21 13:02:13 -0700 | [diff] [blame] | 38 | |
commit-bot@chromium.org | c9424b8 | 2013-10-30 20:03:16 +0000 | [diff] [blame] | 39 | const GrGLContext& glContext() const { return fGLContext; } |
| 40 | |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 41 | const GrGLInterface* glInterface() const { return fGLContext.interface(); } |
commit-bot@chromium.org | b1854a8 | 2014-01-16 18:39:04 +0000 | [diff] [blame] | 42 | const GrGLContextInfo& ctxInfo() const { return fGLContext; } |
| 43 | GrGLStandard glStandard() const { return fGLContext.standard(); } |
| 44 | GrGLVersion glVersion() const { return fGLContext.version(); } |
| 45 | GrGLSLGeneration glslGeneration() const { return fGLContext.glslGeneration(); } |
| 46 | const GrGLCaps& glCaps() const { return *fGLContext.caps(); } |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 47 | |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 48 | GrGLPathRendering* glPathRendering() { |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 49 | SkASSERT(glCaps().pathRenderingSupport()); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 50 | return static_cast<GrGLPathRendering*>(pathRendering()); |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 51 | } |
| 52 | |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 53 | void discard(GrRenderTarget*) SK_OVERRIDE; |
commit-bot@chromium.org | 28361fa | 2014-03-28 16:08:05 +0000 | [diff] [blame] | 54 | |
commit-bot@chromium.org | 0a6fe71 | 2014-04-23 19:26:26 +0000 | [diff] [blame] | 55 | // Used by GrGLProgram and GrGLPathTexGenProgramEffects to configure OpenGL |
| 56 | // state. |
bsalomon@google.com | 34cccde | 2013-01-04 18:34:30 +0000 | [diff] [blame] | 57 | void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* texture); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 58 | |
bsalomon@google.com | 56d11e0 | 2011-11-30 19:59:08 +0000 | [diff] [blame] | 59 | // GrGpu overrides |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 60 | GrPixelConfig preferredReadPixelsConfig(GrPixelConfig readConfig, |
| 61 | GrPixelConfig surfaceConfig) const SK_OVERRIDE; |
| 62 | GrPixelConfig preferredWritePixelsConfig(GrPixelConfig writeConfig, |
| 63 | GrPixelConfig surfaceConfig) const SK_OVERRIDE; |
| 64 | bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const SK_OVERRIDE; |
| 65 | bool readPixelsWillPayForYFlip(GrRenderTarget* renderTarget, |
| 66 | int left, int top, |
| 67 | int width, int height, |
| 68 | GrPixelConfig config, |
| 69 | size_t rowBytes) const SK_OVERRIDE; |
| 70 | bool fullReadPixelsIsFasterThanPartial() const SK_OVERRIDE; |
bsalomon@google.com | 75f9f25 | 2012-01-31 13:35:56 +0000 | [diff] [blame] | 71 | |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 72 | bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) SK_OVERRIDE; |
bsalomon@google.com | eb85117 | 2013-04-15 13:51:00 +0000 | [diff] [blame] | 73 | |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 74 | // These functions should be used to bind GL objects. They track the GL state and skip redundant |
skia.committer@gmail.com | 754a3eb | 2013-03-08 07:01:25 +0000 | [diff] [blame] | 75 | // bindings. Making the equivalent glBind calls directly will confuse the state tracking. |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 76 | void bindVertexArray(GrGLuint id) { |
| 77 | fHWGeometryState.setVertexArrayID(this, id); |
| 78 | } |
| 79 | void bindIndexBufferAndDefaultVertexArray(GrGLuint id) { |
| 80 | fHWGeometryState.setIndexBufferIDOnDefaultVertexArray(this, id); |
| 81 | } |
| 82 | void bindVertexBuffer(GrGLuint id) { |
| 83 | fHWGeometryState.setVertexBufferID(this, id); |
| 84 | } |
| 85 | |
| 86 | // These callbacks update state tracking when GL objects are deleted. They are called from |
| 87 | // GrGLResource onRelease functions. |
| 88 | void notifyVertexArrayDelete(GrGLuint id) { |
| 89 | fHWGeometryState.notifyVertexArrayDelete(id); |
| 90 | } |
| 91 | void notifyVertexBufferDelete(GrGLuint id) { |
| 92 | fHWGeometryState.notifyVertexBufferDelete(id); |
| 93 | } |
| 94 | void notifyIndexBufferDelete(GrGLuint id) { |
| 95 | fHWGeometryState.notifyIndexBufferDelete(id); |
| 96 | } |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 97 | |
bsalomon | f90a02b | 2014-11-26 12:28:00 -0800 | [diff] [blame] | 98 | bool copySurface(GrSurface* dst, |
| 99 | GrSurface* src, |
| 100 | const SkIRect& srcRect, |
| 101 | const SkIPoint& dstPoint) SK_OVERRIDE; |
joshualitt | a702415 | 2014-11-03 14:16:35 -0800 | [diff] [blame] | 102 | |
bsalomon | f90a02b | 2014-11-26 12:28:00 -0800 | [diff] [blame] | 103 | bool canCopySurface(const GrSurface* dst, |
| 104 | const GrSurface* src, |
| 105 | const SkIRect& srcRect, |
| 106 | const SkIPoint& dstPoint) SK_OVERRIDE; |
joshualitt | a702415 | 2014-11-03 14:16:35 -0800 | [diff] [blame] | 107 | |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 108 | void buildProgramDesc(GrProgramDesc*, |
| 109 | const GrPrimitiveProcessor&, |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 110 | const GrPipeline&, |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 111 | const GrBatchTracker&) const SK_OVERRIDE; |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 112 | |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 113 | private: |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 114 | // GrGpu overrides |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 115 | void onResetContext(uint32_t resetBits) SK_OVERRIDE; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 116 | |
bsalomon | 5236cf4 | 2015-01-14 10:42:08 -0800 | [diff] [blame] | 117 | GrTexture* onCreateTexture(const GrSurfaceDesc& desc, bool budgeted, const void* srcData, |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 118 | size_t rowBytes) SK_OVERRIDE; |
bsalomon | 5236cf4 | 2015-01-14 10:42:08 -0800 | [diff] [blame] | 119 | GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, bool budgeted, |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 120 | const void* srcData) SK_OVERRIDE; |
| 121 | GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) SK_OVERRIDE; |
| 122 | GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) SK_OVERRIDE; |
| 123 | GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) SK_OVERRIDE; |
| 124 | GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) SK_OVERRIDE; |
bsalomon | 02a44a4 | 2015-02-19 09:09:00 -0800 | [diff] [blame] | 125 | bool createStencilBufferForRenderTarget(GrRenderTarget* rt, int width, int height) SK_OVERRIDE; |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 126 | bool attachStencilBufferToRenderTarget(GrStencilBuffer* sb, GrRenderTarget* rt) SK_OVERRIDE; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 127 | |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 128 | void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, |
| 129 | bool canIgnoreRect) SK_OVERRIDE; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 130 | |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 131 | void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideClip) SK_OVERRIDE; |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 132 | |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 133 | bool onReadPixels(GrRenderTarget* target, |
| 134 | int left, int top, |
| 135 | int width, int height, |
| 136 | GrPixelConfig, |
| 137 | void* buffer, |
| 138 | size_t rowBytes) SK_OVERRIDE; |
| 139 | |
| 140 | bool onWriteTexturePixels(GrTexture* texture, |
| 141 | int left, int top, int width, int height, |
| 142 | GrPixelConfig config, const void* buffer, |
senorblanco@chromium.org | 3cb406b | 2013-02-05 19:50:46 +0000 | [diff] [blame] | 143 | size_t rowBytes) SK_OVERRIDE; |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 144 | |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 145 | void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE; |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 146 | |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 147 | void onDraw(const DrawArgs&, const GrDrawTarget::DrawInfo&) SK_OVERRIDE; |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 148 | void onStencilPath(const GrPath*, const StencilPathState&) SK_OVERRIDE; |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 149 | void onDrawPath(const DrawArgs&, const GrPath*, const GrStencilSettings&) SK_OVERRIDE; |
| 150 | void onDrawPaths(const DrawArgs&, |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 151 | const GrPathRange*, |
| 152 | const void* indices, |
| 153 | GrDrawTarget::PathIndexType, |
| 154 | const float transformValues[], |
| 155 | GrDrawTarget::PathTransformType, |
| 156 | int count, |
| 157 | const GrStencilSettings&) SK_OVERRIDE; |
bsalomon@google.com | 75f9f25 | 2012-01-31 13:35:56 +0000 | [diff] [blame] | 158 | |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 159 | void clearStencil(GrRenderTarget*) SK_OVERRIDE; |
bsalomon@google.com | 5739d2c | 2012-05-31 15:07:19 +0000 | [diff] [blame] | 160 | |
robertphillips | 754f4e9 | 2014-09-18 13:52:08 -0700 | [diff] [blame] | 161 | // GrDrawTarget overrides |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 162 | void didAddGpuTraceMarker() SK_OVERRIDE; |
| 163 | void didRemoveGpuTraceMarker() SK_OVERRIDE; |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 164 | |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 165 | // binds texture unit in GL |
bsalomon@google.com | 8531c1c | 2011-01-13 19:52:45 +0000 | [diff] [blame] | 166 | void setTextureUnit(int unitIdx); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 167 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 168 | // Flushes state from GrPipeline to GL. Returns false if the state couldn't be set. |
cdalton | d0a840d | 2015-03-16 17:19:58 -0700 | [diff] [blame] | 169 | bool flushGLState(const DrawArgs&); |
bsalomon | d95263c | 2014-12-16 13:05:12 -0800 | [diff] [blame] | 170 | |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 171 | // Sets up vertex attribute pointers and strides. On return indexOffsetInBytes gives the offset |
| 172 | // an into the index buffer. It does not account for drawInfo.startIndex() but rather the start |
| 173 | // index is relative to the returned offset. |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 174 | void setupGeometry(const GrPrimitiveProcessor&, |
joshualitt | d53a827 | 2014-11-10 16:03:14 -0800 | [diff] [blame] | 175 | const GrDrawTarget::DrawInfo& info, |
| 176 | size_t* indexOffsetInBytes); |
bsalomon@google.com | 7acdb8e | 2011-02-11 14:07:02 +0000 | [diff] [blame] | 177 | |
bsalomon@google.com | 86c1f71 | 2011-10-12 14:54:26 +0000 | [diff] [blame] | 178 | // Subclasses should call this to flush the blend state. |
egdaniel | 080e673 | 2014-12-22 07:35:52 -0800 | [diff] [blame] | 179 | void flushBlend(const GrXferProcessor::BlendInfo& blendInfo); |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 180 | |
commit-bot@chromium.org | b1854a8 | 2014-01-16 18:39:04 +0000 | [diff] [blame] | 181 | bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ext); } |
bsalomon@google.com | 9639994 | 2012-02-13 14:39:16 +0000 | [diff] [blame] | 182 | |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 183 | static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
bsalomon@google.com | 080773c | 2011-03-15 19:09:25 +0000 | [diff] [blame] | 184 | |
commit-bot@chromium.org | a0b4028 | 2013-09-18 13:00:55 +0000 | [diff] [blame] | 185 | class ProgramCache : public ::SkNoncopyable { |
bsalomon@google.com | c1d2a58 | 2012-06-01 15:08:19 +0000 | [diff] [blame] | 186 | public: |
bsalomon | 861e103 | 2014-12-16 07:33:49 -0800 | [diff] [blame] | 187 | ProgramCache(GrGLGpu* gpu); |
jvanverth@google.com | 9487877 | 2013-03-12 16:00:54 +0000 | [diff] [blame] | 188 | ~ProgramCache(); |
bsalomon@google.com | 5739d2c | 2012-05-31 15:07:19 +0000 | [diff] [blame] | 189 | |
bsalomon@google.com | c1d2a58 | 2012-06-01 15:08:19 +0000 | [diff] [blame] | 190 | void abandon(); |
joshualitt | 873ad0e | 2015-01-20 09:08:51 -0800 | [diff] [blame] | 191 | GrGLProgram* getProgram(const DrawArgs&); |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 192 | |
bsalomon@google.com | c1d2a58 | 2012-06-01 15:08:19 +0000 | [diff] [blame] | 193 | private: |
| 194 | enum { |
bsalomon@google.com | 9ba4fa6 | 2012-07-16 17:36:28 +0000 | [diff] [blame] | 195 | // We may actually have kMaxEntries+1 shaders in the GL context because we create a new |
| 196 | // shader before evicting from the cache. |
commit-bot@chromium.org | b556422 | 2014-03-28 15:52:18 +0000 | [diff] [blame] | 197 | kMaxEntries = 128, |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 198 | kHashBits = 6, |
bsalomon@google.com | c1d2a58 | 2012-06-01 15:08:19 +0000 | [diff] [blame] | 199 | }; |
| 200 | |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 201 | struct Entry; |
bsalomon@google.com | c1d2a58 | 2012-06-01 15:08:19 +0000 | [diff] [blame] | 202 | |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 203 | struct ProgDescLess; |
bsalomon@google.com | c1d2a58 | 2012-06-01 15:08:19 +0000 | [diff] [blame] | 204 | |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 205 | // binary search for entry matching desc. returns index into fEntries that matches desc or ~ |
| 206 | // of the index of where it should be inserted. |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 207 | int search(const GrProgramDesc& desc) const; |
bsalomon@google.com | c1d2a58 | 2012-06-01 15:08:19 +0000 | [diff] [blame] | 208 | |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 209 | // sorted array of all the entries |
| 210 | Entry* fEntries[kMaxEntries]; |
| 211 | // hash table based on lowest kHashBits bits of the program key. Used to avoid binary |
| 212 | // searching fEntries. |
| 213 | Entry* fHashTable[1 << kHashBits]; |
bsalomon@google.com | c1d2a58 | 2012-06-01 15:08:19 +0000 | [diff] [blame] | 214 | |
bsalomon@google.com | c1d2a58 | 2012-06-01 15:08:19 +0000 | [diff] [blame] | 215 | int fCount; |
| 216 | unsigned int fCurrLRUStamp; |
bsalomon | 861e103 | 2014-12-16 07:33:49 -0800 | [diff] [blame] | 217 | GrGLGpu* fGpu; |
jvanverth@google.com | 9487877 | 2013-03-12 16:00:54 +0000 | [diff] [blame] | 218 | #ifdef PROGRAM_CACHE_STATS |
| 219 | int fTotalRequests; |
| 220 | int fCacheMisses; |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 221 | int fHashMisses; // cache hit but hash table missed |
jvanverth@google.com | 9487877 | 2013-03-12 16:00:54 +0000 | [diff] [blame] | 222 | #endif |
bsalomon@google.com | c1d2a58 | 2012-06-01 15:08:19 +0000 | [diff] [blame] | 223 | }; |
bsalomon@google.com | 5739d2c | 2012-05-31 15:07:19 +0000 | [diff] [blame] | 224 | |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 225 | void flushDither(bool dither); |
egdaniel | 080e673 | 2014-12-22 07:35:52 -0800 | [diff] [blame] | 226 | void flushColorWrite(bool writeColor); |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 227 | void flushDrawFace(GrPipelineBuilder::DrawFace face); |
bsalomon@google.com | c96cb3a | 2012-06-04 19:31:00 +0000 | [diff] [blame] | 228 | |
bsalomon@google.com | a320194 | 2012-06-21 19:58:20 +0000 | [diff] [blame] | 229 | // flushes the scissor. see the note on flushBoundTextureAndParams about |
| 230 | // flushing the scissor after that function is called. |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 231 | void flushScissor(const GrScissorState&, |
joshualitt | 77b1307 | 2014-10-27 14:51:01 -0700 | [diff] [blame] | 232 | const GrGLIRect& rtViewport, |
| 233 | GrSurfaceOrigin rtOrigin); |
| 234 | |
| 235 | // disables the scissor |
| 236 | void disableScissor(); |
bsalomon@google.com | a320194 | 2012-06-21 19:58:20 +0000 | [diff] [blame] | 237 | |
bsalomon@google.com | 18c9c19 | 2011-09-22 21:01:31 +0000 | [diff] [blame] | 238 | void initFSAASupport(); |
bsalomon@google.com | 6aa25c3 | 2011-04-27 19:55:29 +0000 | [diff] [blame] | 239 | |
bsalomon@google.com | 2c17fcd | 2011-07-06 17:47:02 +0000 | [diff] [blame] | 240 | // determines valid stencil formats |
bsalomon@google.com | 18c9c19 | 2011-09-22 21:01:31 +0000 | [diff] [blame] | 241 | void initStencilFormats(); |
bsalomon@google.com | 2c17fcd | 2011-07-06 17:47:02 +0000 | [diff] [blame] | 242 | |
commit-bot@chromium.org | a15f7e5 | 2013-06-05 23:29:25 +0000 | [diff] [blame] | 243 | // sets a texture unit to use for texture operations other than binding a texture to a program. |
| 244 | // ensures that such operations don't negatively interact with tracking bound textures. |
| 245 | void setScratchTextureUnit(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 246 | |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 247 | // bounds is region that may be modified and therefore has to be resolved. |
| 248 | // NULL means whole target. Can be an empty rect. |
| 249 | void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); |
bsalomon | b0bd4f6 | 2014-09-03 07:19:50 -0700 | [diff] [blame] | 250 | |
bsalomon | 3e79124 | 2014-12-17 13:43:13 -0800 | [diff] [blame] | 251 | void flushStencil(const GrStencilSettings&); |
cdalton | d0a840d | 2015-03-16 17:19:58 -0700 | [diff] [blame] | 252 | void flushHWAAState(GrRenderTarget* rt, bool useHWAA); |
bsalomon@google.com | 0650e81 | 2011-04-08 18:07:53 +0000 | [diff] [blame] | 253 | |
bsalomon@google.com | 280e99f | 2012-01-05 16:17:38 +0000 | [diff] [blame] | 254 | bool configToGLFormats(GrPixelConfig config, |
| 255 | bool getSizedInternal, |
| 256 | GrGLenum* internalFormat, |
| 257 | GrGLenum* externalFormat, |
| 258 | GrGLenum* externalType); |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 259 | // helper for onCreateTexture and writeTexturePixels |
bsalomon | b15b4c1 | 2014-10-29 12:41:57 -0700 | [diff] [blame] | 260 | bool uploadTexData(const GrSurfaceDesc& desc, |
bsalomon@google.com | 1e0e607 | 2011-11-28 18:49:37 +0000 | [diff] [blame] | 261 | bool isNewTexture, |
bsalomon@google.com | 6f37951 | 2011-11-16 20:36:03 +0000 | [diff] [blame] | 262 | int left, int top, int width, int height, |
| 263 | GrPixelConfig dataConfig, |
| 264 | const void* data, |
| 265 | size_t rowBytes); |
bsalomon@google.com | 0650e81 | 2011-04-08 18:07:53 +0000 | [diff] [blame] | 266 | |
krajcevski | 145d48c | 2014-06-11 16:07:50 -0700 | [diff] [blame] | 267 | // helper for onCreateCompressedTexture. If width and height are |
| 268 | // set to -1, then this function will use desc.fWidth and desc.fHeight |
| 269 | // for the size of the data. The isNewTexture flag should be set to true |
| 270 | // whenever a new texture needs to be created. Otherwise, we assume that |
| 271 | // the texture is already in GPU memory and that it's going to be updated |
| 272 | // with new data. |
bsalomon | b15b4c1 | 2014-10-29 12:41:57 -0700 | [diff] [blame] | 273 | bool uploadCompressedTexData(const GrSurfaceDesc& desc, |
krajcevski | 145d48c | 2014-06-11 16:07:50 -0700 | [diff] [blame] | 274 | const void* data, |
| 275 | bool isNewTexture = true, |
| 276 | int left = 0, int top = 0, |
| 277 | int width = -1, int height = -1); |
krajcevski | 9c0e629 | 2014-06-02 07:38:14 -0700 | [diff] [blame] | 278 | |
bsalomon | 5236cf4 | 2015-01-14 10:42:08 -0800 | [diff] [blame] | 279 | bool createRenderTargetObjects(const GrSurfaceDesc&, bool budgeted, GrGLuint texID, |
| 280 | GrGLRenderTarget::IDDesc*); |
bsalomon@google.com | 81c3f8d | 2011-08-03 15:18:33 +0000 | [diff] [blame] | 281 | |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 282 | enum TempFBOTarget { |
| 283 | kSrc_TempFBOTarget, |
| 284 | kDst_TempFBOTarget |
| 285 | }; |
egdaniel | 0f5f967 | 2015-02-03 11:10:51 -0800 | [diff] [blame] | 286 | |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 287 | GrGLuint bindSurfaceAsFBO(GrSurface* surface, GrGLenum fboTarget, GrGLIRect* viewport, |
| 288 | TempFBOTarget tempFBOTarget); |
egdaniel | 0f5f967 | 2015-02-03 11:10:51 -0800 | [diff] [blame] | 289 | |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 290 | void unbindTextureFromFBO(GrGLenum fboTarget); |
robertphillips | 754f4e9 | 2014-09-18 13:52:08 -0700 | [diff] [blame] | 291 | |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 292 | GrGLContext fGLContext; |
bsalomon@google.com | 2c17fcd | 2011-07-06 17:47:02 +0000 | [diff] [blame] | 293 | |
bsalomon@google.com | 5739d2c | 2012-05-31 15:07:19 +0000 | [diff] [blame] | 294 | // GL program-related state |
| 295 | ProgramCache* fProgramCache; |
bsalomon@google.com | 9ba4fa6 | 2012-07-16 17:36:28 +0000 | [diff] [blame] | 296 | SkAutoTUnref<GrGLProgram> fCurrentProgram; |
bsalomon@google.com | 4920939 | 2012-06-05 15:13:46 +0000 | [diff] [blame] | 297 | |
| 298 | /////////////////////////////////////////////////////////////////////////// |
| 299 | ///@name Caching of GL State |
| 300 | ///@{ |
| 301 | int fHWActiveTextureUnitIdx; |
bsalomon@google.com | 5739d2c | 2012-05-31 15:07:19 +0000 | [diff] [blame] | 302 | GrGLuint fHWProgramID; |
bsalomon@google.com | 9120748 | 2013-02-12 21:45:24 +0000 | [diff] [blame] | 303 | |
bsalomon@google.com | 4920939 | 2012-06-05 15:13:46 +0000 | [diff] [blame] | 304 | enum TriState { |
| 305 | kNo_TriState, |
| 306 | kYes_TriState, |
| 307 | kUnknown_TriState |
| 308 | }; |
| 309 | |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 310 | GrGLuint fTempSrcFBOID; |
| 311 | GrGLuint fTempDstFBOID; |
| 312 | |
| 313 | GrGLuint fStencilClearFBOID; |
bsalomon | dd3143b | 2015-02-23 09:27:45 -0800 | [diff] [blame] | 314 | |
bsalomon@google.com | a320194 | 2012-06-21 19:58:20 +0000 | [diff] [blame] | 315 | // last scissor / viewport scissor state seen by the GL. |
| 316 | struct { |
| 317 | TriState fEnabled; |
| 318 | GrGLIRect fRect; |
| 319 | void invalidate() { |
| 320 | fEnabled = kUnknown_TriState; |
| 321 | fRect.invalidate(); |
| 322 | } |
| 323 | } fHWScissorSettings; |
| 324 | |
| 325 | GrGLIRect fHWViewport; |
| 326 | |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 327 | /** |
| 328 | * Tracks bound vertex and index buffers and vertex attrib array state. |
| 329 | */ |
| 330 | class HWGeometryState { |
| 331 | public: |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 332 | HWGeometryState() { fVBOVertexArray = NULL; this->invalidate(); } |
skia.committer@gmail.com | 754a3eb | 2013-03-08 07:01:25 +0000 | [diff] [blame] | 333 | |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 334 | ~HWGeometryState() { SkSafeUnref(fVBOVertexArray); } |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 335 | |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 336 | void invalidate() { |
| 337 | fBoundVertexArrayIDIsValid = false; |
| 338 | fBoundVertexBufferIDIsValid = false; |
| 339 | fDefaultVertexArrayBoundIndexBufferID = false; |
| 340 | fDefaultVertexArrayBoundIndexBufferIDIsValid = false; |
| 341 | fDefaultVertexArrayAttribState.invalidate(); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 342 | if (fVBOVertexArray) { |
commit-bot@chromium.org | ce6da4d | 2013-09-09 14:55:37 +0000 | [diff] [blame] | 343 | fVBOVertexArray->invalidateCachedState(); |
| 344 | } |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 345 | } |
| 346 | |
| 347 | void notifyVertexArrayDelete(GrGLuint id) { |
| 348 | if (fBoundVertexArrayIDIsValid && fBoundVertexArrayID == id) { |
| 349 | // Does implicit bind to 0 |
| 350 | fBoundVertexArrayID = 0; |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 351 | } |
| 352 | } |
| 353 | |
bsalomon | 861e103 | 2014-12-16 07:33:49 -0800 | [diff] [blame] | 354 | void setVertexArrayID(GrGLGpu* gpu, GrGLuint arrayID) { |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 355 | if (!gpu->glCaps().vertexArrayObjectSupport()) { |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 356 | SkASSERT(0 == arrayID); |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 357 | return; |
| 358 | } |
| 359 | if (!fBoundVertexArrayIDIsValid || arrayID != fBoundVertexArrayID) { |
| 360 | GR_GL_CALL(gpu->glInterface(), BindVertexArray(arrayID)); |
| 361 | fBoundVertexArrayIDIsValid = true; |
| 362 | fBoundVertexArrayID = arrayID; |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 363 | } |
| 364 | } |
| 365 | |
bsalomon@google.com | e49ad45 | 2013-02-20 19:33:20 +0000 | [diff] [blame] | 366 | void notifyVertexBufferDelete(GrGLuint id) { |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 367 | if (fBoundVertexBufferIDIsValid && id == fBoundVertexBufferID) { |
| 368 | fBoundVertexBufferID = 0; |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 369 | } |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 370 | if (fVBOVertexArray) { |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 371 | fVBOVertexArray->notifyVertexBufferDelete(id); |
| 372 | } |
| 373 | fDefaultVertexArrayAttribState.notifyVertexBufferDelete(id); |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 374 | } |
| 375 | |
bsalomon@google.com | e49ad45 | 2013-02-20 19:33:20 +0000 | [diff] [blame] | 376 | void notifyIndexBufferDelete(GrGLuint id) { |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 377 | if (fDefaultVertexArrayBoundIndexBufferIDIsValid && |
| 378 | id == fDefaultVertexArrayBoundIndexBufferID) { |
| 379 | fDefaultVertexArrayBoundIndexBufferID = 0; |
| 380 | } |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 381 | if (fVBOVertexArray) { |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 382 | fVBOVertexArray->notifyIndexBufferDelete(id); |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 383 | } |
| 384 | } |
| 385 | |
bsalomon | 861e103 | 2014-12-16 07:33:49 -0800 | [diff] [blame] | 386 | void setVertexBufferID(GrGLGpu* gpu, GrGLuint id) { |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 387 | if (!fBoundVertexBufferIDIsValid || id != fBoundVertexBufferID) { |
| 388 | GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ARRAY_BUFFER, id)); |
| 389 | fBoundVertexBufferIDIsValid = true; |
| 390 | fBoundVertexBufferID = id; |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 391 | } |
| 392 | } |
| 393 | |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 394 | /** |
| 395 | * Binds the default vertex array and binds the index buffer. This is used when binding |
| 396 | * an index buffer in order to update it. |
| 397 | */ |
bsalomon | 861e103 | 2014-12-16 07:33:49 -0800 | [diff] [blame] | 398 | void setIndexBufferIDOnDefaultVertexArray(GrGLGpu* gpu, GrGLuint id) { |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 399 | this->setVertexArrayID(gpu, 0); |
| 400 | if (!fDefaultVertexArrayBoundIndexBufferIDIsValid || |
| 401 | id != fDefaultVertexArrayBoundIndexBufferID) { |
| 402 | GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, id)); |
| 403 | fDefaultVertexArrayBoundIndexBufferIDIsValid = true; |
| 404 | fDefaultVertexArrayBoundIndexBufferID = id; |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | /** |
| 409 | * Binds the vertex array object that should be used to render from the vertex buffer. |
| 410 | * The vertex array is bound and its attrib array state object is returned. The vertex |
| 411 | * buffer is bound. The index buffer (if non-NULL) is bound to the vertex array. The |
skia.committer@gmail.com | 754a3eb | 2013-03-08 07:01:25 +0000 | [diff] [blame] | 412 | * returned GrGLAttribArrayState should be used to set vertex attribute arrays. |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 413 | */ |
bsalomon | 861e103 | 2014-12-16 07:33:49 -0800 | [diff] [blame] | 414 | GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 415 | const GrGLVertexBuffer* vbuffer, |
| 416 | const GrGLIndexBuffer* ibuffer); |
| 417 | |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 418 | private: |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 419 | GrGLuint fBoundVertexArrayID; |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 420 | GrGLuint fBoundVertexBufferID; |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 421 | bool fBoundVertexArrayIDIsValid; |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 422 | bool fBoundVertexBufferIDIsValid; |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 423 | |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 424 | GrGLuint fDefaultVertexArrayBoundIndexBufferID; |
| 425 | bool fDefaultVertexArrayBoundIndexBufferIDIsValid; |
| 426 | // We return a non-const pointer to this from bindArrayAndBuffersToDraw when vertex array 0 |
jvanverth | 39edf76 | 2014-12-22 11:44:19 -0800 | [diff] [blame] | 427 | // is bound. However, this class is internal to GrGLGpu and this object never leaks out of |
| 428 | // GrGLGpu. |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 429 | GrGLAttribArrayState fDefaultVertexArrayAttribState; |
bsalomon@google.com | 880b8fc | 2013-02-19 20:17:28 +0000 | [diff] [blame] | 430 | |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame] | 431 | // This is used when we're using a core profile and the vertices are in a VBO. |
| 432 | GrGLVertexArray* fVBOVertexArray; |
bsalomon@google.com | 4920939 | 2012-06-05 15:13:46 +0000 | [diff] [blame] | 433 | } fHWGeometryState; |
bsalomon@google.com | 5782d71 | 2011-01-21 21:03:59 +0000 | [diff] [blame] | 434 | |
bsalomon@google.com | a4d8fc2 | 2012-05-21 13:21:46 +0000 | [diff] [blame] | 435 | struct { |
| 436 | GrBlendCoeff fSrcCoeff; |
| 437 | GrBlendCoeff fDstCoeff; |
| 438 | GrColor fConstColor; |
| 439 | bool fConstColorValid; |
| 440 | TriState fEnabled; |
| 441 | |
| 442 | void invalidate() { |
bsalomon@google.com | 4705954 | 2012-06-06 20:51:20 +0000 | [diff] [blame] | 443 | fSrcCoeff = kInvalid_GrBlendCoeff; |
| 444 | fDstCoeff = kInvalid_GrBlendCoeff; |
bsalomon@google.com | a4d8fc2 | 2012-05-21 13:21:46 +0000 | [diff] [blame] | 445 | fConstColorValid = false; |
| 446 | fEnabled = kUnknown_TriState; |
| 447 | } |
| 448 | } fHWBlendState; |
| 449 | |
egdaniel | b414f25 | 2014-07-29 13:15:47 -0700 | [diff] [blame] | 450 | TriState fMSAAEnabled; |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 451 | |
bsalomon@google.com | 6a51dcb | 2013-02-13 16:03:51 +0000 | [diff] [blame] | 452 | GrStencilSettings fHWStencilSettings; |
| 453 | TriState fHWStencilTestEnabled; |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 454 | |
bsalomon@google.com | 6a51dcb | 2013-02-13 16:03:51 +0000 | [diff] [blame] | 455 | |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 456 | GrPipelineBuilder::DrawFace fHWDrawFace; |
bsalomon@google.com | 6a51dcb | 2013-02-13 16:03:51 +0000 | [diff] [blame] | 457 | TriState fHWWriteToColor; |
| 458 | TriState fHWDitherEnabled; |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 459 | uint32_t fHWBoundRenderTargetUniqueID; |
bsalomon | 1c63bf6 | 2014-07-22 13:09:46 -0700 | [diff] [blame] | 460 | SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; |
commit-bot@chromium.org | 6b30e45 | 2013-10-04 20:02:53 +0000 | [diff] [blame] | 461 | |
bsalomon@google.com | 4920939 | 2012-06-05 15:13:46 +0000 | [diff] [blame] | 462 | ///@} |
bsalomon@google.com | 978c8c6 | 2012-05-21 14:45:49 +0000 | [diff] [blame] | 463 | |
bsalomon@google.com | fe67652 | 2011-06-17 18:12:21 +0000 | [diff] [blame] | 464 | // we record what stencil format worked last time to hopefully exit early |
| 465 | // from our loop that tries stencil formats and calls check fb status. |
| 466 | int fLastSuccessfulStencilFmtIdx; |
| 467 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 468 | typedef GrGpu INHERITED; |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 469 | friend class GrGLPathRendering; // For accessing setTextureUnit. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 470 | }; |
| 471 | |
bsalomon@google.com | a7f84e1 | 2011-03-10 14:13:19 +0000 | [diff] [blame] | 472 | #endif |