[Piglit] [PATCH 1/2] multisample-accuracy: Add an error margin for lit/unlit pixels
Neil Roberts
neil at linux.intel.com
Fri Oct 23 07:34:09 PDT 2015
The unlit and totally_lit stats are supposed to count the pixels where
either a primitive completely covers the pixel or no primitive touches
it at all. However this is effectively only determined by checking
whether any primitive has intersected one of the supersample positions
of the reference image. It's completely possible for a primitive to
intersect the pixel boundary but completely miss any of the
supersample positions. The GL implementation is free to pick whatever
multisample positions it wants within the pixel boundary so it's also
possible for a primitive to intersect a multisample position but miss
all of the supersample positions of the reference image. To cope with
this this patch now allows a small margin of error for the pixels that
are either fully lit or fully unlit.
This was causing the test to give false negatives for i965 with the
16x MSAA positions because in that case it chooses positions that are
exactly on the pixel boundary and these would be outside of the grid
of positions chosen by the supersampling in the reference image. The
positions used are actually those described by the D3D API so it is
possible that other hardware would have the same problem.
---
tests/spec/ext_framebuffer_multisample/common.cpp | 43 +++++++++++++++++------
1 file changed, 33 insertions(+), 10 deletions(-)
diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp
index d7be84f..fb42cc5 100644
--- a/tests/spec/ext_framebuffer_multisample/common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp
@@ -530,15 +530,6 @@ Test::measure_accuracy()
}
}
- printf("Pixels that should be unlit\n");
- unlit_stats.summarize();
- pass = unlit_stats.is_perfect() && pass;
- printf("Pixels that should be totally lit\n");
- totally_lit_stats.summarize();
- pass = totally_lit_stats.is_perfect() && pass;
- printf("Pixels that should be partially lit\n");
- partially_lit_stats.summarize();
-
double error_threshold;
if (test_resolve) {
/* For depth and stencil resolves, the implementation
@@ -558,7 +549,39 @@ Test::measure_accuracy()
error_threshold = 0.333 *
pow(0.6, log((double)effective_num_samples) / log(2.0));
}
- printf("The error threshold for this test is %f\n", error_threshold);
+
+ /* The unlit and totally_lit stats are supposed to count the
+ * pixels where either a primitive completely covers the pixel
+ * or no primitive touches it at all. However this is
+ * effectively only determined by checking whether any
+ * primitive has intersected one of the supersample positions
+ * of the reference image. It's completely possible for a
+ * primitive to intersect the pixel boundary but completely
+ * miss any of the supersample positions. The GL
+ * implementation is free to pick whatever multisample
+ * positions it wants within the pixel boundary so it's also
+ * possible for a primitive to intersect a multisample
+ * position but miss all of the supersample positions of the
+ * reference image. To cope with this we allow a small margin
+ * of error for the pixels that are either fully lit or fully
+ * unlit.
+ */
+ double full_pixel_threshold = error_threshold * 0.05f;
+
+ printf("Pixels that should be unlit\n");
+ unlit_stats.summarize();
+ pass = unlit_stats.is_better_than(full_pixel_threshold) && pass;
+ printf("Pixels that should be totally lit\n");
+ totally_lit_stats.summarize();
+ pass = totally_lit_stats.is_better_than(full_pixel_threshold) && pass;
+ printf("The error threshold for unlit and totally lit "
+ "pixels test is %f\n",
+ full_pixel_threshold);
+ printf("Pixels that should be partially lit\n");
+ partially_lit_stats.summarize();
+
+ printf("The error threshold for partially lit pixels is %f\n",
+ error_threshold);
pass = partially_lit_stats.is_better_than(error_threshold) && pass;
// TODO: deal with sRGB.
return pass;
--
1.9.3
More information about the Piglit
mailing list