• Home
  • Raw
  • Download

Lines Matching +full:test +full:- +full:expectations

4  * Use of this source code is governed by a BSD-style license that can be
14 #include "tests/Test.h"
43 static constexpr int32_t kInts[16] = { 1, -2, 3, -4,
44 5, -6, 7, -8,
45 9, -10, 11, -12,
46 13, -14, 15, -16 };
49 // Metal encodes half-precision uniforms in 16 bits. in element_size()
60 const Uniform expectations[] = {{"uniform", type}}; in DEF_GRAPHITE_TEST() local
61 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
62 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
64 REPORTER_ASSERT(r, mgr.size() > 0, "Layout: %s - Type: %s", in DEF_GRAPHITE_TEST()
77 // Only test scalar and vector floats. (Matrices can introduce padding between values.) in DEF_GRAPHITE_TEST()
84 const Uniform expectations[] = {{"uniform", type}}; in DEF_GRAPHITE_TEST() local
85 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
86 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
95 "Layout: %s - Type: %s float encoding failed", in DEF_GRAPHITE_TEST()
113 const Uniform expectations[] = {{"uniform", type}}; in DEF_GRAPHITE_TEST() local
114 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
115 mgr.write(expectations[0], kInts); in DEF_GRAPHITE_TEST()
124 "Layout: %s - Type: %s int encoding failed", in DEF_GRAPHITE_TEST()
143 const Uniform expectations[] = {{"a", type}, {"b", type}, {"c", type}}; in DEF_GRAPHITE_TEST() local
144 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
145 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
146 mgr.write(expectations[1], kFloats); in DEF_GRAPHITE_TEST()
147 mgr.write(expectations[2], kFloats); in DEF_GRAPHITE_TEST()
156 "Layout: %s - Type: %s tight packing failed", in DEF_GRAPHITE_TEST()
175 const Uniform expectations[] = {{"a", type}, {"b", type}, {"c", type}}; in DEF_GRAPHITE_TEST() local
176 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
177 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
178 mgr.write(expectations[1], kFloats); in DEF_GRAPHITE_TEST()
179 mgr.write(expectations[2], kFloats); in DEF_GRAPHITE_TEST()
196 "Layout: %s - Type: %s matrix packing failed", in DEF_GRAPHITE_TEST()
221 const Uniform expectations[] = {{"a", type1}, {"b", type2}}; in DEF_GRAPHITE_TEST() local
222 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
223 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
224 mgr.write(expectations[1], kFloats); in DEF_GRAPHITE_TEST()
227 // The expected packing varies depending on the bit-widths of each element. in DEF_GRAPHITE_TEST()
255 "Layout: %s - Types: %s, %s padding test failed", in DEF_GRAPHITE_TEST()
274 "Layout: %s - Types: %s, %s padding test failed", in DEF_GRAPHITE_TEST()
301 "Layout: %s - Types: %s, %s padding test failed", in DEF_GRAPHITE_TEST()
331 const Uniform expectations[] = {{"a", type1}, {"b", type2}}; in DEF_GRAPHITE_TEST() local
332 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
333 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
334 mgr.write(expectations[1], kFloats); in DEF_GRAPHITE_TEST()
337 // The expected packing varies depending on the bit-widths of each element. in DEF_GRAPHITE_TEST()
369 "Layout: %s - Types: %s, %s vector-matrix padding test failed", in DEF_GRAPHITE_TEST()
400 "Layout: %s - Types: %s, %s vector-matrix padding test failed", in DEF_GRAPHITE_TEST()
425 "Layout: %s - Types: %s, %s vector-matrix padding test failed", in DEF_GRAPHITE_TEST()
453 const Uniform expectations[] = {{"a", type1}, {"b", type2}}; in DEF_GRAPHITE_TEST() local
454 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
455 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
456 mgr.write(expectations[1], kFloats); in DEF_GRAPHITE_TEST()
459 // The expected packing varies depending on the bit-widths of each element. in DEF_GRAPHITE_TEST()
507 "Layout: %s - Types: %s, %s matrix-vector padding test failed", in DEF_GRAPHITE_TEST()
534 "Layout: %s - Types: %s, %s matrix-vector padding test failed", in DEF_GRAPHITE_TEST()
561 "Layout: %s - Types: %s, %s matrix-vector padding test failed", in DEF_GRAPHITE_TEST()
575 // elements. Test every type that can appear in an array. in DEF_GRAPHITE_TEST()
622 const Uniform expectations[] = {{"a", SkSLType::kHalf}, {"b", arrayType, kArraySize}}; in DEF_GRAPHITE_TEST() local
624 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
625 mgr.write(expectations[0], kHalfs); in DEF_GRAPHITE_TEST()
626 mgr.write(expectations[1], kBuffer); in DEF_GRAPHITE_TEST()
632 "array test %d for type %s failed - expected size: %zu, actual size: %zu", in DEF_GRAPHITE_TEST()
643 // elements. Test every type that can appear in an array. in DEF_GRAPHITE_TEST()
690 const Uniform expectations[] = {{"a", SkSLType::kHalf}, {"b", arrayType, kArraySize}}; in DEF_GRAPHITE_TEST() local
692 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
693 mgr.write(expectations[0], kHalfs); in DEF_GRAPHITE_TEST()
694 mgr.write(expectations[1], kBuffer); in DEF_GRAPHITE_TEST()
700 "array test %d for type %s failed - expected size: %zu, actual size: %zu", in DEF_GRAPHITE_TEST()
711 // elements. Test every type that can appear in an array. in DEF_GRAPHITE_TEST()
764 const Uniform expectations[] = {{"a", SkSLType::kHalf}, {"b", arrayType, kArraySize}}; in DEF_GRAPHITE_TEST() local
766 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
767 mgr.write(expectations[0], kHalfs); in DEF_GRAPHITE_TEST()
768 mgr.write(expectations[1], kBuffer); in DEF_GRAPHITE_TEST()
774 "array test %d for type %s failed - expected size: %zu, actual size: %zu", in DEF_GRAPHITE_TEST()
781 // This test validates that the uniform data for matrix types get written out according to the
782 // layout expectations.
788 const Uniform expectations[] = {{"m", type}}; in DEF_GRAPHITE_TEST() local
789 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
790 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
804 "Incorrect %s element %zu - expected %f, got %f", in DEF_GRAPHITE_TEST()
812 const Uniform expectations[] = {{"m", type}}; in DEF_GRAPHITE_TEST() local
813 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
814 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
828 "Incorrect %s element %zu - expected %f, got %f", in DEF_GRAPHITE_TEST()
835 // This test validates that the uniform data for matrix types get written out according to the
836 // layout expectations.
842 const Uniform expectations[] = {{"m", type}}; in DEF_GRAPHITE_TEST() local
843 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
844 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
859 "Incorrect %s element %zu - expected %f, got %f", in DEF_GRAPHITE_TEST()
867 const Uniform expectations[] = {{"m", type}}; in DEF_GRAPHITE_TEST() local
868 SkDEBUGCODE(mgr.setExpectedUniforms(SkSpan(expectations), /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
869 mgr.write(expectations[0], kFloats); in DEF_GRAPHITE_TEST()
883 "Incorrect %s element %zu - expected %f, got %f", in DEF_GRAPHITE_TEST()
895 // written are integers and will be bit-punned to floats so that expectations are easy to in DEF_GRAPHITE_TEST()
898 std::vector<Uniform> fPreStruct; // before beginStruct(), top-level fields or struct in DEF_GRAPHITE_TEST()
900 std::vector<Uniform> fPostStruct; // after endStruct(), top-level fields in DEF_GRAPHITE_TEST()
904 // If non-empty, holds base alignments for fPreStruct base alignment as a struct in DEF_GRAPHITE_TEST()
907 // Struct tests with no preceeding or following top-level fields in DEF_GRAPHITE_TEST()
1003 // and a following float4 to test alignment after a struct. in DEF_GRAPHITE_TEST()
1072 mgr->write(SkBits2Float(baseValue++)); in DEF_GRAPHITE_TEST()
1075 mgr->write(SkV2{SkBits2Float(baseValue++), in DEF_GRAPHITE_TEST()
1079 mgr->write(SkV3{SkBits2Float(baseValue++), in DEF_GRAPHITE_TEST()
1084 mgr->write(SkV4{SkBits2Float(baseValue++), in DEF_GRAPHITE_TEST()
1102 const TestCase& test = kCases[t]; in DEF_GRAPHITE_TEST() local
1105 auto [baseAlignment, expectedData] = test.fExpectedAlignmentAndData[l]; in DEF_GRAPHITE_TEST()
1109 if (!test.fPreStruct.empty()) { in DEF_GRAPHITE_TEST()
1110 // pre-struct fields in DEF_GRAPHITE_TEST()
1111 const bool preStructIsStruct = !test.fPreStructAlignments.empty(); in DEF_GRAPHITE_TEST()
1112 SkDEBUGCODE(mgr.setExpectedUniforms(test.fPreStruct, preStructIsStruct);) in DEF_GRAPHITE_TEST()
1114 mgr.beginStruct(test.fPreStructAlignments[l]); in DEF_GRAPHITE_TEST()
1116 baseValue = writeFields(&mgr, test.fPreStruct, baseValue); in DEF_GRAPHITE_TEST()
1122 if (!test.fSubstruct.empty()) { in DEF_GRAPHITE_TEST()
1124 SkDEBUGCODE(mgr.setExpectedUniforms(test.fSubstruct, /*isSubstruct=*/true);) in DEF_GRAPHITE_TEST()
1126 baseValue = writeFields(&mgr, test.fSubstruct, baseValue); in DEF_GRAPHITE_TEST()
1130 if (!test.fPostStruct.empty()) { in DEF_GRAPHITE_TEST()
1131 // post-struct fields in DEF_GRAPHITE_TEST()
1132 SkDEBUGCODE(mgr.setExpectedUniforms(test.fPostStruct, /*isSubstruct=*/false);) in DEF_GRAPHITE_TEST()
1133 baseValue = writeFields(&mgr, test.fPostStruct, baseValue); in DEF_GRAPHITE_TEST()
1141 // will already be triggering test failures in DEF_GRAPHITE_TEST()