On 4 September 2011 06:20, Christoph Bumiller <span dir="ltr"><<a href="mailto:e0425955@student.tuwien.ac.at">e0425955@student.tuwien.ac.at</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I encountered some failures in piglit's tests of builtins because a<br>
vector constructor that is given only 1 single argument does not<br>
replicate the argument into the yzw components, for example:<br>
<br>
diff --git a/src/glsl/builtins/ir/cosh b/src/glsl/builtins/ir/cosh<br>
index 45e0ae4..8bf3ad2 100644<br>
--- a/src/glsl/builtins/ir/cosh<br>
+++ b/src/glsl/builtins/ir/cosh<br>
@@ -9,21 +9,21 @@<br>
(signature vec2<br>
(parameters<br>
(declare (in) vec2 x))<br>
- ((return (expression vec2 * (constant vec2 (0.5))<br>
+ ((return (expression vec2 * (constant vec2 (0.5, 0.5))<br>
(expression vec2 +<br>
(expression vec2 exp (var_ref x))<br>
(expression vec2 exp (expression vec2 neg (var_ref<br>
x))))))))<br>
(signature vec3<br>
(parameters<br>
(declare (in) vec3 x))<br>
<br>
Should the constructors or should all the builtin files be fixed ?<br>
<br></blockquote><div><br>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.<br>
<br>Personally, I'd prefer to fix this bug by making the constant a scalar, like this:<br><br>diff --git a/src/glsl/builtins/ir/cosh b/src/glsl/builtins/ir/cosh<br>index 45e0ae4..9457431 100644<br>--- a/src/glsl/builtins/ir/cosh<br>
+++ b/src/glsl/builtins/ir/cosh<br>@@ -9,21 +9,21 @@<br> (signature vec2<br> (parameters<br> (declare (in) vec2 x))<br>- ((return (expression vec2 * (constant vec2 (0.5))<br>+ ((return (expression vec2 * (constant float (0.5))<br>
(expression vec2 +<br> (expression vec2 exp (var_ref x))<br> (expression vec2 exp (expression vec2 neg (var_ref x))))))))<br> (signature vec3<br> (parameters<br> (declare (in) vec3 x))<br>
<br>That would be consistent with what we do in other builtin functions that require constants (e.g. see "asin").<br></div></div>