Allow error bounds for expected output
Closed this issue · 5 comments
Because GPUs do not provide exact precision for float values, it is hard to set the expected output.
For example, this code has many comparisons for the reason.
Why don't we support fuzzy equality operator ~=
and setting an epsilon value to be used across subsequent checks?
(maybe both an absolute value and relative percentage value for the epsilon with reasonable default value e.g., 0.01%
)
This seems like a good idea to me.
Just for info, when using the probe commands to check pixels in the framebuffer there is already a builtin tolerance which is hardcoded at 0.01. This value is taken from the default tolerance in Piglit. In Piglit’s shader_runner, there is a tolerance
command to change this value. I wonder if we should add that command to VkRunner as well and then use the same setting for the fuzzy equality operator.
That sounds good to me.
If you work for other parts, I can work for it.
Let me know that you will start it or not.
Thank you for confirming. I will send a pull request soon.