Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Side by Side Diff: src/gpu/GrRODrawState.h

Issue 542723004: Make GrDrawState and GrEffectStage use the pending io/exec ref mechanisms. (Closed) Base URL: https://skia.googlesource.com/skia.git@complete
Patch Set: rebase again Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | src/gpu/GrRODrawState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 GrRODrawState_DEFINED 8 #ifndef GrRODrawState_DEFINED
9 #define GrRODrawState_DEFINED 9 #define GrRODrawState_DEFINED
10 10
11 #include "GrEffectStage.h"
12 #include "GrRenderTarget.h"
11 #include "GrStencil.h" 13 #include "GrStencil.h"
12 #include "GrEffectStage.h"
13 #include "SkMatrix.h" 14 #include "SkMatrix.h"
14 15
15 class GrDrawTargetCaps; 16 class GrDrawTargetCaps;
16 class GrPaint; 17 class GrPaint;
17 class GrRenderTarget;
18 class GrTexture; 18 class GrTexture;
19 19
20 /** 20 /**
21 * Read-only base class for GrDrawState. This class contains all the necessary d ata to represent a 21 * Read-only base class for GrDrawState. This class contains all the necessary d ata to represent a
22 * canonical DrawState. All methods in the class are const, thus once created th e data in the class 22 * canonical DrawState. All methods in the class are const, thus once created th e data in the class
23 * cannot be changed. 23 * cannot be changed.
24 */ 24 */
25 class GrRODrawState : public SkRefCnt { 25 class GrRODrawState : public SkRefCnt {
26 public: 26 public:
27 SK_DECLARE_INST_COUNT(GrRODrawState) 27 SK_DECLARE_INST_COUNT(GrRODrawState)
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 /////////////////////////////////////////////////////////////////////////// 237 ///////////////////////////////////////////////////////////////////////////
238 /// @name Render Target 238 /// @name Render Target
239 //// 239 ////
240 240
241 /** 241 /**
242 * Retrieves the currently set render-target. 242 * Retrieves the currently set render-target.
243 * 243 *
244 * @return The currently set render target. 244 * @return The currently set render target.
245 */ 245 */
246 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } 246 GrRenderTarget* getRenderTarget() const {
247 return static_cast<GrRenderTarget*>(fRenderTarget.getResource());
248 }
247 249
248 /// @} 250 /// @}
249 251
250 /////////////////////////////////////////////////////////////////////////// 252 ///////////////////////////////////////////////////////////////////////////
251 /// @name Stencil 253 /// @name Stencil
252 //// 254 ////
253 255
254 const GrStencilSettings& getStencil() const { return fStencilSettings; } 256 const GrStencilSettings& getStencil() const { return fStencilSettings; }
255 257
256 /// @} 258 /// @}
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 kIncompatible_CombinedState, 340 kIncompatible_CombinedState,
339 /** Either draw state can be used in place of the other. */ 341 /** Either draw state can be used in place of the other. */
340 kAOrB_CombinedState, 342 kAOrB_CombinedState,
341 /** Use the first draw state. */ 343 /** Use the first draw state. */
342 kA_CombinedState, 344 kA_CombinedState,
343 /** Use the second draw state. */ 345 /** Use the second draw state. */
344 kB_CombinedState, 346 kB_CombinedState,
345 }; 347 };
346 348
347 protected: 349 protected:
350 /**
351 * Converts refs on GrGpuResources owned directly or indirectly by this GrRO DrawState into
352 * pending reads and writes. This should be called when a GrDrawState is rec orded into
353 * a GrDrawTarget for later execution. Subclasses of GrRODrawState may add s etters. However,
354 * once this call has been made the GrRODrawState is immutable. It is also n o longer copyable.
355 * In the future this conversion will automatically happen when converting a GrDrawState into
356 * an optimized draw state.
357 */
358 void convertToPendingExec();
359
360 friend class GrDrawTarget;
361
362 protected:
348 bool isEqual(const GrRODrawState& that) const; 363 bool isEqual(const GrRODrawState& that) const;
349 364
350 // These fields are roughly sorted by decreasing likelihood of being differe nt in op== 365 // These fields are roughly sorted by decreasing likelihood of being differe nt in op==
351 SkAutoTUnref<GrRenderTarget> fRenderTarget; 366 GrProgramResource fRenderTarget;
352 GrColor fColor; 367 GrColor fColor;
353 SkMatrix fViewMatrix; 368 SkMatrix fViewMatrix;
354 GrColor fBlendConstant; 369 GrColor fBlendConstant;
355 uint32_t fFlagBits; 370 uint32_t fFlagBits;
356 const GrVertexAttrib* fVAPtr; 371 const GrVertexAttrib* fVAPtr;
357 int fVACount; 372 int fVACount;
358 size_t fVAStride; 373 size_t fVAStride;
359 GrStencilSettings fStencilSettings; 374 GrStencilSettings fStencilSettings;
360 uint8_t fCoverage; 375 uint8_t fCoverage;
361 DrawFace fDrawFace; 376 DrawFace fDrawFace;
(...skipping 13 matching lines...) Expand all
375 // not need to be compared in op==. 390 // not need to be compared in op==.
376 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt ]; 391 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt ];
377 392
378 private: 393 private:
379 typedef SkRefCnt INHERITED; 394 typedef SkRefCnt INHERITED;
380 }; 395 };
381 396
382 GR_MAKE_BITFIELD_OPS(GrRODrawState::BlendOptFlags); 397 GR_MAKE_BITFIELD_OPS(GrRODrawState::BlendOptFlags);
383 398
384 #endif 399 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | src/gpu/GrRODrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698