[Mesa-dev] [PATCH] mesa, glsl_to_tgsi: fixes for native integers
Ian Romanick
idr at freedesktop.org
Mon Aug 29 10:10:06 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 08/29/2011 09:31 AM, Eric Anholt wrote:
> On Fri, 26 Aug 2011 21:58:12 -0500, Bryan Cain <bryancain3 at gmail.com> wrote:
>> This fixes all of the piglit regressions in softpipe when native integers are
>> enabled.
>> ---
>> src/mesa/main/uniforms.c | 8 +----
>> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 45 ++++++++++++++++++++++++++--
>> 2 files changed, 43 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
>> index cda840f..0801476 100644
>> --- a/src/mesa/main/uniforms.c
>> +++ b/src/mesa/main/uniforms.c
>> @@ -776,13 +776,7 @@ set_program_uniform(struct gl_context *ctx, struct gl_program *program,
>> /* if the uniform is bool-valued, convert to 1 or 0 */
>> if (isUniformBool) {
>> for (i = 0; i < elems; i++) {
>> - if (basicType == GL_FLOAT)
>> - uniformVal[i].b = uniformVal[i].f != 0.0f ? 1 : 0;
>> - else
>> - uniformVal[i].b = uniformVal[i].u ? 1 : 0;
>> -
>> - if (!ctx->Const.NativeIntegers)
>> - uniformVal[i].f = uniformVal[i].b ? 1.0f : 0.0f;
>> + uniformVal[i].f = uniformVal[i].f != 0.0f ? 1.0f : 0.0f;
>> }
>> }
>> }
>
> I think booleans should be integer 1 as uniforms. Otherwise I'll need a
> RealNativeIntegers flag to get that behavior.
I think the issue they're running into is that all non-Intel hardware
uses ~0 for true (out of the "set" instructions) and 0 for false when
using integers. Most of the rest of the stack expects 1 and 0, so the
impedance mismatch is causing headaches. The (1-b) implementation of
ir_unop_not stops working, for example. Though, in that case it seems
like you should have (and use) an integer bit-wise not instruction.
It seems like there should be a better way to handle this...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk5bx+4ACgkQX1gOwKyEAw+rLQCgnj1U5CMLKV6PY9rK3huJzYZO
1lgAn3WpLDmPBh3xy8uosHg0pNfy7mtM
=9snJ
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list