Mesa (glsl2): glcpp: Ignore #if and #elif expressions when skipping.

2010-08-04 Thread Kenneth Graunke
Module: Mesa
Branch: glsl2
Commit: f4239872c9cb56d1e5735b62ea53bedf3f39dfb0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4239872c9cb56d1e5735b62ea53bedf3f39dfb0

Author: Kenneth Graunke 
Date:   Wed Aug  4 16:24:39 2010 -0700

glcpp: Ignore #if and #elif expressions when skipping.

Fixes glcpp test cases 073 and 074, as well as piglit test
xonotic-vs-generic-diffuse.vert.

---

 src/glsl/glcpp/glcpp-parse.c |  202 ++---
 src/glsl/glcpp/glcpp-parse.y |   18 -
 2 files changed, 124 insertions(+), 96 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c
index df16cab..e93f832 100644
--- a/src/glsl/glcpp/glcpp-parse.c
+++ b/src/glsl/glcpp/glcpp-parse.c
@@ -624,16 +624,16 @@ static const yytype_int8 yyrhs[] =
 static const yytype_uint16 yyrline[] =
 {
0,   172,   172,   174,   178,   181,   186,   187,   191,   194,
- 200,   203,   206,   209,   217,   220,   225,   230,   233,   244,
- 247,   250,   259,   263,   272,   277,   278,   281,   284,   287,
- 290,   293,   296,   299,   302,   305,   308,   311,   314,   317,
- 320,   323,   326,   329,   332,   335,   338,   341,   344,   350,
- 355,   363,   364,   368,   374,   375,   378,   380,   387,   391,
- 395,   400,   406,   414,   420,   428,   432,   436,   440,   444,
- 451,   452,   453,   454,   455,   456,   457,   458,   459,   460,
- 461,   462,   463,   464,   465,   466,   467,   468,   469,   470,
- 471,   472,   473,   474,   475,   476,   477,   478,   479,   480,
- 481
+ 200,   203,   206,   209,   217,   228,   233,   238,   247,   258,
+ 261,   264,   273,   277,   286,   291,   292,   295,   298,   301,
+ 304,   307,   310,   313,   316,   319,   322,   325,   328,   331,
+ 334,   337,   340,   343,   346,   349,   352,   355,   358,   364,
+ 369,   377,   378,   382,   388,   389,   392,   394,   401,   405,
+ 409,   414,   420,   428,   434,   442,   446,   450,   454,   458,
+ 465,   466,   467,   468,   469,   470,   471,   472,   473,   474,
+ 475,   476,   477,   478,   479,   480,   481,   482,   483,   484,
+ 485,   486,   487,   488,   489,   490,   491,   492,   493,   494,
+ 495
 };
 #endif
 
@@ -1865,14 +1865,22 @@ yyreduce:
 /* Line 1464 of yacc.c  */
 #line 217 "glcpp/glcpp-parse.y"
 {
-   _glcpp_parser_expand_if (parser, IF_EXPANDED, (yyvsp[(2) - 
(3)].token_list));
+   /* If we're skipping to the next #elif/#else case or to #endif,
+* don't bother expanding or parsing the expression.
+*/
+   if (parser->skip_stack != NULL && parser->skip_stack->type != 
SKIP_NO_SKIP) {
+   _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) 
- (3)]), 0);
+   parser->skip_stack->type = SKIP_TO_ENDIF;
+   } else {
+   _glcpp_parser_expand_if (parser, IF_EXPANDED, 
(yyvsp[(2) - (3)].token_list));
+   }
;}
 break;
 
   case 15:
 
 /* Line 1464 of yacc.c  */
-#line 220 "glcpp/glcpp-parse.y"
+#line 228 "glcpp/glcpp-parse.y"
 {
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - 
(4)].str));
talloc_free ((yyvsp[(2) - (4)].str));
@@ -1883,7 +1891,7 @@ yyreduce:
   case 16:
 
 /* Line 1464 of yacc.c  */
-#line 225 "glcpp/glcpp-parse.y"
+#line 233 "glcpp/glcpp-parse.y"
 {
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - 
(4)].str));
talloc_free ((yyvsp[(2) - (4)].str));
@@ -1894,16 +1902,22 @@ yyreduce:
   case 17:
 
 /* Line 1464 of yacc.c  */
-#line 230 "glcpp/glcpp-parse.y"
+#line 238 "glcpp/glcpp-parse.y"
 {
-   _glcpp_parser_expand_if (parser, ELIF_EXPANDED, (yyvsp[(2) - 
(3)].token_list));
+   /* If we just finished a non-skipped #if/#ifdef/#ifndef block,
+* don't bother expanding or parsing the expression.
+*/
+   if (parser->skip_stack != NULL && parser->skip_stack->type == 
SKIP_NO_SKIP)
+   parser->skip_stack->type = SKIP_TO_ENDIF;
+   else
+   _glcpp_parser_expand_if (parser, ELIF_EXPANDED, 
(yyvsp[(2) - (3)].token_list));
;}
 break;
 
   case 18:
 
 /* Line 1464 of yacc.c  */
-#line 233 "glcpp/glcpp-parse.y"
+#line 247 "glcpp/glcpp-parse.y"
 {
/* #elif without an expression results in a warning if the
 * condition doesn't matter (we just handled #if 1 or such)
@@ -1920,7 +1934,7 @@ yyreduce:
   case 19:
 
 /* Line 1464 of yacc.c  */
-#line 244 "glcpp/glcpp-parse.y"
+#line 258 "glcpp/glcpp-parse.y"
 {
_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - 
(2)]), "else", 1);
;}
@@ -1929,7 +1943,7 @@ yyreduce:
   case 20:
 
 /* Line 1464 of yacc.c  */
-#line 247 "glcpp/glcpp-parse.y"
+#line 261 "glcpp/

Mesa (glsl2): glcpp/tests: Add a corollary to testcase 073 for testing #elif.

2010-08-04 Thread Kenneth Graunke
Module: Mesa
Branch: glsl2
Commit: d65135a7661c320c618151df0a94c852dc9bc621
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d65135a7661c320c618151df0a94c852dc9bc621

Author: Kenneth Graunke 
Date:   Wed Aug  4 16:22:31 2010 -0700

glcpp/tests: Add a corollary to testcase 073 for testing #elif.

---

 src/glsl/glcpp/tests/074-elif-undef.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glsl/glcpp/tests/074-elif-undef.c 
b/src/glsl/glcpp/tests/074-elif-undef.c
new file mode 100644
index 000..67aac89
--- /dev/null
+++ b/src/glsl/glcpp/tests/074-elif-undef.c
@@ -0,0 +1,3 @@
+#ifndef UNDEF
+#elif UNDEF < 0
+#endif

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


Mesa (glsl2): glcpp/tests: Fix 073-if-in-ifdef.c to use #ifdef, not #if.

2010-08-04 Thread Kenneth Graunke
Module: Mesa
Branch: glsl2
Commit: c52b2be16689fbbe8a8ec190dbe9dc7e469956a0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c52b2be16689fbbe8a8ec190dbe9dc7e469956a0

Author: Kenneth Graunke 
Date:   Wed Aug  4 16:21:33 2010 -0700

glcpp/tests: Fix 073-if-in-ifdef.c to use #ifdef, not #if.

The original intention was to use #ifdef.

---

 src/glsl/glcpp/tests/073-if-in-ifdef.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/glcpp/tests/073-if-in-ifdef.c 
b/src/glsl/glcpp/tests/073-if-in-ifdef.c
index b9155b5..61a4809 100644
--- a/src/glsl/glcpp/tests/073-if-in-ifdef.c
+++ b/src/glsl/glcpp/tests/073-if-in-ifdef.c
@@ -1,4 +1,4 @@
-#if UNDEF
+#ifdef UNDEF
 #if UNDEF > 1
 #endif
 #endif

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


Mesa (glsl2): glcpp: Refactor HASH_IF and HASH_ELIF expansion to reuse code .

2010-08-04 Thread Kenneth Graunke
Module: Mesa
Branch: glsl2
Commit: 16b4eed59a07f5e07587f4f9b0cdc304a08a685c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=16b4eed59a07f5e07587f4f9b0cdc304a08a685c

Author: Kenneth Graunke 
Date:   Wed Aug  4 16:10:03 2010 -0700

glcpp: Refactor HASH_IF and HASH_ELIF expansion to reuse code.

---

 src/glsl/glcpp/glcpp-parse.c |  247 +-
 src/glsl/glcpp/glcpp-parse.y |   39 
 2 files changed, 142 insertions(+), 144 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c
index 5ea07c2..df16cab 100644
--- a/src/glsl/glcpp/glcpp-parse.c
+++ b/src/glsl/glcpp/glcpp-parse.c
@@ -176,6 +176,9 @@ int
 _active_list_contains (active_list_t *list, const char *identifier);
 
 static void
+_glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list);
+
+static void
 _glcpp_parser_expand_token_list (glcpp_parser_t *parser,
 token_list_t *list);
 
@@ -208,7 +211,7 @@ add_builtin_define(glcpp_parser_t *parser, const char 
*name, int value);
 
 
 /* Line 189 of yacc.c  */
-#line 212 "glcpp/glcpp-parse.c"
+#line 215 "glcpp/glcpp-parse.c"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -296,7 +299,7 @@ typedef struct YYLTYPE
 
 
 /* Line 264 of yacc.c  */
-#line 300 "glcpp/glcpp-parse.c"
+#line 303 "glcpp/glcpp-parse.c"
 
 #ifdef short
 # undef short
@@ -620,17 +623,17 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-   0,   169,   169,   171,   175,   178,   183,   184,   188,   191,
- 197,   200,   203,   206,   214,   226,   231,   236,   248,   259,
- 262,   265,   274,   278,   287,   292,   293,   296,   299,   302,
- 305,   308,   311,   314,   317,   320,   323,   326,   329,   332,
- 335,   338,   341,   344,   347,   350,   353,   356,   359,   365,
- 370,   378,   379,   383,   389,   390,   393,   395,   402,   406,
- 410,   415,   421,   429,   435,   443,   447,   451,   455,   459,
- 466,   467,   468,   469,   470,   471,   472,   473,   474,   475,
- 476,   477,   478,   479,   480,   481,   482,   483,   484,   485,
- 486,   487,   488,   489,   490,   491,   492,   493,   494,   495,
- 496
+   0,   172,   172,   174,   178,   181,   186,   187,   191,   194,
+ 200,   203,   206,   209,   217,   220,   225,   230,   233,   244,
+ 247,   250,   259,   263,   272,   277,   278,   281,   284,   287,
+ 290,   293,   296,   299,   302,   305,   308,   311,   314,   317,
+ 320,   323,   326,   329,   332,   335,   338,   341,   344,   350,
+ 355,   363,   364,   368,   374,   375,   378,   380,   387,   391,
+ 395,   400,   406,   414,   420,   428,   432,   436,   440,   444,
+ 451,   452,   453,   454,   455,   456,   457,   458,   459,   460,
+ 461,   462,   463,   464,   465,   466,   467,   468,   469,   470,
+ 471,   472,   473,   474,   475,   476,   477,   478,   479,   480,
+ 481
 };
 #endif
 
@@ -1781,7 +1784,7 @@ yyreduce:
 case 4:
 
 /* Line 1464 of yacc.c  */
-#line 175 "glcpp/glcpp-parse.y"
+#line 178 "glcpp/glcpp-parse.y"
 {
glcpp_print(parser->output, "\n");
;}
@@ -1790,7 +1793,7 @@ yyreduce:
   case 5:
 
 /* Line 1464 of yacc.c  */
-#line 178 "glcpp/glcpp-parse.y"
+#line 181 "glcpp/glcpp-parse.y"
 {
_glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - 
(1)].token_list));
glcpp_print(parser->output, "\n");
@@ -1801,7 +1804,7 @@ yyreduce:
   case 8:
 
 /* Line 1464 of yacc.c  */
-#line 188 "glcpp/glcpp-parse.y"
+#line 191 "glcpp/glcpp-parse.y"
 {
_glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), 
(yyvsp[(2) - (3)].ival));
;}
@@ -1810,7 +1813,7 @@ yyreduce:
   case 9:
 
 /* Line 1464 of yacc.c  */
-#line 191 "glcpp/glcpp-parse.y"
+#line 194 "glcpp/glcpp-parse.y"
 {
_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - 
(3)]), "elif", (yyvsp[(2) - (3)].ival));
;}
@@ -1819,7 +1822,7 @@ yyreduce:
   case 10:
 
 /* Line 1464 of yacc.c  */
-#line 197 "glcpp/glcpp-parse.y"
+#line 200 "glcpp/glcpp-parse.y"
 {
_define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) 
- (4)].str), (yyvsp[(3) - (4)].token_list));
;}
@@ -1828,7 +1831,7 @@ yyreduce:
   case 11:
 
 /* Line 1464 of yacc.c  */
-#line 200 "glcpp/glcpp-parse.y"
+#line 203 "glcpp/glcpp-parse.y"
 {
_define_function_macro (parser, & (yylsp[(2) - (6)]), 
(yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list));
;}
@@ -1837,7 +1840,7 @@ yyreduce:
   case 12:
 
 /* Line 1464 of yacc.c  */
-#line 203 "glcpp/glcpp-parse.y"
+#line 206 "glcpp/glcpp-parse.y"
 {
_define_function_macro (parser, & (yylsp[(2) - (7)]), 
(yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - 
(7)].token_list)

Mesa (master): st/mesa: Add missing header in st_context.c.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 9c98e9e6b5b5f5508b67b3650dbaf00db407b5eb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c98e9e6b5b5f5508b67b3650dbaf00db407b5eb

Author: Vinson Lee 
Date:   Wed Aug  4 21:17:13 2010 -0700

st/mesa: Add missing header in st_context.c.

---

 src/mesa/state_tracker/st_context.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_context.c 
b/src/mesa/state_tracker/st_context.c
index 7eb5f32..820f584 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -28,6 +28,7 @@
 #include "main/imports.h"
 #include "main/context.h"
 #include "main/shaderobj.h"
+#include "program/prog_cache.h"
 #include "vbo/vbo.h"
 #include "glapi/glapi.h"
 #include "st_context.h"

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


Mesa (master): st/mesa: Add missing header in st_atom_pixeltransfer.c.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: a0989e94374a678fb6c2d0974255a178361c47a7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0989e94374a678fb6c2d0974255a178361c47a7

Author: Vinson Lee 
Date:   Wed Aug  4 21:13:33 2010 -0700

st/mesa: Add missing header in st_atom_pixeltransfer.c.

---

 src/mesa/state_tracker/st_atom_pixeltransfer.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c 
b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index b88c74f..8a8d175 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -37,6 +37,7 @@
 #include "main/image.h"
 #include "main/macros.h"
 #include "program/program.h"
+#include "program/prog_cache.h"
 #include "program/prog_instruction.h"
 #include "program/prog_parameter.h"
 #include "program/prog_print.h"

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


Mesa (master): st/mesa: Clean up header file inclusion in st_context.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 1525fb4afec0adc164948b4060ec1c0359441cd3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1525fb4afec0adc164948b4060ec1c0359441cd3

Author: Vinson Lee 
Date:   Wed Aug  4 21:09:27 2010 -0700

st/mesa: Clean up header file inclusion in st_context.h.

---

 src/mesa/state_tracker/st_context.h |   15 ++-
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/mesa/state_tracker/st_context.h 
b/src/mesa/state_tracker/st_context.h
index a147a02..60c25fb 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -1,3 +1,4 @@
+//struct dd_function_table;
 /**
  * 
  * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
@@ -29,21 +30,17 @@
 #define ST_CONTEXT_H
 
 #include "main/mtypes.h"
-#include "program/prog_cache.h"
 #include "pipe/p_state.h"
 #include "state_tracker/st_api.h"
 
-
-struct st_context;
-struct st_texture_object;
-struct st_fragment_program;
+struct bitmap_cache;
+struct blit_state;
+struct dd_function_table;
 struct draw_context;
 struct draw_stage;
-struct cso_cache;
-struct cso_blend;
 struct gen_mipmap_state;
-struct blit_state;
-struct bitmap_cache;
+struct st_context;
+struct st_fragment_program;
 
 
 #define ST_NEW_MESA0x1 /* Mesa state has changed */

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


Mesa (glsl2): glsl2: Remove the shader_in/ shader_out tracking separate from var->mode.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: 046bef235744e891e4a48076e1a3ff9a61a63092
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=046bef235744e891e4a48076e1a3ff9a61a63092

Author: Eric Anholt 
Date:   Wed Aug  4 20:33:57 2010 -0700

glsl2: Remove the shader_in/shader_out tracking separate from var->mode.

I introduced this for ir_dead_code to distinguish function parameter
outvals from varying outputs.  Only, since ast_to_hir's
current_function is unset when setting up function parameters (they're
needed for making the function signature in the first place), all
function parameter outvals were marked as shader outputs anyway.  This
meant that an inlined function's cloned outval was marked as a shader
output and couldn't be dead-code eliminated.  Instead, since
ir_dead_code doesn't even look at function parameters, just use
var->mode.

The longest Mesa IR coming out of ir_to_mesa for Yo Frankie drops from
725 instructions to 636.

---

 src/glsl/ast_to_hir.cpp   |   37 ++---
 src/glsl/ir.cpp   |4 
 src/glsl/ir.h |   14 --
 src/glsl/ir_clone.cpp |2 --
 src/glsl/ir_dead_code.cpp |3 ++-
 src/glsl/ir_variable.cpp  |   12 +---
 src/glsl/linker.cpp   |2 --
 7 files changed, 17 insertions(+), 57 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 14c5280..292c7be 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1510,31 +1510,6 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
else if (qual->uniform)
   var->mode = ir_var_uniform;
 
-   if (qual->uniform)
-  var->shader_in = true;
-
-   /* Any 'in' or 'inout' variables at global scope must be marked as being
-* shader inputs.  Likewise, any 'out' or 'inout' variables at global scope
-* must be marked as being shader outputs.
-*/
-   if (state->current_function == NULL) {
-  switch (var->mode) {
-  case ir_var_in:
-  case ir_var_uniform:
-var->shader_in = true;
-break;
-  case ir_var_out:
-var->shader_out = true;
-break;
-  case ir_var_inout:
-var->shader_in = true;
-var->shader_out = true;
-break;
-  default:
-break;
-  }
-   }
-
if (qual->flat)
   var->interpolation = ir_var_flat;
else if (qual->noperspective)
@@ -1702,11 +1677,19 @@ ast_declarator_list::hir(exec_list *instructions,
   & loc);
 
   if (this->type->qualifier.invariant) {
-if ((state->target == vertex_shader) && !var->shader_out) {
+if ((state->target == vertex_shader) && !(var->mode == ir_var_out ||
+  var->mode == ir_var_inout)) {
+   /* FINISHME: Note that this doesn't work for invariant on
+* a function signature outval
+*/
_mesa_glsl_error(& loc, state,
 "`%s' cannot be marked invariant, vertex shader "
 "outputs only\n", var->name);
-} else if ((state->target == fragment_shader) && !var->shader_in) {
+} else if ((state->target == fragment_shader) &&
+   !(var->mode == ir_var_in || var->mode == ir_var_inout)) {
+   /* FINISHME: Note that this doesn't work for invariant on
+* a function signature inval
+*/
_mesa_glsl_error(& loc, state,
 "`%s' cannot be marked invariant, fragment shader "
 "inputs only\n", var->name);
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index c3bade8..dd059e4 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -902,7 +902,6 @@ ir_swizzle::variable_referenced()
 ir_variable::ir_variable(const struct glsl_type *type, const char *name,
 ir_variable_mode mode)
: max_array_access(0), read_only(false), centroid(false), invariant(false),
- shader_in(false), shader_out(false),
  mode(mode), interpolation(ir_var_smooth), array_lvalue(false)
 {
this->ir_type = ir_type_variable;
@@ -922,9 +921,6 @@ ir_variable::ir_variable(const struct glsl_type *type, 
const char *name,
 const char *
 ir_variable::interpolation_string() const
 {
-   if (!this->shader_in && !this->shader_out)
-  return "";
-
switch (this->interpolation) {
case ir_var_smooth:return "smooth";
case ir_var_flat:  return "flat";
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 9878950..e614858 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -194,10 +194,10 @@ public:
/**
 * Get the string value for the interpolation qualifier
 *
-* \return
-* If none of \c shader_in or \c shader_out is set, an empty string will
-* be returned.  Otherwise the string that would be used in a shader to
-* specify \c mode will be returned.
+* \return The string that would be used in a shader to spe

Mesa (glsl2): i965: Settle on printing our program debug to stdout.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: 72fd0568db0ce5f25a1eee0266ec1e7cb3dafab0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=72fd0568db0ce5f25a1eee0266ec1e7cb3dafab0

Author: Eric Anholt 
Date:   Wed Aug  4 19:55:52 2010 -0700

i965: Settle on printing our program debug to stdout.

Mixing stderr (_mesa_print_program, _mesa_print_instruction,
_mesa_print_alu) with stdout means that when writing both to a file,
there isn't a consistent ordering between the two.

---

 src/mesa/drivers/dri/i965/brw_vs.c  |8 +++---
 src/mesa/drivers/dri/i965/brw_vs_emit.c |3 +-
 src/mesa/drivers/dri/i965/brw_wm_fp.c   |   10 
 src/mesa/program/prog_print.c   |   32 +++---
 src/mesa/program/prog_print.h   |7 ++
 5 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs.c 
b/src/mesa/drivers/dri/i965/brw_vs.c
index 9a832af..9f90e1e 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -75,10 +75,10 @@ static void do_vs_prog( struct brw_context *brw,
 c.prog_data.outputs_written |= BITFIELD64_BIT(VERT_RESULT_TEX0 + i);
}
 
-   if (0)
-  _mesa_print_program(&c.vp->program.Base);
-
-
+   if (0) {
+  _mesa_fprint_program_opt(stdout, &c.vp->program.Base, PROG_PRINT_DEBUG,
+  GL_TRUE);
+   }
 
/* Emit GEN4 code.
 */
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c 
b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index c1d6525..d2bd2c7 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -1564,7 +1564,8 @@ void brw_vs_emit(struct brw_vs_compile *c )
 
if (INTEL_DEBUG & DEBUG_VS) {
   printf("vs-mesa:\n");
-  _mesa_print_program(&c->vp->program.Base); 
+  _mesa_fprint_program_opt(stdout, &c->vp->program.Base, PROG_PRINT_DEBUG,
+  GL_TRUE);
   printf("\n");
}
 
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c 
b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index df9e54c..3870bf1 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -1037,13 +1037,12 @@ static void print_insns( const struct prog_instruction 
*insn,
for (i = 0; i < nr; i++, insn++) {
   printf("%3d: ", i);
   if (insn->Opcode < MAX_OPCODE)
-_mesa_print_instruction(insn);
+_mesa_fprint_instruction_opt(stdout, insn, 0, PROG_PRINT_DEBUG, NULL);
   else if (insn->Opcode < MAX_WM_OPCODE) {
 GLuint idx = insn->Opcode - MAX_OPCODE;
 
-_mesa_print_alu_instruction(insn,
-wm_opcode_strings[idx],
-3);
+_mesa_fprint_alu_instruction(stdout, insn, wm_opcode_strings[idx],
+ 3, PROG_PRINT_DEBUG, NULL);
   }
   else 
 printf("965 Opcode %d\n", insn->Opcode);
@@ -1062,7 +1061,8 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
 
if (INTEL_DEBUG & DEBUG_WM) {
   printf("pre-fp:\n");
-  _mesa_print_program(&fp->program.Base); 
+  _mesa_fprint_program_opt(stdout, &fp->program.Base, PROG_PRINT_DEBUG,
+  GL_TRUE);
   printf("\n");
}
 
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index b66d709..1ce1bf2 100644
--- a/src/mesa/program/prog_print.c
+++ b/src/mesa/program/prog_print.c
@@ -540,12 +540,12 @@ fprint_comment(FILE *f, const struct prog_instruction 
*inst)
 }
 
 
-static void
-fprint_alu_instruction(FILE *f,
-   const struct prog_instruction *inst,
-   const char *opcode_string, GLuint numRegs,
-   gl_prog_print_mode mode,
-   const struct gl_program *prog)
+void
+_mesa_fprint_alu_instruction(FILE *f,
+const struct prog_instruction *inst,
+const char *opcode_string, GLuint numRegs,
+gl_prog_print_mode mode,
+const struct gl_program *prog)
 {
GLuint j;
 
@@ -582,8 +582,8 @@ void
 _mesa_print_alu_instruction(const struct prog_instruction *inst,
 const char *opcode_string, GLuint numRegs)
 {
-   fprint_alu_instruction(stderr, inst, opcode_string,
-  numRegs, PROG_PRINT_DEBUG, NULL);
+   _mesa_fprint_alu_instruction(stderr, inst, opcode_string,
+   numRegs, PROG_PRINT_DEBUG, NULL);
 }
 
 
@@ -791,16 +791,16 @@ _mesa_fprint_instruction_opt(FILE *f,
default:
   if (inst->Opcode < MAX_OPCODE) {
  /* typical alu instruction */
- fprint_alu_instruction(f, inst,
-_mesa_opcode_string(inst->Opcode),
-_mesa_num_inst_src_regs(inst->Opcode),
-mode, prog);
+ _mesa_fprint_alu_instruction(f, inst,
+ 

Mesa (glsl2): ir_to_mesa: Print shader source and compiled IR under MESA_GLSL=dump.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: 455290e4281bf53ce2fe248a2adf5163563c44c8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=455290e4281bf53ce2fe248a2adf5163563c44c8

Author: Eric Anholt 
Date:   Wed Aug  4 19:43:41 2010 -0700

ir_to_mesa: Print shader source and compiled IR under MESA_GLSL=dump.

While the Mesa IR dumping includes some corresponding GLSL IR for
correlating Mesa IR to GLSL IR, it doesn't completely express it.
This printing includes things like variable declarations and control
flow structure that is hard to read otherwise.

---

 src/mesa/program/ir_to_mesa.cpp |   18 +-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 1cec4aa..2fd07ca 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2545,7 +2545,14 @@ get_mesa_program(GLcontext *ctx, struct 
gl_shader_program *shader_program,
 
set_branchtargets(&v, mesa_instructions, num_instructions);
if (ctx->Shader.Flags & GLSL_DUMP) {
-  printf("Mesa %s program:\n", target_string);
+  printf("\n");
+  printf("GLSL IR for linked %s program %d:\n", target_string,
+shader_program->Name);
+  _mesa_print_ir(shader->ir, NULL);
+  printf("\n");
+  printf("\n");
+  printf("Mesa IR for linked %s program %d:\n", target_string,
+shader_program->Name);
   print_program(mesa_instructions, mesa_instruction_annotation,
num_instructions);
}
@@ -2635,6 +2642,15 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct 
gl_shader *shader)
   _mesa_write_shader_to_file(shader);
}
 
+   if (ctx->Shader.Flags & GLSL_DUMP) {
+  printf("GLSL source for shader %d:\n", shader->Name);
+  printf("%s\n", shader->Source);
+
+  printf("GLSL IR for shader %d:\n", shader->Name);
+  _mesa_print_ir(shader->ir, NULL);
+  printf("\n\n");
+   }
+
/* Retain any live IR, but trash the rest. */
reparent_ir(shader->ir, shader);
 

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


Mesa (glsl2): glsl2: Remove a dead cut and paste member from ir_variable_refcount_visitor.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: a08f27940ac72538ce0b264917207111d629f097
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a08f27940ac72538ce0b264917207111d629f097

Author: Eric Anholt 
Date:   Wed Aug  4 20:03:15 2010 -0700

glsl2: Remove a dead cut and paste member from ir_variable_refcount_visitor.

---

 src/glsl/ir_variable_refcount.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ir_variable_refcount.h b/src/glsl/ir_variable_refcount.h
index d69cab5..30dd2bd 100644
--- a/src/glsl/ir_variable_refcount.h
+++ b/src/glsl/ir_variable_refcount.h
@@ -78,8 +78,6 @@ public:
 
variable_entry *get_variable_entry(ir_variable *var);
 
-   bool (*predicate)(ir_instruction *ir);
-
/* List of variable_entry */
exec_list variable_list;
 

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


Mesa (glsl2): glsl2: Use linked ir_constant_variable after linking, instead of unlinked.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: e3a90b8e38b1d0de9f473caca96779e215071315
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e3a90b8e38b1d0de9f473caca96779e215071315

Author: Eric Anholt 
Date:   Wed Aug  4 17:12:14 2010 -0700

glsl2: Use linked ir_constant_variable after linking, instead of unlinked.

---

 src/glsl/linker.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 10fd2d5..b2953c6 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1293,7 +1293,7 @@ link_shaders(struct gl_shader_program *prog)
 progress = do_dead_code_local(ir) || progress;
 progress = do_dead_code(ir) || progress;
 progress = do_tree_grafting(ir) || progress;
-progress = do_constant_variable_unlinked(ir) || progress;
+progress = do_constant_variable(ir) || progress;
 progress = do_constant_folding(ir) || progress;
 progress = do_algebraic(ir) || progress;
 progress = do_if_return(ir) || progress;

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


Mesa (glsl2): glsl2: Return progress from ir_vec_index_to_swizzle.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: 022f79e49648d465d2db0240554f58ac42754584
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=022f79e49648d465d2db0240554f58ac42754584

Author: Eric Anholt 
Date:   Wed Aug  4 16:32:12 2010 -0700

glsl2: Return progress from ir_vec_index_to_swizzle.

---

 src/glsl/ir_vec_index_to_swizzle.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/ir_vec_index_to_swizzle.cpp 
b/src/glsl/ir_vec_index_to_swizzle.cpp
index b3de91f..969dc8f 100644
--- a/src/glsl/ir_vec_index_to_swizzle.cpp
+++ b/src/glsl/ir_vec_index_to_swizzle.cpp
@@ -153,5 +153,5 @@ do_vec_index_to_swizzle(exec_list *instructions)
 
v.run(instructions);
 
-   return false;
+   return v.progress;
 }

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


Mesa (master): st/mesa: Add missing header in st_cb_xformfb.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 6f8b6661ce3af17d3cfe4f28ff15f82caf6755b5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f8b6661ce3af17d3cfe4f28ff15f82caf6755b5

Author: Vinson Lee 
Date:   Wed Aug  4 20:58:22 2010 -0700

st/mesa: Add missing header in st_cb_xformfb.h.

---

 src/mesa/state_tracker/st_cb_xformfb.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_xformfb.h 
b/src/mesa/state_tracker/st_cb_xformfb.h
index 50efcb9..574cf48 100644
--- a/src/mesa/state_tracker/st_cb_xformfb.h
+++ b/src/mesa/state_tracker/st_cb_xformfb.h
@@ -29,6 +29,10 @@
 #define ST_CB_XFORMFB_H
 
 
+#include "main/compiler.h"
+
+struct dd_function_table;
+
 #if FEATURE_EXT_transform_feedback
 
 extern void

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


Mesa (master): st/mesa: Clean up st_cb_viewport.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: cb7638579e22a8854d13d58c435c90b2e596e946
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb7638579e22a8854d13d58c435c90b2e596e946

Author: Vinson Lee 
Date:   Wed Aug  4 17:04:38 2010 -0700

st/mesa: Clean up st_cb_viewport.h.

Add inclusion guard.
Add forward declaration.

---

 src/mesa/state_tracker/st_cb_viewport.h |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_viewport.h 
b/src/mesa/state_tracker/st_cb_viewport.h
index db7dd6e..bcfd7cb 100644
--- a/src/mesa/state_tracker/st_cb_viewport.h
+++ b/src/mesa/state_tracker/st_cb_viewport.h
@@ -25,5 +25,12 @@
  *
  **/
 
+#ifndef ST_CB_VIEWPORT_H
+#define ST_CB_VIEWPORT_H
+
+struct dd_function_table;
+
 extern void
 st_init_viewport_functions(struct dd_function_table *functions);
+
+#endif /* ST_CB_VIEW_PORT_H */

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


Mesa (master): st/mesa: Add missing headers in st_cb_texture.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: e857293299c5bc38de683f199fe1ec7833aff61c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e857293299c5bc38de683f199fe1ec7833aff61c

Author: Vinson Lee 
Date:   Wed Aug  4 16:59:12 2010 -0700

st/mesa: Add missing headers in st_cb_texture.h.

---

 src/mesa/state_tracker/st_cb_texture.h |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.h 
b/src/mesa/state_tracker/st_cb_texture.h
index 1cd9fc3..6942478 100644
--- a/src/mesa/state_tracker/st_cb_texture.h
+++ b/src/mesa/state_tracker/st_cb_texture.h
@@ -30,6 +30,13 @@
 #define ST_CB_TEXTURE_H
 
 
+#include "main/glheader.h"
+#include "main/mtypes.h"
+
+struct dd_function_table;
+struct pipe_context;
+struct st_context;
+
 extern GLboolean
 st_finalize_texture(GLcontext *ctx,
struct pipe_context *pipe, 

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


Mesa (master): dri/nouveau: Don't try to validate uninitialized teximages.

2010-08-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: bc578caefb29cb9d1720d51698e2cd23ee490c44
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc578caefb29cb9d1720d51698e2cd23ee490c44

Author: Francisco Jerez 
Date:   Wed Aug  4 16:38:57 2010 +0200

dri/nouveau: Don't try to validate uninitialized teximages.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 79b6757..442f4e8 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -183,10 +183,10 @@ teximage_fits(struct gl_texture_object *t, int level)
struct nouveau_surface *s = &to_nouveau_texture(t)->surfaces[level];
struct gl_texture_image *ti = t->Image[0][level];
 
-   return ti && (t->Target == GL_TEXTURE_RECTANGLE ||
- (s->bo && s->width == ti->Width &&
-  s->height == ti->Height &&
-  s->format == ti->TexFormat));
+   return ti && to_nouveau_teximage(ti)->surface.bo &&
+   (t->Target == GL_TEXTURE_RECTANGLE ||
+(s->bo && s->format == ti->TexFormat &&
+ s->width == ti->Width && s->height == ti->Height));
 }
 
 static GLboolean

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


Mesa (master): dri/nv20: Fix some PGRAPH_ERRORs seen with DATA_CHECK enabled.

2010-08-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: d03f04bfb57cb7b5537cb31f1dc798a6ba500f36
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d03f04bfb57cb7b5537cb31f1dc798a6ba500f36

Author: Francisco Jerez 
Date:   Wed Jul 28 22:32:49 2010 +0200

dri/nv20: Fix some PGRAPH_ERRORs seen with DATA_CHECK enabled.

---

 src/mesa/drivers/dri/nouveau/nv20_state_fb.c  |5 -
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c |3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
index 21da4f7..95691ca 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
@@ -72,7 +72,7 @@ nv20_emit_framebuffer(GLcontext *ctx, int emit)
fb->_ColorDrawBuffers[0])->surface;
 
rt_format |= get_rt_format(s->format);
-   zeta_pitch = rt_pitch = s->pitch;
+   rt_pitch = s->pitch;
 
nouveau_bo_markl(bctx, kelvin, NV20TCL_COLOR_OFFSET,
 s->bo, 0, bo_flags);
@@ -88,6 +88,9 @@ nv20_emit_framebuffer(GLcontext *ctx, int emit)
 
nouveau_bo_markl(bctx, kelvin, NV20TCL_ZETA_OFFSET,
 s->bo, 0, bo_flags);
+   } else {
+   rt_format |= get_rt_format(MESA_FORMAT_Z24_S8);
+   zeta_pitch = rt_pitch;
}
 
BEGIN_RING(chan, kelvin, NV20TCL_RT_FORMAT, 2);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index e46118e..2d45513 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -194,7 +194,8 @@ nv20_emit_tex_obj(GLcontext *ctx, int emit)
| nvgl_wrap_mode(t->WrapS) << 0;
 
tx_filter = nvgl_filter_mode(t->MagFilter) << 24
-   | nvgl_filter_mode(t->MinFilter) << 16;
+   | nvgl_filter_mode(t->MinFilter) << 16
+   | 2 << 12;
 
tx_enable = NV20TCL_TX_ENABLE_ENABLE
| log2i(t->MaxAnisotropy) << 4;

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


Mesa (master): dri/nouveau: Fix up software mipmap generation.

2010-08-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: e96a52e9933eea7264a42983db1428368bcb4962
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e96a52e9933eea7264a42983db1428368bcb4962

Author: Francisco Jerez 
Date:   Wed Jul 28 18:37:24 2010 +0200

dri/nouveau: Fix up software mipmap generation.

---

 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |7 +--
 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   49 
 2 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 8be7edb..bd1273b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -220,7 +220,7 @@ get_tex_format(struct gl_texture_image *ti)
case MESA_FORMAT_RGB565:
return GL_RGB5;
default:
-   assert(0);
+   return GL_NONE;
}
 }
 
@@ -231,7 +231,6 @@ nouveau_render_texture(GLcontext *ctx, struct 
gl_framebuffer *fb,
struct gl_renderbuffer *rb = att->Renderbuffer;
struct gl_texture_image *ti =
att->Texture->Image[att->CubeMapFace][att->TextureLevel];
-   int ret;
 
/* Allocate a renderbuffer object for the texture if we
 * haven't already done so. */
@@ -244,9 +243,7 @@ nouveau_render_texture(GLcontext *ctx, struct 
gl_framebuffer *fb,
}
 
/* Update the renderbuffer fields from the texture. */
-   ret = set_renderbuffer_format(rb, get_tex_format(ti));
-   assert(ret);
-
+   set_renderbuffer_format(rb, get_tex_format(ti));
rb->Width = ti->Width;
rb->Height = ti->Height;
nouveau_surface_ref(&to_nouveau_teximage(ti)->surface,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index dbf9a5c..79b6757 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -38,6 +38,7 @@
 #include "main/mipmap.h"
 #include "main/texfetch.h"
 #include "main/teximage.h"
+#include "drivers/common/meta.h"
 
 static struct gl_texture_object *
 nouveau_texture_new(GLcontext *ctx, GLuint name, GLenum target)
@@ -589,6 +590,53 @@ nouveau_texture_unmap(GLcontext *ctx, struct 
gl_texture_object *t)
}
 }
 
+static void
+store_mipmap(GLcontext *ctx, GLenum target, int first, int last,
+struct gl_texture_object *t)
+{
+   struct gl_pixelstore_attrib packing = {
+   .BufferObj = ctx->Shared->NullBufferObj,
+   .Alignment = 1
+   };
+   GLenum format = t->Image[0][first]->TexFormat;
+   unsigned base_format, type, comps;
+   int i;
+
+   base_format = _mesa_get_format_base_format(format);
+   _mesa_format_to_type_and_comps(format, &type, &comps);
+
+   for (i = first; i <= last; i++) {
+   struct gl_texture_image *ti = t->Image[0][i];
+   void *data = ti->Data;
+
+   nouveau_teximage(ctx, 3, target, i, ti->InternalFormat,
+ti->Width, ti->Height, ti->Depth,
+ti->Border, base_format, type, data,
+&packing, t, ti);
+
+   _mesa_free_texmemory(data);
+   }
+}
+
+static void
+nouveau_generate_mipmap(GLcontext *ctx, GLenum target,
+   struct gl_texture_object *t)
+{
+   if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, t)) {
+   struct gl_texture_image *base = t->Image[0][t->BaseLevel];
+
+   nouveau_teximage_map(ctx, base);
+   _mesa_generate_mipmap(ctx, target, t);
+   nouveau_teximage_unmap(ctx, base);
+
+   store_mipmap(ctx, target, t->BaseLevel + 1,
+get_last_level(t), t);
+
+   } else {
+   _mesa_meta_GenerateMipmap(ctx, target, t);
+   }
+}
+
 void
 nouveau_texture_functions_init(struct dd_function_table *functions)
 {
@@ -607,4 +655,5 @@ nouveau_texture_functions_init(struct dd_function_table 
*functions)
functions->BindTexture = nouveau_bind_texture;
functions->MapTexture = nouveau_texture_map;
functions->UnmapTexture = nouveau_texture_unmap;
+   functions->GenerateMipmap = nouveau_generate_mipmap;
 }

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


Mesa (glsl2): glsl2: Generate masked assignments in some expanded matrix operations

2010-08-04 Thread Ian Romanick
Module: Mesa
Branch: glsl2
Commit: 83cb310dbb47357c4b3065ca0d6739796d9e371f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=83cb310dbb47357c4b3065ca0d6739796d9e371f

Author: Ian Romanick 
Date:   Wed Aug  4 16:27:55 2010 -0700

glsl2: Generate masked assignments in some expanded matrix operations

---

 src/glsl/ir_mat_op_to_vec.cpp |   15 ++-
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp
index 742fc2a..880454c 100644
--- a/src/glsl/ir_mat_op_to_vec.cpp
+++ b/src/glsl/ir_mat_op_to_vec.cpp
@@ -44,7 +44,7 @@ public:
 
ir_visitor_status visit_leave(ir_assignment *);
 
-   ir_rvalue *get_column(ir_variable *var, int col);
+   ir_dereference *get_column(ir_variable *var, int col);
ir_rvalue *get_element(ir_variable *var, int col, int row);
 
void do_mul_mat_mat(ir_variable *result_var,
@@ -109,7 +109,7 @@ ir_mat_op_to_vec_visitor::get_element(ir_variable *var, int 
col, int row)
return new(base_ir) ir_swizzle(deref, row, 0, 0, 0, 1);
 }
 
-ir_rvalue *
+ir_dereference *
 ir_mat_op_to_vec_visitor::get_column(ir_variable *var, int row)
 {
ir_dereference *deref;
@@ -314,7 +314,9 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign)
case ir_binop_add:
case ir_binop_sub:
case ir_binop_div:
-   case ir_binop_mod:
+   case ir_binop_mod: {
+  const unsigned mask = (1U << result_var->type->vector_elements) - 1;
+
   /* For most operations, the matrix version is just going
* column-wise through and applying the operation to each column
* if available.
@@ -322,7 +324,7 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign)
   for (i = 0; i < matrix_columns; i++) {
 ir_rvalue *op0 = get_column(op_var[0], i);
 ir_rvalue *op1 = get_column(op_var[1], i);
-ir_rvalue *result = get_column(result_var, i);
+ir_dereference *result = get_column(result_var, i);
 ir_expression *column_expr;
 ir_assignment *column_assign;
 
@@ -333,10 +335,13 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment 
*assign)
 
 column_assign = new(base_ir) ir_assignment(result,
column_expr,
-   NULL);
+   NULL,
+   mask);
+assert(column_assign->write_mask != 0);
 base_ir->insert_before(column_assign);
   }
   break;
+   }
case ir_binop_mul:
   if (op_var[0]->type->is_matrix()) {
 if (op_var[1]->type->is_matrix()) {

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


Mesa (glsl2): glsl2: Generate masked assignments in vector and matrix constructors

2010-08-04 Thread Ian Romanick
Module: Mesa
Branch: glsl2
Commit: 3d58be6135e71e6105ae65850f2dbeaf9ecff5c3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d58be6135e71e6105ae65850f2dbeaf9ecff5c3

Author: Ian Romanick 
Date:   Tue Aug  3 16:05:54 2010 -0700

glsl2: Generate masked assignments in vector and matrix constructors

Previously the in-line matrix and vector constructors would generate
swizzles in the LHS.  The code is actually more clear if it just
generates the masked assignments instead of relying on the
ir_assignment constructor to convert the swizzles to write masks.

---

 src/glsl/ast_function.cpp |   82 +
 1 files changed, 46 insertions(+), 36 deletions(-)

diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index c22dfa8..1b8b319 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -572,16 +572,17 @@ emit_inline_vector_constructor(const glsl_type *type,
   ir_rvalue *rhs = new(ctx) ir_swizzle(first_param, 0, 0, 0, 0,
   lhs_components);
   ir_dereference_variable *lhs = new(ctx) ir_dereference_variable(var);
+  const unsigned mask = (1U << lhs_components) - 1;
 
   assert(rhs->type == lhs->type);
 
-  ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL);
+  ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL, mask);
   instructions->push_tail(inst);
} else {
   unsigned base_component = 0;
   foreach_list(node, parameters) {
-ir_rvalue *rhs = (ir_rvalue *) node;
-unsigned rhs_components = rhs->type->components();
+ir_rvalue *param = (ir_rvalue *) node;
+unsigned rhs_components = param->type->components();
 
 /* Do not try to assign more components to the vector than it has!
  */
@@ -589,19 +590,23 @@ emit_inline_vector_constructor(const glsl_type *type,
rhs_components = lhs_components - base_component;
 }
 
-/* Emit an assignment of the constructor parameter to the next set of
- * components in the temporary variable.
+/* Generate a swizzle that puts the first element of the source at
+ * the location of the first element of the destination.
  */
-unsigned mask[4] = { 0, 0, 0, 0 };
-for (unsigned i = 0; i < rhs_components; i++) {
-   mask[i] = i + base_component;
-}
+unsigned swiz[4] = { 0, 0, 0, 0 };
+for (unsigned i = 0; i < rhs_components; i++)
+   swiz[i + base_component] = i;
 
+/* Mask of fields to be written in the assignment.
+ */
+const unsigned write_mask = ((1U << rhs_components) - 1)
+   << base_component;
 
-ir_rvalue *lhs_ref = new(ctx) ir_dereference_variable(var);
-ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, mask, rhs_components);
+ir_dereference *lhs = new(ctx) ir_dereference_variable(var);
+ir_rvalue *rhs = new(ctx) ir_swizzle(param, swiz, lhs_components);
 
-ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL);
+ir_instruction *inst =
+   new(ctx) ir_assignment(lhs, rhs, NULL, write_mask);
 instructions->push_tail(inst);
 
 /* Advance the component index by the number of components that were
@@ -631,18 +636,27 @@ assign_to_matrix_column(ir_variable *var, unsigned 
column, unsigned row_base,
ir_rvalue *src, unsigned src_base, unsigned count,
void *mem_ctx)
 {
-   const unsigned mask[8] = { 0, 1, 2, 3, 0, 0, 0, 0 };
-
ir_constant *col_idx = new(mem_ctx) ir_constant(column);
-   ir_rvalue *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx);
+   ir_dereference *column_ref = new(mem_ctx) ir_dereference_array(var, 
col_idx);
 
assert(column_ref->type->components() >= (row_base + count));
-   ir_rvalue *lhs = new(mem_ctx) ir_swizzle(column_ref, &mask[row_base], 
count);
-
assert(src->type->components() >= (src_base + count));
-   ir_rvalue *rhs = new(mem_ctx) ir_swizzle(src, &mask[src_base], count);
 
-   return new(mem_ctx) ir_assignment(lhs, rhs, NULL);
+   /* Generate a swizzle that puts the first element of the source at the
+* location of the first element of the destination.
+*/
+   unsigned swiz[4] = { src_base, src_base, src_base, src_base };
+   for (unsigned i = 0; i < count; i++)
+  swiz[i + row_base] = src_base + i;
+
+   ir_rvalue *const rhs =
+  new(mem_ctx) ir_swizzle(src, swiz, column_ref->type->components());
+
+   /* Mask of fields to be written in the assignment.
+*/
+   const unsigned write_mask = ((1U << count) - 1) << row_base;
+
+   return new(mem_ctx) ir_assignment(column_ref, rhs, NULL, write_mask);
 }
 
 
@@ -704,10 +718,9 @@ emit_inline_matrix_constructor(const glsl_type *type,
NULL);
   instructions->push_tail(inst);
 
-  ir_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var);
- 

Mesa (glsl2): glsl2: Additional validation of write masks

2010-08-04 Thread Ian Romanick
Module: Mesa
Branch: glsl2
Commit: 6235c6a83855fe2818affda3c82e1a245bd0232e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6235c6a83855fe2818affda3c82e1a245bd0232e

Author: Ian Romanick 
Date:   Wed Aug  4 16:27:17 2010 -0700

glsl2: Additional validation of write masks

---

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

diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 89bcd1c..701bf21 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -67,6 +67,8 @@ public:
 
virtual ir_visitor_status visit_leave(ir_expression *ir);
 
+   virtual ir_visitor_status visit_enter(ir_assignment *ir);
+
static void validate_ir(ir_instruction *ir, void *data);
 
ir_function *current_function;
@@ -320,6 +322,36 @@ ir_validate::visit(ir_variable *ir)
return visit_continue;
 }
 
+ir_visitor_status
+ir_validate::visit_enter(ir_assignment *ir)
+{
+   const ir_dereference *const lhs = ir->lhs;
+   if (lhs->type->is_scalar() || lhs->type->is_vector()) {
+  if (ir->write_mask == 0) {
+printf("Assignment LHS is %s, but write mask is 0:\n",
+   lhs->type->is_scalar() ? "scalar" : "vector");
+ir->print();
+abort();
+  }
+
+  /* Mask of fields that do not exist in the destination.  These should
+   * not be written by the assignment.
+   */
+  const unsigned invalid_mask = ~((1U << lhs->type->components()) - 1);
+
+  if ((invalid_mask & ir->write_mask) != 0) {
+printf("Assignment write mask enables invalid components for "
+   "type %s:\n", lhs->type->name);
+ir->print();
+abort();
+  }
+   }
+
+   this->validate_ir(ir, this->data);
+
+   return visit_continue;
+}
+
 void
 ir_validate::validate_ir(ir_instruction *ir, void *data)
 {

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


Mesa (glsl2): glsl2: Add ir_assignment::write_mask and associated methods

2010-08-04 Thread Ian Romanick
Module: Mesa
Branch: glsl2
Commit: 5a7758efbe14dee026245a4f4f4fb3ccf7b2c23b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a7758efbe14dee026245a4f4f4fb3ccf7b2c23b

Author: Ian Romanick 
Date:   Mon Aug  2 18:48:25 2010 -0700

glsl2: Add ir_assignment::write_mask and associated methods

Replace swizzles on the LHS with additional swizzles on the RHS and a
write mask in the assignment instruction.  As part of this add
ir_assignment::set_lhs.  Ideally we'd make ir_assignment::lhs private
to prevent erroneous writes, but that would require a lot of code
butchery at this point.

Add ir_assignment constructor that takes an explicit write mask.  This
is required for ir_assignment::clone, but it can also be used in other
places.  Without this, ir_assignment clones lose their write masks,
and incorrect IR is generated in optimization passes.

Add ir_assignment::whole_variable_written method.  This method gets
the variable on the LHS if the whole variable is written or NULL
otherwise.  This is different from
ir->lhs->whole_variable_referenced() because the latter has no
knowledge of the write mask stored in the ir_assignment.

Gut all code from ir_to_mesa that handled swizzles on the LHS of
assignments.  There is probably some other refactoring that could be
done here, but that can be left for another day.

---

 src/glsl/ir.cpp  |  113 +-
 src/glsl/ir.h|   44 +-
 src/glsl/ir_clone.cpp|3 +-
 src/glsl/ir_constant_variable.cpp|2 +-
 src/glsl/ir_copy_propagation.cpp |2 +-
 src/glsl/ir_dead_code_local.cpp  |2 +-
 src/glsl/ir_print_visitor.cpp|   14 -
 src/glsl/ir_tree_grafting.cpp|2 +-
 src/glsl/ir_vec_index_to_swizzle.cpp |2 +-
 src/mesa/program/ir_to_mesa.cpp  |   67 -
 10 files changed, 199 insertions(+), 52 deletions(-)

diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 79cbaa9..c3bade8 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -22,6 +22,7 @@
  */
 #include 
 #include "main/imports.h"
+#include "main/macros.h"
 #include "ir.h"
 #include "ir_visitor.h"
 #include "glsl_types.h"
@@ -31,13 +32,121 @@ ir_rvalue::ir_rvalue()
this->type = glsl_type::error_type;
 }
 
+/**
+ * Modify the swizzle make to move one component to another
+ *
+ * \param mIR swizzle to be modified
+ * \param from Component in the RHS that is to be swizzled
+ * \param to   Desired swizzle location of \c from
+ */
+static void
+update_rhs_swizzle(ir_swizzle_mask &m, unsigned from, unsigned to)
+{
+   switch (to) {
+   case 0: m.x = from; break;
+   case 1: m.y = from; break;
+   case 2: m.z = from; break;
+   case 3: m.w = from; break;
+   default: assert(!"Should not get here.");
+   }
+
+   m.num_components = MAX2(m.num_components, (to + 1));
+}
+
+void
+ir_assignment::set_lhs(ir_rvalue *lhs)
+{
+   while (lhs != NULL) {
+  ir_swizzle *swiz = lhs->as_swizzle();
+
+  if (swiz == NULL)
+break;
+
+  unsigned write_mask = 0;
+  ir_swizzle_mask rhs_swiz = { 0, 0, 0, 0, 0, 0 };
+
+  for (unsigned i = 0; i < swiz->mask.num_components; i++) {
+unsigned c = 0;
+
+switch (i) {
+case 0: c = swiz->mask.x; break;
+case 1: c = swiz->mask.y; break;
+case 2: c = swiz->mask.z; break;
+case 3: c = swiz->mask.w; break;
+default: assert(!"Should not get here.");
+}
+
+write_mask |= (((this->write_mask >> i) & 1) << c);
+update_rhs_swizzle(rhs_swiz, i, c);
+  }
+
+  this->write_mask = write_mask;
+  lhs = swiz->val;
+
+  this->rhs = new(this) ir_swizzle(this->rhs, rhs_swiz);
+   }
+
+   assert((lhs == NULL) || lhs->as_dereference());
+
+   this->lhs = (ir_dereference *) lhs;
+}
+
+ir_variable *
+ir_assignment::whole_variable_written()
+{
+   ir_variable *v = this->lhs->whole_variable_referenced();
+
+   if (v == NULL)
+  return NULL;
+
+   if (v->type->is_scalar())
+  return v;
+
+   if (v->type->is_vector()) {
+  const unsigned mask = (1U << v->type->vector_elements) - 1;
+
+  if (mask != this->write_mask)
+return NULL;
+   }
+
+   /* Either all the vector components are assigned or the variable is some
+* composite type (and the whole thing is assigned.
+*/
+   return v;
+}
+
+ir_assignment::ir_assignment(ir_dereference *lhs, ir_rvalue *rhs,
+ir_rvalue *condition, unsigned write_mask)
+{
+   this->ir_type = ir_type_assignment;
+   this->condition = condition;
+   this->rhs = rhs;
+   this->lhs = lhs;
+   this->write_mask = write_mask;
+}
+
 ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs,
 ir_rvalue *condition)
 {
this->ir_type = ir_type_assignment;
-   this->lhs = lhs;
-   this->rhs = rhs;
this->condition = condition;
+   this->rhs = rhs;
+
+   /* If the RHS is a vector type, assume that all components of the vector
+* 

Mesa (glsl2): glsl2: Don' t try to construct an ir_assignment with an invalid LHS

2010-08-04 Thread Ian Romanick
Module: Mesa
Branch: glsl2
Commit: 8e9ce2eb56a087c2544112700ae1abe3f96648dd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e9ce2eb56a087c2544112700ae1abe3f96648dd

Author: Ian Romanick 
Date:   Tue Aug  3 15:02:35 2010 -0700

glsl2: Don't try to construct an ir_assignment with an invalid LHS

---

 src/glsl/ast_to_hir.cpp |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index b65a323..14c5280 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -555,9 +555,8 @@ do_assignment(exec_list *instructions, struct 
_mesa_glsl_parse_state *state,
  NULL));
deref_var = new(ctx) ir_dereference_variable(var);
 
-   instructions->push_tail(new(ctx) ir_assignment(lhs,
- deref_var,
- NULL));
+   if (!error_emitted)
+  instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var, NULL));
 
return new(ctx) ir_dereference_variable(var);
 }

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


Mesa (master): st/mesa: Add forward declaration in st_cb_strings.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 060a95c3a942daca936d421400b7327f038d6f27
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=060a95c3a942daca936d421400b7327f038d6f27

Author: Vinson Lee 
Date:   Wed Aug  4 16:46:42 2010 -0700

st/mesa: Add forward declaration in st_cb_strings.h.

---

 src/mesa/state_tracker/st_cb_strings.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_strings.h 
b/src/mesa/state_tracker/st_cb_strings.h
index 3b765aa..92d5d2d 100644
--- a/src/mesa/state_tracker/st_cb_strings.h
+++ b/src/mesa/state_tracker/st_cb_strings.h
@@ -30,6 +30,8 @@
 #define ST_CB_STRINGS_H
 
 
+struct dd_function_table;
+
 extern void
 st_init_string_functions(struct dd_function_table *functions);
 

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


Mesa (master): st/mesa: Add missing header in st_cb_readpixels.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: e9d6f2fc8a88cd18a9914ee7c8f947c869ed3e50
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e9d6f2fc8a88cd18a9914ee7c8f947c869ed3e50

Author: Vinson Lee 
Date:   Wed Aug  4 16:40:04 2010 -0700

st/mesa: Add missing header in st_cb_readpixels.h.

Include mtypes.h for GLcontext symbol.

---

 src/mesa/state_tracker/st_cb_readpixels.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_readpixels.h 
b/src/mesa/state_tracker/st_cb_readpixels.h
index c90ef02..9e1f7b4 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.h
+++ b/src/mesa/state_tracker/st_cb_readpixels.h
@@ -29,6 +29,10 @@
 #ifndef ST_CB_READPIXELS_H
 #define ST_CB_READPIXELS_H
 
+#include "main/mtypes.h"
+
+struct dd_function_table;
+
 extern struct st_renderbuffer *
 st_get_color_read_renderbuffer(GLcontext *ctx);
 

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


Mesa (master): st/mesa: Clean up header file inclusion in st_cb_rasterpos.h .

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: a25ac9b5266c1f6820b073108555140c631454e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a25ac9b5266c1f6820b073108555140c631454e1

Author: Vinson Lee 
Date:   Wed Aug  4 16:33:10 2010 -0700

st/mesa: Clean up header file inclusion in st_cb_rasterpos.h.

---

 src/mesa/state_tracker/st_cb_rasterpos.h |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_rasterpos.h 
b/src/mesa/state_tracker/st_cb_rasterpos.h
index d2ed729..2dc109b 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.h
+++ b/src/mesa/state_tracker/st_cb_rasterpos.h
@@ -29,7 +29,9 @@
 #define ST_CB_RASTERPOS_H
 
 
-#include "main/mtypes.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
 
 #if FEATURE_rastpos
 

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


Mesa (glsl2): glsl2: Constant fold the children of many more ir_instruction types.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: 8dbdcb0b43c8749018ff62dd5751190e54fe2445
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8dbdcb0b43c8749018ff62dd5751190e54fe2445

Author: Eric Anholt 
Date:   Wed Aug  4 16:18:18 2010 -0700

glsl2: Constant fold the children of many more ir_instruction types.

---

 src/glsl/ir_constant_folding.cpp |   39 +++--
 1 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp
index a6d82e3..1126042 100644
--- a/src/glsl/ir_constant_folding.cpp
+++ b/src/glsl/ir_constant_folding.cpp
@@ -82,7 +82,7 @@ public:
 void
 ir_constant_folding_visitor::fold_constant(ir_rvalue **rvalue)
 {
-   if ((*rvalue)->ir_type == ir_type_constant)
+   if (*rvalue == NULL || (*rvalue)->ir_type == ir_type_constant)
   return;
 
ir_constant *constant = (*rvalue)->constant_expression_value();
@@ -131,15 +131,32 @@ ir_constant_folding_visitor::visit(ir_expression *ir)
 void
 ir_constant_folding_visitor::visit(ir_texture *ir)
 {
-   // FINISHME: Do stuff with texture lookups
-   (void) ir;
+   fold_constant(&ir->coordinate);
+   fold_constant(&ir->projector);
+   fold_constant(&ir->shadow_comparitor);
+
+   switch (ir->op) {
+   case ir_tex:
+  break;
+   case ir_txb:
+  fold_constant(&ir->lod_info.bias);
+  break;
+   case ir_txf:
+   case ir_txl:
+  fold_constant(&ir->lod_info.lod);
+  break;
+   case ir_txd:
+  fold_constant(&ir->lod_info.grad.dPdx);
+  fold_constant(&ir->lod_info.grad.dPdy);
+  break;
+   }
 }
 
 
 void
 ir_constant_folding_visitor::visit(ir_swizzle *ir)
 {
-   ir->val->accept(this);
+   fold_constant(&ir->val);
 }
 
 
@@ -180,8 +197,8 @@ ir_constant_folding_visitor::visit(ir_assignment *ir)
ir->condition = NULL;
 else
ir->remove();
+this->progress = true;
   }
-  this->progress = true;
}
 }
 
@@ -196,14 +213,22 @@ ir_constant_folding_visitor::visit(ir_constant *ir)
 void
 ir_constant_folding_visitor::visit(ir_call *ir)
 {
-   (void) ir;
+   foreach_iter(exec_list_iterator, iter, *ir) {
+  ir_rvalue *param = (ir_rvalue *)iter.get();
+  ir_rvalue *new_param = param;
+  fold_constant(&new_param);
+
+  if (new_param != param) {
+param->replace_with(new_param);
+  }
+   }
 }
 
 
 void
 ir_constant_folding_visitor::visit(ir_return *ir)
 {
-   (void) ir;
+   fold_constant(&ir->value);
 }
 
 

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


Mesa (glsl2): glsl2: Refactor constant folding of rvalues to a function.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: 3d23f0a90c982ad43a6f18ef69a23b2fcdb1d1d2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d23f0a90c982ad43a6f18ef69a23b2fcdb1d1d2

Author: Eric Anholt 
Date:   Wed Aug  4 16:06:00 2010 -0700

glsl2: Refactor constant folding of rvalues to a function.

---

 src/glsl/ir_constant_folding.cpp |   47 +-
 1 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp
index 66a92e9..492036e 100644
--- a/src/glsl/ir_constant_folding.cpp
+++ b/src/glsl/ir_constant_folding.cpp
@@ -73,9 +73,25 @@ public:
virtual void visit(ir_loop *);
virtual void visit(ir_loop_jump *);
/*...@}*/
+
+   void fold_constant(ir_rvalue **rvalue);
 };
 
 void
+ir_constant_folding_visitor::fold_constant(ir_rvalue **rvalue)
+{
+   if ((*rvalue)->ir_type == ir_type_constant)
+  return;
+
+   ir_constant *constant = (*rvalue)->constant_expression_value();
+   if (constant) {
+  *rvalue = constant;
+   } else {
+  (*rvalue)->accept(this);
+   }
+}
+
+void
 ir_constant_folding_visitor::visit(ir_variable *ir)
 {
(void) ir;
@@ -101,16 +117,10 @@ ir_constant_folding_visitor::visit(ir_function *ir)
 void
 ir_constant_folding_visitor::visit(ir_expression *ir)
 {
-   ir_constant *op[2];
unsigned int operand;
 
for (operand = 0; operand < ir->get_num_operands(); operand++) {
-  op[operand] = ir->operands[operand]->constant_expression_value();
-  if (op[operand]) {
-ir->operands[operand] = op[operand];
-  } else {
-ir->operands[operand]->accept(this);
-  }
+  fold_constant(&ir->operands[operand]);
}
 }
 
@@ -140,14 +150,7 @@ ir_constant_folding_visitor::visit(ir_dereference_variable 
*ir)
 void
 ir_constant_folding_visitor::visit(ir_dereference_array *ir)
 {
-   ir_constant *const_val =
-  ir->array_index->constant_expression_value();
-
-   if (const_val)
-  ir->array_index = const_val;
-   else
-  ir->array_index->accept(this);
-
+   fold_constant(&ir->array_index);
ir->array->accept(this);
 }
 
@@ -162,17 +165,13 @@ ir_constant_folding_visitor::visit(ir_dereference_record 
*ir)
 void
 ir_constant_folding_visitor::visit(ir_assignment *ir)
 {
-   ir_constant *const_val = ir->rhs->constant_expression_value();
-   if (const_val)
-  ir->rhs = const_val;
-   else
-  ir->rhs->accept(this);
+   fold_constant(&ir->rhs);
 
if (ir->condition) {
   /* If the condition is constant, either remove the condition or
* remove the never-executed assignment.
*/
-  const_val = ir->condition->constant_expression_value();
+  ir_constant *const_val = ir->condition->constant_expression_value();
   if (const_val) {
 if (const_val->value.b[0])
ir->condition = NULL;
@@ -214,11 +213,7 @@ ir_constant_folding_visitor::visit(ir_discard *ir)
 void
 ir_constant_folding_visitor::visit(ir_if *ir)
 {
-   ir_constant *const_val = ir->condition->constant_expression_value();
-   if (const_val)
-  ir->condition = const_val;
-   else
-  ir->condition->accept(this);
+   fold_constant(&ir->condition);
 
visit_exec_list(&ir->then_instructions, this);
visit_exec_list(&ir->else_instructions, this);

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


Mesa (glsl2): glsl2: Return a real progress value from constant folding.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: 6ecf62f673bf90d0969f8db032781b49a988975a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ecf62f673bf90d0969f8db032781b49a988975a

Author: Eric Anholt 
Date:   Wed Aug  4 16:07:41 2010 -0700

glsl2: Return a real progress value from constant folding.

---

 src/glsl/ir_constant_folding.cpp |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp
index 492036e..a6d82e3 100644
--- a/src/glsl/ir_constant_folding.cpp
+++ b/src/glsl/ir_constant_folding.cpp
@@ -39,7 +39,7 @@ class ir_constant_folding_visitor : public ir_visitor {
 public:
ir_constant_folding_visitor()
{
-  /* empty */
+  this->progress = false;
}
 
virtual ~ir_constant_folding_visitor()
@@ -75,6 +75,8 @@ public:
/*...@}*/
 
void fold_constant(ir_rvalue **rvalue);
+
+   bool progress;
 };
 
 void
@@ -86,6 +88,7 @@ ir_constant_folding_visitor::fold_constant(ir_rvalue **rvalue)
ir_constant *constant = (*rvalue)->constant_expression_value();
if (constant) {
   *rvalue = constant;
+  this->progress = true;
} else {
   (*rvalue)->accept(this);
}
@@ -178,6 +181,7 @@ ir_constant_folding_visitor::visit(ir_assignment *ir)
 else
ir->remove();
   }
+  this->progress = true;
}
 }
 
@@ -240,6 +244,5 @@ do_constant_folding(exec_list *instructions)
 
visit_exec_list(instructions, &constant_folding);
 
-   /* FINISHME: Return real progress. */
-   return false;
+   return constant_folding.progress;
 }

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


Mesa (master): st/mesa: Add missing header in st_cb_program.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 2bb3bfa943d3250d036673dbdea215b19d70c21e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2bb3bfa943d3250d036673dbdea215b19d70c21e

Author: Vinson Lee 
Date:   Wed Aug  4 16:13:15 2010 -0700

st/mesa: Add missing header in st_cb_program.h.

Include mtypes.h for GLcontext symbol.

---

 src/mesa/state_tracker/st_cb_program.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_program.h 
b/src/mesa/state_tracker/st_cb_program.h
index 0de96f2..0fd179e 100644
--- a/src/mesa/state_tracker/st_cb_program.h
+++ b/src/mesa/state_tracker/st_cb_program.h
@@ -29,6 +29,10 @@
 #define ST_CB_PROGRAM_H
 
 
+#include "main/mtypes.h"
+
+struct dd_function_table;
+
 extern void
 st_init_program_functions(struct dd_function_table *functions);
 

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


Mesa (glsl2): glcpp: Refresh autogenerated lexer and parser.

2010-08-04 Thread Kenneth Graunke
Module: Mesa
Branch: glsl2
Commit: 0ef79a5f115659b3719a330d01a365e8ca8144c4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ef79a5f115659b3719a330d01a365e8ca8144c4

Author: Kenneth Graunke 
Date:   Tue Aug  3 20:25:13 2010 -0700

glcpp: Refresh autogenerated lexer and parser.

---

 src/glsl/glcpp/glcpp-lex.c   |   44 +++-
 src/glsl/glcpp/glcpp-parse.c |  252 ++
 src/glsl/glcpp/glcpp-parse.h |7 +-
 3 files changed, 148 insertions(+), 155 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c
index 40db2c2..d976904 100644
--- a/src/glsl/glcpp/glcpp-lex.c
+++ b/src/glsl/glcpp/glcpp-lex.c
@@ -54,6 +54,7 @@ typedef int flex_int32_t;
 typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
@@ -84,8 +85,6 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX (4294967295U)
 #endif
 
-#endif /* ! C99 */
-
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -159,15 +158,7 @@ typedef void* yyscan_t;
 
 /* Size of default input buffer. */
 #ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
 #define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
 #endif
 
 /* The state buf must be large enough to hold one state per character in the 
main buffer.
@@ -691,7 +682,7 @@ void glcpp_set_column (int  column_no , yyscan_t yyscanner);
} while(0);
 #define YY_USER_INIT yylineno = 0; yycolumn = 0;
 
-#line 695 "glcpp/glcpp-lex.c"
+#line 686 "glcpp/glcpp-lex.c"
 
 #define INITIAL 0
 #define DONE 1
@@ -846,12 +837,7 @@ static int input (yyscan_t yyscanner );
 
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
 #define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
 #endif
 
 /* Copy whatever the last rule matched to the standard output. */
@@ -859,7 +845,7 @@ static int input (yyscan_t yyscanner );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -870,7 +856,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
-   size_t n; \
+   int n; \
for ( n = 0; n < max_size && \
 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -962,7 +948,7 @@ YY_DECL
 
 
/* Single-line comments */
-#line 966 "glcpp/glcpp-lex.c"
+#line 952 "glcpp/glcpp-lex.c"
 
 yylval = yylval_param;
 
@@ -1133,7 +1119,7 @@ case 8:
 YY_RULE_SETUP
 #line 90 "glcpp/glcpp-lex.l"
 {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
yylineno++;
yycolumn = 0;
yyextra->space_tokens = 0;
@@ -1146,7 +1132,7 @@ case 9:
 YY_RULE_SETUP
 #line 100 "glcpp/glcpp-lex.l"
 {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
yylineno++;
yycolumn = 0;
return OTHER;
@@ -1283,7 +1269,7 @@ case 22:
 YY_RULE_SETUP
 #line 188 "glcpp/glcpp-lex.l"
 {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
return INTEGER_STRING;
 }
YY_BREAK
@@ -1291,7 +1277,7 @@ case 23:
 YY_RULE_SETUP
 #line 193 "glcpp/glcpp-lex.l"
 {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
return INTEGER_STRING;
 }
YY_BREAK
@@ -1299,7 +1285,7 @@ case 24:
 YY_RULE_SETUP
 #line 198 "glcpp/glcpp-lex.l"
 {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
return INTEGER_STRING;
 }
YY_BREAK
@@ -1377,7 +1363,7 @@ case 35:
 YY_RULE_SETUP
 #line 243 "glcpp/glcpp-lex.l"
 {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
return IDENTIFIER;
 }
YY_BREAK
@@ -1392,7 +1378,7 @@ case 37:
 YY_RULE_SETUP
 #line 252 "glcpp/glcpp-lex.l"
 {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
return OTHER;
 }
YY_BREAK
@@ -1442,7 +1428,7 @@ YY_RULE_SETUP
 #line 286 "glcpp/glcpp-lex.l"
 ECHO;
YY_BREAK
-#line 1446 "glcpp/glcpp-lex.c"
+#line 1432 "glcpp/glcpp-lex.c"

Mesa (glsl2): glcpp: Remove xtalloc wrappers in favor of plain talloc.

2010-08-04 Thread Kenneth Graunke
Module: Mesa
Branch: glsl2
Commit: 1ffc1cd86186ae5d03bb28a1e041c4a57761515e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ffc1cd86186ae5d03bb28a1e041c4a57761515e

Author: Kenneth Graunke 
Date:   Tue Aug  3 20:21:52 2010 -0700

glcpp: Remove xtalloc wrappers in favor of plain talloc.

Calling exit() on a memory failure probably made sense for the
standalone preprocessor, but doesn't seem too appealing as part of
the GL library.  Also, we don't use it in the main compiler.

---

 src/glsl/Makefile|3 +-
 src/glsl/glcpp/Makefile.am   |3 +-
 src/glsl/glcpp/glcpp-lex.l   |   14 +++---
 src/glsl/glcpp/glcpp-parse.y |   38 
 src/glsl/glcpp/glcpp.h   |   24 --
 src/glsl/glcpp/xtalloc.c |   99 --
 6 files changed, 28 insertions(+), 153 deletions(-)

diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index f98b772..3102947 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -9,8 +9,7 @@ LIBNAME = glsl
 LIBGLCPP_SOURCES = \
glcpp/glcpp-lex.c \
glcpp/glcpp-parse.c \
-   glcpp/pp.c \
-   glcpp/xtalloc.c
+   glcpp/pp.c
 
 GLCPP_SOURCES = \
$(LIBGLCPP_SOURCES) \
diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am
index 00c6c56..81147e6 100644
--- a/src/glsl/glcpp/Makefile.am
+++ b/src/glsl/glcpp/Makefile.am
@@ -25,8 +25,7 @@ libglcpp_la_SOURCES = \
glcpp-lex.l \
glcpp-parse.y \
glcpp.h \
-   pp.c \
-   xtalloc.c
+   pp.c
 
 BUILT_SOURCES = glcpp-parse.h glcpp-parse.c glcpp-lex.c
 CLEANFILES = $(BUILT_SOURCES)
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 17a097e..1a0052d 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -88,7 +88,7 @@ HEXADECIMAL_INTEGER   0[xX][0-9a-fA-F]+[uU]?
 }
 
 {HASH}(version) {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
yylineno++;
yycolumn = 0;
yyextra->space_tokens = 0;
@@ -98,7 +98,7 @@ HEXADECIMAL_INTEGER   0[xX][0-9a-fA-F]+[uU]?
/* glcpp doesn't handle #extension, #version, or #pragma directives.
 * Simply pass them through to the main compiler's lexer/parser. */
 {HASH}(extension|pragma)[^\n]+ {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
yylineno++;
yycolumn = 0;
return OTHER;
@@ -186,17 +186,17 @@ HEXADECIMAL_INTEGER   0[xX][0-9a-fA-F]+[uU]?
 }
 
 {DECIMAL_INTEGER} {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
return INTEGER_STRING;
 }
 
 {OCTAL_INTEGER} {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
return INTEGER_STRING;
 }
 
 {HEXADECIMAL_INTEGER} {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
return INTEGER_STRING;
 }
 
@@ -241,7 +241,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
 }
 
 {IDENTIFIER} {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
return IDENTIFIER;
 }
 
@@ -250,7 +250,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
 }
 
 {OTHER}+ {
-   yylval->str = xtalloc_strdup (yyextra, yytext);
+   yylval->str = talloc_strdup (yyextra, yytext);
return OTHER;
 }
 
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 855448f..55a8d17 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -503,7 +503,7 @@ _string_list_create (void *ctx)
 {
string_list_t *list;
 
-   list = xtalloc (ctx, string_list_t);
+   list = talloc (ctx, string_list_t);
list->head = NULL;
list->tail = NULL;
 
@@ -515,8 +515,8 @@ _string_list_append_item (string_list_t *list, const char 
*str)
 {
string_node_t *node;
 
-   node = xtalloc (list, string_node_t);
-   node->str = xtalloc_strdup (node, str);
+   node = talloc (list, string_node_t);
+   node->str = talloc_strdup (node, str);
 
node->next = NULL;
 
@@ -569,7 +569,7 @@ _argument_list_create (void *ctx)
 {
argument_list_t *list;
 
-   list = xtalloc (ctx, argument_list_t);
+   list = talloc (ctx, argument_list_t);
list->head = NULL;
list->tail = NULL;
 
@@ -581,7 +581,7 @@ _argument_list_append (argument_list_t *list, token_list_t 
*argument)
 {
argument_node_t *node;
 
-   node = xtalloc (list, argument_node_t);
+   node = talloc (list, argument_node_t);
node->argument = argument;
 
node->next = NULL;
@@ -638,7 +638,7 @@ _token_create_str (void *ctx, int type, char *str)
 {
token_t *token;
 
-   token = xtalloc (ctx, token_t);
+   token = talloc (ctx, token_t);
token->type = type;
token->va

Mesa (glsl2): glsl2: Remove uses of deprecated TALLOC_CTX type.

2010-08-04 Thread Kenneth Graunke
Module: Mesa
Branch: glsl2
Commit: ad98aa9d93646600cc95b3e45a40eec26f18988a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad98aa9d93646600cc95b3e45a40eec26f18988a

Author: Kenneth Graunke 
Date:   Tue Aug  3 20:05:53 2010 -0700

glsl2: Remove uses of deprecated TALLOC_CTX type.

---

 src/glsl/ast_function.cpp |   12 ++--
 src/glsl/glsl_types.cpp   |   26 +-
 src/glsl/glsl_types.h |   12 ++--
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index 661f8f6..c22dfa8 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -629,20 +629,20 @@ emit_inline_vector_constructor(const glsl_type *type,
 ir_instruction *
 assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base,
ir_rvalue *src, unsigned src_base, unsigned count,
-   TALLOC_CTX *ctx)
+   void *mem_ctx)
 {
const unsigned mask[8] = { 0, 1, 2, 3, 0, 0, 0, 0 };
 
-   ir_constant *col_idx = new(ctx) ir_constant(column);
-   ir_rvalue *column_ref = new(ctx) ir_dereference_array(var, col_idx);
+   ir_constant *col_idx = new(mem_ctx) ir_constant(column);
+   ir_rvalue *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx);
 
assert(column_ref->type->components() >= (row_base + count));
-   ir_rvalue *lhs = new(ctx) ir_swizzle(column_ref, &mask[row_base], count);
+   ir_rvalue *lhs = new(mem_ctx) ir_swizzle(column_ref, &mask[row_base], 
count);
 
assert(src->type->components() >= (src_base + count));
-   ir_rvalue *rhs = new(ctx) ir_swizzle(src, &mask[src_base], count);
+   ir_rvalue *rhs = new(mem_ctx) ir_swizzle(src, &mask[src_base], count);
 
-   return new(ctx) ir_assignment(lhs, rhs, NULL);
+   return new(mem_ctx) ir_assignment(lhs, rhs, NULL);
 }
 
 
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 40a5b6c..88f305a 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -33,14 +33,14 @@ extern "C" {
 
 hash_table *glsl_type::array_types = NULL;
 hash_table *glsl_type::record_types = NULL;
-void *glsl_type::ctx = NULL;
+void *glsl_type::mem_ctx = NULL;
 
 void
 glsl_type::init_talloc_type_ctx(void)
 {
-   if (glsl_type::ctx == NULL) {
-  glsl_type::ctx = talloc_init("glsl_type");
-  assert(glsl_type::ctx != NULL);
+   if (glsl_type::mem_ctx == NULL) {
+  glsl_type::mem_ctx = talloc_init("glsl_type");
+  assert(glsl_type::mem_ctx != NULL);
}
 }
 
@@ -55,7 +55,7 @@ glsl_type::glsl_type(GLenum gl_type,
length(0)
 {
init_talloc_type_ctx();
-   this->name = talloc_strdup(this->ctx, name);
+   this->name = talloc_strdup(this->mem_ctx, name);
/* Neither dimension is zero or both dimensions are zero.
 */
assert((vector_elements == 0) == (matrix_columns == 0));
@@ -73,7 +73,7 @@ glsl_type::glsl_type(GLenum gl_type,
length(0)
 {
init_talloc_type_ctx();
-   this->name = talloc_strdup(this->ctx, name);
+   this->name = talloc_strdup(this->mem_ctx, name);
memset(& fields, 0, sizeof(fields));
 }
 
@@ -88,8 +88,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, 
unsigned num_fields,
unsigned int i;
 
init_talloc_type_ctx();
-   this->name = talloc_strdup(this->ctx, name);
-   this->fields.structure = talloc_array(this->ctx,
+   this->name = talloc_strdup(this->mem_ctx, name);
+   this->fields.structure = talloc_array(this->mem_ctx,
 glsl_struct_field, length);
for (i = 0; i < length; i++) {
   this->fields.structure[i].type = fields[i].type;
@@ -228,9 +228,9 @@ _mesa_glsl_release_types(void)
   glsl_type::record_types = NULL;
}
 
-   if (glsl_type::ctx != NULL) {
-  talloc_free(glsl_type::ctx);
-  glsl_type::ctx = NULL;
+   if (glsl_type::mem_ctx != NULL) {
+  talloc_free(glsl_type::mem_ctx);
+  glsl_type::mem_ctx = NULL;
}
 }
 
@@ -315,7 +315,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned 
length) :
 * NUL.
 */
const unsigned name_length = strlen(array->name) + 10 + 3;
-   char *const n = (char *) talloc_size(this->ctx, name_length);
+   char *const n = (char *) talloc_size(this->mem_ctx, name_length);
 
if (length == 0)
   snprintf(n, name_length, "%s[]", array->name);
@@ -405,7 +405,7 @@ glsl_type::get_array_instance(const glsl_type *base, 
unsigned array_size)
if (t == NULL) {
   t = new glsl_type(base, array_size);
 
-  hash_table_insert(array_types, (void *) t, talloc_strdup(ctx, key));
+  hash_table_insert(array_types, (void *) t, talloc_strdup(mem_ctx, key));
}
 
assert(t->base_type == GLSL_TYPE_ARRAY);
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index c3f81b8..97d0d98 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -76,17 +76,17 @@ struct glsl_type {
*/
 
/* Callers of this talloc-based new need not call delete. It's
-*

Mesa (nv50-compiler): nv50: build proper phi functions in the first place

2010-08-04 Thread Christoph Bumiller
Module: Mesa
Branch: nv50-compiler
Commit: aaa8802a22d83fd89d7e306b7d03fa587a19aa0a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aaa8802a22d83fd89d7e306b7d03fa587a19aa0a

Author: Christoph Bumiller 
Date:   Thu Aug  5 00:11:56 2010 +0200

nv50: build proper phi functions in the first place

---

 src/gallium/drivers/nv50/nv50_pc.c  |   39 +++-
 src/gallium/drivers/nv50/nv50_pc.h  |3 +
 src/gallium/drivers/nv50/nv50_pc_optimize.c |4 +
 src/gallium/drivers/nv50/nv50_pc_regalloc.c |  140 +--
 src/gallium/drivers/nv50/nv50_tgsi_to_nc.c  |  127 +++--
 5 files changed, 166 insertions(+), 147 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_pc.c 
b/src/gallium/drivers/nv50/nv50_pc.c
index 614982d..e32d28a 100644
--- a/src/gallium/drivers/nv50/nv50_pc.c
+++ b/src/gallium/drivers/nv50/nv50_pc.c
@@ -394,7 +394,7 @@ nv_nvi_delete(struct nv_instruction *nvi)
struct nv_basic_block *b = nvi->bb;
int j;
 
-   debug_printf("REM: "); nv_print_instruction(nvi);
+   /* debug_printf("REM: "); nv_print_instruction(nvi); */
 
for (j = 0; j < 5; ++j)
   nv_reference(NULL, &nvi->src[j], NULL);
@@ -477,5 +477,40 @@ nvbb_dominated_by(struct nv_basic_block *b, struct 
nv_basic_block *d)
for (j = 0; j < b->num_in; ++j)
   n += nvbb_dominated_by(b->in[j], d);
 
-   return n && (n == b->num_in);
+   return (n && (n == b->num_in)) ? 1 : 0;
+}
+
+/* check if bf (future) can be reached from bp (past) */
+boolean
+nvbb_reachable_by(struct nv_basic_block *bf, struct nv_basic_block *bp,
+  struct nv_basic_block *bt)
+{
+   if (bf == bp)
+  return TRUE;
+   if (bp == bt)
+  return FALSE;
+
+   if (bp->out[0] && bp->out[0] != bp &&
+   nvbb_reachable_by(bf, bp->out[0], bt))
+  return TRUE;
+   if (bp->out[1] && bp->out[1] != bp &&
+   nvbb_reachable_by(bf, bp->out[1], bt))
+  return TRUE;
+   return FALSE;
+}
+
+struct nv_basic_block *
+nvbb_dom_frontier(struct nv_basic_block *b)
+{
+   struct nv_basic_block *df = b->out[0];
+
+   assert(df);
+   while (nvbb_dominated_by(df, b) ||
+  (!nvbb_dominated_by(df->in[0], b) &&
+   (!df->in[1] || !nvbb_dominated_by(df->in[1], b {
+  df = df->out[0];
+  assert(df);
+   }
+   assert(df);
+   return df;
 }
diff --git a/src/gallium/drivers/nv50/nv50_pc.h 
b/src/gallium/drivers/nv50/nv50_pc.h
index 4b191c5..987043c 100644
--- a/src/gallium/drivers/nv50/nv50_pc.h
+++ b/src/gallium/drivers/nv50/nv50_pc.h
@@ -426,6 +426,9 @@ void nv_nvi_delete(struct nv_instruction *);
 void nv_nvi_permute(struct nv_instruction *, struct nv_instruction *);
 void nvbb_attach_block(struct nv_basic_block *parent, struct nv_basic_block *);
 int nvbb_dominated_by(struct nv_basic_block *, struct nv_basic_block *);
+boolean nvbb_reachable_by(struct nv_basic_block *, struct nv_basic_block *,
+  struct nv_basic_block *);
+struct nv_basic_block *nvbb_dom_frontier(struct nv_basic_block *);
 int nvcg_replace_value(struct nv_pc *pc, struct nv_value *old_val,
struct nv_value *new_val);
 
diff --git a/src/gallium/drivers/nv50/nv50_pc_optimize.c 
b/src/gallium/drivers/nv50/nv50_pc_optimize.c
index 324f8bb..f2f8d0e 100644
--- a/src/gallium/drivers/nv50/nv50_pc_optimize.c
+++ b/src/gallium/drivers/nv50/nv50_pc_optimize.c
@@ -771,6 +771,10 @@ nv_pass_cse(struct nv_pass *ctx, struct nv_basic_block *b)
 if (ik->src[4] || ir->src[4])
continue; /* don't mess with address registers */
 
+if (ik->flags_src || ir->flags_src ||
+ik->flags_def || ir->flags_def)
+   continue; /* and also not with flags, for now */
+
 for (s = 0; s < 3; ++s) {
struct nv_value *a, *b;
 
diff --git a/src/gallium/drivers/nv50/nv50_pc_regalloc.c 
b/src/gallium/drivers/nv50/nv50_pc_regalloc.c
index 941ec9f..172e44f 100644
--- a/src/gallium/drivers/nv50/nv50_pc_regalloc.c
+++ b/src/gallium/drivers/nv50/nv50_pc_regalloc.c
@@ -43,25 +43,6 @@ struct nv_pc_pass {
uint pass_seq;
 };
 
-/* check if bf (future) can be reached from bp (past) */
-static boolean
-bb_reachable_by(struct nv_basic_block *bf, struct nv_basic_block *bp,
-struct nv_basic_block *bt)
-{
-   if (bf == bp)
-  return TRUE;
-   if (bp == bt)
-  return FALSE;
-
-   if (bp->out[0] && bp->out[0] != bp &&
-   bb_reachable_by(bf, bp->out[0], bt))
-  return TRUE;
-   if (bp->out[1] && bp->out[1] != bp &&
-   bb_reachable_by(bf, bp->out[1], bt))
-  return TRUE;
-   return FALSE;
-}
-
 static void
 ranges_coalesce(struct nv_range *range)
 {
@@ -377,32 +358,13 @@ try_join_values(struct nv_pc_pass *ctx, struct nv_value 
*a, struct nv_value *b)
do_join_values(ctx, a, b);
 }
 
-/* For phi functions with sources from blocks that are not direct predecessors,
- * if such a source is to be used in an earlier predecessor, we need to add an
- * additional phi func

Mesa (nv50-compiler): nv50: fix constbuf validation

2010-08-04 Thread Christoph Bumiller
Module: Mesa
Branch: nv50-compiler
Commit: 720e0c430d0a66cbf5adfcf40030f27e55ad6c6a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=720e0c430d0a66cbf5adfcf40030f27e55ad6c6a

Author: Christoph Bumiller 
Date:   Sat Jul 31 21:30:35 2010 +0200

nv50: fix constbuf validation

We only uploaded up to the highest offset a program would use,
and if the constant buffer isn't changed when a new program is
used, the new program is missing the rest of them.

Might want to introduce a "fill state" for user mem constbufs.

---

 src/gallium/drivers/nv50/nv50_shader_state.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c 
b/src/gallium/drivers/nv50/nv50_shader_state.c
index f7e6355..3d5df59 100644
--- a/src/gallium/drivers/nv50/nv50_shader_state.c
+++ b/src/gallium/drivers/nv50/nv50_shader_state.c
@@ -44,7 +44,7 @@ nv50_transfer_constbuf(struct nv50_context *nv50,
if (!map)
   return;
 
-   count = MIN2(buf->width0, size);
+   count = buf->width0; /* MIN2(buf->width0, size); */
start = 0;
 
while (count) {
@@ -92,8 +92,13 @@ nv50_program_validate_data(struct nv50_context *nv50, struct 
nv50_program *p)
   }
}
 
+   /* If the state tracker doesn't change the constbuf, and it is first
+* validated with a program that doesn't use it, this check prevents
+* it from even being uploaded. */
+   /*
if (p->parm_size == 0)
   return;
+   */
 
switch (p->type) {
case PIPE_SHADER_VERTEX:

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


Mesa (nv50-compiler): nv50: don't eliminate loads to dedicated values

2010-08-04 Thread Christoph Bumiller
Module: Mesa
Branch: nv50-compiler
Commit: 2c695d38e6b194572becf82300fba5e34b1fd7d7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c695d38e6b194572becf82300fba5e34b1fd7d7

Author: Christoph Bumiller 
Date:   Sat Jul 31 20:56:42 2010 +0200

nv50: don't eliminate loads to dedicated values

---

 src/gallium/drivers/nv50/nv50_pc_optimize.c |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_pc_optimize.c 
b/src/gallium/drivers/nv50/nv50_pc_optimize.c
index 1f2f163..324f8bb 100644
--- a/src/gallium/drivers/nv50/nv50_pc_optimize.c
+++ b/src/gallium/drivers/nv50/nv50_pc_optimize.c
@@ -639,12 +639,10 @@ nv_pass_reload_elim(struct nv_pass_reld_elim *ctx, struct 
nv_basic_block *b)
 break;
 
   if (it) {
-#if 1
- nvcg_replace_value(ctx->pc, ld->def[0], it->value);
-#else
- ld->opcode = NV_OP_MOV;
- nv_reference(ctx->pc, &ld->src[0], it->value);
-#endif
+ if (ld->def[0]->reg.id >= 0)
+it->value = ld->def[0];
+ else
+nvcg_replace_value(ctx->pc, ld->def[0], it->value);
   } else {
  if (ctx->alloc == LOAD_RECORD_POOL_SIZE)
 continue;

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


Mesa (master): r300/compiler: Remove unnecessary header.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 7f7bbf0d5b78e0a4ace7ad6eddf5e73a826c75eb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f7bbf0d5b78e0a4ace7ad6eddf5e73a826c75eb

Author: Vinson Lee 
Date:   Wed Aug  4 15:45:41 2010 -0700

r300/compiler: Remove unnecessary header.

---

 src/mesa/drivers/dri/r300/compiler/r500_fragprog.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c 
b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
index 95be619..80a1204 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
@@ -30,7 +30,6 @@
 #include 
 
 #include "../r300_reg.h"
-#include "radeon_emulate_loops.h"
 
 /**
  * Rewrite IF instructions to use the ALU result special register.

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


Mesa (master): intel: Remove unnecessary header.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 81bc4f4cbfdd4d8abaf97cb66baf1c7b0cbe05b3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=81bc4f4cbfdd4d8abaf97cb66baf1c7b0cbe05b3

Author: Vinson Lee 
Date:   Wed Aug  4 15:38:24 2010 -0700

intel: Remove unnecessary header.

---

 src/mesa/drivers/dri/intel/intel_extensions_es2.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es2.c 
b/src/mesa/drivers/dri/intel/intel_extensions_es2.c
index baf8e13..de34bbb 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions_es2.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions_es2.c
@@ -28,7 +28,6 @@
 #include "main/extensions.h"
 
 #include "intel_extensions.h"
-#include "utils.h"
 
 static const char *es2_extensions[] = {
/* Used by mesa internally (cf all_mesa_extensions in ../common/utils.c) */

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


Mesa (master): st/mesa: Add missing headers in st_cb_flush.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 9f7e7ce7572d1ab370def14db8be7059869cda29
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f7e7ce7572d1ab370def14db8be7059869cda29

Author: Vinson Lee 
Date:   Wed Aug  4 15:32:53 2010 -0700

st/mesa: Add missing headers in st_cb_flush.h.

Add forward declarations.
Include p_compiler.h for uint symbol.

---

 src/mesa/state_tracker/st_cb_flush.h |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_flush.h 
b/src/mesa/state_tracker/st_cb_flush.h
index 7fca017..7672b4c 100644
--- a/src/mesa/state_tracker/st_cb_flush.h
+++ b/src/mesa/state_tracker/st_cb_flush.h
@@ -30,6 +30,12 @@
 #define ST_CB_FLUSH_H
 
 
+#include "pipe/p_compiler.h"
+
+struct dd_function_table;
+struct pipe_fence_handle;
+struct st_context;
+
 extern void
 st_init_flush_functions(struct dd_function_table *functions);
 

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


Mesa (master): st/mesa: Clean up header inclusion in st_cb_feedback.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 85dbb2904bbcab5bad65cc267daafd6ebcf32ded
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=85dbb2904bbcab5bad65cc267daafd6ebcf32ded

Author: Vinson Lee 
Date:   Wed Aug  4 15:26:37 2010 -0700

st/mesa: Clean up header inclusion in st_cb_feedback.h.

Replace mtypes.h with forward declaration.
Include compiler.h for INLINE symbol.

---

 src/mesa/state_tracker/st_cb_feedback.h |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_feedback.h 
b/src/mesa/state_tracker/st_cb_feedback.h
index 706d849..f2342f5 100644
--- a/src/mesa/state_tracker/st_cb_feedback.h
+++ b/src/mesa/state_tracker/st_cb_feedback.h
@@ -30,7 +30,9 @@
 #define ST_CB_FEEDBACK_H
 
 
-#include "main/mtypes.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
 
 #if FEATURE_feedback
 

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


Mesa (glsl2): glsl2: add gl_LightModel built-in uniform.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: ea3a9eb53a3c9ed8ead645e2b2e6a3261626
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea3a9eb53a3c9ed8ead645e2b2e6a3261626

Author: Aras Pranckevicius 
Date:   Wed Aug  4 17:11:32 2010 +0200

glsl2: add gl_LightModel built-in uniform.

---

 src/glsl/builtin_variables.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/glsl/builtin_variables.h b/src/glsl/builtin_variables.h
index 9551e1a..2ec7d62 100644
--- a/src/glsl/builtin_variables.h
+++ b/src/glsl/builtin_variables.h
@@ -93,5 +93,6 @@ static const builtin_variable 
builtin_110_deprecated_uniforms[] = {
{ ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverseTranspose" },
{ ir_var_uniform, -1, "mat4", 
"gl_ModelViewProjectionMatrixInverseTranspose" },
{ ir_var_uniform, -1, "float", "gl_NormalScale" },
+   { ir_var_uniform, -1, "gl_LightModelParameters", "gl_LightModel"},
 };
 

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


Mesa (glsl2): ir_to_mesa: Clean up the mapping of samplers to Mesa' s sampler uniforms.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: fe1918c71c3e387939cef9359d4b31ebc5c11a17
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe1918c71c3e387939cef9359d4b31ebc5c11a17

Author: Eric Anholt 
Date:   Wed Aug  4 14:21:01 2010 -0700

ir_to_mesa: Clean up the mapping of samplers to Mesa's sampler uniforms.

Instead of using a linker-assigned location (since samplers don't
actually take up uniform space, being a link-time choice), use the
sampler's varaible pointer as a hash key.

---

 src/mesa/program/ir_to_mesa.cpp |   42 --
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index dcf8c49..777b4d9 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -45,6 +45,7 @@ extern "C" {
 #include "main/mtypes.h"
 #include "main/shaderobj.h"
 #include "main/uniforms.h"
+#include "program/hash_table.h"
 #include "program/prog_instruction.h"
 #include "program/prog_optimize.h"
 #include "program/prog_print.h"
@@ -160,6 +161,7 @@ public:
 class ir_to_mesa_visitor : public ir_visitor {
 public:
ir_to_mesa_visitor();
+   ~ir_to_mesa_visitor();
 
function_entry *current_function;
 
@@ -261,11 +263,10 @@ public:
  ir_constant *constant,
  struct ir_to_mesa_dst_reg temp);
 
-   int *sampler_map;
-   int sampler_map_size;
+   struct hash_table *sampler_map;
 
-   void map_sampler(int location, int sampler);
-   int get_sampler_number(int location);
+   void set_sampler_location(ir_variable *sampler, int location);
+   int get_sampler_location(ir_variable *sampler);
 
void *mem_ctx;
 };
@@ -370,22 +371,22 @@ ir_to_mesa_visitor::ir_to_mesa_emit_op0(ir_instruction 
*ir,
 }
 
 void
-ir_to_mesa_visitor::map_sampler(int location, int sampler)
+ir_to_mesa_visitor::set_sampler_location(ir_variable *sampler, int location)
 {
-   if (this->sampler_map_size <= location) {
-  this->sampler_map = talloc_realloc(this->mem_ctx, this->sampler_map,
-int, location + 1);
-  this->sampler_map_size = location + 1;
+   if (this->sampler_map == NULL) {
+  this->sampler_map = hash_table_ctor(0, hash_table_pointer_hash,
+ hash_table_pointer_compare);
}
 
-   this->sampler_map[location] = sampler;
+   hash_table_insert(this->sampler_map, (void *)(uintptr_t)location, sampler);
 }
 
 int
-ir_to_mesa_visitor::get_sampler_number(int location)
+ir_to_mesa_visitor::get_sampler_location(ir_variable *sampler)
 {
-   assert(location < this->sampler_map_size);
-   return this->sampler_map[location];
+   void *result = hash_table_find(this->sampler_map, sampler);
+
+   return (int)(uintptr_t)result;
 }
 
 inline ir_to_mesa_dst_reg
@@ -1394,14 +1395,10 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir)
 
 /* FINISHME: Fix up uniform name for arrays and things */
 if (ir->var->type->base_type == GLSL_TYPE_SAMPLER) {
-   /* FINISHME: we whack the location of the var here, which
-* is probably not expected.  But we need to communicate
-* mesa's sampler number to the tex instruction.
-*/
int sampler = _mesa_add_sampler(this->prog->Parameters,
ir->var->name,
ir->var->type->gl_type);
-   map_sampler(ir->var->location, sampler);
+   set_sampler_location(ir->var, sampler);
 
entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_SAMPLER,
  sampler);
@@ -2059,7 +2056,7 @@ ir_to_mesa_visitor::visit(ir_texture *ir)
 */
sampler->accept(this);
 
-   inst->sampler = get_sampler_number(sampler->var->location);
+   inst->sampler = get_sampler_location(sampler->var);
 
switch (sampler->type->sampler_dimensionality) {
case GLSL_SAMPLER_DIM_1D:
@@ -2166,10 +2163,15 @@ ir_to_mesa_visitor::ir_to_mesa_visitor()
next_temp = 1;
next_signature_id = 1;
sampler_map = NULL;
-   sampler_map_size = 0;
current_function = NULL;
 }
 
+ir_to_mesa_visitor::~ir_to_mesa_visitor()
+{
+   if (this->sampler_map)
+  hash_table_dtor(this->sampler_map);
+}
+
 static struct prog_src_register
 mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg)
 {

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


Mesa (glsl2): glsl2: Don' t try to assign locations for samplers during linking.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: b6ceddc371d026dc30f2cc0f377bc0214e11d768
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6ceddc371d026dc30f2cc0f377bc0214e11d768

Author: Eric Anholt 
Date:   Wed Aug  4 14:26:15 2010 -0700

glsl2: Don't try to assign locations for samplers during linking.

Mesa will do the mapping at _mesa_add_sampler() time.  Fixes assertion
failures in debug builds, which might have caught real problems with
multiple samplers linked in a row.

---

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

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 65f3697..10fd2d5 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -793,6 +793,9 @@ assign_uniform_locations(struct gl_shader_program *prog)
 if ((var == NULL) || (var->mode != ir_var_uniform))
continue;
 
+if (var->type->is_sampler())
+   continue;
+
 const unsigned vec4_slots = (var->component_slots() + 3) / 4;
 assert(vec4_slots != 0);
 

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


Mesa (glsl2): mesa: Don' t null deref looking for Mesa IR code at compile time.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: 8e181b629f97ada65cc1b8a17ba42edc2ea77254
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e181b629f97ada65cc1b8a17ba42edc2ea77254

Author: Eric Anholt 
Date:   Wed Aug  4 14:13:08 2010 -0700

mesa: Don't null deref looking for Mesa IR code at compile time.

The new compiler doesn't generate Mesa IR at compile time, and that
compile time code previously wouldn't have reflected the link time
code that actually got used.  But do dump the info log of the compile
regardless.

---

 src/mesa/program/prog_print.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index 6ab199a..b66d709 100644
--- a/src/mesa/program/prog_print.c
+++ b/src/mesa/program/prog_print.c
@@ -1031,11 +1031,9 @@ _mesa_write_shader_to_file(const struct gl_shader 
*shader)
 
fprintf(f, "/* Compile status: %s */\n",
shader->CompileStatus ? "ok" : "fail");
-   if (!shader->CompileStatus) {
-  fprintf(f, "/* Log Info: */\n");
-  fputs(shader->InfoLog, f);
-   }
-   else {
+   fprintf(f, "/* Log Info: */\n");
+   fputs(shader->InfoLog, f);
+   if (shader->CompileStatus && shader->Program) {
   fprintf(f, "/* GPU code */\n");
   fprintf(f, "/*\n");
   _mesa_fprint_program_opt(f, shader->Program, PROG_PRINT_DEBUG, GL_TRUE);

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


Mesa (master): r600g: force flush on map as temporary fix to readpixel

2010-08-04 Thread Jerome Glisse
Module: Mesa
Branch: master
Commit: 12dac449fba5fe17087fd48ac959a5388875b2d3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=12dac449fba5fe17087fd48ac959a5388875b2d3

Author: Jerome Glisse 
Date:   Wed Aug  4 16:28:33 2010 -0400

r600g: force flush on map as temporary fix to readpixel

Should allow more piglit test to pass. Need to plugin
proper flushing.

Signed-off-by: Jerome Glisse 

---

 src/gallium/drivers/r600/r600_texture.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_texture.c 
b/src/gallium/drivers/r600/r600_texture.c
index 3725bf8..033c71f 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -234,6 +234,8 @@ void* r600_texture_transfer_map(struct pipe_context *ctx,
struct r600_screen *rscreen = r600_screen(ctx->screen);
char *map;
 
+   r600_flush(ctx, 0, NULL);
+
resource = (struct r600_resource *)transfer->resource;
if (radeon_bo_map(rscreen->rw, resource->bo)) {
return NULL;

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


Mesa (master): st/mesa: Add missing headers to st_cb_fbo.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 2e85117b5f8909b8737e0c0e479360640e405192
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e85117b5f8909b8737e0c0e479360640e405192

Author: Vinson Lee 
Date:   Wed Aug  4 13:17:57 2010 -0700

st/mesa: Add missing headers to st_cb_fbo.h.

---

 src/mesa/state_tracker/st_cb_fbo.h |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.h 
b/src/mesa/state_tracker/st_cb_fbo.h
index 43b6c1e..62a9bbc 100644
--- a/src/mesa/state_tracker/st_cb_fbo.h
+++ b/src/mesa/state_tracker/st_cb_fbo.h
@@ -29,6 +29,15 @@
 #ifndef ST_CB_FBO_H
 #define ST_CB_FBO_H
 
+#include "main/compiler.h"
+#include "main/glheader.h"
+#include "main/mtypes.h"
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+
+struct dd_function_table;
+struct pipe_context;
 
 /**
  * Derived renderbuffer class.  Just need to add a pointer to the

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


Mesa (master): r600g: always perform texture perspective divide + fix blending

2010-08-04 Thread Jerome Glisse
Module: Mesa
Branch: master
Commit: 9a78e790dc4c40362b971ad5eff2505c02b73ed7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a78e790dc4c40362b971ad5eff2505c02b73ed7

Author: Jerome Glisse 
Date:   Wed Aug  4 16:10:11 2010 -0400

r600g: always perform texture perspective divide + fix blending

quake3 engine seems to run fine at this point (ioquake)

Signed-off-by: Jerome Glisse 

---

 src/gallium/drivers/r600/r600_shader.c|  121 -
 src/gallium/drivers/r600/r600_state.c |5 +-
 src/gallium/drivers/r600/r600_state_inlines.h |2 +-
 src/gallium/drivers/r600/r600d.h  |   25 +
 4 files changed, 88 insertions(+), 65 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 43b3e40..8da102c 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -963,68 +963,66 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
src_gpr = ctx->file_offset[inst->Src[0].Register.File] + 
inst->Src[0].Register.Index;
 
/* Add perspective divide */
-   if (ctx->inst_info->tgsi_opcode == TGSI_OPCODE_TXP) {
-   memset(&alu, 0, sizeof(struct r600_bc_alu));
-   alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE;
-   alu.src[0].sel = src_gpr;
-   alu.src[0].chan = tgsi_chan(&inst->Src[0], 3);
-   alu.dst.sel = ctx->temp_reg;
-   alu.dst.chan = 3;
-   alu.last = 1;
-   alu.dst.write = 1;
-   r = r600_bc_add_alu(ctx->bc, &alu);
-   if (r)
-   return r;
+   memset(&alu, 0, sizeof(struct r600_bc_alu));
+   alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE;
+   alu.src[0].sel = src_gpr;
+   alu.src[0].chan = tgsi_chan(&inst->Src[0], 3);
+   alu.dst.sel = ctx->temp_reg;
+   alu.dst.chan = 3;
+   alu.last = 1;
+   alu.dst.write = 1;
+   r = r600_bc_add_alu(ctx->bc, &alu);
+   if (r)
+   return r;
 
-   memset(&alu, 0, sizeof(struct r600_bc_alu));
-   alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL;
-   alu.src[0].sel = ctx->temp_reg;
-   alu.src[0].chan = 3;
-   alu.src[1].sel = src_gpr;
-   alu.src[1].chan = tgsi_chan(&inst->Src[0], 0);
-   alu.dst.sel = ctx->temp_reg;
-   alu.dst.chan = 0;
-   alu.dst.write = 1;
-   r = r600_bc_add_alu(ctx->bc, &alu);
-   if (r)
-   return r;
-   memset(&alu, 0, sizeof(struct r600_bc_alu));
-   alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL;
-   alu.src[0].sel = ctx->temp_reg;
-   alu.src[0].chan = 3;
-   alu.src[1].sel = src_gpr;
-   alu.src[1].chan = tgsi_chan(&inst->Src[0], 1);
-   alu.dst.sel = ctx->temp_reg;
-   alu.dst.chan = 1;
-   alu.dst.write = 1;
-   r = r600_bc_add_alu(ctx->bc, &alu);
-   if (r)
-   return r;
-   memset(&alu, 0, sizeof(struct r600_bc_alu));
-   alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL;
-   alu.src[0].sel = ctx->temp_reg;
-   alu.src[0].chan = 3;
-   alu.src[1].sel = src_gpr;
-   alu.src[1].chan = tgsi_chan(&inst->Src[0], 2);
-   alu.dst.sel = ctx->temp_reg;
-   alu.dst.chan = 2;
-   alu.dst.write = 1;
-   r = r600_bc_add_alu(ctx->bc, &alu);
-   if (r)
-   return r;
-   memset(&alu, 0, sizeof(struct r600_bc_alu));
-   alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
-   alu.src[0].sel = 249;
-   alu.src[0].chan = 0;
-   alu.dst.sel = ctx->temp_reg;
-   alu.dst.chan = 3;
-   alu.last = 1;
-   alu.dst.write = 1;
-   r = r600_bc_add_alu(ctx->bc, &alu);
-   if (r)
-   return r;
-   src_gpr = ctx->temp_reg;
-   }
+   memset(&alu, 0, sizeof(struct r600_bc_alu));
+   alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL;
+   alu.src[0].sel = ctx->temp_reg;
+   alu.src[0].chan = 3;
+   alu.src[1].sel = src_gpr;
+   alu.src[1].chan = tgsi_chan(&inst->Src[0], 0);
+   alu.dst.sel = ctx->temp_reg;
+   alu.dst.chan = 0;
+   alu.dst.write = 1;
+   r = r600_bc_add_alu(ctx->bc, &alu);
+   if (r)
+   return r;
+   memset(&alu, 0, sizeof(struct r600_bc_alu));
+   alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL;
+   alu.src[0].sel = ctx->temp_reg;
+   alu.src[0].chan = 3;
+   alu.src[1].sel = src_gpr;
+   alu.src[1].chan = tgsi_chan(&inst->Src[0], 1);
+   alu.dst.sel = ctx->temp_reg;
+   alu.dst.chan = 1;
+   alu.dst.write = 1;
+   r 

Mesa (master): st/mesa: Clean up header file inclusion in st_cb_eglimage.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 19bfb55fb54447b322d3aefecf6e0dbb81d8f812
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=19bfb55fb54447b322d3aefecf6e0dbb81d8f812

Author: Vinson Lee 
Date:   Wed Aug  4 13:04:36 2010 -0700

st/mesa: Clean up header file inclusion in st_cb_eglimage.h.

Replace dd.h and mtypes.h with a forward declaration.
Include compiler.h for INLINE symbol.

---

 src/mesa/state_tracker/st_cb_eglimage.h |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_eglimage.h 
b/src/mesa/state_tracker/st_cb_eglimage.h
index d6953e9..b6e44d5 100644
--- a/src/mesa/state_tracker/st_cb_eglimage.h
+++ b/src/mesa/state_tracker/st_cb_eglimage.h
@@ -29,8 +29,9 @@
 #ifndef ST_CB_EGLIMAGE_H
 #define ST_CB_EGLIMAGE_H
 
-#include "main/mtypes.h"
-#include "main/dd.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
 
 #if FEATURE_OES_EGL_image
 

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


Mesa (glsl2): glsl2: Skip talloc_parent in constant_expression of non-constant arrays.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: 952d0f88e1741d51b641be75f7c5a6565e245a69
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=952d0f88e1741d51b641be75f7c5a6565e245a69

Author: Eric Anholt 
Date:   Wed Aug  4 12:57:58 2010 -0700

glsl2: Skip talloc_parent in constant_expression of non-constant arrays.

---

 src/glsl/ir_constant_expression.cpp |2 +-
 src/mesa/program/ir_to_mesa.cpp |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ir_constant_expression.cpp 
b/src/glsl/ir_constant_expression.cpp
index 677353e..0a92424 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -690,11 +690,11 @@ ir_dereference_variable::constant_expression_value()
 ir_constant *
 ir_dereference_array::constant_expression_value()
 {
-   void *ctx = talloc_parent(this);
ir_constant *array = this->array->constant_expression_value();
ir_constant *idx = this->array_index->constant_expression_value();
 
if ((array != NULL) && (idx != NULL)) {
+  void *ctx = talloc_parent(this);
   if (array->type->is_matrix()) {
 /* Array access of a matrix results in a vector.
  */
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index ba0934c..dcf8c49 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2622,7 +2622,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct 
gl_shader *shader)
 progress = do_constant_folding(shader->ir) || progress;
 progress = do_algebraic(shader->ir) || progress;
 progress = do_if_return(shader->ir) || progress;
-if (ctx->Shader.EmitNoIfs)
+if (1 || ctx->Shader.EmitNoIfs)
progress = do_if_to_cond_assign(shader->ir) || progress;
 
 progress = do_vec_index_to_swizzle(shader->ir) || progress;

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


Mesa (master): draw: Fix return type of draw_translate_vinfo_size.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 988e86762f07eb8b685eef6f3302566f604db2a6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=988e86762f07eb8b685eef6f3302566f604db2a6

Author: Vinson Lee 
Date:   Wed Aug  4 12:55:21 2010 -0700

draw: Fix return type of draw_translate_vinfo_size.

Fixes typo from commit b609cfc7c9c38f26e7e6d6f7dd5dd6d38f4ed209.

---

 src/gallium/auxiliary/draw/draw_vertex.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_vertex.h 
b/src/gallium/auxiliary/draw/draw_vertex.h
index 3af31ff..e63cf5f 100644
--- a/src/gallium/auxiliary/draw/draw_vertex.h
+++ b/src/gallium/auxiliary/draw/draw_vertex.h
@@ -166,7 +166,7 @@ static INLINE enum pipe_format 
draw_translate_vinfo_format(enum attrib_emit emit
}
 }
 
-static INLINE enum attrib_emit draw_translate_vinfo_size(enum attrib_emit emit)
+static INLINE unsigned draw_translate_vinfo_size(enum attrib_emit emit)
 {
switch (emit) {
case EMIT_OMIT:

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


Mesa (glsl2): glsl2: Make the clone() method take a talloc context.

2010-08-04 Thread Eric Anholt
Module: Mesa
Branch: glsl2
Commit: 8273bd46877e2ea2b8a02b87a11c68102d07e1f2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8273bd46877e2ea2b8a02b87a11c68102d07e1f2

Author: Eric Anholt 
Date:   Wed Aug  4 12:34:56 2010 -0700

glsl2: Make the clone() method take a talloc context.

In most cases, we needed to be reparenting the cloned IR to a
different context (for example, to the linked shader instead of the
unlinked shader), or optimization before the reparent would cause
memory usage of the original object to grow and grow.

---

 src/glsl/ast_to_hir.cpp  |   10 +-
 src/glsl/ir.h|   47 +
 src/glsl/ir_clone.cpp|  150 +
 src/glsl/ir_constant_expression.cpp  |7 +-
 src/glsl/ir_function_inlining.cpp|6 +-
 src/glsl/ir_import_prototypes.cpp|2 +-
 src/glsl/ir_vec_index_to_cond_assign.cpp |8 +-
 src/glsl/link_functions.cpp  |6 +-
 src/glsl/linker.cpp  |   25 +++--
 9 files changed, 130 insertions(+), 131 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 3522f55..b65a323 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -966,7 +966,7 @@ ast_expression::hir(exec_list *instructions,
   op[0], op[1]);
 
   result = do_assignment(instructions, state,
-op[0]->clone(NULL), temp_rhs,
+op[0]->clone(ctx, NULL), temp_rhs,
 this->subexpressions[0]->get_location());
   type = result->type;
   error_emitted = (op[0]->type->is_error());
@@ -992,7 +992,7 @@ ast_expression::hir(exec_list *instructions,
op[0], op[1]);
 
   result = do_assignment(instructions, state,
-op[0]->clone(NULL), temp_rhs,
+op[0]->clone(ctx, NULL), temp_rhs,
 this->subexpressions[0]->get_location());
   type = result->type;
   error_emitted = type->is_error();
@@ -1113,7 +1113,7 @@ ast_expression::hir(exec_list *instructions,
op[0], op[1]);
 
   result = do_assignment(instructions, state,
-op[0]->clone(NULL), temp_rhs,
+op[0]->clone(ctx, NULL), temp_rhs,
 this->subexpressions[0]->get_location());
   type = result->type;
   error_emitted = op[0]->type->is_error();
@@ -1139,10 +1139,10 @@ ast_expression::hir(exec_list *instructions,
   /* Get a temporary of a copy of the lvalue before it's modified.
* This may get thrown away later.
*/
-  result = get_lvalue_copy(instructions, op[0]->clone(NULL));
+  result = get_lvalue_copy(instructions, op[0]->clone(ctx, NULL));
 
   (void)do_assignment(instructions, state,
- op[0]->clone(NULL), temp_rhs,
+ op[0]->clone(ctx, NULL), temp_rhs,
  this->subexpressions[0]->get_location());
 
   type = result->type;
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index f88a243..f964b36 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -76,7 +76,8 @@ public:
 
virtual void accept(ir_visitor *) = 0;
virtual ir_visitor_status accept(ir_hierarchical_visitor *) = 0;
-   virtual ir_instruction *clone(struct hash_table *ht) const = 0;
+   virtual ir_instruction *clone(void *mem_ctx,
+struct hash_table *ht) const = 0;
 
/**
 * \name IR instruction downcast functions
@@ -113,7 +114,7 @@ protected:
 
 class ir_rvalue : public ir_instruction {
 public:
-   virtual ir_rvalue *clone(struct hash_table *) const = 0;
+   virtual ir_rvalue *clone(void *mem_ctx, struct hash_table *) const = 0;
 
virtual ir_constant *constant_expression_value() = 0;
 
@@ -175,7 +176,7 @@ class ir_variable : public ir_instruction {
 public:
ir_variable(const struct glsl_type *, const char *, ir_variable_mode);
 
-   virtual ir_variable *clone(struct hash_table *ht) const;
+   virtual ir_variable *clone(void *mem_ctx, struct hash_table *ht) const;
 
virtual ir_variable *as_variable()
{
@@ -283,7 +284,8 @@ class ir_function_signature : public ir_instruction {
 public:
ir_function_signature(const glsl_type *return_type);
 
-   virtual ir_function_signature *clone(struct hash_table *ht) const;
+   virtual ir_function_signature *clone(void *mem_ctx,
+   struct hash_table *ht) const;
 
virtual void accept(ir_visitor *v)
{
@@ -369,7 +371,7 @@ class ir_function : public ir_instruction {
 public:
ir_function(const char *name);
 
-   virtual ir_function *clone(struct hash_table *ht) const;
+   virtual ir_function *clone(void *mem_ctx, struct hash_table *ht) const;
 
virtual ir_function *as_function()
{
@@ -439,7 +

Mesa (master): st/mesa: Clean up header file inclusion in st_cb_drawtex.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 137c510097503e590cf8b30d2b97e617b9a1543b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=137c510097503e590cf8b30d2b97e617b9a1543b

Author: Vinson Lee 
Date:   Wed Aug  4 12:46:38 2010 -0700

st/mesa: Clean up header file inclusion in st_cb_drawtex.h.

Replace mtypes.h with forward declarations.
Include compiler.h for INLINE symbol.

---

 src/mesa/state_tracker/st_cb_drawtex.h |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_drawtex.h 
b/src/mesa/state_tracker/st_cb_drawtex.h
index a3f54a3..d21262f 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.h
+++ b/src/mesa/state_tracker/st_cb_drawtex.h
@@ -10,7 +10,10 @@
 #define ST_CB_DRAWTEX_H
 
 
-#include "main/mtypes.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
+struct st_context;
 
 #if FEATURE_OES_draw_texture
 

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


Mesa (master): st/mesa: Clean up header file inclusion in st_cb_drawpixels. h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: dce63cf431177594f1267406276f441391701f70
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dce63cf431177594f1267406276f441391701f70

Author: Vinson Lee 
Date:   Wed Aug  4 12:29:26 2010 -0700

st/mesa: Clean up header file inclusion in st_cb_drawpixels.h.

Replace mtypes.h with forward declarations.
Include compiler.h for INLINE symbol.

---

 src/mesa/state_tracker/st_cb_drawpixels.h |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_drawpixels.h 
b/src/mesa/state_tracker/st_cb_drawpixels.h
index 7d5e901..575f169 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.h
+++ b/src/mesa/state_tracker/st_cb_drawpixels.h
@@ -30,7 +30,10 @@
 #define ST_CB_DRAWPIXELS_H
 
 
-#include "main/mtypes.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
+struct st_context;
 
 #if FEATURE_drawpix
 

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


Mesa (master): st/mesa: Add forward declaration in st_cb_condrender.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 7fdf6d5c28293e169b7874d95632ec0bba9da78a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7fdf6d5c28293e169b7874d95632ec0bba9da78a

Author: Vinson Lee 
Date:   Wed Aug  4 12:24:51 2010 -0700

st/mesa: Add forward declaration in st_cb_condrender.h.

---

 src/mesa/state_tracker/st_cb_condrender.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_condrender.h 
b/src/mesa/state_tracker/st_cb_condrender.h
index 891f1cb..79d0db8 100644
--- a/src/mesa/state_tracker/st_cb_condrender.h
+++ b/src/mesa/state_tracker/st_cb_condrender.h
@@ -29,6 +29,8 @@
 #define ST_CB_CONDRENDER_H
 
 
+struct dd_function_table;
+
 extern void st_init_cond_render_functions(struct dd_function_table *functions);
 
 

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


Mesa (master): st/mesa: Add forward declarations in st_cb_clear.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: ed810ba7243f0b1c35f21e7be5708446962a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ed810ba7243f0b1c35f21e7be5708446962a

Author: Vinson Lee 
Date:   Wed Aug  4 12:22:31 2010 -0700

st/mesa: Add forward declarations in st_cb_clear.h.

---

 src/mesa/state_tracker/st_cb_clear.h |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_clear.h 
b/src/mesa/state_tracker/st_cb_clear.h
index bc035ac..b27c09d 100644
--- a/src/mesa/state_tracker/st_cb_clear.h
+++ b/src/mesa/state_tracker/st_cb_clear.h
@@ -30,6 +30,9 @@
 #define ST_CB_CLEAR_H
 
 
+struct dd_function_table;
+struct st_context;
+
 extern void
 st_init_clear(struct st_context *st);
 

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


Mesa (master): st/mesa: Include missing headers in st_cb_bufferobjects.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 6bc17324da6e9d90ea2586c59c162a72f900a0fc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6bc17324da6e9d90ea2586c59c162a72f900a0fc

Author: Vinson Lee 
Date:   Wed Aug  4 12:13:29 2010 -0700

st/mesa: Include missing headers in st_cb_bufferobjects.h.

Include compiler.h for INLINE symbol.
Include mtypes.h for gl_buffer_object symbol.

---

 src/mesa/state_tracker/st_cb_bufferobjects.h |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.h 
b/src/mesa/state_tracker/st_cb_bufferobjects.h
index a27daac..1c991d2 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.h
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.h
@@ -28,9 +28,12 @@
 #ifndef ST_CB_BUFFEROBJECTS_H
 #define ST_CB_BUFFEROBJECTS_H
 
-struct st_context;
-struct gl_buffer_object;
+#include "main/compiler.h"
+#include "main/mtypes.h"
+
+struct dd_function_table;
 struct pipe_resource;
+struct st_context;
 
 /**
  * State_tracker vertex/pixel buffer object, derived from Mesa's

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


Mesa (master): st/mesa: Clean up header file inclusion in st_cb_blit.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: eb4f2d4b0264e180f818230fa69a420793423eb7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb4f2d4b0264e180f818230fa69a420793423eb7

Author: Vinson Lee 
Date:   Wed Aug  4 12:07:12 2010 -0700

st/mesa: Clean up header file inclusion in st_cb_blit.h.

Replaced mtypes.h and st_context.h with forward declarations.
Added compiler.h for INLINE symbol.

---

 src/mesa/state_tracker/st_cb_blit.h |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_blit.h 
b/src/mesa/state_tracker/st_cb_blit.h
index 7ab9a54..c230652 100644
--- a/src/mesa/state_tracker/st_cb_blit.h
+++ b/src/mesa/state_tracker/st_cb_blit.h
@@ -29,8 +29,10 @@
 #define ST_CB_BLIT_H
 
 
-#include "main/mtypes.h"
-#include "st_context.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
+struct st_context;
 
 
 extern void

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


Mesa (master): st/mesa: Clean up header file inclusion in st_cb_bitmap.h.

2010-08-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: e6902afeee522494f1787cc7c79415f55dce2eb4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6902afeee522494f1787cc7c79415f55dce2eb4

Author: Vinson Lee 
Date:   Wed Aug  4 12:00:19 2010 -0700

st/mesa: Clean up header file inclusion in st_cb_bitmap.h.

Removed mtypes.h.
Include compiler.h for INLINE symbol.
Added forward declarations.

---

 src/mesa/state_tracker/st_cb_bitmap.h |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_bitmap.h 
b/src/mesa/state_tracker/st_cb_bitmap.h
index 8af975b..d04b2b6 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.h
+++ b/src/mesa/state_tracker/st_cb_bitmap.h
@@ -30,7 +30,10 @@
 #define ST_CB_BITMAP_H
 
 
-#include "main/mtypes.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
+struct st_context;
 
 #if FEATURE_drawpix
 

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


Mesa (master): glx: Move deref after NULL check

2010-08-04 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 2542d8e0c2ec3eb4de266c0b2ad93dba918cb89c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2542d8e0c2ec3eb4de266c0b2ad93dba918cb89c

Author: Kristian Høgsberg 
Date:   Wed Aug  4 12:50:36 2010 -0400

glx: Move deref after NULL check

---

 src/glx/dri2_glx.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 99384f8..ff48c79 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -657,9 +657,10 @@ dri2_bind_tex_image(Display * dpy,
struct dri2_drawable *pdraw = (struct dri2_drawable *) base;
struct dri2_display *pdp =
   (struct dri2_display *) dpyPriv->dri2Display;
-   struct dri2_screen *psc = (struct dri2_screen *) base->psc;
+   struct dri2_screen *psc;
 
if (pdraw != NULL) {
+  psc = (struct dri2_screen *) base->psc;
 
 #if __DRI2_FLUSH_VERSION >= 3
   if (!pdp->invalidateAvailable && psc->f)

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


Mesa (glsl2): glsl2: Set ir_discard::ir_type when cloning it

2010-08-04 Thread Ian Romanick
Module: Mesa
Branch: glsl2
Commit: 84ee01f40acf88185484df386b7715034e7685c9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=84ee01f40acf88185484df386b7715034e7685c9

Author: Aras Pranckevicius 
Date:   Wed Aug  4 16:31:04 2010 +0200

glsl2: Set ir_discard::ir_type when cloning it

Fixes unset ir_type after inlining.

---

 src/glsl/ir.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index bee9f6a..f88a243 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -889,6 +889,7 @@ public:
 
ir_discard(ir_rvalue *cond)
{
+  this->ir_type = ir_type_discard;
   this->condition = cond;
}
 

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


Mesa (master): glx: Fix use after free in drisw error path

2010-08-04 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: e3a0e468bc67e4169406bb4c96b5ab483dc48a28
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e3a0e468bc67e4169406bb4c96b5ab483dc48a28

Author: Kristian Høgsberg 
Date:   Wed Aug  4 08:57:02 2010 -0400

glx: Fix use after free in drisw error path

---

 src/glx/drisw_glx.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 66a6043..c5b1791 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -502,10 +502,9 @@ driCreateScreen(int screen, struct glx_display *priv)
return &psc->base;
 
  handle_error:
-   Xfree(psc);
-
if (psc->driver)
   dlclose(psc->driver);
+   Xfree(psc);
 
ErrorMessageF("reverting to indirect rendering\n");
 

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


Mesa (master): glx: We no longer need screen extensions for drisw

2010-08-04 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: e71c44cedd6d22930bf873504d89faf68d93e1cc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e71c44cedd6d22930bf873504d89faf68d93e1cc

Author: Kristian Høgsberg 
Date:   Wed Aug  4 08:51:43 2010 -0400

glx: We no longer need screen extensions for drisw

https://bugs.freedesktop.org/show_bug.cgi?id=29177

---

 src/glx/drisw_glx.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 46c5606..66a6043 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -485,8 +485,6 @@ driCreateScreen(int screen, struct glx_display *priv)
   goto handle_error;
}
 
-   extensions = psc->core->getExtensions(psc->driScreen);
-
psc->base.configs =
   driConvertConfigs(psc->core, psc->base.configs, driver_configs);
psc->base.visuals =

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


Mesa (master): glx: dri2InvalidateBuffers() needs the X drawable XID not the GLX one

2010-08-04 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 9da1c9da139327132dea57b18048a4eb386b6bad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9da1c9da139327132dea57b18048a4eb386b6bad

Author: Kristian Høgsberg 
Date:   Wed Aug  4 08:43:08 2010 -0400

glx: dri2InvalidateBuffers() needs the X drawable XID not the GLX one

This never ceases to entertain.

---

 src/glx/dri2_glx.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index e57d10f..99384f8 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -439,7 +439,7 @@ dri2FlushFrontBuffer(__DRIdrawable *driDrawable, void 
*loaderPrivate)
 
/* Old servers don't send invalidate events */
if (!pdp->invalidateAvailable)
-   dri2InvalidateBuffers(priv->dpy, pdraw->base.drawable);
+   dri2InvalidateBuffers(priv->dpy, pdraw->base.xDrawable);
 
dri2_wait_gl(gc);
 }
@@ -507,7 +507,7 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t 
target_msc, int64_t divisor,
 
 /* Old servers don't send invalidate events */
 if (!pdp->invalidateAvailable)
-   dri2InvalidateBuffers(dpyPriv->dpy, pdraw->drawable);
+   dri2InvalidateBuffers(dpyPriv->dpy, pdraw->xDrawable);
 
 /* Old servers can't handle swapbuffers */
 if (!pdp->swapAvailable) {

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


Mesa (master): r600: relax stride/alignment requirements for vertices

2010-08-04 Thread Andre Maasikas
Module: Mesa
Branch: master
Commit: 8ad5b76d52f1c009f48ea90556633e497b40ba87
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ad5b76d52f1c009f48ea90556633e497b40ba87

Author: Andre Maasikas 
Date:   Wed Aug  4 12:49:39 2010 +0300

r600: relax stride/alignment requirements for vertices

seems hw can do unaligned accesses and unaligned strides
removes extra conversion when using vbo's

however I needed to switch 3 component byte format to 4 component formats
for tests to pass. Somewhat sililar to GL_SHORT fix done earlier

removes assert and gains +2 piglit especially draw-vertices

---

 src/mesa/drivers/dri/r600/r700_assembler.c |5 -
 src/mesa/drivers/dri/r600/r700_render.c|   23 +++
 src/mesa/drivers/dri/r600/r700_vertprog.c  |6 +++---
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c 
b/src/mesa/drivers/dri/r600/r700_assembler.c
index b555ea6..9c954cb 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -275,7 +275,10 @@ GLuint GetSurfaceFormat(GLenum eType, GLuint nChannels, 
GLuint * pClient_size)
 case 2:
 format = FMT_8_8; break;
 case 3:
-format = FMT_8_8_8; break;
+/* for some (small/unaligned) strides using 4 comps works
+ * better, probably same as GL_SHORT below
+ * test piglit/draw-vertices */
+format = FMT_8_8_8_8; break;
 case 4:
 format = FMT_8_8_8_8; break;
 default:
diff --git a/src/mesa/drivers/dri/r600/r700_render.c 
b/src/mesa/drivers/dri/r600/r700_render.c
index 316a094..ba55f38 100644
--- a/src/mesa/drivers/dri/r600/r700_render.c
+++ b/src/mesa/drivers/dri/r600/r700_render.c
@@ -625,11 +625,11 @@ static void r700SetupStreams(GLcontext *ctx, const struct 
gl_client_array *input
 
 stride = (input[i]->StrideB == 0) ? getTypeSize(input[i]->Type) * 
input[i]->Size : input[i]->StrideB;
 
-if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT 
|| input[i]->Type == GL_INT ||
+if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT 
|| input[i]->Type == GL_INT
 #if MESA_BIG_ENDIAN
-getTypeSize(input[i]->Type) != 4 || 
+|| getTypeSize(input[i]->Type) != 4
 #endif
-stride < 4) 
+) 
 {
 r700ConvertAttrib(ctx, count, input[i], 
&context->stream_desc[index]);
 } 
@@ -637,19 +637,10 @@ static void r700SetupStreams(GLcontext *ctx, const struct 
gl_client_array *input
 {
 if (input[i]->BufferObj->Name) 
 {
-if (stride % 4 != 0) 
-{
-assert(((intptr_t) input[i]->Ptr) % input[i]->StrideB == 
0);
-r700AlignDataToDword(ctx, input[i], count, 
&context->stream_desc[index]);
-context->stream_desc[index].is_named_bo = GL_FALSE;
-} 
-else 
-{
-context->stream_desc[index].stride = input[i]->StrideB;
-context->stream_desc[index].bo_offset = (intptr_t) 
input[i]->Ptr;
-context->stream_desc[index].bo = 
get_radeon_buffer_object(input[i]->BufferObj)->bo;
-context->stream_desc[index].is_named_bo = GL_TRUE;
-}
+context->stream_desc[index].stride = input[i]->StrideB;
+context->stream_desc[index].bo_offset = (intptr_t) 
input[i]->Ptr;
+context->stream_desc[index].bo = 
get_radeon_buffer_object(input[i]->BufferObj)->bo;
+context->stream_desc[index].is_named_bo = GL_TRUE;
 } 
 else 
 {
diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c 
b/src/mesa/drivers/dri/r600/r700_vertprog.c
index 137f300..6a2a09e 100644
--- a/src/mesa/drivers/dri/r600/r700_vertprog.c
+++ b/src/mesa/drivers/dri/r600/r700_vertprog.c
@@ -461,11 +461,11 @@ static void r700TranslateAttrib(GLcontext *ctx, GLuint 
unLoc, int count, const s
stride = (input->StrideB == 0) ? getTypeSize(input->Type) * input->Size 
: input->StrideB;
 
-if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || 
input->Type == GL_INT ||
+if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || 
input->Type == GL_INT
 #if MESA_BIG_ENDIAN
-getTypeSize(input->Type) != 4 ||
+|| getTypeSize(input->Type) != 4
 #endif
-stride < 4) 
+   ) 
 {
 pStreamDesc->type = GL_FLOAT;
 

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