Demos (master): multitex: Uniforms must be set after linking the program.

2011-08-01 Thread Jose Fonseca
Module: Demos
Branch: master
Commit: 606882b68bf3a9c7a9e89739d00bde014f34ebb2
URL:
http://cgit.freedesktop.org/mesa/demos/commit/?id=606882b68bf3a9c7a9e89739d00bde014f34ebb2

Author: José Fonseca 
Date:   Mon Aug  1 13:17:43 2011 +0100

multitex: Uniforms must be set after linking the program.

This fixes the program when replacing gl_Vertex with VertCoord in
multitex.vert, and VertCoord happens to not receive location 0.

---

 src/glsl/multitex.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/multitex.c b/src/glsl/multitex.c
index d0d5ffd..262ea50 100644
--- a/src/glsl/multitex.c
+++ b/src/glsl/multitex.c
@@ -328,9 +328,6 @@ CreateAProgram(const char *vertProgFile, const char 
*fragProgFile,
 
glUseProgram(program);
 
-   SetUniformValues(program, uniforms);
-   PrintUniforms(Uniforms);
-
assert(ValidateShaderProgram(program));
 
VertCoord_attr = glGetAttribLocation(program, "VertCoord");
@@ -355,6 +352,9 @@ CreateAProgram(const char *vertProgFile, const char 
*fragProgFile,
printf("TexCoord1_attr = %d\n", TexCoord1_attr);
printf("VertCoord_attr = %d\n", VertCoord_attr);
 
+   SetUniformValues(program, uniforms);
+   PrintUniforms(Uniforms);
+
return program;
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glsl: Remove duplicate comment

2011-08-01 Thread Chad Versace
Module: Mesa
Branch: master
Commit: 5541920e0ac4ea8383c7f896daba24a304aafec6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5541920e0ac4ea8383c7f896daba24a304aafec6

Author: Chad Versace 
Date:   Mon Aug  1 09:36:08 2011 -0700

glsl: Remove duplicate comment

Remove duplicate doxgen comment for
ir_function.cpp:parameter_lists_match().

Signed-off-by: Chad Versace 

---

 src/glsl/ir_function.cpp |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp
index 6cfc32c..2a4de5b 100644
--- a/src/glsl/ir_function.cpp
+++ b/src/glsl/ir_function.cpp
@@ -37,14 +37,6 @@ typedef enum {
  * \param list_b Actual parameters passed to the function.
  * \see matching_signature()
  */
-
-/**
- * \brief Check if two parameter lists match.
- *
- * \param list_a Parameters of the function definition.
- * \param list_b Actual parameters passed to the function.
- * \see matching_signature()
- */
 static parameter_list_match_t
 parameter_lists_match(const exec_list *list_a, const exec_list *list_b)
 {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glsl: improve the accuracy of the asin() builtin function.

2011-08-01 Thread Paul Berry
Module: Mesa
Branch: master
Commit: d4c80f5f85c749df3fc091ff07b60ef4989fa6d9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4c80f5f85c749df3fc091ff07b60ef4989fa6d9

Author: Paul Berry 
Date:   Wed Jul 27 14:34:12 2011 -0700

glsl: improve the accuracy of the asin() builtin function.

The previous formula for asin(x) was algebraically equivalent to:

sign(x)*(pi/2 - sqrt(1-|x|)*(A + B|x| + C|x|^2))

where A, B, and C were arbitrary constants determined by a curve fit.

This formula had a worst case absolute error of 0.00448, an unbounded
worst case relative error, and a discontinuity near x=0.

Changed the formula to:

sign(x)*(pi/2 - sqrt(1-|x|)*(pi/2 + (pi/4-1)|x| + A|x|^2 + B|x|^3))

where A and B are arbitrary constants determined by a curve fit.  This
has a worst case absolute error of 0.00039, a worst case relative
error of 0.000405, and no discontinuities.

I don't expect a significant performance degradation, since the extra
multiply-accumulate should be fast compared to the sqrt() computation.

Fixes piglit tests {vs,fs}-asin-float and {vs,fs}-atan-*

---

 src/glsl/builtins/ir/asin |   68 ++--
 1 files changed, 40 insertions(+), 28 deletions(-)

diff --git a/src/glsl/builtins/ir/asin b/src/glsl/builtins/ir/asin
index e230ad6..45d9e67 100644
--- a/src/glsl/builtins/ir/asin
+++ b/src/glsl/builtins/ir/asin
@@ -5,23 +5,26 @@
  ((return (expression float *
   (expression float sign (var_ref x))
   (expression float -
-   (expression float *
-(constant float (3.1415926))
-(constant float (0.5)))
+   (constant float (1.5707964))
(expression float *
 (expression float sqrt
  (expression float -
   (constant float (1.0))
   (expression float abs (var_ref x
 (expression float +
- (constant float (1.5707288))
+ (constant float (1.5707964))
  (expression float *
   (expression float abs (var_ref x))
   (expression float +
-   (constant float (-0.2121144))
+   (constant float (-0.21460183))
(expression float *
-(constant float (0.0742610))
-(expression float abs (var_ref x
+(expression float abs (var_ref x))
+ (expression float +
+  (constant float (0.086566724))
+  (expression float *
+   (expression float abs (var_ref x))
+   (constant float (-0.03102955))
+
 
(signature vec2
  (parameters
@@ -29,23 +32,26 @@
  ((return (expression vec2 *
   (expression vec2 sign (var_ref x))
   (expression vec2 -
-   (expression float *
-(constant float (3.1415926))
-(constant float (0.5)))
+   (constant float (1.5707964))
(expression vec2 *
 (expression vec2 sqrt
  (expression vec2 -
   (constant float (1.0))
   (expression vec2 abs (var_ref x
 (expression vec2 +
- (constant float (1.5707288))
+ (constant float (1.5707964))
  (expression vec2 *
   (expression vec2 abs (var_ref x))
   (expression vec2 +
-   (constant float (-0.2121144))
+   (constant float (-0.21460183))
(expression vec2 *
-(constant float (0.0742610))
-(expression vec2 abs (var_ref x
+(expression vec2 abs (var_ref x))
+ (expression vec2 +
+  (constant float (0.086566724))
+  (expression vec2 *
+   (expression vec2 abs (var_ref x))
+   (constant float (-0.03102955))
+
 
(signature vec3
  (parameters
@@ -53,23 +59,26 @@
  ((return (expression vec3 *
   (expression vec3 sign (var_ref x))
   (expression vec3 -
-   (expression float *
-(constant float (3.1415926))
-(constant float (0.5)))
+   (constant float (1.5707964))
(expression vec3 *
 (expression vec3 sqrt
  (expression vec3 -
   (constant float (1.0))
   (expression vec3 abs (var_ref x
 (expression vec3 +
- (constant float (1.5707288))
+ (constant float (1.5707964))
  (expression vec3 *
   (expression vec3 abs (var_ref x))
   (expression vec3 +
- 

Mesa (master): glsl: improve the accuracy of the atan(x, y) builtin function .

2011-08-01 Thread Paul Berry
Module: Mesa
Branch: master
Commit: b1b4ea0b3679db0b8fddaa9663a10d4712bba3b7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1b4ea0b3679db0b8fddaa9663a10d4712bba3b7

Author: Paul Berry 
Date:   Wed Jul 27 15:53:31 2011 -0700

glsl: improve the accuracy of the atan(x,y) builtin function.

The previous formula for atan(x,y) returned a value of +/- pi whenever
|x|<0.0001, and used a formula based on atan(y/x) otherwise.  This
broke in cases where both x and y were small (e.g. atan(1e-5, 1e-5)).

This patch modifies the formula so that it returns a value of +/- pi
whenever |x|<1e-8*|y|, and uses the formula based on atan(y/x)
otherwise.

---

 src/glsl/builtins/ir/atan |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/glsl/builtins/ir/atan b/src/glsl/builtins/ir/atan
index cfecc1f..7b5ea13 100644
--- a/src/glsl/builtins/ir/atan
+++ b/src/glsl/builtins/ir/atan
@@ -54,7 +54,9 @@
 )
 (
   (declare () float r)
-  (if (expression bool > (expression float abs (var_ref x)) (constant 
float (0.000100))) (
+  (if (expression bool >
+   (expression float abs (var_ref x))
+   (expression float * (constant float (1.0e-8)) (expression float abs 
(var_ref y (
 (assign (x) (var_ref r) (call atan ((expression float / (var_ref y) 
(var_ref x)
 (if (expression bool < (var_ref x) (constant float (0.00)) ) (
   (if (expression bool >= (var_ref y) (constant float (0.00)) )

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965/gen5+: Fix incorrect miptree layout for non-power-of-two cubemaps.

2011-08-01 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 81b036b4d79423c194596461b098a525af0102c2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=81b036b4d79423c194596461b098a525af0102c2

Author: Kenneth Graunke 
Date:   Sat Jul 30 16:44:49 2011 -0700

i965/gen5+: Fix incorrect miptree layout for non-power-of-two cubemaps.

For power-of-two sizes, h0 == mt->height0 since it's already a multiple
of two.  However, for NPOT, they're different; h1 should be computed
based on the original size.

Fixes piglit test "cubemap npot" and oglconform test "textureNPOT".

NOTE: This is a candidate for stable release branches.

Reviewed-by: Eric Anholt 
Signed-off-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/brw_tex_layout.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index f462f32..46a417a 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -60,7 +60,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
   * given in Volume 1 of the BSpec.
   */
  h0 = ALIGN(mt->height0, align_h);
- h1 = ALIGN(minify(h0), align_h);
+ h1 = ALIGN(minify(mt->height0), align_h);
  qpitch = (h0 + h1 + (intel->gen >= 7 ? 12 : 11) * align_h);
   if (mt->compressed)
 qpitch /= 4;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit