[Piglit] [PATCH] glsl-1.10 / glsl-1.20: Relax precision requirements of variable indexing tests

Ian Romanick idr at freedesktop.org
Thu Aug 22 15:15:00 PDT 2013


On 08/22/2013 07:23 AM, Brian Paul wrote:
> On 08/21/2013 09:44 PM, Ian Romanick wrote:
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> Many of these tests fail on older GPU such as Intel i915 due to the
>> precision requirement.  This is because many GPUs in this class only use
>> 24-bit floats.  Many also implement many instructions cheaply (with poor
>> precision).
>>
>> Do a couple things to relax the precision requirement.  First, use the
>> distance squared instead of the distance.  This saves an
>> inverse-square-root and a multiple.  The inverse-square-root has
>> notoriously poor precision on old GPUs.  Second, pick a precision that
>> passes on at least one 24-bit float GPU.  I picked 4e-9 because that was
>> the smallest bound that would pass on i915.
>>
>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>> ---
>> I suspect that r300 GPUs also fail these tests, but I don't have any of
>> that hardware around.  Could someone test before and after for me? :)
>>
>> This is also not the full patch.  The full patch is ~300kb, so the list
>> server would have rejected it.  This is just a handful of representitive
>> tests and the generator script.
>>
>>   .../fs-temp-array-mat2-col-row-wr.shader_test             |  4 +++-
>>   .../fs-temp-array-mat2-col-wr.shader_test                 |  4 +++-
>>   .../fs-temp-array-mat2-index-col-row-wr.shader_test       |  4 +++-
>>   .../fs-temp-array-mat2-index-col-wr.shader_test           |  4 +++-
>>   .../fs-temp-array-mat2-index-row-wr.shader_test           |  4 +++-
>>   .../fs-temp-array-mat2-index-wr.shader_test               |  4 +++-
>>   .../vs-temp-array-mat2-col-row-wr.shader_test             |  6 +++---
>>   .../vs-temp-array-mat2-col-wr.shader_test                 |  6 +++---
>>   .../vs-temp-array-mat2-index-col-row-wr.shader_test       |  6 +++---
>>   .../vs-temp-array-mat2-index-col-wr.shader_test           |  6 +++---
>>   .../vs-temp-array-mat2-index-row-wr.shader_test           |  6 +++---
>>   .../vs-temp-array-mat2-index-wr.shader_test               |  6 +++---
>>   tests/spec/glsl-1.10/variable-index-write.sh              | 15
>> +++++++++++++--
>>   13 files changed, 49 insertions(+), 26 deletions(-)
>>
>> diff --git
>> a/tests/spec/glsl-1.10/execution/variable-indexing/fs-temp-array-mat2-col-row-wr.shader_test
>> b/tests/spec/glsl-1.10/execution/variable-indexing/fs-temp-array-mat2-col-row-wr.shader_test
>>
>> index 647cc02..ee9e77f 100644
>> ---
>> a/tests/spec/glsl-1.10/execution/variable-indexing/fs-temp-array-mat2-col-row-wr.shader_test
>>
>> +++
>> b/tests/spec/glsl-1.10/execution/variable-indexing/fs-temp-array-mat2-col-row-wr.shader_test
>>
>> @@ -16,6 +16,8 @@ uniform int row;
>>   uniform int col;
>>   uniform float value;
>>
>> +float distanceSqr(vec a, vec b) { vec diff = a - b; return
>> abs(dot(diff, diff)); }
>
> I believe you can omit the abs().  dot(x,x) will always be >= 0.

Duh.  You are correct.  I will make that change.

> -Brian



More information about the Piglit mailing list