| OLD | NEW |
| 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 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 /// @} | 268 /// @} |
| 269 | 269 |
| 270 /////////////////////////////////////////////////////////////////////////// | 270 /////////////////////////////////////////////////////////////////////////// |
| 271 /// @name State Flags | 271 /// @name State Flags |
| 272 //// | 272 //// |
| 273 | 273 |
| 274 /** | 274 /** |
| 275 * Flags that affect rendering. Controlled using enable/disableState(). All | 275 * Flags that affect rendering. Controlled using enable/disableState(). All |
| 276 * default to disabled. | 276 * default to disabled. |
| 277 */ | 277 */ |
| 278 enum StateBits { | 278 enum Flags { |
| 279 /** | 279 /** |
| 280 * Perform dithering. TODO: Re-evaluate whether we need this bit | 280 * Perform dithering. TODO: Re-evaluate whether we need this bit |
| 281 */ | 281 */ |
| 282 kDither_StateBit = 0x01, | 282 kDither_Flag = 0x01, |
| 283 /** | 283 /** |
| 284 * Perform HW anti-aliasing. This means either HW FSAA, if supported by
the render target, | 284 * Perform HW anti-aliasing. This means either HW FSAA, if supported by
the render target, |
| 285 * or smooth-line rendering if a line primitive is drawn and line smooth
ing is supported by | 285 * or smooth-line rendering if a line primitive is drawn and line smooth
ing is supported by |
| 286 * the 3D API. | 286 * the 3D API. |
| 287 */ | 287 */ |
| 288 kHWAntialias_StateBit = 0x02, | 288 kHWAntialias_Flag = 0x02, |
| 289 | 289 |
| 290 kLast_StateBit = kHWAntialias_StateBit, | 290 /** |
| 291 * Modifies the vertex shader so that vertices will be positioned at pix
el centers. |
| 292 */ |
| 293 kSnapVerticesToPixelCenters_Flag = 0x04, |
| 294 |
| 295 kLast_Flag = kSnapVerticesToPixelCenters_Flag, |
| 291 }; | 296 }; |
| 292 | 297 |
| 293 bool isDither() const { return 0 != (fFlagBits & kDither_StateBit); } | 298 bool isDither() const { return SkToBool(fFlags & kDither_Flag); } |
| 294 bool isHWAntialias() const { return 0 != (fFlagBits & kHWAntialias_StateBit)
; } | 299 bool isHWAntialias() const { return SkToBool(fFlags & kHWAntialias_Flag); } |
| 300 bool snapVerticesToPixelCenters() const { |
| 301 return SkToBool(fFlags & kSnapVerticesToPixelCenters_Flag); } |
| 295 | 302 |
| 296 /** | 303 /** |
| 297 * Enable render state settings. | 304 * Enable render state settings. |
| 298 * | 305 * |
| 299 * @param stateBits bitfield of StateBits specifying the states to enable | 306 * @param flags bitfield of Flags specifying the states to enable |
| 300 */ | 307 */ |
| 301 void enableState(uint32_t stateBits) { fFlagBits |= stateBits; } | 308 void enableState(uint32_t flags) { fFlags |= flags; } |
| 302 | 309 |
| 303 /** | 310 /** |
| 304 * Disable render state settings. | 311 * Disable render state settings. |
| 305 * | 312 * |
| 306 * @param stateBits bitfield of StateBits specifying the states to disable | 313 * @param flags bitfield of Flags specifying the states to disable |
| 307 */ | 314 */ |
| 308 void disableState(uint32_t stateBits) { fFlagBits &= ~(stateBits); } | 315 void disableState(uint32_t flags) { fFlags &= ~(flags); } |
| 309 | 316 |
| 310 /** | 317 /** |
| 311 * Enable or disable stateBits based on a boolean. | 318 * Enable or disable flags based on a boolean. |
| 312 * | 319 * |
| 313 * @param stateBits bitfield of StateBits to enable or disable | 320 * @param flags bitfield of Flags to enable or disable |
| 314 * @param enable if true enable stateBits, otherwise disable | 321 * @param enable if true enable stateBits, otherwise disable |
| 315 */ | 322 */ |
| 316 void setState(uint32_t stateBits, bool enable) { | 323 void setState(uint32_t flags, bool enable) { |
| 317 if (enable) { | 324 if (enable) { |
| 318 this->enableState(stateBits); | 325 this->enableState(flags); |
| 319 } else { | 326 } else { |
| 320 this->disableState(stateBits); | 327 this->disableState(flags); |
| 321 } | 328 } |
| 322 } | 329 } |
| 323 | 330 |
| 324 /// @} | 331 /// @} |
| 325 | 332 |
| 326 /////////////////////////////////////////////////////////////////////////// | 333 /////////////////////////////////////////////////////////////////////////// |
| 327 /// @name Face Culling | 334 /// @name Face Culling |
| 328 //// | 335 //// |
| 329 | 336 |
| 330 enum DrawFace { | 337 enum DrawFace { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 */ | 422 */ |
| 416 void calcCoverageInvariantOutput(GrColor) const; | 423 void calcCoverageInvariantOutput(GrColor) const; |
| 417 | 424 |
| 418 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. | 425 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. |
| 419 // This is used to assert that this condition holds. | 426 // This is used to assert that this condition holds. |
| 420 SkDEBUGCODE(int fBlockEffectRemovalCnt;) | 427 SkDEBUGCODE(int fBlockEffectRemovalCnt;) |
| 421 | 428 |
| 422 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; | 429 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; |
| 423 | 430 |
| 424 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 431 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| 425 uint32_t fFlagBits; | 432 uint32_t fFlags; |
| 426 GrStencilSettings fStencilSettings; | 433 GrStencilSettings fStencilSettings; |
| 427 DrawFace fDrawFace; | 434 DrawFace fDrawFace; |
| 428 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; | 435 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; |
| 429 FragmentStageArray fColorStages; | 436 FragmentStageArray fColorStages; |
| 430 FragmentStageArray fCoverageStages; | 437 FragmentStageArray fCoverageStages; |
| 431 GrClip fClip; | 438 GrClip fClip; |
| 432 | 439 |
| 433 mutable GrProcOptInfo fColorProcInfo; | 440 mutable GrProcOptInfo fColorProcInfo; |
| 434 mutable GrProcOptInfo fCoverageProcInfo; | 441 mutable GrProcOptInfo fCoverageProcInfo; |
| 435 mutable bool fColorProcInfoValid; | 442 mutable bool fColorProcInfoValid; |
| 436 mutable bool fCoverageProcInfoValid; | 443 mutable bool fCoverageProcInfoValid; |
| 437 mutable GrColor fColorCache; | 444 mutable GrColor fColorCache; |
| 438 mutable GrColor fCoverageCache; | 445 mutable GrColor fCoverageCache; |
| 439 | 446 |
| 440 friend class GrPipeline; | 447 friend class GrPipeline; |
| 441 }; | 448 }; |
| 442 | 449 |
| 443 #endif | 450 #endif |
| OLD | NEW |