OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
10 | 10 |
11 #include "GrPipelineBuilder.h" | 11 #include "GrPipelineBuilder.h" |
12 #include "GrProgramDesc.h" | 12 #include "GrProgramDesc.h" |
| 13 #include "GrStencil.h" |
13 #include "GrSwizzle.h" | 14 #include "GrSwizzle.h" |
14 #include "GrAllocator.h" | 15 #include "GrAllocator.h" |
15 #include "GrTextureParamsAdjuster.h" | 16 #include "GrTextureParamsAdjuster.h" |
16 #include "GrTypes.h" | 17 #include "GrTypes.h" |
17 #include "GrXferProcessor.h" | 18 #include "GrXferProcessor.h" |
18 #include "SkPath.h" | 19 #include "SkPath.h" |
19 #include "SkTArray.h" | 20 #include "SkTArray.h" |
20 | 21 |
21 class GrBatchTracker; | 22 class GrBatchTracker; |
22 class GrBuffer; | 23 class GrBuffer; |
23 class GrContext; | 24 class GrContext; |
24 class GrGLContext; | 25 class GrGLContext; |
25 class GrMesh; | 26 class GrMesh; |
26 class GrNonInstancedVertices; | 27 class GrNonInstancedVertices; |
27 class GrPath; | 28 class GrPath; |
28 class GrPathRange; | 29 class GrPathRange; |
29 class GrPathRenderer; | 30 class GrPathRenderer; |
30 class GrPathRendererChain; | 31 class GrPathRendererChain; |
31 class GrPathRendering; | 32 class GrPathRendering; |
32 class GrPipeline; | 33 class GrPipeline; |
33 class GrPrimitiveProcessor; | 34 class GrPrimitiveProcessor; |
34 class GrRenderTarget; | 35 class GrRenderTarget; |
35 class GrStencilAttachment; | 36 class GrStencilAttachment; |
36 class GrStencilSettings; | |
37 class GrSurface; | 37 class GrSurface; |
38 class GrTexture; | 38 class GrTexture; |
39 | 39 |
40 class GrGpu : public SkRefCnt { | 40 class GrGpu : public SkRefCnt { |
41 public: | 41 public: |
42 /** | 42 /** |
43 * Create an instance of GrGpu that matches the specified backend. If the re
quested backend is | 43 * Create an instance of GrGpu that matches the specified backend. If the re
quested backend is |
44 * not supported (at compile-time or run-time) this returns nullptr. The con
text will not be | 44 * not supported (at compile-time or run-time) this returns nullptr. The con
text will not be |
45 * fully constructed and should not be used by GrGpu until after this functi
on returns. | 45 * fully constructed and should not be used by GrGpu until after this functi
on returns. |
46 */ | 46 */ |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 return this->onMakeCopyForTextureParams(texture, params, copyParams); | 478 return this->onMakeCopyForTextureParams(texture, params, copyParams); |
479 } | 479 } |
480 | 480 |
481 // This is only to be used in GL-specific tests. | 481 // This is only to be used in GL-specific tests. |
482 virtual const GrGLContext* glContextForTesting() const { return nullptr; } | 482 virtual const GrGLContext* glContextForTesting() const { return nullptr; } |
483 | 483 |
484 // This is only to be used by testing code | 484 // This is only to be used by testing code |
485 virtual void resetShaderCacheForTesting() const {} | 485 virtual void resetShaderCacheForTesting() const {} |
486 | 486 |
487 protected: | 487 protected: |
| 488 // Functions used to map clip-respecting stencil tests into normal |
| 489 // stencil funcs supported by GPUs. |
| 490 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
| 491 GrStencilFunc func); |
| 492 static void ConvertStencilFuncAndMask(GrStencilFunc func, |
| 493 bool clipInStencil, |
| 494 unsigned int clipBit, |
| 495 unsigned int userBits, |
| 496 unsigned int* ref, |
| 497 unsigned int* mask); |
| 498 |
488 static void ElevateDrawPreference(GrGpu::DrawPreference* preference, | 499 static void ElevateDrawPreference(GrGpu::DrawPreference* preference, |
489 GrGpu::DrawPreference elevation) { | 500 GrGpu::DrawPreference elevation) { |
490 GR_STATIC_ASSERT(GrGpu::kCallerPrefersDraw_DrawPreference > GrGpu::kNoDr
aw_DrawPreference); | 501 GR_STATIC_ASSERT(GrGpu::kCallerPrefersDraw_DrawPreference > GrGpu::kNoDr
aw_DrawPreference); |
491 GR_STATIC_ASSERT(GrGpu::kGpuPrefersDraw_DrawPreference > | 502 GR_STATIC_ASSERT(GrGpu::kGpuPrefersDraw_DrawPreference > |
492 GrGpu::kCallerPrefersDraw_DrawPreference); | 503 GrGpu::kCallerPrefersDraw_DrawPreference); |
493 GR_STATIC_ASSERT(GrGpu::kRequireDraw_DrawPreference > | 504 GR_STATIC_ASSERT(GrGpu::kRequireDraw_DrawPreference > |
494 GrGpu::kGpuPrefersDraw_DrawPreference); | 505 GrGpu::kGpuPrefersDraw_DrawPreference); |
495 *preference = SkTMax(*preference, elevation); | 506 *preference = SkTMax(*preference, elevation); |
496 } | 507 } |
497 | 508 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 SkTArray<const MultisampleSpecs*, true> fMultisa
mpleSpecsMap; | 614 SkTArray<const MultisampleSpecs*, true> fMultisa
mpleSpecsMap; |
604 GrTAllocator<MultisampleSpecs> fMultisa
mpleSpecsAllocator; | 615 GrTAllocator<MultisampleSpecs> fMultisa
mpleSpecsAllocator; |
605 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 616 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
606 GrContext* fContext
; | 617 GrContext* fContext
; |
607 | 618 |
608 friend class GrPathRendering; | 619 friend class GrPathRendering; |
609 typedef SkRefCnt INHERITED; | 620 typedef SkRefCnt INHERITED; |
610 }; | 621 }; |
611 | 622 |
612 #endif | 623 #endif |
OLD | NEW |