[Mesa-dev] GLSL builtins constant constructor
Ian Romanick
idr at freedesktop.org
Sun Sep 4 14:49:06 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 09/04/2011 08:35 AM, Paul Berry wrote:
> On 4 September 2011 06:20, Christoph Bumiller
> <e0425955 at student.tuwien.ac.at <mailto:e0425955 at student.tuwien.ac.at>>
> wrote:
>
> I encountered some failures in piglit's tests of builtins because a
> vector constructor that is given only 1 single argument does not
> replicate the argument into the yzw components, for example:
>
> diff --git a/src/glsl/builtins/ir/cosh b/src/glsl/builtins/ir/cosh
> index 45e0ae4..8bf3ad2 100644
> --- a/src/glsl/builtins/ir/cosh
> +++ b/src/glsl/builtins/ir/cosh
> @@ -9,21 +9,21 @@
> (signature vec2
> (parameters
> (declare (in) vec2 x))
> - ((return (expression vec2 * (constant vec2 (0.5))
> + ((return (expression vec2 * (constant vec2 (0.5, 0.5))
> (expression vec2 +
> (expression vec2 exp (var_ref x))
> (expression vec2 exp (expression vec2 neg (var_ref
> x))))))))
> (signature vec3
> (parameters
> (declare (in) vec3 x))
>
> Should the constructors or should all the builtin files be fixed ?
>
>
> Thanks for noticing this, Christoph. I wrote the tests for hyperbolic
> trig functions a few weeks ago, and I've been waiting for some i965
> churn to settle down before looping back to fix the bugs.
>
> Personally, I'd prefer to fix this bug by making the constant a scalar,
> like this:
I don't recall for sure, but, while that is valid GLSL, I don't think
that's valid in the IR. Did you try it? I think you may have to wrap
it in a swizzle, at which point it's probably better to use the correct
vec# constructor.
> diff --git a/src/glsl/builtins/ir/cosh b/src/glsl/builtins/ir/cosh
> index 45e0ae4..9457431 100644
> --- a/src/glsl/builtins/ir/cosh
> +++ b/src/glsl/builtins/ir/cosh
> @@ -9,21 +9,21 @@
> (signature vec2
> (parameters
> (declare (in) vec2 x))
> - ((return (expression vec2 * (constant vec2 (0.5))
> + ((return (expression vec2 * (constant float (0.5))
> (expression vec2 +
> (expression vec2 exp (var_ref x))
> (expression vec2 exp (expression vec2 neg (var_ref
> x))))))))
> (signature vec3
> (parameters
> (declare (in) vec3 x))
>
> That would be consistent with what we do in other builtin functions that
> require constants (e.g. see "asin").
>
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk5j8k4ACgkQX1gOwKyEAw8r3gCfdKZtC4/FiWLtlU3+n6UAzhka
OuYAnRsm7363gieE66dc06VBtFgrS4r1
=Ep5P
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list