blob: 4985d99a127305a69adc6e2290c42bbdac91bfa9 [file] [log] [blame]
reed@google.comac10a2d2010-12-22 21:39:39 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * 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.comac10a2d2010-12-22 21:39:39 +00006 */
7
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
reed@google.comac10a2d2010-12-22 21:39:39 +000010#ifndef GrGpuGL_DEFINED
11#define GrGpuGL_DEFINED
12
bsalomon@google.comc1d2a582012-06-01 15:08:19 +000013#include "GrBinHashKey.h"
tomhudson@google.comd8f856c2012-05-10 12:13:36 +000014#include "GrDrawState.h"
15#include "GrGpu.h"
bsalomon@google.com89ec61e2012-02-10 20:05:18 +000016#include "GrGLContextInfo.h"
bsalomon@google.com4043ae22011-08-02 14:19:11 +000017#include "GrGLIndexBuffer.h"
bsalomon@google.com81c3f8d2011-08-03 15:18:33 +000018#include "GrGLIRect.h"
bsalomon@google.com5739d2c2012-05-31 15:07:19 +000019#include "GrGLProgram.h"
bsalomon@google.com81c3f8d2011-08-03 15:18:33 +000020#include "GrGLStencilBuffer.h"
21#include "GrGLTexture.h"
22#include "GrGLVertexBuffer.h"
bsalomon@google.comc1d2a582012-06-01 15:08:19 +000023#include "../GrTHashCache.h"
reed@google.comac10a2d2010-12-22 21:39:39 +000024
25class GrGpuGL : public GrGpu {
26public:
bsalomon@google.com5739d2c2012-05-31 15:07:19 +000027 GrGpuGL(const GrGLContextInfo& ctxInfo);
reed@google.comac10a2d2010-12-22 21:39:39 +000028 virtual ~GrGpuGL();
29
rmistry@google.comd6176b02012-08-23 18:14:13 +000030 const GrGLInterface* glInterface() const {
bsalomon@google.com89ec61e2012-02-10 20:05:18 +000031 return fGLContextInfo.interface();
32 }
tomhudson@google.comdd182cb2012-02-10 21:01:00 +000033 GrGLBinding glBinding() const { return fGLContextInfo.binding(); }
34 GrGLVersion glVersion() const { return fGLContextInfo.version(); }
35 GrGLSLGeneration glslGeneration() const {
bsalomon@google.com89ec61e2012-02-10 20:05:18 +000036 return fGLContextInfo.glslGeneration();
37 }
bsalomon@google.com0b77d682011-08-19 13:28:54 +000038
bsalomon@google.com56d11e02011-11-30 19:59:08 +000039 // GrGpu overrides
bsalomon@google.com0a97be22011-11-08 19:20:57 +000040 virtual GrPixelConfig preferredReadPixelsConfig(GrPixelConfig config)
bsalomon@google.com56d11e02011-11-30 19:59:08 +000041 const SK_OVERRIDE;
bsalomon@google.coma85449d2011-11-19 02:36:05 +000042 virtual GrPixelConfig preferredWritePixelsConfig(GrPixelConfig config)
bsalomon@google.com56d11e02011-11-30 19:59:08 +000043 const SK_OVERRIDE;
bsalomon@google.comc4364992011-11-07 15:54:49 +000044 virtual bool readPixelsWillPayForYFlip(
45 GrRenderTarget* renderTarget,
46 int left, int top,
47 int width, int height,
48 GrPixelConfig config,
bsalomon@google.com56d11e02011-11-30 19:59:08 +000049 size_t rowBytes) const SK_OVERRIDE;
50 virtual bool fullReadPixelsIsFasterThanPartial() const SK_OVERRIDE;
bsalomon@google.com75f9f252012-01-31 13:35:56 +000051
bsalomon@google.com5739d2c2012-05-31 15:07:19 +000052 virtual void abandonResources() SK_OVERRIDE;
53
54 bool programUnitTest();
55
bsalomon@google.com49209392012-06-05 15:13:46 +000056
bsalomon@google.com88939ae2011-12-14 15:58:11 +000057protected:
bsalomon@google.com1c13c962011-02-14 16:51:21 +000058 // GrGpu overrides
bsalomon@google.com1bf1c212011-11-05 12:18:58 +000059 virtual void onResetContext() SK_OVERRIDE;
bsalomon@google.coma7f84e12011-03-10 14:13:19 +000060
bsalomon@google.comfea37b52011-04-25 15:51:06 +000061 virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
bsalomon@google.combcdbbe62011-04-12 15:40:00 +000062 const void* srcData,
bsalomon@google.com13f1b6f2012-05-31 12:52:43 +000063 size_t rowBytes) SK_OVERRIDE;
bsalomon@google.combcdbbe62011-04-12 15:40:00 +000064 virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size,
bsalomon@google.com13f1b6f2012-05-31 12:52:43 +000065 bool dynamic) SK_OVERRIDE;
bsalomon@google.combcdbbe62011-04-12 15:40:00 +000066 virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size,
bsalomon@google.com13f1b6f2012-05-31 12:52:43 +000067 bool dynamic) SK_OVERRIDE;
bsalomon@google.com64aef2b2012-06-11 15:36:13 +000068 virtual GrPath* onCreatePath(const SkPath&) SK_OVERRIDE;
bsalomon@google.com16e3dde2012-10-25 18:43:28 +000069 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) SK_OVERRIDE;
70 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) SK_OVERRIDE;
bsalomon@google.com81c3f8d2011-08-03 15:18:33 +000071 virtual bool createStencilBufferForRenderTarget(GrRenderTarget* rt,
bsalomon@google.com13f1b6f2012-05-31 12:52:43 +000072 int width,
73 int height) SK_OVERRIDE;
74 virtual bool attachStencilBufferToRenderTarget(
75 GrStencilBuffer* sb,
76 GrRenderTarget* rt) SK_OVERRIDE;
bsalomon@google.coma7f84e12011-03-10 14:13:19 +000077
bsalomon@google.com13f1b6f2012-05-31 12:52:43 +000078 virtual void onClear(const GrIRect* rect, GrColor color) SK_OVERRIDE;
bsalomon@google.coma7f84e12011-03-10 14:13:19 +000079
bsalomon@google.com13f1b6f2012-05-31 12:52:43 +000080 virtual void onForceRenderTargetFlush() SK_OVERRIDE;
bsalomon@google.coma7f84e12011-03-10 14:13:19 +000081
bsalomon@google.com5877ffd2011-04-11 17:58:48 +000082 virtual bool onReadPixels(GrRenderTarget* target,
rmistry@google.comd6176b02012-08-23 18:14:13 +000083 int left, int top,
bsalomon@google.comc6980972011-11-02 19:57:21 +000084 int width, int height,
rmistry@google.comd6176b02012-08-23 18:14:13 +000085 GrPixelConfig,
bsalomon@google.comc4364992011-11-07 15:54:49 +000086 void* buffer,
87 size_t rowBytes,
88 bool invertY) SK_OVERRIDE;
bsalomon@google.coma7f84e12011-03-10 14:13:19 +000089
bsalomon@google.com6f379512011-11-16 20:36:03 +000090 virtual void onWriteTexturePixels(GrTexture* texture,
91 int left, int top, int width, int height,
92 GrPixelConfig config, const void* buffer,
93 size_t rowBytes) SK_OVERRIDE;
94
bsalomon@google.com75f9f252012-01-31 13:35:56 +000095 virtual void onResolveRenderTarget(GrRenderTarget* target) SK_OVERRIDE;
96
bsalomon@google.com25fb21f2011-06-21 18:17:25 +000097 virtual void onGpuDrawIndexed(GrPrimitiveType type,
98 uint32_t startVertex,
99 uint32_t startIndex,
100 uint32_t vertexCount,
bsalomon@google.com13f1b6f2012-05-31 12:52:43 +0000101 uint32_t indexCount) SK_OVERRIDE;
bsalomon@google.com25fb21f2011-06-21 18:17:25 +0000102 virtual void onGpuDrawNonIndexed(GrPrimitiveType type,
103 uint32_t vertexCount,
bsalomon@google.com13f1b6f2012-05-31 12:52:43 +0000104 uint32_t numVertices) SK_OVERRIDE;
bsalomon@google.comded4f4b2012-06-28 18:48:06 +0000105
106 virtual void setStencilPathSettings(const GrPath&,
107 GrPathFill,
108 GrStencilSettings* settings)
109 SK_OVERRIDE;
110 virtual void onGpuStencilPath(const GrPath*, GrPathFill) SK_OVERRIDE;
robertphillips@google.com730ebe52012-04-16 16:33:13 +0000111
bsalomon@google.com13f1b6f2012-05-31 12:52:43 +0000112 virtual void clearStencil() SK_OVERRIDE;
113 virtual void clearStencilClip(const GrIRect& rect,
114 bool insideClip) SK_OVERRIDE;
bsalomon@google.com64aef2b2012-06-11 15:36:13 +0000115 virtual bool flushGraphicsState(DrawType) SK_OVERRIDE;
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000116 virtual void setupGeometry(int* startVertex,
117 int* startIndex,
118 int vertexCount,
119 int indexCount) SK_OVERRIDE;
120
bsalomon@google.com49209392012-06-05 15:13:46 +0000121private:
122
123 const GrGLCaps& glCaps() const { return fGLContextInfo.caps(); }
bsalomon@google.com5782d712011-01-21 21:03:59 +0000124
bsalomon@google.com1c13c962011-02-14 16:51:21 +0000125 // binds texture unit in GL
bsalomon@google.com8531c1c2011-01-13 19:52:45 +0000126 void setTextureUnit(int unitIdx);
reed@google.comac10a2d2010-12-22 21:39:39 +0000127
bsalomon@google.com1c13c962011-02-14 16:51:21 +0000128 // binds appropriate vertex and index buffers, also returns any extra
129 // extra verts or indices to offset by.
130 void setBuffers(bool indexed,
131 int* extraVertexOffset,
132 int* extraIndexOffset);
bsalomon@google.com7acdb8e2011-02-11 14:07:02 +0000133
bsalomon@google.com86c1f712011-10-12 14:54:26 +0000134 // Subclasses should call this to flush the blend state.
135 // The params should be the final coeffecients to apply
136 // (after any blending optimizations or dual source blending considerations
137 // have been accounted for).
bsalomon@google.com64aef2b2012-06-11 15:36:13 +0000138 void flushBlend(bool isLines,
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000139 GrBlendCoeff srcCoeff,
140 GrBlendCoeff dstCoeff);
141
bsalomon@google.com89ec61e2012-02-10 20:05:18 +0000142 bool hasExtension(const char* ext) const {
143 return fGLContextInfo.hasExtension(ext);
bsalomon@google.com96399942012-02-13 14:39:16 +0000144 }
145
146 const GrGLContextInfo& glContextInfo() const { return fGLContextInfo; }
bsalomon@google.com2c17fcd2011-07-06 17:47:02 +0000147
bsalomon@google.com99621082011-11-15 16:47:16 +0000148 // adjusts texture matrix to account for orientation
bsalomon@google.comc6cf7232011-02-17 16:43:10 +0000149 static void AdjustTextureMatrix(const GrGLTexture* texture,
bsalomon@google.comc6cf7232011-02-17 16:43:10 +0000150 GrMatrix* matrix);
bsalomon@google.com88939ae2011-12-14 15:58:11 +0000151
bsalomon@google.com288d9542012-10-17 12:53:54 +0000152 // This helper determines if what optimizations can be applied to the matrix after any coord
153 // adjustments are applied. The return is a bitfield of GrGLProgram::StageDesc::OptFlags.
bsalomon@google.com08283af2012-10-26 13:01:20 +0000154 static int TextureMatrixOptFlags(const GrGLTexture* texture, const GrEffectStage& sampler);
bsalomon@google.com88939ae2011-12-14 15:58:11 +0000155
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000156 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff);
bsalomon@google.com080773c2011-03-15 19:09:25 +0000157
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000158 // for readability of function impls
bsalomon@google.com9ba4fa62012-07-16 17:36:28 +0000159 typedef GrGLProgram::Desc ProgramDesc;
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000160 typedef ProgramDesc::StageDesc StageDesc;
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000161
bsalomon@google.comc1d2a582012-06-01 15:08:19 +0000162 class ProgramCache : public ::GrNoncopyable {
163 public:
164 ProgramCache(const GrGLContextInfo& gl);
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000165
bsalomon@google.comc1d2a582012-06-01 15:08:19 +0000166 void abandon();
bsalomon@google.coma469c282012-10-24 18:28:34 +0000167 GrGLProgram* getProgram(const GrGLProgram::Desc& desc, const GrEffect** stages);
bsalomon@google.comc1d2a582012-06-01 15:08:19 +0000168 private:
169 enum {
bsalomon@google.com9ba4fa62012-07-16 17:36:28 +0000170 kKeySize = sizeof(ProgramDesc),
171 // We may actually have kMaxEntries+1 shaders in the GL context because we create a new
172 // shader before evicting from the cache.
bsalomon@google.comc1d2a582012-06-01 15:08:19 +0000173 kMaxEntries = 32
174 };
175
176 class Entry;
bsalomon@google.com9ba4fa62012-07-16 17:36:28 +0000177 // The value of the hash key is based on the ProgramDesc.
178 typedef GrTBinHashKey<Entry, kKeySize> ProgramHashKey;
bsalomon@google.comc1d2a582012-06-01 15:08:19 +0000179
180 class Entry : public ::GrNoncopyable {
181 public:
bsalomon@google.com9ba4fa62012-07-16 17:36:28 +0000182 Entry() : fProgram(NULL), fLRUStamp(0) {}
183 Entry& operator = (const Entry& entry) {
184 GrSafeRef(entry.fProgram.get());
185 fProgram.reset(entry.fProgram.get());
186 fKey = entry.fKey;
187 fLRUStamp = entry.fLRUStamp;
188 return *this;
189 }
bsalomon@google.comc1d2a582012-06-01 15:08:19 +0000190 int compare(const ProgramHashKey& key) const {
191 return fKey.compare(key);
192 }
193
194 public:
bsalomon@google.com9ba4fa62012-07-16 17:36:28 +0000195 SkAutoTUnref<GrGLProgram> fProgram;
196 ProgramHashKey fKey;
197 unsigned int fLRUStamp; // Move outside entry?
bsalomon@google.comc1d2a582012-06-01 15:08:19 +0000198 };
199
200 GrTHashTable<Entry, ProgramHashKey, 8> fHashCache;
201
202 Entry fEntries[kMaxEntries];
203 int fCount;
204 unsigned int fCurrLRUStamp;
205 const GrGLContextInfo& fGL;
206 };
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000207
bsalomon@google.com4c883782012-06-04 19:05:11 +0000208 // binds the texture and sets its texture params
bsalomon@google.coma3201942012-06-21 19:58:20 +0000209 // This may also perform a downsample on the src texture which may or may
210 // not modify the scissor test and rect. So in flushGraphicsState a
211 // call to flushScissor must occur after all textures have been flushed via
212 // this function.
bsalomon@google.com4c883782012-06-04 19:05:11 +0000213 void flushBoundTextureAndParams(int stage);
bsalomon@google.comb8670992012-07-25 21:27:09 +0000214 void flushBoundTextureAndParams(int stage,
215 const GrTextureParams& params,
216 GrGLTexture* nextTexture);
bsalomon@google.com4c883782012-06-04 19:05:11 +0000217
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000218 // sets the texture matrix for the currently bound program
bsalomon@google.com08283af2012-10-26 13:01:20 +0000219 void flushTextureMatrix(int stageIdx);
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000220
221 // sets the color specified by GrDrawState::setColor()
222 void flushColor(GrColor color);
223
224 // sets the color specified by GrDrawState::setCoverage()
225 void flushCoverage(GrColor color);
226
227 // sets the MVP matrix uniform for currently bound program
bsalomon@google.comded4f4b2012-06-28 18:48:06 +0000228 void flushViewMatrix(DrawType type);
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000229
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000230
bsalomon@google.comc96cb3a2012-06-04 19:31:00 +0000231 // flushes dithering, color-mask, and face culling stat
232 void flushMiscFixedFunctionState();
233
bsalomon@google.coma3201942012-06-21 19:58:20 +0000234 // flushes the scissor. see the note on flushBoundTextureAndParams about
235 // flushing the scissor after that function is called.
236 void flushScissor();
237
bsalomon@google.com64aef2b2012-06-11 15:36:13 +0000238 void buildProgram(bool isPoints,
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000239 BlendOptFlags blendOpts,
240 GrBlendCoeff dstCoeff,
bsalomon@google.comf271cc72012-10-24 19:35:13 +0000241 const GrEffect** effects,
bsalomon@google.com9ba4fa62012-07-16 17:36:28 +0000242 ProgramDesc* desc);
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000243
bsalomon@google.com67e78c92012-10-17 13:36:14 +0000244 // Inits GrDrawTarget::Caps, subclass may enable additional caps.
bsalomon@google.com18c9c192011-09-22 21:01:31 +0000245 void initCaps();
246
247 void initFSAASupport();
bsalomon@google.com6aa25c32011-04-27 19:55:29 +0000248
bsalomon@google.com2c17fcd2011-07-06 17:47:02 +0000249 // determines valid stencil formats
bsalomon@google.com18c9c192011-09-22 21:01:31 +0000250 void initStencilFormats();
bsalomon@google.com2c17fcd2011-07-06 17:47:02 +0000251
reed@google.comac10a2d2010-12-22 21:39:39 +0000252 // notify callbacks to update state tracking when related
253 // objects are bound to GL or deleted outside of the class
254 void notifyVertexBufferBind(const GrGLVertexBuffer* buffer);
255 void notifyVertexBufferDelete(const GrGLVertexBuffer* buffer);
256 void notifyIndexBufferBind(const GrGLIndexBuffer* buffer);
257 void notifyIndexBufferDelete(const GrGLIndexBuffer* buffer);
reed@google.comac10a2d2010-12-22 21:39:39 +0000258 void notifyTextureDelete(GrGLTexture* texture);
259 void notifyRenderTargetDelete(GrRenderTarget* renderTarget);
bsalomon@google.com5782d712011-01-21 21:03:59 +0000260
bsalomon@google.com8531c1c2011-01-13 19:52:45 +0000261 void setSpareTextureUnit();
reed@google.comac10a2d2010-12-22 21:39:39 +0000262
bsalomon@google.com8295dc12011-05-02 12:53:34 +0000263 // bound is region that may be modified and therefore has to be resolved.
264 // NULL means whole target. Can be an empty rect.
265 void flushRenderTarget(const GrIRect* bound);
bsalomon@google.comded4f4b2012-06-28 18:48:06 +0000266 void flushStencil(DrawType);
267 void flushAAState(DrawType);
bsalomon@google.com0650e812011-04-08 18:07:53 +0000268
bsalomon@google.com280e99f2012-01-05 16:17:38 +0000269 bool configToGLFormats(GrPixelConfig config,
270 bool getSizedInternal,
271 GrGLenum* internalFormat,
272 GrGLenum* externalFormat,
273 GrGLenum* externalType);
bsalomon@google.com6f379512011-11-16 20:36:03 +0000274 // helper for onCreateTexture and writeTexturePixels
bsalomon@google.com136f55b2011-11-28 18:34:44 +0000275 bool uploadTexData(const GrGLTexture::Desc& desc,
bsalomon@google.com1e0e6072011-11-28 18:49:37 +0000276 bool isNewTexture,
bsalomon@google.com6f379512011-11-16 20:36:03 +0000277 int left, int top, int width, int height,
278 GrPixelConfig dataConfig,
279 const void* data,
280 size_t rowBytes);
bsalomon@google.com0650e812011-04-08 18:07:53 +0000281
bsalomon@google.com81c3f8d2011-08-03 15:18:33 +0000282 bool createRenderTargetObjects(int width, int height,
283 GrGLuint texID,
284 GrGLRenderTarget::Desc* desc);
285
robertphillips@google.com99a5ac02012-04-10 19:26:38 +0000286 void fillInConfigRenderableTable();
287
reed@google.comac10a2d2010-12-22 21:39:39 +0000288 friend class GrGLVertexBuffer;
289 friend class GrGLIndexBuffer;
290 friend class GrGLTexture;
291 friend class GrGLRenderTarget;
292
bsalomon@google.com89ec61e2012-02-10 20:05:18 +0000293 GrGLContextInfo fGLContextInfo;
bsalomon@google.com2c17fcd2011-07-06 17:47:02 +0000294
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000295 // GL program-related state
296 ProgramCache* fProgramCache;
bsalomon@google.com9ba4fa62012-07-16 17:36:28 +0000297 SkAutoTUnref<GrGLProgram> fCurrentProgram;
bsalomon@google.com49209392012-06-05 15:13:46 +0000298
299 ///////////////////////////////////////////////////////////////////////////
300 ///@name Caching of GL State
301 ///@{
302 int fHWActiveTextureUnitIdx;
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000303 GrGLuint fHWProgramID;
304 GrColor fHWConstAttribColor;
305 GrColor fHWConstAttribCoverage;
bsalomon@google.com5739d2c2012-05-31 15:07:19 +0000306
bsalomon@google.com49209392012-06-05 15:13:46 +0000307 enum TriState {
308 kNo_TriState,
309 kYes_TriState,
310 kUnknown_TriState
311 };
312
bsalomon@google.coma3201942012-06-21 19:58:20 +0000313 // last scissor / viewport scissor state seen by the GL.
314 struct {
315 TriState fEnabled;
316 GrGLIRect fRect;
317 void invalidate() {
318 fEnabled = kUnknown_TriState;
319 fRect.invalidate();
320 }
321 } fHWScissorSettings;
322
323 GrGLIRect fHWViewport;
324
bsalomon@google.com49209392012-06-05 15:13:46 +0000325 struct {
326 size_t fVertexOffset;
327 GrVertexLayout fVertexLayout;
328 const GrVertexBuffer* fVertexBuffer;
329 const GrIndexBuffer* fIndexBuffer;
330 bool fArrayPtrsDirty;
331 } fHWGeometryState;
bsalomon@google.com5782d712011-01-21 21:03:59 +0000332
bsalomon@google.coma4d8fc22012-05-21 13:21:46 +0000333 struct {
334 GrBlendCoeff fSrcCoeff;
335 GrBlendCoeff fDstCoeff;
336 GrColor fConstColor;
337 bool fConstColorValid;
338 TriState fEnabled;
339
340 void invalidate() {
bsalomon@google.com47059542012-06-06 20:51:20 +0000341 fSrcCoeff = kInvalid_GrBlendCoeff;
342 fDstCoeff = kInvalid_GrBlendCoeff;
bsalomon@google.coma4d8fc22012-05-21 13:21:46 +0000343 fConstColorValid = false;
344 fEnabled = kUnknown_TriState;
345 }
346 } fHWBlendState;
347
bsalomon@google.com4d5f3fe2012-05-21 17:11:44 +0000348 struct {
349 TriState fMSAAEnabled;
350 TriState fSmoothLineEnabled;
351 void invalidate() {
352 fMSAAEnabled = kUnknown_TriState;
353 fSmoothLineEnabled = kUnknown_TriState;
354 }
355 } fHWAAState;
356
bsalomon@google.comded4f4b2012-06-28 18:48:06 +0000357 struct {
358 GrMatrix fViewMatrix;
359 SkISize fRTSize;
360 void invalidate() {
361 fViewMatrix = GrMatrix::InvalidMatrix();
362 fRTSize.fWidth = -1; // just make the first value compared illegal.
363 }
364 } fHWPathMatrixState;
365
bsalomon@google.coma3201942012-06-21 19:58:20 +0000366 GrStencilSettings fHWStencilSettings;
367 TriState fHWStencilTestEnabled;
bsalomon@google.com457b8a32012-05-21 21:19:58 +0000368
bsalomon@google.comc811ea32012-05-21 15:33:09 +0000369 GrDrawState::DrawFace fHWDrawFace;
370 TriState fHWWriteToColor;
371 TriState fHWDitherEnabled;
372 GrRenderTarget* fHWBoundRenderTarget;
373 GrTexture* fHWBoundTextures[GrDrawState::kNumStages];
bsalomon@google.com49209392012-06-05 15:13:46 +0000374 ///@}
bsalomon@google.com978c8c62012-05-21 14:45:49 +0000375
bsalomon@google.comfe676522011-06-17 18:12:21 +0000376 // we record what stencil format worked last time to hopefully exit early
377 // from our loop that tries stencil formats and calls check fb status.
378 int fLastSuccessfulStencilFmtIdx;
379
bsalomon@google.com18c9c192011-09-22 21:01:31 +0000380 bool fPrintedCaps;
381
reed@google.comac10a2d2010-12-22 21:39:39 +0000382 typedef GrGpu INHERITED;
383};
384
bsalomon@google.coma7f84e12011-03-10 14:13:19 +0000385#endif
bsalomon@google.comfe676522011-06-17 18:12:21 +0000386