OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 GrGrInstancedPipelineInfo_DEFINED | 8 #ifndef GrGrInstancedPipelineInfo_DEFINED |
9 #define GrGrInstancedPipelineInfo_DEFINED | 9 #define GrGrInstancedPipelineInfo_DEFINED |
10 | 10 |
11 #include "GrRenderTarget.h" | 11 #include "GrRenderTarget.h" |
12 | 12 |
13 /** | 13 /** |
14 * Provides info about the pipeline that GrInstancedRendering needs in order to
select appropriate | 14 * Provides info about the pipeline that GrInstancedRendering needs in order to
select appropriate |
15 * drawing algorithms. | 15 * drawing algorithms. |
16 */ | 16 */ |
17 struct GrInstancedPipelineInfo { | 17 struct GrInstancedPipelineInfo { |
18 GrInstancedPipelineInfo(const GrRenderTarget* rt) | 18 GrInstancedPipelineInfo(const GrRenderTarget* rt) |
19 : fIsMultisampled(rt->isStencilBufferMultisampled()), | 19 : fIsMultisampled(rt->isStencilBufferMultisampled()), |
20 fIsMixedSampled(rt->hasMixedSamples()), | 20 fIsMixedSampled(rt->isMixedSampled()), |
21 fIsRenderingToFloat(GrPixelConfigIsFloatingPoint(rt->desc().fConfig)), | 21 fIsRenderingToFloat(GrPixelConfigIsFloatingPoint(rt->desc().fConfig)), |
22 fColorDisabled(false), | 22 fColorDisabled(false), |
23 fDrawingShapeToStencil(false), | 23 fDrawingShapeToStencil(false), |
24 fCanDiscard(false) { | 24 fCanDiscard(false) { |
25 } | 25 } |
26 | 26 |
27 bool canUseCoverageAA() const { | 27 bool canUseCoverageAA() const { |
28 return !fIsMultisampled || (fIsMixedSampled && !fDrawingShapeToStencil); | 28 return !fIsMultisampled || (fIsMixedSampled && !fDrawingShapeToStencil); |
29 } | 29 } |
30 | 30 |
31 bool fIsMultisampled : 1; | 31 bool fIsMultisampled : 1; |
32 bool fIsMixedSampled : 1; | 32 bool fIsMixedSampled : 1; |
33 bool fIsRenderingToFloat : 1; | 33 bool fIsRenderingToFloat : 1; |
34 bool fColorDisabled : 1; | 34 bool fColorDisabled : 1; |
35 /** | 35 /** |
36 * Indicates that the instanced renderer should take extra precautions to en
sure the shape gets | 36 * Indicates that the instanced renderer should take extra precautions to en
sure the shape gets |
37 * drawn correctly to the stencil buffer (e.g. no coverage AA). NOTE: this d
oes not mean a | 37 * drawn correctly to the stencil buffer (e.g. no coverage AA). NOTE: this d
oes not mean a |
38 * stencil test is or is not active. | 38 * stencil test is or is not active. |
39 */ | 39 */ |
40 bool fDrawingShapeToStencil : 1; | 40 bool fDrawingShapeToStencil : 1; |
41 /** | 41 /** |
42 * Indicates that the instanced renderer can use processors with discard ins
tructions. This | 42 * Indicates that the instanced renderer can use processors with discard ins
tructions. This |
43 * should not be set if the shader will use derivatives, automatic mipmap LO
D, or other features | 43 * should not be set if the shader will use derivatives, automatic mipmap LO
D, or other features |
44 * that depend on neighboring pixels. Some draws will fail to create if this
is not set. | 44 * that depend on neighboring pixels. Some draws will fail to create if this
is not set. |
45 */ | 45 */ |
46 bool fCanDiscard : 1; | 46 bool fCanDiscard : 1; |
47 }; | 47 }; |
48 | 48 |
49 #endif | 49 #endif |
OLD | NEW |