15
15
* the transform code is applied.
16
16
*/
17
17
enum SampleFlag {
18
- kExplicitlySampled_Flag = 0b0000001 , // GrFP::isSampledWithExplicitCoords()
18
+ kExplicitlySampled_Flag = 0b00001 , // GrFP::isSampledWithExplicitCoords()
19
19
20
- kLegacyCoordTransform_Flag = 0b0000010 , // !GrFP::coordTransform(i)::isNoOp()
20
+ kLegacyCoordTransform_Flag = 0b00010 , // !GrFP::coordTransform(i)::isNoOp()
21
21
22
- kNone_SampleMatrix_Flag = 0b0000100 , // GrFP::sampleMatrix()::isNoOp()
23
- kConstUniform_SampleMatrix_Flag = 0b0001000 , // GrFP::sampleMatrix()::isConstUniform()
24
- kVariable_SampleMatrix_Flag = 0b0001100 , // GrFP::sampleMatrix()::isVariable()
25
-
26
- // Legacy coord transforms specialize on identity, S+T, no-perspective, and general matrix types
27
- // FIXME these (and kLegacyCoordTransform) can be removed once all FPs no longer use them
28
- kLCT_ScaleTranslate_Matrix_Flag = 0b0010000 , // GrFP::coordTransform(i)::isScaleTranslate()
29
- kLCT_NoPersp_Matrix_Flag = 0b0100000 , // !GrFP::coordTransform(i)::hasPerspective()
30
- kLCT_General_Matrix_Flag = 0b0110000 , // any other matrix type
22
+ kNone_SampleMatrix_Flag = 0b00100 , // GrFP::sampleMatrix()::isNoOp()
23
+ kConstUniform_SampleMatrix_Flag = 0b01000 , // GrFP::sampleMatrix()::isConstUniform()
24
+ kVariable_SampleMatrix_Flag = 0b01100 , // GrFP::sampleMatrix()::isVariable()
31
25
32
26
// Currently, sample(matrix) only specializes on no-perspective or general.
33
27
// FIXME add new flags as more matrix types are supported.
34
- kPersp_Matrix_Flag = 0b1000000 , // GrFP::sampleMatrix()::fHasPerspective
28
+ kPersp_Matrix_Flag = 0b10000 , // GrFP::sampleMatrix()::fHasPerspective
35
29
};
36
30
37
31
GrPrimitiveProcessor::GrPrimitiveProcessor (ClassID classID) : GrProcessor(classID) {}
@@ -42,31 +36,16 @@ const GrPrimitiveProcessor::TextureSampler& GrPrimitiveProcessor::textureSampler
42
36
}
43
37
44
38
uint32_t GrPrimitiveProcessor::computeCoordTransformsKey (const GrFragmentProcessor& fp) const {
45
- // This is highly coupled with the code in GrGLSLGeometryProcessor::emitTransforms().
46
- // At this point, all effects either don't use legacy coord transforms, or only use 1.
47
- SkASSERT (fp.numCoordTransforms () <= 1 );
39
+ // This is highly coupled with the code in GrGLSLGeometryProcessor::collectTransforms().
40
+ // At this point, all effects do not use really coord transforms; they may implicitly report
41
+ // a noop coord transform but this does not impact the key.
42
+ SkASSERT (fp.numCoordTransforms () == 0 ||
43
+ (fp.numCoordTransforms () == 1 && fp.coordTransform (0 ).isNoOp ()));
48
44
49
45
uint32_t key = 0 ;
50
46
if (fp.isSampledWithExplicitCoords ()) {
51
47
key |= kExplicitlySampled_Flag ;
52
48
}
53
- if (fp.numCoordTransforms () > 0 ) {
54
- const GrCoordTransform& coordTransform = fp.coordTransform (0 );
55
- if (!coordTransform.isNoOp ()) {
56
- // A true identity matrix shouldn't result in a coord transform; proxy normalization
57
- // and flipping will eventually present as a scale+translate matrix.
58
- SkASSERT (!coordTransform.matrix ().isIdentity () || coordTransform.normalize () ||
59
- coordTransform.reverseY ());
60
- key |= kLegacyCoordTransform_Flag ;
61
- if (coordTransform.matrix ().isScaleTranslate ()) {
62
- key |= kLCT_ScaleTranslate_Matrix_Flag ;
63
- } else if (!coordTransform.matrix ().hasPerspective ()) {
64
- key |= kLCT_NoPersp_Matrix_Flag ;
65
- } else {
66
- key |= kLCT_General_Matrix_Flag ;
67
- }
68
- }
69
- }
70
49
71
50
switch (fp.sampleMatrix ().fKind ) {
72
51
case SkSL::SampleMatrix::Kind::kNone :
0 commit comments