[Mesa-dev] [PATCH] gallium/tgsi: correct typo propagated from NV_vertex_program1_1

Erik Faye-Lund kusmabite at gmail.com
Fri Feb 7 04:43:40 PST 2014


On Thu, Feb 6, 2014 at 5:30 PM, Brian Paul <brianp at vmware.com> wrote:
> On 02/06/2014 09:09 AM, Erik Faye-Lund wrote:
>>
>> In the specification text of NV_vertex_program1_1, the upper
>> limit of the RCC instruction is written as 1.884467e+19 in
>> scientific notation, but as 0x5F800000 in binary. But the binary
>> version translates to 1.84467e+19 rather than 1.884467e+19 in
>> scientific notation.
>>
>> Since the lower-limit equals 2^-64 and the binary version equals
>> 2^+64, let's assume the value in scientific notation is a typo
>> and implement this using the value from the binary version
>> instead.
>>
>> Signed-off-by: Erik Faye-Lund <kusmabite at gmail.com>
>> ---
>>
>> I've also e-mailed NVIDIA's contact as listed in the specification,
>> but I haven't gotten any reply yet.
>>
>> I think it's pretty obvious, though. I seriously doubt anyone
>> implemented the old limit, as it would require quite a bit more
>> gates AFAIK.
>>
>>   src/gallium/auxiliary/tgsi/tgsi_exec.c | 8 ++++----
>>   src/gallium/docs/source/tgsi.rst       | 2 +-
>>   2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c
>> b/src/gallium/auxiliary/tgsi/tgsi_exec.c
>> index 3d37eaa..7d35aeb 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
>> @@ -915,8 +915,8 @@ micro_rcc(union tgsi_exec_channel *dst,
>>         float recip = 1.0f / src->f[i];
>>
>>         if (recip > 0.0f) {
>> -         if (recip > 1.884467e+019f) {
>> -            dst->f[i] = 1.884467e+019f;
>> +         if (recip > 1.84467e+019f) {
>> +            dst->f[i] = 1.84467e+019f;
>>            }
>>            else if (recip < 5.42101e-020f) {
>>               dst->f[i] = 5.42101e-020f;
>> @@ -926,8 +926,8 @@ micro_rcc(union tgsi_exec_channel *dst,
>>            }
>>         }
>>         else {
>> -         if (recip < -1.884467e+019f) {
>> -            dst->f[i] = -1.884467e+019f;
>> +         if (recip < -1.84467e+019f) {
>> +            dst->f[i] = -1.84467e+019f;
>>            }
>>            else if (recip > -5.42101e-020f) {
>>               dst->f[i] = -5.42101e-020f;
>
>
> As long as you're at it, this code should probably be rewritten in terms of
> the CLAMP() macro to be more concise.
>

Good point. I'll do that in a preceding clean-up patch, though.


More information about the mesa-dev mailing list