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

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

Issue 947443003: Move clip off of draw target (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: windows warning Created 5 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 GrPipelineBuilder_DEFINED 8 #ifndef GrPipelineBuilder_DEFINED
9 #define GrPipelineBuilder_DEFINED 9 #define GrPipelineBuilder_DEFINED
10 10
11 #include "GrBatch.h" 11 #include "GrBatch.h"
12 #include "GrBlend.h" 12 #include "GrBlend.h"
13 #include "GrClip.h"
13 #include "GrDrawTargetCaps.h" 14 #include "GrDrawTargetCaps.h"
14 #include "GrGpuResourceRef.h" 15 #include "GrGpuResourceRef.h"
15 #include "GrFragmentStage.h" 16 #include "GrFragmentStage.h"
16 #include "GrProcOptInfo.h" 17 #include "GrProcOptInfo.h"
17 #include "GrRenderTarget.h" 18 #include "GrRenderTarget.h"
18 #include "GrStencil.h" 19 #include "GrStencil.h"
19 #include "GrXferProcessor.h" 20 #include "GrXferProcessor.h"
20 #include "SkMatrix.h" 21 #include "SkMatrix.h"
21 #include "effects/GrCoverageSetOpXP.h" 22 #include "effects/GrCoverageSetOpXP.h"
22 #include "effects/GrDisableColorXP.h" 23 #include "effects/GrDisableColorXP.h"
(...skipping 14 matching lines...) Expand all
37 } 38 }
38 39
39 virtual ~GrPipelineBuilder(); 40 virtual ~GrPipelineBuilder();
40 41
41 /** 42 /**
42 * Initializes the GrPipelineBuilder based on a GrPaint, view matrix and ren der target. Note 43 * Initializes the GrPipelineBuilder based on a GrPaint, view matrix and ren der target. Note
43 * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipeli neBuilder that have 44 * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipeli neBuilder that have
44 * no GrPaint equivalents are set to default values with the exception of ve rtex attribute state 45 * no GrPaint equivalents are set to default values with the exception of ve rtex attribute state
45 * which is unmodified by this function and clipping which will be enabled. 46 * which is unmodified by this function and clipping which will be enabled.
46 */ 47 */
47 void setFromPaint(const GrPaint&, GrRenderTarget*); 48 void setFromPaint(const GrPaint&, GrRenderTarget*, const GrClip*);
48 49
49 /// @} 50 /// @}
50 51
51 /** 52 /**
52 * Depending on features available in the underlying 3D API and the color bl end mode requested 53 * Depending on features available in the underlying 3D API and the color bl end mode requested
53 * it may or may not be possible to correctly blend with fractional pixel co verage generated by 54 * it may or may not be possible to correctly blend with fractional pixel co verage generated by
54 * the fragment shader. 55 * the fragment shader.
55 * 56 *
56 * This function considers the current GrPipelineBuilder and the draw target 's capabilities to 57 * This function considers the current GrPipelineBuilder and the draw target 's capabilities to
57 * determine whether coverage can be handled correctly. This function assume s that the caller 58 * determine whether coverage can be handled correctly. This function assume s that the caller
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 /** 299 /**
299 * Perform dithering. TODO: Re-evaluate whether we need this bit 300 * Perform dithering. TODO: Re-evaluate whether we need this bit
300 */ 301 */
301 kDither_StateBit = 0x01, 302 kDither_StateBit = 0x01,
302 /** 303 /**
303 * Perform HW anti-aliasing. This means either HW FSAA, if supported by the render target, 304 * Perform HW anti-aliasing. This means either HW FSAA, if supported by the render target,
304 * or smooth-line rendering if a line primitive is drawn and line smooth ing is supported by 305 * or smooth-line rendering if a line primitive is drawn and line smooth ing is supported by
305 * the 3D API. 306 * the 3D API.
306 */ 307 */
307 kHWAntialias_StateBit = 0x02, 308 kHWAntialias_StateBit = 0x02,
308 /**
309 * Draws will respect the clip, otherwise the clip is ignored.
310 */
311 kClip_StateBit = 0x04,
312 309
313 kLast_StateBit = kClip_StateBit, 310 kLast_StateBit = kHWAntialias_StateBit,
314 }; 311 };
315 312
316 bool isClipState() const { return 0 != (fFlagBits & kClip_StateBit); }
317 bool isDither() const { return 0 != (fFlagBits & kDither_StateBit); } 313 bool isDither() const { return 0 != (fFlagBits & kDither_StateBit); }
318 bool isHWAntialias() const { return 0 != (fFlagBits & kHWAntialias_StateBit) ; } 314 bool isHWAntialias() const { return 0 != (fFlagBits & kHWAntialias_StateBit) ; }
319 315
320 /** 316 /**
321 * Enable render state settings. 317 * Enable render state settings.
322 * 318 *
323 * @param stateBits bitfield of StateBits specifying the states to enable 319 * @param stateBits bitfield of StateBits specifying the states to enable
324 */ 320 */
325 void enableState(uint32_t stateBits) { fFlagBits |= stateBits; } 321 void enableState(uint32_t stateBits) { fFlagBits |= stateBits; }
326 322
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 390
395 const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const { 391 const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const {
396 this->calcColorInvariantOutput(batch); 392 this->calcColorInvariantOutput(batch);
397 return fColorProcInfo; 393 return fColorProcInfo;
398 } 394 }
399 395
400 const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const { 396 const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const {
401 this->calcCoverageInvariantOutput(batch); 397 this->calcCoverageInvariantOutput(batch);
402 return fCoverageProcInfo; 398 return fCoverageProcInfo;
403 } 399 }
400
401 void setClip(const GrClip& clip) { fClip = clip; }
402 const GrClip& clip() const { return fClip; }
403
404 private: 404 private:
405 // Calculating invariant color / coverage information is expensive, so we pa rtially cache the 405 // Calculating invariant color / coverage information is expensive, so we pa rtially cache the
406 // results. 406 // results.
407 // 407 //
408 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result s but only for a 408 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result s but only for a
409 // specific color and coverage. May be calle d multiple times 409 // specific color and coverage. May be calle d multiple times
410 // willBlendWithDst() - only called by Nvpr, does not cache results 410 // willBlendWithDst() - only called by Nvpr, does not cache results
411 // GrOptDrawState constructor - never caches results 411 // GrOptDrawState constructor - never caches results
412 412
413 /** 413 /**
(...skipping 27 matching lines...) Expand all
441 441
442 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; 442 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray;
443 443
444 SkAutoTUnref<GrRenderTarget> fRenderTarget; 444 SkAutoTUnref<GrRenderTarget> fRenderTarget;
445 uint32_t fFlagBits; 445 uint32_t fFlagBits;
446 GrStencilSettings fStencilSettings; 446 GrStencilSettings fStencilSettings;
447 DrawFace fDrawFace; 447 DrawFace fDrawFace;
448 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; 448 mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
449 FragmentStageArray fColorStages; 449 FragmentStageArray fColorStages;
450 FragmentStageArray fCoverageStages; 450 FragmentStageArray fCoverageStages;
451 GrClip fClip;
451 452
452 mutable GrProcOptInfo fColorProcInfo; 453 mutable GrProcOptInfo fColorProcInfo;
453 mutable GrProcOptInfo fCoverageProcInfo; 454 mutable GrProcOptInfo fCoverageProcInfo;
454 mutable bool fColorProcInfoValid; 455 mutable bool fColorProcInfoValid;
455 mutable bool fCoverageProcInfoValid; 456 mutable bool fCoverageProcInfoValid;
456 mutable GrColor fColorCache; 457 mutable GrColor fColorCache;
457 mutable GrColor fCoverageCache; 458 mutable GrColor fCoverageCache;
458 459
459 friend class GrPipeline; 460 friend class GrPipeline;
460 }; 461 };
461 462
462 #endif 463 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698