[Mesa-dev] Mesa (master): draw: fix flat shading and screen-space linear interpolation in clipper

Marek Olšák maraeo at gmail.com
Wed Jul 11 08:02:40 PDT 2012


On Wed, Jul 11, 2012 at 4:23 PM, Jose Fonseca <jfonseca at vmware.com> wrote:
>
> When NativeIntegers is FALSE, Mesa generates this VS:
>
>   DCL SV[0], INSTANCEID
>   ...
>   ARL ADDR[0].x, SV[0].xxxx
>
> If INSTANCEID is an integer this is wrong, as it is reading a float where there's an integer. (e.g., for INSTANCEID =1 ARRD[0] would have round(0.0000000001) zero).
>
> But, if I modify mesa statetracker to insert the U2F as necessary evertyhing will work as expected
>
>   DCL SV[0], INSTANCEID
>   ...
>   U2F TEMP[0].x, SV[0].xxxx
>   ARL ADDR[0].x, TEMP[0].xxxx
>
> This is essencially what Olivier patch did, but without guessing. Mesa state tracker can known everything it needs to do the "right thing", i.e., INSTANCEID is integer.

I see. However if PIPE_SHADER_CAP_INTEGERS is 0, I2F and U2F are
unsupported instructions. The proper solution would be to add the type
after the system value declaration if you want unambiguous TGSI
shaders:

DCL SV[0], INSTANCEID, FLOAT

or Draw could use pipe->get_shader_param(PIPE_SHADER_CAP_INTEGERS) to
see what the expected type is.

Marek


More information about the mesa-dev mailing list