Mesa (master): mesa: Add ARB_arrays_of_arrays

2014-01-23 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: 72288e0c7b7ec769da71fbaf124ec4ee8be7577b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=72288e0c7b7ec769da71fbaf124ec4ee8be7577b

Author: Timothy Arceri t_arc...@yahoo.com.au
Date:   Thu Jan 23 23:15:29 2014 +1100

mesa: Add ARB_arrays_of_arrays

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
Reviewed-by: Paul Berry stereotype...@gmail.com

---

 src/glsl/glcpp/glcpp-parse.y |3 +++
 src/mesa/main/extensions.c   |1 +
 src/mesa/main/mtypes.h   |1 +
 3 files changed, 5 insertions(+)

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index bbe8a06..e241521 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -1222,6 +1222,9 @@ glcpp_parser_create (const struct gl_extensions 
*extensions, int api)
 add_builtin_define(parser, GL_EXT_texture_array, 1);
  }
 
+  if (extensions-ARB_arrays_of_arrays)
+ add_builtin_define(parser, GL_ARB_arrays_of_arrays, 1);
+
  if (extensions-ARB_fragment_coord_conventions)
 add_builtin_define(parser, GL_ARB_fragment_coord_conventions,
1);
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index c2c9c09..0676f1e 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -80,6 +80,7 @@ static const struct extension extension_table[] = {
/* ARB Extensions */
{ GL_ARB_ES2_compatibility,   o(ARB_ES2_compatibility),   
GL, 2009 },
{ GL_ARB_ES3_compatibility,   o(ARB_ES3_compatibility),   
GL, 2012 },
+   { GL_ARB_arrays_of_arrays,o(ARB_arrays_of_arrays),
GL, 2012 },
{ GL_ARB_base_instance,   o(ARB_base_instance),   
GL, 2011 },
{ GL_ARB_blend_func_extended, o(ARB_blend_func_extended), 
GL, 2009 },
{ GL_ARB_clear_buffer_object, o(dummy_true),  
GL, 2012 },
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3dd9678..679e1a3 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3380,6 +3380,7 @@ struct gl_extensions
GLboolean ANGLE_texture_compression_dxt;
GLboolean ARB_ES2_compatibility;
GLboolean ARB_ES3_compatibility;
+   GLboolean ARB_arrays_of_arrays;
GLboolean ARB_base_instance;
GLboolean ARB_blend_func_extended;
GLboolean ARB_color_buffer_float;

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


Mesa (master): glsl: remove remaining is_array variables

2014-01-23 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: b0c64d3cc6d1d3a64c86a5b2cd748b4178bff350
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b0c64d3cc6d1d3a64c86a5b2cd748b4178bff350

Author: Timothy Arceri t_arc...@yahoo.com.au
Date:   Thu Jan 23 23:22:01 2014 +1100

glsl: remove remaining is_array variables

Previously the reason we needed is_array was because we used array_size == NULL 
to
 represent both non-arrays and unsized arrays.  Now that we use a non-NULL
array_specifier to represent an unsized array, is_array is redundant.

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
Reviewed-by: Paul Berry stereotype...@gmail.com

---

 src/glsl/ast.h  |   32 +++-
 src/glsl/ast_to_hir.cpp |   11 +--
 src/glsl/ast_type.cpp   |6 ++
 src/glsl/glsl_parser.yy |   30 +++---
 src/glsl/glsl_parser_extras.cpp |   15 ++-
 5 files changed, 35 insertions(+), 59 deletions(-)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index d462dd5..0bda28d 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -371,14 +371,13 @@ public:
 
 class ast_declaration : public ast_node {
 public:
-   ast_declaration(const char *identifier, bool is_array,
+   ast_declaration(const char *identifier,
ast_array_specifier *array_specifier,
ast_expression *initializer);
virtual void print(void) const;
 
const char *identifier;
-   
-   bool is_array;
+
ast_array_specifier *array_specifier;
 
ast_expression *initializer;
@@ -588,10 +587,10 @@ public:
 * Use only if the objects are allocated from the same context and will not
 * be modified. Zeros the inherited ast_node's fields.
 */
-   ast_type_specifier(const ast_type_specifier *that, bool is_array,
+   ast_type_specifier(const ast_type_specifier *that,
   ast_array_specifier *array_specifier)
   : ast_node(), type_name(that-type_name), structure(that-structure),
-is_array(is_array), array_specifier(array_specifier),
+array_specifier(array_specifier),
 default_precision(that-default_precision)
{
   /* empty */
@@ -599,8 +598,7 @@ public:
 
/** Construct a type specifier from a type name */
ast_type_specifier(const char *name) 
-  : type_name(name), structure(NULL),
-   is_array(false), array_specifier(NULL),
+  : type_name(name), structure(NULL), array_specifier(NULL),
default_precision(ast_precision_none)
{
   /* empty */
@@ -608,8 +606,7 @@ public:
 
/** Construct a type specifier from a structure definition */
ast_type_specifier(ast_struct_specifier *s)
-  : type_name(s-name), structure(s),
-   is_array(false), array_specifier(NULL),
+  : type_name(s-name), structure(s), array_specifier(NULL),
default_precision(ast_precision_none)
{
   /* empty */
@@ -626,7 +623,6 @@ public:
const char *type_name;
ast_struct_specifier *structure;
 
-   bool is_array;
ast_array_specifier *array_specifier;
 
/** For precision statements, this is the given precision; otherwise none. 
*/
@@ -680,7 +676,6 @@ public:
ast_parameter_declarator() :
   type(NULL),
   identifier(NULL),
-  is_array(false),
   array_specifier(NULL),
   formal_parameter(false),
   is_void(false)
@@ -695,7 +690,6 @@ public:
 
ast_fully_specified_type *type;
const char *identifier;
-   bool is_array;
ast_array_specifier *array_specifier;
 
static void parameters_to_hir(exec_list *ast_parameters,
@@ -943,13 +937,10 @@ class ast_interface_block : public ast_node {
 public:
ast_interface_block(ast_type_qualifier layout,
const char *instance_name,
-   bool is_array,
ast_array_specifier *array_specifier)
: layout(layout), block_name(NULL), instance_name(instance_name),
- is_array(is_array), array_specifier(array_specifier)
+ array_specifier(array_specifier)
{
-  if (!is_array)
- assert(array_specifier == NULL);
}
 
virtual ir_rvalue *hir(exec_list *instructions,
@@ -970,15 +961,6 @@ public:
exec_list declarations;
 
/**
-* True if the block is declared as an array
-*
-* \note
-* A block can only be an array if it also has an instance name.  If this
-* field is true, ::instance_name must also not be \c NULL.
-*/
-   bool is_array;
-
-   /**
 * Declared array size of the block instance
 *
 * If the block is not declared as an array or if the block instance array
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index f13ac51..c71078e 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2874,7 +2874,6 @@ ast_declarator_list::hir(exec_list *instructions,
   }
 
   foreach_list_typed (ast_declaration, decl, link, this-declarations) {
-assert(!decl-is_array);
 

Mesa (master): glsl: create type name for arrays of arrays

2014-01-23 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: 61a584609936940f69207dd520b5b4208810a9e7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=61a584609936940f69207dd520b5b4208810a9e7

Author: Timothy Arceri t_arc...@yahoo.com.au
Date:   Thu Jan 23 23:21:02 2014 +1100

glsl: create type name for arrays of arrays

We need to insert outermost dimensions in the correct spot otherwise
 the dimension order will be backwards

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
Reviewed-by: Paul Berry stereotype...@gmail.com

---

 src/glsl/glsl_types.cpp |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index f9bb0cf..1b0b3ef 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -300,8 +300,20 @@ glsl_type::glsl_type(const glsl_type *array, unsigned 
length) :
 
if (length == 0)
   snprintf(n, name_length, %s[], array-name);
-   else
-  snprintf(n, name_length, %s[%u], array-name, length);
+   else {
+  /* insert outermost dimensions in the correct spot
+   * otherwise the dimension order will be backwards
+   */
+  const char *pos = strchr(array-name, '[');
+  if (pos) {
+ int idx = pos - array-name;
+ snprintf(n, idx+1, %s, array-name);
+ snprintf(n + idx, name_length - idx, [%u]%s,
+  length, array-name + idx);
+  } else {
+ snprintf(n, name_length, %s[%u], array-name, length);
+  }
+   }
 
this-name = n;
 }

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


Mesa (master): docs: Mark ARB_arrays_of_arrays as started

2014-01-23 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: 815e064fb653c6f00fc6a0f1dd58d75ff085e20d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=815e064fb653c6f00fc6a0f1dd58d75ff085e20d

Author: Timothy Arceri t_arc...@yahoo.com.au
Date:   Thu Jan 23 23:24:45 2014 +1100

docs: Mark ARB_arrays_of_arrays as started

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
Reviewed-by: Paul Berry stereotype...@gmail.com

---

 docs/GL3.txt |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 3bded7d..799db4b 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -142,7 +142,7 @@ GL 4.2:
 GL 4.3:
 
   GLSL 4.3 not started
-  GL_ARB_arrays_of_arrays  not started
+  GL_ARB_arrays_of_arrays  started
   GL_ARB_ES3_compatibility DONE (i965)
   GL_ARB_clear_buffer_object   not started
   GL_ARB_compute_shadernot started

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


Mesa (master): glsl: Allow arrays of arrays as input to vertex shader

2014-01-23 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: 3d492f19f6e1a50a645cfa3b04d64808d44af5e3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d492f19f6e1a50a645cfa3b04d64808d44af5e3

Author: Timothy Arceri t_arc...@yahoo.com.au
Date:   Thu Jan 23 23:20:25 2014 +1100

glsl: Allow arrays of arrays as input to vertex shader

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
Reviewed-by: Paul Berry stereotype...@gmail.com

---

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

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index be12f97..f13ac51 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3143,8 +3143,9 @@ ast_declarator_list::hir(exec_list *instructions,
  *vectors. Vertex shader inputs cannot be arrays or
  *structures.
 */
-   const glsl_type *check_type = var-type-is_array()
-  ? var-type-fields.array : var-type;
+const glsl_type *check_type = var-type;
+while (check_type-is_array())
+   check_type = check_type-element_type();
 
switch (check_type-base_type) {
case GLSL_TYPE_FLOAT:

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


Mesa (master): glsl: only call mark_max_array if we are assigning an

2014-01-23 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: 3dc932d45048843d83b0f0207043d713f7bceb3c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3dc932d45048843d83b0f0207043d713f7bceb3c

Author: Timothy Arceri t_arc...@yahoo.com.au
Date:   Thu Jan 23 23:19:54 2014 +1100

glsl: only call mark_max_array if we are assigning an
 array

This change does not help fix or prevent any bugs
it just seems reasonable to do

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
Reviewed-by: Paul Berry stereotype...@gmail.com

---

 src/glsl/ast_to_hir.cpp |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index e25cba3..be12f97 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -830,8 +830,10 @@ do_assignment(exec_list *instructions, struct 
_mesa_glsl_parse_state *state,
   rhs-type-array_size());
 d-type = var-type;
   }
-  mark_whole_array_access(rhs);
-  mark_whole_array_access(lhs);
+  if (lhs-type-is_array()) {
+ mark_whole_array_access(rhs);
+ mark_whole_array_access(lhs);
+  }
}
 
/* Most callers of do_assignment (assign, add_assign, pre_inc/dec,

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


Mesa (master): glsl: Add ARB_arrays_of_arrays support to yacc definition and ast

2014-01-23 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: bfb48750f08223fdf1c2d7bf4db1bba5a1088a7c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfb48750f08223fdf1c2d7bf4db1bba5a1088a7c

Author: Timothy Arceri t_arc...@yahoo.com.au
Date:   Thu Jan 23 23:16:41 2014 +1100

glsl: Add ARB_arrays_of_arrays support to yacc definition and ast

Adds array specifier object to hold array information

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
Reviewed-by: Paul Berry stereotype...@gmail.com

---

 src/glsl/ast.h  |   66 +++
 src/glsl/ast_array_index.cpp|   13 +++
 src/glsl/ast_to_hir.cpp |  172 +++
 src/glsl/ast_type.cpp   |8 +-
 src/glsl/glsl_parser.yy |  128 +
 src/glsl/glsl_parser_extras.cpp |   19 ++---
 src/glsl/glsl_parser_extras.h   |2 +
 7 files changed, 235 insertions(+), 173 deletions(-)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index b24052b..d462dd5 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -276,6 +276,43 @@ private:
bool cons;
 };
 
+class ast_array_specifier : public ast_node {
+public:
+   /** Unsized array specifier ([]) */
+   explicit ast_array_specifier(const struct YYLTYPE locp)
+ : dimension_count(1), is_unsized_array(true)
+   {
+  set_location(locp);
+   }
+
+   /** Sized array specifier ([dim]) */
+   ast_array_specifier(const struct YYLTYPE locp, ast_expression *dim)
+ : dimension_count(1), is_unsized_array(false)
+   {
+  set_location(locp);
+  array_dimensions.push_tail(dim-link);
+   }
+
+   void add_dimension(ast_expression *dim)
+   {
+  array_dimensions.push_tail(dim-link);
+  dimension_count++;
+   }
+
+   virtual void print(void) const;
+
+   /* Count including sized and unsized dimensions */
+   unsigned dimension_count;
+
+   /* If true, this means that the array has an unsized outermost dimension. */
+   bool is_unsized_array;
+
+   /* This list contains objects of type ast_node containing the
+* sized dimensions only, in outermost-to-innermost order.
+*/
+   exec_list array_dimensions;
+};
+
 /**
  * C-style aggregate initialization class
  *
@@ -334,14 +371,15 @@ public:
 
 class ast_declaration : public ast_node {
 public:
-   ast_declaration(const char *identifier, bool is_array, ast_expression 
*array_size,
-  ast_expression *initializer);
+   ast_declaration(const char *identifier, bool is_array,
+   ast_array_specifier *array_specifier,
+   ast_expression *initializer);
virtual void print(void) const;
 
const char *identifier;

bool is_array;
-   ast_expression *array_size;
+   ast_array_specifier *array_specifier;
 
ast_expression *initializer;
 };
@@ -551,9 +589,9 @@ public:
 * be modified. Zeros the inherited ast_node's fields.
 */
ast_type_specifier(const ast_type_specifier *that, bool is_array,
-  ast_expression *array_size)
+  ast_array_specifier *array_specifier)
   : ast_node(), type_name(that-type_name), structure(that-structure),
-is_array(is_array), array_size(array_size),
+is_array(is_array), array_specifier(array_specifier),
 default_precision(that-default_precision)
{
   /* empty */
@@ -562,7 +600,7 @@ public:
/** Construct a type specifier from a type name */
ast_type_specifier(const char *name) 
   : type_name(name), structure(NULL),
-   is_array(false), array_size(NULL),
+   is_array(false), array_specifier(NULL),
default_precision(ast_precision_none)
{
   /* empty */
@@ -571,7 +609,7 @@ public:
/** Construct a type specifier from a structure definition */
ast_type_specifier(ast_struct_specifier *s)
   : type_name(s-name), structure(s),
-   is_array(false), array_size(NULL),
+   is_array(false), array_specifier(NULL),
default_precision(ast_precision_none)
{
   /* empty */
@@ -589,7 +627,7 @@ public:
ast_struct_specifier *structure;
 
bool is_array;
-   ast_expression *array_size;
+   ast_array_specifier *array_specifier;
 
/** For precision statements, this is the given precision; otherwise none. 
*/
unsigned default_precision:2;
@@ -643,7 +681,7 @@ public:
   type(NULL),
   identifier(NULL),
   is_array(false),
-  array_size(NULL),
+  array_specifier(NULL),
   formal_parameter(false),
   is_void(false)
{
@@ -658,7 +696,7 @@ public:
ast_fully_specified_type *type;
const char *identifier;
bool is_array;
-   ast_expression *array_size;
+   ast_array_specifier *array_specifier;
 
static void parameters_to_hir(exec_list *ast_parameters,
 bool formal, exec_list *ir_parameters,
@@ -906,12 +944,12 @@ public:
ast_interface_block(ast_type_qualifier layout,
const char *instance_name,
bool is_array,
-  

Mesa (master): egl: Use C11 thread abstractions.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: f298720cbcf311804e9f4479d27ad06e1b932007
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f298720cbcf311804e9f4479d27ad06e1b932007

Author: José Fonseca jfons...@vmware.com
Date:   Fri Apr 26 08:04:17 2013 +0100

egl: Use C11 thread abstractions.

Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Reviewed-by: Chad Versace chad.vers...@linux.intel.com

---

 src/egl/main/eglmutex.h |   26 +++---
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/src/egl/main/eglmutex.h b/src/egl/main/eglmutex.h
index 1349e9e..2ec965c 100644
--- a/src/egl/main/eglmutex.h
+++ b/src/egl/main/eglmutex.h
@@ -31,46 +31,34 @@
 
 #include eglcompiler.h
 
-#ifdef HAVE_PTHREAD
-#include pthread.h
+#include c11/threads.h
 
-typedef pthread_mutex_t _EGLMutex;
+typedef mtx_t _EGLMutex;
 
 static INLINE void _eglInitMutex(_EGLMutex *m)
 {
-   pthread_mutex_init(m, NULL);
+   mtx_init(m, mtx_plain);
 }
 
 static INLINE void
 _eglDestroyMutex(_EGLMutex *m)
 {
-   pthread_mutex_destroy(m);
+   mtx_destroy(m);
 }
 
 static INLINE void
 _eglLockMutex(_EGLMutex *m)
 {
-   pthread_mutex_lock(m);
+   mtx_lock(m);
 }
 
 static INLINE void
 _eglUnlockMutex(_EGLMutex *m)
 {
-   pthread_mutex_unlock(m);
+   mtx_unlock(m);
 }
 
-#define _EGL_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#define _EGL_MUTEX_INITIALIZER _MTX_INITIALIZER_NP
 
-#else
-
-typedef int _EGLMutex;
-static INLINE void _eglInitMutex(_EGLMutex *m) { (void) m; }
-static INLINE void _eglDestroyMutex(_EGLMutex *m) { (void) m; }
-static INLINE void _eglLockMutex(_EGLMutex *m) { (void) m; }
-static INLINE void _eglUnlockMutex(_EGLMutex *m) { (void) m; }
-
-#define _EGL_MUTEX_INITIALIZER 0
-
-#endif
 
 #endif /* EGLMUTEX_INCLUDED */

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


Mesa (master): mapi: Use C11 thread abstractions.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 54876afcf0624c1ef25c1995cfc3b10fbfab1ba0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=54876afcf0624c1ef25c1995cfc3b10fbfab1ba0

Author: José Fonseca jfons...@vmware.com
Date:   Fri Apr 26 08:04:06 2013 +0100

mapi: Use C11 thread abstractions.

Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Chad Versace chad.vers...@linux.intel.com

---

 src/mapi/u_thread.h |  165 ---
 1 file changed, 13 insertions(+), 152 deletions(-)

diff --git a/src/mapi/u_thread.h b/src/mapi/u_thread.h
index 31999c4..75fbec6 100644
--- a/src/mapi/u_thread.h
+++ b/src/mapi/u_thread.h
@@ -46,12 +46,7 @@
 #include stdlib.h
 #include u_compiler.h
 
-#if defined(HAVE_PTHREAD)
-#include pthread.h /* POSIX threads headers */
-#endif
-#ifdef _WIN32
-#include windows.h
-#endif
+#include c11/threads.h
 
 #if defined(HAVE_PTHREAD) || defined(_WIN32)
 #ifndef THREADS
@@ -79,43 +74,32 @@ extern C {
 #endif
 
 
-/*
- * POSIX threads. This should be your choice in the Unix world
- * whenever possible.  When building with POSIX threads, be sure
- * to enable any compiler flags which will cause the MT-safe
- * libc (if one exists) to be used when linking, as well as any
- * header macros for MT-safe errno, etc.  For Solaris, this is the -mt
- * compiler flag.  On Solaris with gcc, use -D_REENTRANT to enable
- * proper compiling for MT-safe libc etc.
- */
-#if defined(HAVE_PTHREAD)
-
 struct u_tsd {
-   pthread_key_t key;
+   tss_t key;
unsigned initMagic;
 };
 
-typedef pthread_mutex_t u_mutex;
+typedef mtx_t u_mutex;
 
 #define u_mutex_declare_static(name) \
-   static u_mutex name = PTHREAD_MUTEX_INITIALIZER
+   static u_mutex name = _MTX_INITIALIZER_NP
 
-#define u_mutex_init(name)pthread_mutex_init((name), NULL)
-#define u_mutex_destroy(name) pthread_mutex_destroy((name))
-#define u_mutex_lock(name)(void) pthread_mutex_lock((name))
-#define u_mutex_unlock(name)  (void) pthread_mutex_unlock((name))
+#define u_mutex_init(name)mtx_init((name), mtx_plain)
+#define u_mutex_destroy(name) mtx_destroy((name))
+#define u_mutex_lock(name)(void) mtx_lock((name))
+#define u_mutex_unlock(name)  (void) mtx_unlock((name))
 
 static INLINE unsigned long
 u_thread_self(void)
 {
-   return (unsigned long) pthread_self();
+   return (unsigned long) thrd_current();
 }
 
 
 static INLINE void
 u_tsd_init(struct u_tsd *tsd)
 {
-   if (pthread_key_create(tsd-key, NULL/*free*/) != 0) {
+   if (tss_create(tsd-key, NULL/*free*/) != 0) {
   perror(INIT_TSD_ERROR);
   exit(-1);
}
@@ -129,7 +113,7 @@ u_tsd_get(struct u_tsd *tsd)
if (tsd-initMagic != INIT_MAGIC) {
   u_tsd_init(tsd);
}
-   return pthread_getspecific(tsd-key);
+   return tss_get(tsd-key);
 }
 
 
@@ -139,56 +123,12 @@ u_tsd_set(struct u_tsd *tsd, void *ptr)
if (tsd-initMagic != INIT_MAGIC) {
   u_tsd_init(tsd);
}
-   if (pthread_setspecific(tsd-key, ptr) != 0) {
+   if (tss_set(tsd-key, ptr) != 0) {
   perror(SET_TSD_ERROR);
   exit(-1);
}
 }
 
-#endif /* HAVE_PTHREAD */
-
-
-/*
- * Windows threads. Should work with Windows NT and 95.
- * IMPORTANT: Link with multithreaded runtime library when THREADS are
- * used!
- */
-#ifdef _WIN32
-
-struct u_tsd {
-   DWORD key;
-   unsigned initMagic;
-};
-
-typedef CRITICAL_SECTION u_mutex;
-
-/* http://locklessinc.com/articles/pthreads_on_windows/ */
-#define u_mutex_declare_static(name) \
-   static u_mutex name = {(PCRITICAL_SECTION_DEBUG)-1, -1, 0, 0, 0, 0}
-
-#define u_mutex_init(name)InitializeCriticalSection(name)
-#define u_mutex_destroy(name) DeleteCriticalSection(name)
-#define u_mutex_lock(name)EnterCriticalSection(name)
-#define u_mutex_unlock(name)  LeaveCriticalSection(name)
-
-static INLINE unsigned long
-u_thread_self(void)
-{
-   return GetCurrentThreadId();
-}
-
-
-static INLINE void
-u_tsd_init(struct u_tsd *tsd)
-{
-   tsd-key = TlsAlloc();
-   if (tsd-key == TLS_OUT_OF_INDEXES) {
-  perror(INIT_TSD_ERROR);
-  exit(-1);
-   }
-   tsd-initMagic = INIT_MAGIC;
-}
-
 
 static INLINE void
 u_tsd_destroy(struct u_tsd *tsd)
@@ -196,90 +136,11 @@ u_tsd_destroy(struct u_tsd *tsd)
if (tsd-initMagic != INIT_MAGIC) {
   return;
}
-   TlsFree(tsd-key);
+   tss_delete(tsd-key);
tsd-initMagic = 0x0;
 }
 
 
-static INLINE void *
-u_tsd_get(struct u_tsd *tsd)
-{
-   if (tsd-initMagic != INIT_MAGIC) {
-  u_tsd_init(tsd);
-   }
-   return TlsGetValue(tsd-key);
-}
-
-
-static INLINE void
-u_tsd_set(struct u_tsd *tsd, void *ptr)
-{
-   /* the following code assumes that the struct u_tsd has been initialized
-  to zero at creation */
-   if (tsd-initMagic != INIT_MAGIC) {
-  u_tsd_init(tsd);
-   }
-   if (TlsSetValue(tsd-key, ptr) == 0) {
-  perror(SET_TSD_ERROR);
-  exit(-1);
-   }
-}
-
-#endif /* _WIN32 */
-
-
-/*
- * THREADS not defined
- */
-#ifndef THREADS
-
-struct u_tsd {
-   unsigned initMagic;
-};
-
-typedef unsigned u_mutex;
-
-#define 

Mesa (master): c11: Update docs/ license.html and include verbatim copy of Boost license.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 799f30f3854a30569bb356d1640c0e3f11de0be2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=799f30f3854a30569bb356d1640c0e3f11de0be2

Author: José Fonseca jfons...@vmware.com
Date:   Thu Jan 23 10:49:57 2014 +

c11: Update docs/license.html and include verbatim copy of Boost license.

---

 docs/license.html   |3 +++
 include/c11/threads.h   |   23 ++-
 include/c11/threads_posix.h |   23 ++-
 include/c11/threads_win32.h |   23 ++-
 4 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/docs/license.html b/docs/license.html
index 80bb604..d56823f 100644
--- a/docs/license.html
+++ b/docs/license.html
@@ -103,6 +103,9 @@ Device driverssrc/mesa/drivers/* MIT, generally
 
 Ext headers   include/GL/glext.h Khronos
   include/GL/glxext.h
+
+C11 threadinclude/c11/threads*.h Boost (permissive)
+emulation
 /pre
 
 p
diff --git a/include/c11/threads.h b/include/c11/threads.h
index 4bb78b6..45823df 100644
--- a/include/c11/threads.h
+++ b/include/c11/threads.h
@@ -3,7 +3,28 @@
  *
  * (C) Copyright yohhoy 2012.
  * Distributed under the Boost Software License, Version 1.0.
- * (See copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (the Software) to use, reproduce, display, distribute,
+ * execute, and transmit the Software, and to prepare [[derivative work]]s of 
the
+ * Software, and to permit third-parties to whom the Software is furnished to
+ * do so, all subject to the following:
+ *
+ * The copyright notices in the Software and this entire statement, including
+ * the above license grant, this restriction and the following disclaimer,
+ * must be included in all copies of the Software, in whole or in part, and
+ * all derivative works of the Software, unless such copies or derivative
+ * works are solely in the form of machine-executable object code generated by
+ * a source language processor.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
  */
 #ifndef EMULATED_THREADS_H_INCLUDED_
 #define EMULATED_THREADS_H_INCLUDED_
diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
index 463c93f..047e2ea 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -3,7 +3,28 @@
  *
  * (C) Copyright yohhoy 2012.
  * Distributed under the Boost Software License, Version 1.0.
- * (See copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (the Software) to use, reproduce, display, distribute,
+ * execute, and transmit the Software, and to prepare [[derivative work]]s of 
the
+ * Software, and to permit third-parties to whom the Software is furnished to
+ * do so, all subject to the following:
+ *
+ * The copyright notices in the Software and this entire statement, including
+ * the above license grant, this restriction and the following disclaimer,
+ * must be included in all copies of the Software, in whole or in part, and
+ * all derivative works of the Software, unless such copies or derivative
+ * works are solely in the form of machine-executable object code generated by
+ * a source language processor.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
  */
 #include stdlib.h
 #include assert.h
diff --git a/include/c11/threads_win32.h b/include/c11/threads_win32.h
index 5a63e90..ee29460 100644
--- a/include/c11/threads_win32.h
+++ b/include/c11/threads_win32.h
@@ -3,7 +3,28 @@
  *
  * (C) Copyright yohhoy 2012.
  * Distributed under the Boost Software License, Version 1.0.
- * (See copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation 

Mesa (master): os: Remove pipe_static_condvar.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 349f0a94aeaded3125d5c7f31ae2092f1b4a5727
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=349f0a94aeaded3125d5c7f31ae2092f1b4a5727

Author: José Fonseca jfons...@vmware.com
Date:   Tue Mar 12 11:54:58 2013 +

os: Remove pipe_static_condvar.

Never used.

Reviewed-by: Brian Paul bri...@vmware.com

---

 src/gallium/auxiliary/os/os_thread.h |   12 
 1 file changed, 12 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_thread.h 
b/src/gallium/auxiliary/os/os_thread.h
index 6403b4f..b7b98b7 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -105,9 +105,6 @@ typedef pthread_mutex_t pipe_mutex;
  */
 typedef pthread_cond_t pipe_condvar;
 
-#define pipe_static_condvar(mutex) \
-   static pipe_condvar mutex = PTHREAD_COND_INITIALIZER
-
 #define pipe_condvar_init(cond)\
pthread_cond_init((cond), NULL)
 
@@ -187,9 +184,6 @@ typedef CRITICAL_SECTION pipe_mutex;
  */
 typedef CONDITION_VARIABLE pipe_condvar;
 
-#define pipe_static_condvar(cond) \
-   /*static*/ pipe_condvar cond = CONDITION_VARIABLE_INIT
-
 #define pipe_condvar_init(cond) \
InitializeConditionVariable((cond))
 
@@ -213,9 +207,6 @@ typedef CONDITION_VARIABLE pipe_condvar;
  */
 typedef DWORD pipe_condvar;
 
-#define pipe_static_condvar(cond) \
-   /*static*/ pipe_condvar cond = 1
-
 #define pipe_condvar_init(cond) \
(void) (cond = 1)
 
@@ -284,9 +275,6 @@ typedef unsigned pipe_mutex;
 
 typedef int64_t pipe_condvar;
 
-#define pipe_static_condvar(condvar) \
-   static pipe_condvar condvar = 1000
-
 #define pipe_condvar_init(condvar) \
(void) (condvar = 1000)
 

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


Mesa (master): c11: Import threads.h emulation library.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: ecaa81bd9648131e01f9ad4fd9d185370df8e872
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ecaa81bd9648131e01f9ad4fd9d185370df8e872

Author: José Fonseca jfons...@vmware.com
Date:   Tue Mar 12 10:37:46 2013 +

c11: Import threads.h emulation library.

Implementation is based of https://gist.github.com/2223710 with the
following modifications:
- inline implementatation
- retain XP compatability
- add temporary hack for static mutex initializers (as they are not part
  of the stack but still widely used internally)
- make TIME_UTC a conditional macro (some system headers already define
  it, so this prevents conflict)
- respect HAVE_PTHREAD macro

Reviewed-by: Brian Paul bri...@vmware.com
Acked-by: Ian Romanick ian.d.roman...@intel.com
Acked-by: Chad Versace chad.vers...@linux.intel.com

---

 include/c11/threads.h   |   58 +
 include/c11/threads_posix.h |  346 +
 include/c11/threads_win32.h |  588 +++
 3 files changed, 992 insertions(+)

diff --git a/include/c11/threads.h b/include/c11/threads.h
new file mode 100644
index 000..4bb78b6
--- /dev/null
+++ b/include/c11/threads.h
@@ -0,0 +1,58 @@
+/*
+ * C11 threads.h emulation library
+ *
+ * (C) Copyright yohhoy 2012.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+#ifndef EMULATED_THREADS_H_INCLUDED_
+#define EMULATED_THREADS_H_INCLUDED_
+
+#include time.h
+
+#ifndef TIME_UTC
+#define TIME_UTC 1
+#endif
+
+#include c99_compat.h /* for `inline` */
+
+/* types */
+typedef void (*tss_dtor_t)(void*);
+typedef int (*thrd_start_t)(void*);
+
+struct xtime {
+time_t sec;
+long nsec;
+};
+typedef struct xtime xtime;
+
+
+/* enumeration constants */
+enum {
+mtx_plain = 0,
+mtx_try   = 1,
+mtx_timed = 2,
+mtx_recursive = 4
+};
+
+enum {
+thrd_success = 0, // succeeded
+thrd_timeout, // timeout
+thrd_error,   // failed
+thrd_busy,// resource busy
+thrd_nomem// out of memory
+};
+
+/*-- functions --*/
+
+#if defined(_WIN32)  !defined(__CYGWIN__)
+#include threads_win32.h
+#elif defined(HAVE_PTHREAD)
+#include threads_posix.h
+#else
+#error Not supported on this platform.
+#endif
+
+
+
+#endif /* EMULATED_THREADS_H_INCLUDED_ */
diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
new file mode 100644
index 000..463c93f
--- /dev/null
+++ b/include/c11/threads_posix.h
@@ -0,0 +1,346 @@
+/*
+ * C11 threads.h emulation library
+ *
+ * (C) Copyright yohhoy 2012.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+#include stdlib.h
+#include assert.h
+#include limits.h
+#include errno.h
+#include unistd.h
+#include sched.h
+#include stdint.h /* for intptr_t */
+
+/*
+Configuration macro:
+
+  EMULATED_THREADS_USE_NATIVE_TIMEDLOCK
+Use pthread_mutex_timedlock() for `mtx_timedlock()'
+Otherwise use mtx_trylock() + *busy loop* emulation.
+*/
+#if !defined(__CYGWIN__)
+#define EMULATED_THREADS_USE_NATIVE_TIMEDLOCK
+#endif
+
+
+#include pthread.h
+
+/* macros */
+#define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
+#ifdef INIT_ONCE_STATIC_INIT
+#define TSS_DTOR_ITERATIONS PTHREAD_DESTRUCTOR_ITERATIONS
+#else
+#define TSS_DTOR_ITERATIONS 1  // assume TSS dtor MAY be called at least once.
+#endif
+
+// FIXME: temporary non-standard hack to ease transition
+#define _MTX_INITIALIZER_NP PTHREAD_MUTEX_INITIALIZER
+
+/* types */
+typedef pthread_cond_t  cnd_t;
+typedef pthread_t   thrd_t;
+typedef pthread_key_t   tss_t;
+typedef pthread_mutex_t mtx_t;
+typedef pthread_once_t  once_flag;
+
+
+/*
+Implementation limits:
+  - Conditionally emulation for mutex with timeout
+(see EMULATED_THREADS_USE_NATIVE_TIMEDLOCK macro)
+*/
+struct impl_thrd_param {
+thrd_start_t func;
+void *arg;
+};
+
+static inline void *
+impl_thrd_routine(void *p)
+{
+struct impl_thrd_param pack = *((struct impl_thrd_param *)p);
+free(p);
+return (void*)(intptr_t)pack.func(pack.arg);
+}
+
+
+/*--- 7.25.2 Initialization functions ---*/
+// 7.25.2.1
+static inline void
+call_once(once_flag *flag, void (*func)(void))
+{
+pthread_once(flag, func);
+}
+
+
+/*- 7.25.3 Condition variable functions -*/
+// 7.25.3.1
+static inline int
+cnd_broadcast(cnd_t *cond)
+{
+if (!cond) return thrd_error;
+pthread_cond_broadcast(cond);
+return thrd_success;
+}
+
+// 7.25.3.2
+static inline void
+cnd_destroy(cnd_t *cond)
+{
+assert(cond);
+pthread_cond_destroy(cond);
+}
+
+// 7.25.3.3
+static inline int
+cnd_init(cnd_t 

Mesa (master): gallium: Use C11 thread abstractions.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: fd33a6bcd7f1271e80332379131e82e00fe10586
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd33a6bcd7f1271e80332379131e82e00fe10586

Author: José Fonseca jfons...@vmware.com
Date:   Fri Apr 26 08:03:33 2013 +0100

gallium: Use C11 thread abstractions.

Note that PIPE_ROUTINE now returns an int.

Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Chad Versace chad.vers...@linux.intel.com

---

 src/gallium/auxiliary/os/os_thread.h  |  262 +++--
 src/gallium/drivers/llvmpipe/lp_rast.c|2 +-
 src/gallium/drivers/rbug/rbug_core.c  |4 +-
 src/gallium/tests/unit/pipe_barrier_test.c|2 +-
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c |2 +-
 5 files changed, 37 insertions(+), 235 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_thread.h 
b/src/gallium/auxiliary/os/os_thread.h
index b7b98b7..1d802d2 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -40,271 +40,97 @@
 #include pipe/p_compiler.h
 #include util/u_debug.h /* for assert */
 
+#include c11/threads.h
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) 
|| defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN) 
|| defined(PIPE_OS_HURD)
-
-#include pthread.h /* POSIX threads headers */
-#include stdio.h /* for perror() */
+#ifdef HAVE_PTHREAD
 #include signal.h
+#endif
 
 
 /* pipe_thread
  */
-typedef pthread_t pipe_thread;
+typedef thrd_t pipe_thread;
 
 #define PIPE_THREAD_ROUTINE( name, param ) \
-   void *name( void *param )
+   int name( void *param )
 
-static INLINE pipe_thread pipe_thread_create( void *(* routine)( void *), void 
*param )
+static INLINE pipe_thread pipe_thread_create( PIPE_THREAD_ROUTINE((*routine), 
), void *param )
 {
pipe_thread thread;
+#ifdef HAVE_PTHREAD
sigset_t saved_set, new_set;
int ret;
 
sigfillset(new_set);
pthread_sigmask(SIG_SETMASK, new_set, saved_set);
-   ret = pthread_create( thread, NULL, routine, param );
+   ret = thrd_create( thread, routine, param );
pthread_sigmask(SIG_SETMASK, saved_set, NULL);
+#else
+   int ret;
+   ret = thrd_create( thread, routine, param );
+#endif
if (ret)
   return 0;
+
return thread;
 }
 
 static INLINE int pipe_thread_wait( pipe_thread thread )
 {
-   return pthread_join( thread, NULL );
+   return thrd_join( thread, NULL );
 }
 
 static INLINE int pipe_thread_destroy( pipe_thread thread )
 {
-   return pthread_detach( thread );
+   return thrd_detach( thread );
 }
 
 
 /* pipe_mutex
  */
-typedef pthread_mutex_t pipe_mutex;
+typedef mtx_t pipe_mutex;
 
 #define pipe_static_mutex(mutex) \
-   static pipe_mutex mutex = PTHREAD_MUTEX_INITIALIZER
+   static pipe_mutex mutex = _MTX_INITIALIZER_NP
 
 #define pipe_mutex_init(mutex) \
-   (void) pthread_mutex_init((mutex), NULL)
+   (void) mtx_init((mutex), mtx_plain)
 
 #define pipe_mutex_destroy(mutex) \
-   pthread_mutex_destroy((mutex))
+   mtx_destroy((mutex))
 
 #define pipe_mutex_lock(mutex) \
-   (void) pthread_mutex_lock((mutex))
+   (void) mtx_lock((mutex))
 
 #define pipe_mutex_unlock(mutex) \
-   (void) pthread_mutex_unlock((mutex))
+   (void) mtx_unlock((mutex))
 
 
 /* pipe_condvar
  */
-typedef pthread_cond_t pipe_condvar;
+typedef cnd_t pipe_condvar;
 
 #define pipe_condvar_init(cond)\
-   pthread_cond_init((cond), NULL)
-
-#define pipe_condvar_destroy(cond) \
-   pthread_cond_destroy((cond))
-
-#define pipe_condvar_wait(cond, mutex) \
-  pthread_cond_wait((cond), (mutex))
-
-#define pipe_condvar_signal(cond) \
-  pthread_cond_signal((cond))
-
-#define pipe_condvar_broadcast(cond) \
-  pthread_cond_broadcast((cond))
-
-
-
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
-
-#include windows.h
-
-/* pipe_thread
- */
-typedef HANDLE pipe_thread;
-
-#define PIPE_THREAD_ROUTINE( name, param ) \
-   void * WINAPI name( void *param )
-
-static INLINE pipe_thread pipe_thread_create( void *(WINAPI * routine)( void 
*), void *param )
-{
-   DWORD id;
-   return CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) routine, param, 0, 
id );
-}
-
-static INLINE int pipe_thread_wait( pipe_thread thread )
-{
-   if (WaitForSingleObject( thread, INFINITE ) == WAIT_OBJECT_0)
-  return 0;
-   return -1;
-}
-
-static INLINE int pipe_thread_destroy( pipe_thread thread )
-{
-   if (CloseHandle( thread ))
-  return 0;
-   return -1;
-}
-
-
-/* pipe_mutex
- */
-typedef CRITICAL_SECTION pipe_mutex;
-
-/* http://locklessinc.com/articles/pthreads_on_windows/ */
-#define pipe_static_mutex(mutex) \
-   static pipe_mutex mutex = {(PCRITICAL_SECTION_DEBUG)-1, -1, 0, 0, 0, 0}
-
-#define pipe_mutex_init(mutex) \
-   InitializeCriticalSection(mutex)
-
-#define pipe_mutex_destroy(mutex) \
-   DeleteCriticalSection(mutex)
-
-#define pipe_mutex_lock(mutex) \
-   EnterCriticalSection(mutex)
-
-#define pipe_mutex_unlock(mutex) \
-   LeaveCriticalSection(mutex)
-
-/* TODO: Need a macro to 

Mesa (master): radeon: Adding missing stdio.h include.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 6b6fdb6aa998520e2026b993e658b6d9d7b2210f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b6fdb6aa998520e2026b993e658b6d9d7b2210f

Author: José Fonseca jfons...@vmware.com
Date:   Thu Jan 23 13:23:43 2014 +

radeon: Adding missing stdio.h include.

Became apparent with the C11 thread changes.  Unfortunately I didn't
have all dependencies to build the driver, and only noticed
this issue on build server.

---

 src/gallium/drivers/radeon/r600_buffer_common.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index 66e9d57..d29671e 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -28,6 +28,7 @@
 #include util/u_memory.h
 #include util/u_upload_mgr.h
 #include inttypes.h
+#include stdio.h
 
 boolean r600_rings_is_buffer_referenced(struct r600_common_context *ctx,
struct radeon_winsys_cs_handle *buf,

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


Mesa (master): mapi: Prevent cast from pointer to integer of different size.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: ab5dc45b2fb7447dcb4f48b3f83f75e271eca9b6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab5dc45b2fb7447dcb4f48b3f83f75e271eca9b6

Author: José Fonseca jfons...@vmware.com
Date:   Thu Jan 23 13:21:52 2014 +

mapi: Prevent cast from pointer to integer of different size.

On Windows64.

---

 src/mapi/u_thread.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mapi/u_thread.h b/src/mapi/u_thread.h
index 75fbec6..ba5d98e 100644
--- a/src/mapi/u_thread.h
+++ b/src/mapi/u_thread.h
@@ -92,7 +92,7 @@ typedef mtx_t u_mutex;
 static INLINE unsigned long
 u_thread_self(void)
 {
-   return (unsigned long) thrd_current();
+   return (unsigned long) (uintptr_t) thrd_current();
 }
 
 

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


Mesa (master): os/os_thread: Revert pipe_barrier pre-processing logic.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: fa75cc4b896ea16efb43c01f0e220a97773c3a2e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa75cc4b896ea16efb43c01f0e220a97773c3a2e

Author: José Fonseca jfons...@vmware.com
Date:   Thu Jan 23 13:44:10 2014 +

os/os_thread: Revert pipe_barrier pre-processing logic.

Whitelist platforms instead of blacklisting, as several pthread
implementations are missing pthread_barrier_t, in particular MacOSX.

---

 src/gallium/auxiliary/os/os_thread.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/os/os_thread.h 
b/src/gallium/auxiliary/os/os_thread.h
index 1d802d2..ff46a89 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -130,7 +130,7 @@ typedef cnd_t pipe_condvar;
  * pipe_barrier
  */
 
-#if defined(HAVE_PTHREAD)  !defined(PIPE_OS_ANDROID)
+#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || 
defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HURD))  !defined(PIPE_OS_ANDROID)
 
 typedef pthread_barrier_t pipe_barrier;
 

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


Mesa (master): c11: Fix missing pthread_mutex_timedlock declaration warnings on MacOSX.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: cd978ce26ae9ca70a1667601e0611e43ca512bc9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd978ce26ae9ca70a1667601e0611e43ca512bc9

Author: José Fonseca jfons...@vmware.com
Date:   Thu Jan 23 13:42:38 2014 +

c11: Fix missing pthread_mutex_timedlock declaration warnings on MacOSX.

---

 include/c11/threads_posix.h |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
index 047e2ea..e54af39 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -41,7 +41,7 @@ Configuration macro:
 Use pthread_mutex_timedlock() for `mtx_timedlock()'
 Otherwise use mtx_trylock() + *busy loop* emulation.
 */
-#if !defined(__CYGWIN__)
+#if !defined(__CYGWIN__)  !defined(__APPLE__)
 #define EMULATED_THREADS_USE_NATIVE_TIMEDLOCK
 #endif
 
@@ -196,6 +196,12 @@ mtx_lock(mtx_t *mtx)
 return thrd_success;
 }
 
+static inline int
+mtx_trylock(mtx_t *mtx);
+
+static inline void
+thrd_yield(void);
+
 // 7.25.4.4
 static inline int
 mtx_timedlock(mtx_t *mtx, const xtime *xt)

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


Mesa (master): radeon: More missing stdio.h includes.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: ab6f9fccd4f90949ee21e5f5e90cdf152815304b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab6f9fccd4f90949ee21e5f5e90cdf152815304b

Author: José Fonseca jfons...@vmware.com
Date:   Thu Jan 23 14:20:20 2014 +

radeon: More missing stdio.h includes.

---

 src/gallium/drivers/radeon/r600_pipe_common.h |2 ++
 src/gallium/winsys/radeon/drm/radeon_drm_bo.c |1 +
 2 files changed, 3 insertions(+)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index bf0b968..6ee20f6 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -32,6 +32,8 @@
 #ifndef R600_PIPE_COMMON_H
 #define R600_PIPE_COMMON_H
 
+#include stdio.h
+
 #include ../../winsys/radeon/drm/radeon_winsys.h
 
 #include util/u_range.h
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c 
b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index ca569a1..2ac060b 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -41,6 +41,7 @@
 #include xf86drm.h
 #include errno.h
 #include fcntl.h
+#include stdio.h
 
 /*
  * this are copy from radeon_drm, once an updated libdrm is released

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


Mesa (master): mesa: add missing ETC2_SRGB cases in formats.c

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 91567b83bfd8979389f66635c50f36714a08a3f5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=91567b83bfd8979389f66635c50f36714a08a3f5

Author: Brian Paul bri...@vmware.com
Date:   Tue Jan 21 16:08:18 2014 -0800

mesa: add missing ETC2_SRGB cases in formats.c

In the _mesa_get_format_color_encoding() and _mesa_get_srgb_format_linear()
functions.

Reviewed-by: Marek Olšák marek.ol...@amd.com

---

 src/mesa/main/formats.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 1246c4d..7bde1f1 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -2032,6 +2032,9 @@ _mesa_get_format_color_encoding(gl_format format)
case MESA_FORMAT_SRGBA_DXT3:
case MESA_FORMAT_SRGBA_DXT5:
case MESA_FORMAT_XBGR_SRGB:
+   case MESA_FORMAT_ETC2_SRGB8:
+   case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC:
+   case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
   return GL_SRGB;
default:
   return GL_LINEAR;
@@ -2077,6 +2080,15 @@ _mesa_get_srgb_format_linear(gl_format format)
case MESA_FORMAT_XBGR_SRGB:
   format = MESA_FORMAT_RGBX_REV;
   break;
+   case MESA_FORMAT_ETC2_SRGB8:
+  format = MESA_FORMAT_ETC2_RGB8;
+  break;
+   case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC:
+  format = MESA_FORMAT_ETC2_RGBA8_EAC;
+  break;
+   case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
+  format = MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1;
+  break;
default:
   break;
}

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


Mesa (master): mesa: fix/add some cases in _mesa_get_linear_internalformat ()

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b98fa6fe6ff10f0f210d44ea411c4ee7429ab2b3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b98fa6fe6ff10f0f210d44ea411c4ee7429ab2b3

Author: Brian Paul bri...@vmware.com
Date:   Tue Jan 21 16:09:10 2014 -0800

mesa: fix/add some cases in _mesa_get_linear_internalformat()

In some cases we were converting generic formats to sized formats
and vice versa.  The point is to simply convert sRGB formats to
corresponding linear formats.

Reviewed-by: Marek Olšák marek.ol...@amd.com

---

 src/mesa/main/glformats.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index bec7a9b..02709a1 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1229,10 +1229,16 @@ _mesa_get_linear_internalformat(GLenum format)
case GL_SRGB8_ALPHA8:
   return GL_RGBA8;
 
-   case GL_SLUMINANCE:
+   case GL_SLUMINANCE8:
   return GL_LUMINANCE8;
 
+   case GL_SLUMINANCE:
+  return GL_LUMINANCE;
+
case GL_SLUMINANCE_ALPHA:
+  return GL_LUMINANCE_ALPHA;
+
+   case GL_SLUMINANCE8_ALPHA8:
   return GL_LUMINANCE8_ALPHA8;
 
default:

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


Mesa (master): glsl: silence a couple warnings in find_active_atomic_counters()

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1f2007429e0874539c8360482f0720d78963c69c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f2007429e0874539c8360482f0720d78963c69c

Author: Brian Paul bri...@vmware.com
Date:   Wed Jan 22 10:03:15 2014 -0800

glsl: silence a couple warnings in find_active_atomic_counters()

Silence unitialized variable 'id' warning.  Silence unused 'found' warning.
Only seen in release builds.

Reviewed-by: Marek Olšák marek.ol...@amd.com

---

 src/glsl/link_atomics.cpp |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glsl/link_atomics.cpp b/src/glsl/link_atomics.cpp
index db9c539..d92cdb1 100644
--- a/src/glsl/link_atomics.cpp
+++ b/src/glsl/link_atomics.cpp
@@ -105,9 +105,10 @@ namespace {
 ir_variable *var = ((ir_instruction *)node)-as_variable();
 
 if (var  var-type-contains_atomic()) {
-   unsigned id;
+   unsigned id = 0;
bool found = prog-UniformHash-get(id, var-name);
assert(found);
+   (void) found;
active_atomic_buffer *buf = buffers[var-data.binding];
 
/* If this is the first time the buffer is used, increment

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


Mesa (master): mesa: rename unbind_texobj_from_imgunits()

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 35ddd2cc5d1b25d9ca7f2473f4523791e37ed385
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=35ddd2cc5d1b25d9ca7f2473f4523791e37ed385

Author: Brian Paul bri...@vmware.com
Date:   Wed Jan 22 11:32:28 2014 -0700

mesa: rename unbind_texobj_from_imgunits()

... to unbind_texobj_from_image_units() and change a local var's type
to silence an MSVC warning.

Reviewed-by: Marek Olšák marek.ol...@amd.com

---

 src/mesa/main/texobj.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 3c64c437..5d516c5 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1104,10 +1104,10 @@ unbind_texobj_from_texunits(struct gl_context *ctx,
  * and unbind it if that's the case.
  */
 static void
-unbind_texobj_from_imgunits(struct gl_context *ctx,
-struct gl_texture_object *texObj)
+unbind_texobj_from_image_units(struct gl_context *ctx,
+   struct gl_texture_object *texObj)
 {
-   int i;
+   GLuint i;
 
for (i = 0; i  ctx-Const.MaxImageUnits; i++) {
   struct gl_image_unit *unit = ctx-ImageUnits[i];
@@ -1169,7 +1169,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
  * image unit.  If so, unbind it.
  * See section 3.9.X of GL_ARB_shader_image_load_store.
  */
-unbind_texobj_from_imgunits(ctx, delObj);
+unbind_texobj_from_image_units(ctx, delObj);
 
 _mesa_unlock_texture(ctx, delObj);
 

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


Mesa (master): svga: rename shader_result - variant

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 2a30379dcdb9f643d97ba48811fddf90484a84f2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a30379dcdb9f643d97ba48811fddf90484a84f2

Author: Brian Paul bri...@vmware.com
Date:   Sat Jan 18 03:45:41 2014 -0800

svga: rename shader_result - variant

To be more consisten with other parts of gallium.  Plus, update/add
various comments.

Reviewed-by: José Fonseca jfons...@vmware.com

---

 src/gallium/drivers/svga/svga_context.h |   15 ++--
 src/gallium/drivers/svga/svga_pipe_fs.c |   18 ++---
 src/gallium/drivers/svga/svga_pipe_vs.c |   18 ++---
 src/gallium/drivers/svga/svga_state_constants.c |   24 +++
 src/gallium/drivers/svga/svga_state_fs.c|   83 --
 src/gallium/drivers/svga/svga_state_vs.c|   86 ---
 src/gallium/drivers/svga/svga_tgsi.c|   34 -
 src/gallium/drivers/svga/svga_tgsi.h|   22 +++---
 8 files changed, 158 insertions(+), 142 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_context.h 
b/src/gallium/drivers/svga/svga_context.h
index dee0cec..f75fac5 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -50,7 +50,7 @@
 
 struct draw_vertex_shader;
 struct draw_fragment_shader;
-struct svga_shader_result;
+struct svga_shader_variant;
 struct SVGACmdMemory;
 struct util_bitmask;
 
@@ -61,11 +61,13 @@ struct svga_shader
 
struct tgsi_shader_info info;
 
-   struct svga_shader_result *results;
+   /** Head of linked list of variants */
+   struct svga_shader_variant *variants;
 
unsigned id;  /** for debugging only */
 };
 
+
 struct svga_fragment_shader
 {
struct svga_shader base;
@@ -78,6 +80,7 @@ struct svga_fragment_shader
int8_t generic_remap_table[MAX_GENERIC_VARYING];
 };
 
+
 struct svga_vertex_shader
 {
struct svga_shader base;
@@ -282,8 +285,8 @@ struct svga_hw_draw_state
unsigned ts[SVGA3D_PIXEL_SAMPLERREG_MAX][SVGA3D_TS_MAX];
float cb[PIPE_SHADER_TYPES][SVGA3D_CONSTREG_MAX][4];
 
-   struct svga_shader_result *fs;
-   struct svga_shader_result *vs;
+   struct svga_shader_variant *fs;
+   struct svga_shader_variant *vs;
struct svga_hw_view_state views[PIPE_MAX_SAMPLERS];
 
unsigned num_views;
@@ -405,8 +408,8 @@ struct svga_context
 #define SVGA_NEW_NEED_PIPELINE   0x10
 #define SVGA_NEW_NEED_SWVFETCH   0x20
 #define SVGA_NEW_NEED_SWTNL  0x40
-#define SVGA_NEW_FS_RESULT   0x80
-#define SVGA_NEW_VS_RESULT   0x100
+#define SVGA_NEW_FS_VARIANT  0x80
+#define SVGA_NEW_VS_VARIANT  0x100
 #define SVGA_NEW_TEXTURE_FLAGS   0x400
 #define SVGA_NEW_STENCIL_REF 0x800
 
diff --git a/src/gallium/drivers/svga/svga_pipe_fs.c 
b/src/gallium/drivers/svga/svga_pipe_fs.c
index 4c04ea0..7bdcd8e 100644
--- a/src/gallium/drivers/svga/svga_pipe_fs.c
+++ b/src/gallium/drivers/svga/svga_pipe_fs.c
@@ -88,33 +88,33 @@ svga_delete_fs_state(struct pipe_context *pipe, void 
*shader)
 {
struct svga_context *svga = svga_context(pipe);
struct svga_fragment_shader *fs = (struct svga_fragment_shader *) shader;
-   struct svga_shader_result *result, *tmp;
+   struct svga_shader_variant *variant, *tmp;
enum pipe_error ret;
 
svga_hwtnl_flush_retry(svga);
 
draw_delete_fragment_shader(svga-swtnl.draw, fs-draw_shader);
 
-   for (result = fs-base.results; result; result = tmp) {
-  tmp = result-next;
+   for (variant = fs-base.variants; variant; variant = tmp) {
+  tmp = variant-next;
 
-  ret = SVGA3D_DestroyShader(svga-swc, result-id, SVGA3D_SHADERTYPE_PS);
+  ret = SVGA3D_DestroyShader(svga-swc, variant-id, SVGA3D_SHADERTYPE_PS);
   if (ret != PIPE_OK) {
  svga_context_flush(svga, NULL);
- ret = SVGA3D_DestroyShader(svga-swc, result-id,
+ ret = SVGA3D_DestroyShader(svga-swc, variant-id,
 SVGA3D_SHADERTYPE_PS);
  assert(ret == PIPE_OK);
   }
 
-  util_bitmask_clear(svga-fs_bm, result-id);
+  util_bitmask_clear(svga-fs_bm, variant-id);
 
-  svga_destroy_shader_result(result);
+  svga_destroy_shader_variant(variant);
 
   /*
-   * Remove stale references to this result to ensure a new result on the
+   * Remove stale references to this variant to ensure a new variant on the
* same address will be detected as a change.
*/
-  if (result == svga-state.hw_draw.fs)
+  if (variant == svga-state.hw_draw.fs)
  svga-state.hw_draw.fs = NULL;
}
 
diff --git a/src/gallium/drivers/svga/svga_pipe_vs.c 
b/src/gallium/drivers/svga/svga_pipe_vs.c
index 72e2fc1..fd132eb 100644
--- a/src/gallium/drivers/svga/svga_pipe_vs.c
+++ b/src/gallium/drivers/svga/svga_pipe_vs.c
@@ -148,33 +148,33 @@ svga_delete_vs_state(struct pipe_context *pipe, void 
*shader)
 {
struct svga_context *svga = svga_context(pipe);
struct 

Mesa (master): mesa: initialize is_layered variable to silence warning

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 5306ee736ebcce0c1cf899589c2344acdedc2162
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5306ee736ebcce0c1cf899589c2344acdedc2162

Author: Brian Paul bri...@vmware.com
Date:   Wed Jan 22 10:02:28 2014 -0800

mesa: initialize is_layered variable to silence warning

Reviewed-by: Marek Olšák marek.ol...@amd.com

---

 src/mesa/main/fbobject.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index dc7184a..943f40b 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -880,7 +880,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
/* Covers max_layer_count, is_layered, and layer_tex_target */
bool layer_info_valid = false;
GLuint max_layer_count = 0, att_layer_count;
-   bool is_layered;
+   bool is_layered = false;
GLenum layer_tex_target = 0;
 
assert(_mesa_is_user_fbo(fb));

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


Mesa (master): svga: whitespace, formatting fixes in svga_state_framebuffer.c

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: f12954e1cbb9750814e2d73e8f8435719bff9528
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f12954e1cbb9750814e2d73e8f8435719bff9528

Author: Brian Paul bri...@vmware.com
Date:   Sat Jan 18 05:57:32 2014 -0800

svga: whitespace, formatting fixes in svga_state_framebuffer.c

Reviewed-by: José Fonseca jfons...@vmware.com

---

 src/gallium/drivers/svga/svga_state_framebuffer.c |   57 ++---
 1 file changed, 26 insertions(+), 31 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c 
b/src/gallium/drivers/svga/svga_state_framebuffer.c
index 6976d37..1497116 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -66,22 +66,22 @@ emit_framebuffer( struct svga_context *svga,
 * We need to reemit non-null surface bindings, even when they are not
 * dirty, to ensure that the resources are paged in.
 */
-   
+
for (i = 0; i  svgascreen-max_color_buffers; i++) {
   if (curr-cbufs[i] != hw-cbufs[i] ||
   (reemit  hw-cbufs[i])) {
  if (svga-curr.nr_fbs++  MAX_RT_PER_BATCH)
 return PIPE_ERROR_OUT_OF_MEMORY;
 
- ret = SVGA3D_SetRenderTarget(svga-swc, SVGA3D_RT_COLOR0 + i, 
curr-cbufs[i]);
+ ret = SVGA3D_SetRenderTarget(svga-swc, SVGA3D_RT_COLOR0 + i,
+  curr-cbufs[i]);
  if (ret != PIPE_OK)
 return ret;
- 
+
  pipe_surface_reference(hw-cbufs[i], curr-cbufs[i]);
   }
}
 
-   
if (curr-zsbuf != hw-zsbuf ||
(reemit  hw-zsbuf)) {
   ret = SVGA3D_SetRenderTarget(svga-swc, SVGA3D_RT_DEPTH, curr-zsbuf);
@@ -90,7 +90,8 @@ emit_framebuffer( struct svga_context *svga,
 
   if (curr-zsbuf 
   curr-zsbuf-format == PIPE_FORMAT_S8_UINT_Z24_UNORM) {
- ret = SVGA3D_SetRenderTarget(svga-swc, SVGA3D_RT_STENCIL, 
curr-zsbuf);
+ ret = SVGA3D_SetRenderTarget(svga-swc, SVGA3D_RT_STENCIL,
+  curr-zsbuf);
  if (ret != PIPE_OK)
 return ret;
   }
@@ -99,7 +100,7 @@ emit_framebuffer( struct svga_context *svga,
  if (ret != PIPE_OK)
 return ret;
   }
-  
+
   pipe_surface_reference(hw-zsbuf, curr-zsbuf);
}
 
@@ -129,7 +130,8 @@ svga_reemit_framebuffer_bindings(struct svga_context *svga)
 
for (i = 0; i  svgascreen-max_color_buffers; i++) {
   if (hw-cbufs[i]) {
- ret = SVGA3D_SetRenderTarget(svga-swc, SVGA3D_RT_COLOR0 + i, 
hw-cbufs[i]);
+ ret = SVGA3D_SetRenderTarget(svga-swc, SVGA3D_RT_COLOR0 + i,
+  hw-cbufs[i]);
  if (ret != PIPE_OK) {
 return ret;
  }
@@ -163,7 +165,7 @@ svga_reemit_framebuffer_bindings(struct svga_context *svga)
 }
 
 
-struct svga_tracked_state svga_hw_framebuffer = 
+struct svga_tracked_state svga_hw_framebuffer =
 {
hw framebuffer state,
SVGA_NEW_FRAME_BUFFER,
@@ -173,7 +175,7 @@ struct svga_tracked_state svga_hw_framebuffer =
 
 
 
-/*** 
+/***
  */
 
 static enum pipe_error
@@ -198,8 +200,8 @@ emit_viewport( struct svga_context *svga,
 
float fx =viewport-scale[0] * -1.0f + viewport-translate[0];
float fy = flip * viewport-scale[1] * -1.0f + viewport-translate[1];
-   float fw =viewport-scale[0] * 2.0f; 
-   float fh = flip * viewport-scale[1] * 2.0f; 
+   float fw =viewport-scale[0] * 2.0f;
+   float fh = flip * viewport-scale[1] * 2.0f;
 
memset( prescale, 0, sizeof(prescale) );
 
@@ -225,13 +227,11 @@ emit_viewport( struct svga_context *svga,
prescale.translate[3] = 0;
prescale.enabled = TRUE;
 
-
-
if (fw  0) {
   prescale.scale[0] *= -1.0f;
   prescale.translate[0] += -fw;
   fw = -fw;
-  fx =viewport-scale[0] * 1.0f + viewport-translate[0];
+  fx = viewport-scale[0] * 1.0f + viewport-translate[0];
}
 
if (fh  0.0) {
@@ -244,7 +244,7 @@ emit_viewport( struct svga_context *svga,
 
if (fx  0) {
   prescale.translate[0] += fx;
-  prescale.scale[0] *= fw / (fw + fx); 
+  prescale.scale[0] *= fw / (fw + fx);
   fw += fx;
   fx = 0.0f;
}
@@ -256,17 +256,16 @@ emit_viewport( struct svga_context *svga,
   else {
  prescale.translate[1] += fy;
   }
-  prescale.scale[1] *= fh / (fh + fy); 
+  prescale.scale[1] *= fh / (fh + fy);
   fh += fy;
   fy = 0.0f;
}
 
if (fx + fw  fb_width) {
-  prescale.scale[0] *= fw / (fb_width - fx); 
+  prescale.scale[0] *= fw / (fb_width - fx);
   prescale.translate[0] -= fx * (fw / (fb_width - fx));
   prescale.translate[0] += fx;
   fw = fb_width - fx;
-  
}
 
if (fy + fh  fb_height) {
@@ -289,7 +288,6 @@ emit_viewport( struct svga_context *svga,
   goto 

Mesa (master): svga: minor code movement in svga_tgsi_insn.c

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: a15eb1967671f9c2f58d22c5ef8f4b53806f9597
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a15eb1967671f9c2f58d22c5ef8f4b53806f9597

Author: Brian Paul bri...@vmware.com
Date:   Sat Jan 18 05:08:49 2014 -0800

svga: minor code movement in svga_tgsi_insn.c

Reviewed-by: José Fonseca jfons...@vmware.com

---

 src/gallium/drivers/svga/svga_tgsi_insn.c |   94 ++---
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c 
b/src/gallium/drivers/svga/svga_tgsi_insn.c
index 88c96c0..4d78e96 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -729,45 +729,6 @@ alias_src_dst(struct src_register src,
 
 
 /**
- * Translate/emit a LRP (linear interpolation) instruction.
- */
-static boolean
-submit_lrp(struct svga_shader_emitter *emit,
-   SVGA3dShaderDestToken dst,
-   struct src_register src0,
-   struct src_register src1,
-   struct src_register src2)
-{
-   SVGA3dShaderDestToken tmp;
-   boolean need_dst_tmp = FALSE;
-
-   /* The dst reg must be a temporary, and not be the same as src0 or src2 */
-   if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP ||
-   alias_src_dst(src0, dst) ||
-   alias_src_dst(src2, dst))
-  need_dst_tmp = TRUE;
-
-   if (need_dst_tmp) {
-  tmp = get_temp( emit );
-  tmp.mask = dst.mask;
-   }
-   else {
-  tmp = dst;
-   }
-
-   if (!submit_op3(emit, inst_token( SVGA3DOP_LRP ), tmp, src0, src1, src2))
-  return FALSE;
-
-   if (need_dst_tmp) {
-  if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp )))
- return FALSE;
-   }
-
-   return TRUE;
-}
-
-
-/**
  * Helper for emitting SVGA immediate values using the SVGA3DOP_DEF[I]
  * instructions.
  */
@@ -1092,20 +1053,20 @@ emit_if(struct svga_shader_emitter *emit,
 
 
 static boolean
-emit_endif(struct svga_shader_emitter *emit,
-   const struct tgsi_full_instruction *insn)
+emit_else(struct svga_shader_emitter *emit,
+  const struct tgsi_full_instruction *insn)
 {
-   emit-dynamic_branching_level--;
-
-   return emit_instruction(emit, inst_token(SVGA3DOP_ENDIF));
+   return emit_instruction(emit, inst_token(SVGA3DOP_ELSE));
 }
 
 
 static boolean
-emit_else(struct svga_shader_emitter *emit,
-  const struct tgsi_full_instruction *insn)
+emit_endif(struct svga_shader_emitter *emit,
+   const struct tgsi_full_instruction *insn)
 {
-   return emit_instruction(emit, inst_token(SVGA3DOP_ELSE));
+   emit-dynamic_branching_level--;
+
+   return emit_instruction(emit, inst_token(SVGA3DOP_ENDIF));
 }
 
 
@@ -2335,6 +2296,45 @@ emit_xpd(struct svga_shader_emitter *emit,
 
 
 /**
+ * Emit a LRP (linear interpolation) instruction.
+ */
+static boolean
+submit_lrp(struct svga_shader_emitter *emit,
+   SVGA3dShaderDestToken dst,
+   struct src_register src0,
+   struct src_register src1,
+   struct src_register src2)
+{
+   SVGA3dShaderDestToken tmp;
+   boolean need_dst_tmp = FALSE;
+
+   /* The dst reg must be a temporary, and not be the same as src0 or src2 */
+   if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP ||
+   alias_src_dst(src0, dst) ||
+   alias_src_dst(src2, dst))
+  need_dst_tmp = TRUE;
+
+   if (need_dst_tmp) {
+  tmp = get_temp( emit );
+  tmp.mask = dst.mask;
+   }
+   else {
+  tmp = dst;
+   }
+
+   if (!submit_op3(emit, inst_token( SVGA3DOP_LRP ), tmp, src0, src1, src2))
+  return FALSE;
+
+   if (need_dst_tmp) {
+  if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp )))
+ return FALSE;
+   }
+
+   return TRUE;
+}
+
+
+/**
  * Translate/emit LRP (Linear Interpolation) instruction.
  */
 static boolean

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


Mesa (master): svga: assorted cleanups in shader code

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: fe043ae554aae87843ef2aa4b75bc0fc000e842a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe043ae554aae87843ef2aa4b75bc0fc000e842a

Author: Brian Paul bri...@vmware.com
Date:   Sat Jan 18 03:53:27 2014 -0800

svga: assorted cleanups in shader code

Reviewed-by: José Fonseca jfons...@vmware.com

---

 src/gallium/drivers/svga/svga_state_fs.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_state_fs.c 
b/src/gallium/drivers/svga/svga_state_fs.c
index 36f2cd5..1afdae9 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -293,7 +293,6 @@ make_fs_key(const struct svga_context *svga,
 }
 
 
-
 static enum pipe_error
 emit_hw_fs(struct svga_context *svga, unsigned dirty)
 {

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


Mesa (master): svga: simplify common immediate value construction

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 56b876ecd0c2d1958314671fcfdfa6a959c74137
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=56b876ecd0c2d1958314671fcfdfa6a959c74137

Author: Brian Paul bri...@vmware.com
Date:   Sat Jan 18 04:53:43 2014 -0800

svga: simplify common immediate value construction

Use some new helper functions to make the code much more readable.
And fix wrong value for XPD's w result.

Reviewed-by: José Fonseca jfons...@vmware.com

---

 src/gallium/drivers/svga/svga_tgsi_emit.h |4 +-
 src/gallium/drivers/svga/svga_tgsi_insn.c |  202 -
 2 files changed, 115 insertions(+), 91 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h 
b/src/gallium/drivers/svga/svga_tgsi_emit.h
index 28b8e69..d31b866 100644
--- a/src/gallium/drivers/svga/svga_tgsi_emit.h
+++ b/src/gallium/drivers/svga/svga_tgsi_emit.h
@@ -85,8 +85,8 @@ struct svga_shader_emitter
 
boolean in_main_func;
 
-   boolean created_zero_immediate;
-   int zero_immediate_idx;
+   boolean created_common_immediate;
+   int common_immediate_idx;
 
boolean created_loop_const;
int loop_const_idx;
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c 
b/src/gallium/drivers/svga/svga_tgsi_insn.c
index 062579b..88c96c0 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -810,30 +810,6 @@ emit_def_const(struct svga_shader_emitter *emit,
 }
 
 
-/**
- * Create/emit a constant with values {0, 0.5, -1, 1}.
- * We can swizzle this to produce other useful constants such as
- * {0, 0, 0, 0}, {1, 1, 1, 1}, etc.
- */
-static boolean
-create_zero_immediate( struct svga_shader_emitter *emit )
-{
-   unsigned idx = emit-nr_hw_float_const++;
-
-   /* Emit the constant (0, 0.5, -1, 1) and use swizzling to generate
-* other useful vectors.
-*/
-   if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT,
-idx, 0, 0.5, -1, 1 ))
-  return FALSE;
-
-   emit-zero_immediate_idx = idx;
-   emit-created_zero_immediate = TRUE;
-
-   return TRUE;
-}
-
-
 static boolean
 create_loop_const( struct svga_shader_emitter *emit )
 {
@@ -905,30 +881,93 @@ get_vface( struct svga_shader_emitter *emit )
 
 
 /**
- * returns {0, 0, 0, 1} immediate
+ * Create/emit a common constant with values {0, 0.5, -1, 1}.
+ * We can swizzle this to produce other useful constants such as
+ * {0, 0, 0, 0}, {1, 1, 1, 1}, etc.
+ */
+static boolean
+create_common_immediate( struct svga_shader_emitter *emit )
+{
+   unsigned idx = emit-nr_hw_float_const++;
+
+   /* Emit the constant (0, 0.5, -1, 1) and use swizzling to generate
+* other useful vectors.
+*/
+   if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT,
+idx, 0.0f, 0.5f, -1.0f, 1.0f ))
+  return FALSE;
+
+   emit-common_immediate_idx = idx;
+   emit-created_common_immediate = TRUE;
+
+   return TRUE;
+}
+
+
+/**
+ * Return swizzle/position for the given value in the common immediate.
+ */
+static inline unsigned
+common_immediate_swizzle(float value)
+{
+   if (value == 0.0f)
+  return TGSI_SWIZZLE_X;
+   else if (value == 0.5f)
+  return TGSI_SWIZZLE_Y;
+   else if (value == -1.0f)
+  return TGSI_SWIZZLE_Z;
+   else if (value == 1.0f)
+  return TGSI_SWIZZLE_W;
+   else {
+  assert(!illegal value in common_immediate_swizzle);
+  return TGSI_SWIZZLE_X;
+   }
+}
+
+
+/**
+ * Returns an immediate reg where all the terms are either 0, 1, -1 or 0.5
+ */
+static struct src_register
+get_immediate(struct svga_shader_emitter *emit,
+  float x, float y, float z, float w)
+{
+   unsigned sx = common_immediate_swizzle(x);
+   unsigned sy = common_immediate_swizzle(y);
+   unsigned sz = common_immediate_swizzle(z);
+   unsigned sw = common_immediate_swizzle(w);
+   assert(emit-created_common_immediate);
+   assert(emit-common_immediate_idx = 0);
+   return swizzle(src_register(SVGA3DREG_CONST, emit-common_immediate_idx),
+  sx, sy, sz, sw);
+}
+
+
+/**
+ * returns {0, 0, 0, 0} immediate
  */
 static struct src_register
 get_zero_immediate( struct svga_shader_emitter *emit )
 {
-   assert(emit-created_zero_immediate);
-   assert(emit-zero_immediate_idx = 0);
+   assert(emit-created_common_immediate);
+   assert(emit-common_immediate_idx = 0);
return swizzle(src_register( SVGA3DREG_CONST,
-emit-zero_immediate_idx),
-  0, 0, 0, 3);
+emit-common_immediate_idx),
+  0, 0, 0, 0);
 }
 
 
 /**
- * returns {1, 1, 1, -1} immediate
+ * returns {1, 1, 1, 1} immediate
  */
 static struct src_register
-get_pos_neg_one_immediate( struct svga_shader_emitter *emit )
+get_one_immediate( struct svga_shader_emitter *emit )
 {
-   assert(emit-created_zero_immediate);
-   assert(emit-zero_immediate_idx = 0);
+   assert(emit-created_common_immediate);
+   assert(emit-common_immediate_idx = 0);
return swizzle(src_register( SVGA3DREG_CONST,

Mesa (master): svga: add comments, etc to svga_tgsi_insn.c code

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 023020d740b4fb5da2b9f344d97d1c151e7bbb90
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=023020d740b4fb5da2b9f344d97d1c151e7bbb90

Author: Brian Paul bri...@vmware.com
Date:   Sat Jan 18 04:28:47 2014 -0800

svga: add comments, etc to svga_tgsi_insn.c code

To make things a little easier to understand for newcomers.

Reviewed-by: José Fonseca jfons...@vmware.com

---

 src/gallium/drivers/svga/svga_tgsi_insn.c |  194 -
 1 file changed, 163 insertions(+), 31 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c 
b/src/gallium/drivers/svga/svga_tgsi_insn.c
index ce00da6..062579b 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -56,8 +56,7 @@ translate_opcode(uint opcode)
case TGSI_OPCODE_NOP:return SVGA3DOP_NOP;
case TGSI_OPCODE_NRM4:   return SVGA3DOP_NRM;
default:
-  debug_printf(Unkown opcode %u\n, opcode);
-  assert( 0 );
+  assert(!svga: unexpected opcode in translate_opcode());
   return SVGA3DOP_LAST_INST;
}
 }
@@ -75,12 +74,17 @@ translate_file(unsigned file)
case TGSI_FILE_SAMPLER:   return SVGA3DREG_SAMPLER;
case TGSI_FILE_ADDRESS:   return SVGA3DREG_ADDR;
default:
-  assert( 0 );
+  assert(!svga: unexpected register file in translate_file());
   return SVGA3DREG_TEMP;
}
 }
 
 
+/**
+ * Translate a TGSI destination register to an SVGA3DShaderDestToken.
+ * \param insn  the TGSI instruction
+ * \param idx  which TGSI dest register to translate (usually (always?) zero)
+ */
 static SVGA3dShaderDestToken
 translate_dst_register( struct svga_shader_emitter *emit,
 const struct tgsi_full_instruction *insn,
@@ -184,6 +188,9 @@ svga_arl_adjustment( const struct svga_shader_emitter *emit 
)
 }
 
 
+/**
+ * Translate a TGSI src register to a src_register.
+ */
 static struct src_register
 translate_src_register( const struct svga_shader_emitter *emit,
 const struct tgsi_full_src_register *reg )
@@ -300,6 +307,9 @@ release_temp( struct svga_shader_emitter *emit,
 }
 
 
+/**
+ * Release all temps.
+ */
 static void
 reset_temp_regs(struct svga_shader_emitter *emit)
 {
@@ -472,6 +482,9 @@ emit_repl(struct svga_shader_emitter *emit,
 }
 
 
+/**
+ * Submit/emit an instruction with zero operands.
+ */
 static boolean
 submit_op0(struct svga_shader_emitter *emit,
SVGA3dShaderInstToken inst,
@@ -482,6 +495,9 @@ submit_op0(struct svga_shader_emitter *emit,
 }
 
 
+/**
+ * Submit/emit an instruction with one operand.
+ */
 static boolean
 submit_op1(struct svga_shader_emitter *emit,
SVGA3dShaderInstToken inst,
@@ -493,6 +509,8 @@ submit_op1(struct svga_shader_emitter *emit,
 
 
 /**
+ * Submit/emit an instruction with two operands.
+ *
  * SVGA shaders may not refer to 1 constant register in a single
  * instruction.  This function checks for that usage and inserts a
  * move to temporary if detected.
@@ -543,6 +561,8 @@ submit_op2(struct svga_shader_emitter *emit,
 
 
 /**
+ * Submit/emit an instruction with three operands.
+ *
  * SVGA shaders may not refer to 1 constant register in a single
  * instruction.  This function checks for that usage and inserts a
  * move to temporary if detected.
@@ -613,6 +633,8 @@ submit_op3(struct svga_shader_emitter *emit,
 
 
 /**
+ * Submit/emit an instruction with four operands.
+ *
  * SVGA shaders may not refer to 1 constant register in a single
  * instruction.  This function checks for that usage and inserts a
  * move to temporary if detected.
@@ -706,6 +728,9 @@ alias_src_dst(struct src_register src,
 }
 
 
+/**
+ * Translate/emit a LRP (linear interpolation) instruction.
+ */
 static boolean
 submit_lrp(struct svga_shader_emitter *emit,
SVGA3dShaderDestToken dst,
@@ -742,6 +767,10 @@ submit_lrp(struct svga_shader_emitter *emit,
 }
 
 
+/**
+ * Helper for emitting SVGA immediate values using the SVGA3DOP_DEF[I]
+ * instructions.
+ */
 static boolean
 emit_def_const(struct svga_shader_emitter *emit,
SVGA3dShaderConstType type,
@@ -781,6 +810,11 @@ emit_def_const(struct svga_shader_emitter *emit,
 }
 
 
+/**
+ * Create/emit a constant with values {0, 0.5, -1, 1}.
+ * We can swizzle this to produce other useful constants such as
+ * {0, 0, 0, 0}, {1, 1, 1, 1}, etc.
+ */
 static boolean
 create_zero_immediate( struct svga_shader_emitter *emit )
 {
@@ -943,8 +977,8 @@ get_fake_arl_const( struct svga_shader_emitter *emit )
 
 
 /**
- * Return the register which holds the current dimenions of the
- * texture bound to the given sampler
+ * Return a register which holds the width and height of the texture
+ * currently bound to the given sampler.
  */
 static struct src_register
 get_tex_dimensions( struct svga_shader_emitter *emit, int sampler_num )
@@ -1241,6 +1275,9 @@ emit_nrm(struct svga_shader_emitter *emit,
 }
 
 
+/**
+ * Sine / Cosine helper function.
+ */
 

Mesa (master): mesa: whitespace fixes in glformats.c

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1a441805781382067e92cd9f3b324f23164c3024
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a441805781382067e92cd9f3b324f23164c3024

Author: Brian Paul bri...@vmware.com
Date:   Thu Jan 23 08:29:54 2014 -0700

mesa: whitespace fixes in glformats.c

Reindent _mesa_get_nongeneric_internalformat() to match other functions.
Remove extraneous empty lines in _mesa_get_linear_internalformat().

Trivial.

---

 src/mesa/main/glformats.c |  126 ++---
 1 file changed, 51 insertions(+), 75 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 02709a1..7d4a310 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1136,76 +1136,60 @@ GLenum
 _mesa_get_nongeneric_internalformat(GLenum format)
 {
switch (format) {
-  /* GL 1.1 formats. */
-  case 4:
-  case GL_RGBA:
- return GL_RGBA8;
-
-  case 3:
-  case GL_RGB:
- return GL_RGB8;
-
-  case 2:
-  case GL_LUMINANCE_ALPHA:
- return GL_LUMINANCE8_ALPHA8;
-
-  case 1:
-  case GL_LUMINANCE:
- return GL_LUMINANCE8;
-
-  case GL_ALPHA:
- return GL_ALPHA8;
-
-  case GL_INTENSITY:
- return GL_INTENSITY8;
-
-  /* GL_ARB_texture_rg */
-  case GL_RED:
- return GL_R8;
-
-  case GL_RG:
- return GL_RG8;
-
-  /* GL_EXT_texture_sRGB */
-  case GL_SRGB:
- return GL_SRGB8;
-
-  case GL_SRGB_ALPHA:
- return GL_SRGB8_ALPHA8;
-
-  case GL_SLUMINANCE:
- return GL_SLUMINANCE8;
-
-  case GL_SLUMINANCE_ALPHA:
- return GL_SLUMINANCE8_ALPHA8;
-
-  /* GL_EXT_texture_snorm */
-  case GL_RGBA_SNORM:
- return GL_RGBA8_SNORM;
-
-  case GL_RGB_SNORM:
- return GL_RGB8_SNORM;
-
-  case GL_RG_SNORM:
- return GL_RG8_SNORM;
-
-  case GL_RED_SNORM:
- return GL_R8_SNORM;
-
-  case GL_LUMINANCE_ALPHA_SNORM:
- return GL_LUMINANCE8_ALPHA8_SNORM;
-
-  case GL_LUMINANCE_SNORM:
- return GL_LUMINANCE8_SNORM;
+   /* GL 1.1 formats. */
+   case 4:
+   case GL_RGBA:
+  return GL_RGBA8;
+   case 3:
+   case GL_RGB:
+  return GL_RGB8;
+   case 2:
+   case GL_LUMINANCE_ALPHA:
+  return GL_LUMINANCE8_ALPHA8;
+   case 1:
+   case GL_LUMINANCE:
+  return GL_LUMINANCE8;
+   case GL_ALPHA:
+  return GL_ALPHA8;
+   case GL_INTENSITY:
+  return GL_INTENSITY8;
 
-  case GL_ALPHA_SNORM:
- return GL_ALPHA8_SNORM;
+   /* GL_ARB_texture_rg */
+   case GL_RED:
+  return GL_R8;
+   case GL_RG:
+  return GL_RG8;
 
-  case GL_INTENSITY_SNORM:
- return GL_INTENSITY8_SNORM;
+   /* GL_EXT_texture_sRGB */
+   case GL_SRGB:
+  return GL_SRGB8;
+   case GL_SRGB_ALPHA:
+  return GL_SRGB8_ALPHA8;
+   case GL_SLUMINANCE:
+  return GL_SLUMINANCE8;
+   case GL_SLUMINANCE_ALPHA:
+  return GL_SLUMINANCE8_ALPHA8;
+
+   /* GL_EXT_texture_snorm */
+   case GL_RGBA_SNORM:
+  return GL_RGBA8_SNORM;
+   case GL_RGB_SNORM:
+  return GL_RGB8_SNORM;
+   case GL_RG_SNORM:
+  return GL_RG8_SNORM;
+   case GL_RED_SNORM:
+  return GL_R8_SNORM;
+   case GL_LUMINANCE_ALPHA_SNORM:
+  return GL_LUMINANCE8_ALPHA8_SNORM;
+   case GL_LUMINANCE_SNORM:
+  return GL_LUMINANCE8_SNORM;
+   case GL_ALPHA_SNORM:
+  return GL_ALPHA8_SNORM;
+   case GL_INTENSITY_SNORM:
+  return GL_INTENSITY8_SNORM;
 
-  default:
- return format;
+   default:
+  return format;
}
 }
 
@@ -1219,28 +1203,20 @@ _mesa_get_linear_internalformat(GLenum format)
switch (format) {
case GL_SRGB:
   return GL_RGB;
-
case GL_SRGB_ALPHA:
   return GL_RGBA;
-
case GL_SRGB8:
   return GL_RGB8;
-
case GL_SRGB8_ALPHA8:
   return GL_RGBA8;
-
case GL_SLUMINANCE8:
   return GL_LUMINANCE8;
-
case GL_SLUMINANCE:
   return GL_LUMINANCE;
-
case GL_SLUMINANCE_ALPHA:
   return GL_LUMINANCE_ALPHA;
-
case GL_SLUMINANCE8_ALPHA8:
   return GL_LUMINANCE8_ALPHA8;
-
default:
   return format;
}

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


Mesa (master): draw: Save original driver functions earlier.

2014-01-23 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 840154dc5002f7291aa2ece5322be7c2e40d9b6d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=840154dc5002f7291aa2ece5322be7c2e40d9b6d

Author: José Fonseca jfons...@vmware.com
Date:   Wed Jun 20 14:25:46 2012 +0100

draw: Save original driver functions earlier.

Otherwise they will be NULL when stage destroy is invoked prematurely,
(i.e, on out of memory).

Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Roland Scheidegger srol...@vmware.com

---

 src/gallium/auxiliary/draw/draw_pipe_aaline.c   |   14 +++---
 src/gallium/auxiliary/draw/draw_pipe_pstipple.c |   14 +++---
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c 
b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index f2895dd..8955762 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -996,13 +996,6 @@ draw_install_aaline_stage(struct draw_context *draw, 
struct pipe_context *pipe)
if (!aaline)
   goto fail;
 
-   /* create special texture, sampler state */
-   if (!aaline_create_texture(aaline))
-  goto fail;
-
-   if (!aaline_create_sampler(aaline))
-  goto fail;
-
/* save original driver functions */
aaline-driver_create_fs_state = pipe-create_fs_state;
aaline-driver_bind_fs_state = pipe-bind_fs_state;
@@ -1011,6 +1004,13 @@ draw_install_aaline_stage(struct draw_context *draw, 
struct pipe_context *pipe)
aaline-driver_bind_sampler_states = pipe-bind_sampler_states;
aaline-driver_set_sampler_views = pipe-set_sampler_views;
 
+   /* create special texture, sampler state */
+   if (!aaline_create_texture(aaline))
+  goto fail;
+
+   if (!aaline_create_sampler(aaline))
+  goto fail;
+
/* override the driver's functions */
pipe-create_fs_state = aaline_create_fs_state;
pipe-bind_fs_state = aaline_bind_fs_state;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c 
b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index 73da966..d7dcfdb 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -794,13 +794,6 @@ draw_install_pstipple_stage(struct draw_context *draw,
 
draw-pipeline.pstipple = pstip-stage;
 
-   /* create special texture, sampler state */
-   if (!pstip_create_texture(pstip))
-  goto fail;
-
-   if (!pstip_create_sampler(pstip))
-  goto fail;
-
/* save original driver functions */
pstip-driver_create_fs_state = pipe-create_fs_state;
pstip-driver_bind_fs_state = pipe-bind_fs_state;
@@ -810,6 +803,13 @@ draw_install_pstipple_stage(struct draw_context *draw,
pstip-driver_set_sampler_views = pipe-set_sampler_views;
pstip-driver_set_polygon_stipple = pipe-set_polygon_stipple;
 
+   /* create special texture, sampler state */
+   if (!pstip_create_texture(pstip))
+  goto fail;
+
+   if (!pstip_create_sampler(pstip))
+  goto fail;
+
/* override the driver's functions */
pipe-create_fs_state = pstip_create_fs_state;
pipe-bind_fs_state = pstip_bind_fs_state;

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


Mesa (master): radeon / r200: Fix 'empty body' warning

2014-01-23 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 5b4c12972c338d65b13d98740557eaa63c4a49ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b4c12972c338d65b13d98740557eaa63c4a49ec

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Mon Jan 20 10:56:13 2014 -0800

radeon / r200: Fix 'empty body' warning

radeon_common.c: In function 'radeon_draw_buffer':
radeon_common.c:237:3: warning: suggest braces around empty body in an 'if' 
statement [-Wempty-body]

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Reviewed-by: Alex Deucher alexander.deuc...@amd.com
Cc: Marek Olšák marek.ol...@amd.com

---

 src/mesa/drivers/dri/radeon/radeon_common.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index d8839d1..7800e50 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -233,9 +233,9 @@ void radeon_draw_buffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
return;
}
 
-   if (fb-Name)
+   if (fb-Name) {
;/* do something depthy/stencily TODO */
-
+}
 
/* none */
if (fb-Name == 0) {

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


Mesa (master): radeon / r200: Remove unused 'dostate' parameter

2014-01-23 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 2d5fd2069031de9324a135b51a369617667223e4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d5fd2069031de9324a135b51a369617667223e4

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Mon Jan 20 11:08:36 2014 -0800

radeon / r200: Remove unused 'dostate' parameter

This parameter hasn't been used since January 2010 (commit 29e02c7).
Fixes the following warning in both radeon and r200:

radeon_common.c: In function 'r200_rcommonBeginBatch':
radeon_common.c:762:14: warning: unused parameter 'dostate' [-Wunused-parameter]

Note that now BEGIN_BATCH and BEGIN_PATCH_NO_AUTOSTATE are identical.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Reviewed-by: Alex Deucher alexander.deuc...@amd.com
Cc: Marek Olšák marek.ol...@amd.com

---

 src/mesa/drivers/dri/radeon/radeon_cmdbuf.h |5 ++---
 src/mesa/drivers/dri/radeon/radeon_common.c |1 -
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h 
b/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h
index efccc81..63f51c3 100644
--- a/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h
+++ b/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h
@@ -9,7 +9,6 @@ void rcommonDestroyCmdBuf(radeonContextPtr rmesa);
 
 void rcommonBeginBatch(radeonContextPtr rmesa,
   int n,
-  int dostate,
   const char *file,
   const char *function,
   int line);
@@ -32,12 +31,12 @@ void rcommonBeginBatch(radeonContextPtr rmesa,
  * Prepare writing n dwords to the command buffer,
  * including producing any necessary state emits on buffer wraparound.
  */
-#define BEGIN_BATCH(n) rcommonBeginBatch(b_l_rmesa, n, 1, __FILE__, 
__FUNCTION__, __LINE__)
+#define BEGIN_BATCH(n) rcommonBeginBatch(b_l_rmesa, n, __FILE__, __FUNCTION__, 
__LINE__)
 
 /**
  * Same as BEGIN_BATCH, but do not cause automatic state emits.
  */
-#define BEGIN_BATCH_NO_AUTOSTATE(n) rcommonBeginBatch(b_l_rmesa, n, 0, 
__FILE__, __FUNCTION__, __LINE__)
+#define BEGIN_BATCH_NO_AUTOSTATE(n) rcommonBeginBatch(b_l_rmesa, n, __FILE__, 
__FUNCTION__, __LINE__)
 
 /**
  * Write one dword to the command buffer.
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index 7800e50..4078fdf 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -759,7 +759,6 @@ void rcommonDestroyCmdBuf(radeonContextPtr rmesa)
 }
 
 void rcommonBeginBatch(radeonContextPtr rmesa, int n,
-  int dostate,
   const char *file,
   const char *function,
   int line)

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


Mesa (master): mesa: Set gl_constants::MinMapBufferAlignment

2014-01-23 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: e4fcae0755d8a369b657f2ada22815ea77312fbe
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4fcae0755d8a369b657f2ada22815ea77312fbe

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Wed Jan 22 08:28:49 2014 -0800

mesa: Set gl_constants::MinMapBufferAlignment

Leaving it set to zero isn't really correct since every allocation has
at least an alignment of 1 byte.  It also caused a problem in the i965
driver after I removed the MAX(64, ...) from the alignment calculation.
That's what I get for changing a patch without retesting it. :(

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73907
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Cc: Lu Hua huax...@intel.com

---

 src/mesa/main/context.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 7c3b2d7..b7cd568 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -587,6 +587,7 @@ _mesa_init_constants(struct gl_context *ctx)
ctx-Const.MaxSpotExponent = 128.0;
ctx-Const.MaxViewportWidth = MAX_VIEWPORT_WIDTH;
ctx-Const.MaxViewportHeight = MAX_VIEWPORT_HEIGHT;
+   ctx-Const.MinMapBufferAlignment = 1;
 
/* Driver must override these values if ARB_viewport_array is supported. */
ctx-Const.MaxViewports = 1;

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


Mesa (master): radeon / r200: Fix incompatible pointer type warning

2014-01-23 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: b790bed21e332cfe0b999dfa9988ae5168557a0c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b790bed21e332cfe0b999dfa9988ae5168557a0c

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Mon Jan 20 10:41:31 2014 -0800

radeon / r200: Fix incompatible pointer type warning

When parameters were removed from dd_function_table::Viewport (commit
065bd6ff), radeon_viewport (in both radeon and r200) started generating
a warning.

radeon_common.c: In function 'r200_radeon_viewport':
radeon_common.c:415:15: warning: assignment from incompatible pointer type 
[enabled by default]
radeon_common.c:419:23: warning: assignment from incompatible pointer type 
[enabled by default]

I didn't notice this initially, and it's harmless because the function is
never called through the incorrectly typed pointer.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Reviewed-by: Alex Deucher alexander.deuc...@amd.com
Cc: Marek Olšák marek.ol...@amd.com

---

 src/mesa/drivers/dri/radeon/radeon_common.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index e900bc5..d8839d1 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -400,8 +400,7 @@ void radeon_viewport(struct gl_context *ctx)
 {
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
__DRIcontext *driContext = radeon-dri.context;
-   void (*old_viewport)(struct gl_context *ctx, GLint x, GLint y,
-GLsizei w, GLsizei h);
+   void (*old_viewport)(struct gl_context *ctx);
 
if (_mesa_is_winsys_fbo(ctx-DrawBuffer)) {
if (radeon-is_front_buffer_rendering) {

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


Mesa (master): radeon / r200: Eliminate BEGIN_BATCH_NO_AUTOSTATE

2014-01-23 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 7a0f26dec9aad75834d3314d5e306d49729b37f1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a0f26dec9aad75834d3314d5e306d49729b37f1

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Mon Jan 20 11:16:26 2014 -0800

radeon / r200: Eliminate BEGIN_BATCH_NO_AUTOSTATE

Sed job:

grep -lr BEGIN_BATCH_NO_AUTOSTATE src/mesa/drivers/dri/ | while read f
do
cat $f | sed 's/BEGIN_BATCH_NO_AUTOSTATE/BEGIN_BATCH/g'  x
mv x $f
done

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Reviewed-by: Alex Deucher alexander.deuc...@amd.com
Cc: Marek Olšák marek.ol...@amd.com

---

 src/mesa/drivers/dri/r200/r200_blit.c   |2 +-
 src/mesa/drivers/dri/r200/r200_cmdbuf.c |2 +-
 src/mesa/drivers/dri/r200/r200_context.c|2 +-
 src/mesa/drivers/dri/r200/r200_state_init.c |   18 +-
 src/mesa/drivers/dri/radeon/radeon_blit.c   |2 +-
 src/mesa/drivers/dri/radeon/radeon_cmdbuf.h |9 ++---
 src/mesa/drivers/dri/radeon/radeon_common.c |2 +-
 src/mesa/drivers/dri/radeon/radeon_context.c|2 +-
 src/mesa/drivers/dri/radeon/radeon_ioctl.c  |4 ++--
 src/mesa/drivers/dri/radeon/radeon_queryobj.c   |2 +-
 src/mesa/drivers/dri/radeon/radeon_state_init.c |   14 +++---
 11 files changed, 27 insertions(+), 32 deletions(-)

diff --git a/src/mesa/drivers/dri/r200/r200_blit.c 
b/src/mesa/drivers/dri/r200/r200_blit.c
index a6a1a3f..666fbad 100644
--- a/src/mesa/drivers/dri/r200/r200_blit.c
+++ b/src/mesa/drivers/dri/r200/r200_blit.c
@@ -337,7 +337,7 @@ static inline void emit_cb_setup(struct r200_context *r200,
 if (bo-flags  RADEON_BO_FLAGS_MICRO_TILE)
dst_pitch |= R200_COLOR_MICROTILE_ENABLE;
 
-BEGIN_BATCH_NO_AUTOSTATE(22);
+BEGIN_BATCH(22);
 OUT_BATCH_REGVAL(R200_RE_AUX_SCISSOR_CNTL, 0);
 OUT_BATCH_REGVAL(R200_RE_CNTL, 0);
 OUT_BATCH_REGVAL(RADEON_RE_TOP_LEFT, 0);
diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c 
b/src/mesa/drivers/dri/r200/r200_cmdbuf.c
index b351c20..1e6c0d8 100644
--- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c
+++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c
@@ -211,7 +211,7 @@ void r200EmitMaxVtxIndex(r200ContextPtr rmesa, int count)
 {
BATCH_LOCALS(rmesa-radeon);
 
-   BEGIN_BATCH_NO_AUTOSTATE(2);
+   BEGIN_BATCH(2);
OUT_BATCH(CP_PACKET0(R200_SE_VF_MAX_VTX_INDX, 0));
OUT_BATCH(count);
END_BATCH();
diff --git a/src/mesa/drivers/dri/r200/r200_context.c 
b/src/mesa/drivers/dri/r200/r200_context.c
index 5427fc2..a7021f2 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -169,7 +169,7 @@ static void r200_emit_query_finish(radeonContextPtr radeon)
BATCH_LOCALS(radeon);
struct radeon_query_object *query = radeon-query.current;
 
-   BEGIN_BATCH_NO_AUTOSTATE(4);
+   BEGIN_BATCH(4);
OUT_BATCH(CP_PACKET0(RADEON_RB3D_ZPASS_ADDR, 0));
OUT_BATCH_RELOC(0, query-bo, query-curr_offset, 0, RADEON_GEM_DOMAIN_GTT, 
0);
END_BATCH();
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c 
b/src/mesa/drivers/dri/r200/r200_state_init.c
index bf9cef0..79aa753 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -293,7 +293,7 @@ VP_CHECK( tcl_vpp_size_add4, 
ctx-VertexProgram.Current-Base.NumNativeParameter
 _start = h.veclinear.addr_lo | (h.veclinear.addr_hi  8); \
 _sz = h.veclinear.count * 4;   \
 if (_sz) { \
-BEGIN_BATCH_NO_AUTOSTATE(dwords); \
+BEGIN_BATCH(dwords); \
 OUT_BATCH(CP_PACKET0(RADEON_SE_TCL_STATE_FLUSH, 0));   \
 OUT_BATCH(0);  \
 OUT_BATCH(CP_PACKET0(R200_SE_TCL_VECTOR_INDX_REG, 0)); \
@@ -346,7 +346,7 @@ static void mtl_emit(struct gl_context *ctx, struct 
radeon_state_atom *atom)
BATCH_LOCALS(r200-radeon);
uint32_t dwords = atom-check(ctx, atom);
 
-   BEGIN_BATCH_NO_AUTOSTATE(dwords);
+   BEGIN_BATCH(dwords);
OUT_VEC(atom-cmd[MTL_CMD_0], (atom-cmd+1));
OUT_SCL2(atom-cmd[MTL_CMD_1], (atom-cmd + 18));
END_BATCH();
@@ -358,7 +358,7 @@ static void lit_emit(struct gl_context *ctx, struct 
radeon_state_atom *atom)
BATCH_LOCALS(r200-radeon);
uint32_t dwords = atom-check(ctx, atom);
 
-   BEGIN_BATCH_NO_AUTOSTATE(dwords);
+   BEGIN_BATCH(dwords);
OUT_VEC(atom-cmd[LIT_CMD_0], atom-cmd+1);
OUT_SCL(atom-cmd[LIT_CMD_1], atom-cmd+LIT_CMD_1+1);
END_BATCH();
@@ -370,7 +370,7 @@ static void ptp_emit(struct gl_context *ctx, struct 
radeon_state_atom *atom)
BATCH_LOCALS(r200-radeon);
uint32_t dwords = atom-check(ctx, atom);
 
-   BEGIN_BATCH_NO_AUTOSTATE(dwords);
+   BEGIN_BATCH(dwords);
OUT_VEC(atom-cmd[PTP_CMD_0], atom-cmd+1);
OUT_VEC(atom-cmd[PTP_CMD_1], atom-cmd+PTP_CMD_1+1);
END_BATCH();
@@ -391,7 +391,7 @@ static void 

Mesa (master): driconf: Synchronize po files

2014-01-23 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 822b4315b7eb9d7659d7954416ffe441fd364730
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=822b4315b7eb9d7659d7954416ffe441fd364730

Author: Alex Henrie alexhenri...@gmail.com
Date:   Wed Jan 15 10:41:46 2014 -0700

driconf: Synchronize po files

See the instructions in Makefile.am under Updating existing
translations.

Reviewed-by: Eric Anholt e...@anholt.net

---

 src/mesa/drivers/dri/common/xmlpool/de.po |  235 -
 src/mesa/drivers/dri/common/xmlpool/es.po |  212 ++
 src/mesa/drivers/dri/common/xmlpool/fr.po |  199 
 src/mesa/drivers/dri/common/xmlpool/nl.po |  197 
 src/mesa/drivers/dri/common/xmlpool/sv.po |  216 +-
 5 files changed, 702 insertions(+), 357 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=822b4315b7eb9d7659d7954416ffe441fd364730
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): driconf: Correct and update Spanish translations

2014-01-23 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 84529a5ddb214961d0a743c68a4b8e13fb7ab34b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=84529a5ddb214961d0a743c68a4b8e13fb7ab34b

Author: Alex Henrie alexhenri...@gmail.com
Date:   Wed Jan 15 10:42:05 2014 -0700

driconf: Correct and update Spanish translations

Reviewed-by: Eric Anholt e...@anholt.net

---

 src/mesa/drivers/dri/common/xmlpool/es.po |   64 +++--
 1 file changed, 33 insertions(+), 31 deletions(-)

diff --git a/src/mesa/drivers/dri/common/xmlpool/es.po 
b/src/mesa/drivers/dri/common/xmlpool/es.po
index e5b4d1a..4a6ab91 100644
--- a/src/mesa/drivers/dri/common/xmlpool/es.po
+++ b/src/mesa/drivers/dri/common/xmlpool/es.po
@@ -10,23 +10,23 @@ msgstr 
 Project-Id-Version: es\n
 Report-Msgid-Bugs-To: \n
 POT-Creation-Date: 2014-01-13 22:30-0700\n
-PO-Revision-Date: 2005-04-12 20:26+0200\n
-Last-Translator: David Rubio Miguélez de...@ono.com\n
+PO-Revision-Date: 2014-01-15 10:34-0700\n
+Last-Translator: Alex Henrie alexhenri...@gmail.com\n
 Language-Team: Spanish e...@li.org\n
 Language: es\n
 MIME-Version: 1.0\n
 Content-Type: text/plain; charset=UTF-8\n
 Content-Transfer-Encoding: 8bit\n
 Plural-Forms: nplurals=2; plural=(n != 1);\n
-X-Generator: KBabel 1.10\n
+X-Generator: Poedit 1.5.4\n
 
 #: t_options.h:56
 msgid Debugging
-msgstr Depurando
+msgstr Depuración
 
 #: t_options.h:60
 msgid Disable 3D acceleration
-msgstr Desactivar aceleración 3D
+msgstr Deshabilitar aceleración 3D
 
 #: t_options.h:65
 msgid Show performance boxes
@@ -34,36 +34,41 @@ msgstr Mostrar cajas de rendimiento
 
 #: t_options.h:70
 msgid Enable flushing batchbuffer after each draw call
-msgstr 
+msgstr Habilitar vaciado del batchbuffer después de cada llamada de dibujo
 
 #: t_options.h:75
 msgid Enable flushing GPU caches with each draw call
-msgstr 
+msgstr Habilitar vaciado de los cachés GPU con cada llamada de dibujo
 
 #: t_options.h:80
 msgid Disable throttling on first batch after flush
-msgstr 
+msgstr Deshabilitar regulación del primer lote después de vaciar
 
 #: t_options.h:85
 msgid Force GLSL extension default behavior to 'warn'
 msgstr 
+Forzar que el comportamiento por defecto de las extensiones GLSL sea 'warn'
 
 #: t_options.h:90
 msgid Disable dual source blending
-msgstr 
+msgstr Deshabilitar mezcla de fuente dual
 
 #: t_options.h:95
 msgid Disable backslash-based line continuations in GLSL source
 msgstr 
+Deshabilitar continuaciones de línea basadas en barra inversa en el código 
+GLSL
 
 #: t_options.h:100
 msgid Disable GL_ARB_shader_bit_encoding
-msgstr 
+msgstr Deshabilitar GL_ARB_shader_bit_encoding
 
 #: t_options.h:105
 msgid 
 Force a default GLSL version for shaders that lack an explicit #version line
 msgstr 
+Forzar una versión de GLSL por defecto en los shaders a los cuales les falta 
+una línea #version explícita
 
 #: t_options.h:115
 msgid Image Quality
@@ -75,7 +80,7 @@ msgstr Profundidad de color de textura
 
 #: t_options.h:129
 msgid Prefer frame buffer color depth
-msgstr Preferir profundidad de color del \framebuffer\
+msgstr Preferir profundidad de color del framebuffer
 
 #: t_options.h:130
 msgid Prefer 32 bits per texel
@@ -101,8 +106,8 @@ msgstr Prohibir valores negativos de Nivel De Detalle 
(LOD) de texturas
 msgid 
 Enable S3TC texture compression even if software support is not available
 msgstr 
-Activar la compresión de texturas S3TC incluso si el soporte por software no 
-está disponible
+Habilitar la compresión de texturas S3TC incluso si el soporte por software 
+no está disponible
 
 #: t_options.h:155
 msgid Initial color reduction method
@@ -150,31 +155,35 @@ msgstr Búfer de profundidad en coma flotante
 
 #: t_options.h:190
 msgid A post-processing filter to cel-shade the output
-msgstr 
+msgstr Un filtro de postprocesamiento para aplicar cel shading a la salida
 
 #: t_options.h:195
 msgid A post-processing filter to remove the red channel
-msgstr 
+msgstr Un filtro de postprocesamiento para eliminar el canal rojo
 
 #: t_options.h:200
 msgid A post-processing filter to remove the green channel
-msgstr 
+msgstr Un filtro de postprocesamiento para eliminar el canal verde
 
 #: t_options.h:205
 msgid A post-processing filter to remove the blue channel
-msgstr 
+msgstr Un filtro de postprocesamiento para eliminar el canal azul
 
 #: t_options.h:210
 msgid 
 Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for 
 default quality
 msgstr 
+Antialiasing morfológico basado en el MLAA de Jimenez. 0 para deshabilitar, 
+8 para calidad por defecto
 
 #: t_options.h:215
 msgid 
 Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for 
 default quality. Color version, usable with 2d GL apps
 msgstr 
+Antialiasing morfológico basado en el MLAA de Jimenez. 0 para deshabilitar, 
+8 para calidad por defecto. Versión en color, usable con aplicaciones GL 2D
 
 #: t_options.h:225
 msgid Performance
@@ -200,12 +209,12 @@ msgstr Pasar por alto la tubería TCL
 msgid 
 

Mesa (master): driconf: Add Catalan translations

2014-01-23 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: d5e5367e8992c2e5322d35fba8d86c33a0db6825
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d5e5367e8992c2e5322d35fba8d86c33a0db6825

Author: Alex Henrie alexhenri...@gmail.com
Date:   Wed Jan 15 10:42:23 2014 -0700

driconf: Add Catalan translations

See the instructions in Makefile.am under Adding new translations.

Reviewed-by: Eric Anholt e...@anholt.net

---

 src/mesa/drivers/dri/common/xmlpool/Makefile.am |2 +-
 src/mesa/drivers/dri/common/xmlpool/ca.po   |  321 +++
 2 files changed, 322 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile.am 
b/src/mesa/drivers/dri/common/xmlpool/Makefile.am
index ad7887d..0908c82 100644
--- a/src/mesa/drivers/dri/common/xmlpool/Makefile.am
+++ b/src/mesa/drivers/dri/common/xmlpool/Makefile.am
@@ -41,7 +41,7 @@
 # - info gettext
 
 # The set of supported languages. Add languages as needed.
-POS=de.po es.po nl.po fr.po sv.po
+POS=ca.po de.po es.po nl.po fr.po sv.po
 
 #
 # Don't change anything below, unless you know what you're doing.
diff --git a/src/mesa/drivers/dri/common/xmlpool/ca.po 
b/src/mesa/drivers/dri/common/xmlpool/ca.po
new file mode 100644
index 000..c0cf7f6
--- /dev/null
+++ b/src/mesa/drivers/dri/common/xmlpool/ca.po
@@ -0,0 +1,321 @@
+# Language  translations for Mesa package
+# Traduccions al català del paquet «Mesa».
+#
+# Copyright © 2014 Alex Henrie alexhenri...@gmail.com
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the Software),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+msgid 
+msgstr 
+Project-Id-Version: Mesa 10.1.0-devel\n
+Report-Msgid-Bugs-To: \n
+POT-Creation-Date: 2014-01-13 22:30-0700\n
+PO-Revision-Date: 2014-01-15 10:37-0700\n
+Last-Translator: Alex Henrie alexhenri...@gmail.com\n
+Language-Team: Catalan c...@li.org\n
+Language: ca\n
+MIME-Version: 1.0\n
+Content-Type: text/plain; charset=UTF-8\n
+Content-Transfer-Encoding: 8bit\n
+X-Generator: Poedit 1.5.4\n
+
+#: t_options.h:56
+msgid Debugging
+msgstr Depuració
+
+#: t_options.h:60
+msgid Disable 3D acceleration
+msgstr Deshabilita l'acceleració 3D
+
+#: t_options.h:65
+msgid Show performance boxes
+msgstr Mostra les caixes de rendiment
+
+#: t_options.h:70
+msgid Enable flushing batchbuffer after each draw call
+msgstr Habilita el buidatge del batchbuffer després de cada trucada de dibuix
+
+#: t_options.h:75
+msgid Enable flushing GPU caches with each draw call
+msgstr 
+Habilita el buidatge de les memòries cau de GPU amb cada trucada de dibuix
+
+#: t_options.h:80
+msgid Disable throttling on first batch after flush
+msgstr Deshabilita la regulació en el primer lot després de buidar
+
+#: t_options.h:85
+msgid Force GLSL extension default behavior to 'warn'
+msgstr 
+Força que el comportament per defecte de les extensions GLSL sigui 'warn'
+
+#: t_options.h:90
+msgid Disable dual source blending
+msgstr Deshabilita la barreja de font dual
+
+#: t_options.h:95
+msgid Disable backslash-based line continuations in GLSL source
+msgstr 
+Deshabilitar les continuacions de línia basades en barra invertida en la 
+font GLSL
+
+#: t_options.h:100
+msgid Disable GL_ARB_shader_bit_encoding
+msgstr Deshabilita el GL_ARB_shader_bit_encoding
+
+#: t_options.h:105
+msgid 
+Force a default GLSL version for shaders that lack an explicit #version line
+msgstr 
+Força una versió GLSL per defecte en els shaders als quals falta una línia 
+#version explícita
+
+#: t_options.h:115
+msgid Image Quality
+msgstr Qualitat d'Imatge
+
+#: t_options.h:128
+msgid Texture color depth
+msgstr Profunditat de color de textura
+
+#: t_options.h:129
+msgid Prefer frame buffer color depth
+msgstr Prefereix profunditat de color del framebuffer
+
+#: t_options.h:130
+msgid Prefer 32 bits per texel
+msgstr Prefereix 32 bits per texel
+
+#: t_options.h:131
+msgid Prefer 16 bits per texel
+msgstr Prefereix 16 bits per texel
+
+#: t_options.h:132
+msgid Force 16 bits per texel
+msgstr Força 16 bits per texel
+
+#: 

Mesa (master): glx: link loader util lib only when building with dri3

2014-01-23 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: c6b6916b9a6506e65b0cdaa6f56c27c645cc710d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6b6916b9a6506e65b0cdaa6f56c27c645cc710d

Author: Emil Velikov emil.l.veli...@gmail.com
Date:   Wed Jan 22 00:42:30 2014 +

glx: link loader util lib only when building with dri3

Otherwise we pull libudev as a dependency and crash
games/programs that ship their own version of libudev.

Either way we should link the loader lib only when needed.
This fixes a regression caused by
commit eac776cf779b705cbfb8d41812f1d171fb09c76f
Author: Emil Velikov emil.l.veli...@gmail.com
Date:   Sat Jan 11 02:24:43 2014 +

glx: use the loader util lib

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73854
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com

---

 src/glx/Makefile.am |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 54a0cc0..69a6bf9 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -100,9 +100,9 @@ libglx_la_SOURCES = \
 if HAVE_DRI3
 libglx_la_SOURCES += \
   dri3_glx.c
-endif
 
 libglx_la_LIBADD = $(top_builddir)/src/loader/libloader.la
+endif
 
 GL_LIBS = \
libglx.la \

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


Mesa (master): svga: fix PS output register setup regression

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 349efdbba141dc64a2b8f6beb481b9f3d7da6d7d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=349efdbba141dc64a2b8f6beb481b9f3d7da6d7d

Author: Brian Paul bri...@vmware.com
Date:   Thu Jan 23 09:36:57 2014 -0700

svga: fix PS output register setup regression

Fixes glean fragProg1 regression caused by commit b9f68d927ea
(implement TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS).  This bug
only appears when the fragment shader emits fragment.Z before
color outputs.  The bug was caused by confusion between register
indexes and semantic indexes.

Also added some comments to better explain register indexing.

Reviewed-by: Jose Fonseca jfons...@vmware.com

---

 src/gallium/drivers/svga/svga_tgsi_decl_sm30.c |5 +++--
 src/gallium/drivers/svga/svga_tgsi_emit.h  |3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c 
b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
index 137afd6..42d6f48 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -319,6 +319,7 @@ ps30_input(struct svga_shader_emitter *emit,
 /**
  * Process a PS output declaration.
  * Note that we don't actually emit a SVGA3DOpDcl for PS outputs.
+ * \idx  register index, such as OUT[2] (not semantic index)
  */
 static boolean
 ps30_output(struct svga_shader_emitter *emit,
@@ -344,9 +345,9 @@ ps30_output(struct svga_shader_emitter *emit,
 if (semantic.Index == 0) {
unsigned i;
for (i = 0; i  emit-key.fkey.write_color0_to_n_cbufs; i++) {
-  emit-output_map[i] = dst_register(SVGA3DREG_TEMP,
+  emit-output_map[idx+i] = dst_register(SVGA3DREG_TEMP,
  emit-nr_hw_temp++);
-  emit-temp_color_output[i] = emit-output_map[i];
+  emit-temp_color_output[i] = emit-output_map[idx+i];
   emit-true_color_output[i] = dst_register(SVGA3DREG_COLOROUT,
 i);
}
diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h 
b/src/gallium/drivers/svga/svga_tgsi_emit.h
index d31b866..53f93de 100644
--- a/src/gallium/drivers/svga/svga_tgsi_emit.h
+++ b/src/gallium/drivers/svga/svga_tgsi_emit.h
@@ -99,6 +99,7 @@ struct svga_shader_emitter
unsigned label[32];
unsigned nr_labels;
 
+   /** input/output register mappings, indexed by register number */
struct src_register input_map[PIPE_MAX_ATTRIBS];
SVGA3dShaderDestToken output_map[PIPE_MAX_ATTRIBS];
 
@@ -119,7 +120,7 @@ struct svga_shader_emitter
/* shared output for depth and fog */
SVGA3dShaderDestToken vs_depth_fog;
 
-   /* PS output colors */
+   /* PS output colors (indexed by color semantic index) */
SVGA3dShaderDestToken temp_color_output[PIPE_MAX_COLOR_BUFS];
SVGA3dShaderDestToken true_color_output[PIPE_MAX_COLOR_BUFS];
 

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


Mesa (master): st/mesa: fix glReadBuffer(GL_NONE) segfault

2014-01-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: f7c118ffbfdafaccd4ec05d4a040d07e120c5090
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f7c118ffbfdafaccd4ec05d4a040d07e120c5090

Author: Brian Paul bri...@vmware.com
Date:   Thu Jan 23 09:47:34 2014 -0700

st/mesa: fix glReadBuffer(GL_NONE) segfault

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73956
Cc: 10.0 mesa-sta...@lists.freedesktop.org
Tested-by: Ahmed Allam ahmabd...@hotmail.com
Reviewed-by: Marek Olšák marek.ol...@amd.com

---

 src/mesa/state_tracker/st_cb_fbo.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index 637f7ee..eca04b8 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -700,7 +700,8 @@ st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
(void) buffer;
 
/* add the renderbuffer on demand */
-   st_manager_add_color_renderbuffer(st, fb, fb-_ColorReadBufferIndex);
+   if (fb-_ColorReadBufferIndex = 0)
+  st_manager_add_color_renderbuffer(st, fb, fb-_ColorReadBufferIndex);
 }
 
 

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


Mesa (master): gles2: Update gl2ext.h to revision 24614.

2014-01-23 Thread Matt Turner
Module: Mesa
Branch: master
Commit: d519ebb34cd21cfc13987f2038d7a2ec353a5cfd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d519ebb34cd21cfc13987f2038d7a2ec353a5cfd

Author: Matt Turner matts...@gmail.com
Date:   Wed Jan 22 14:12:14 2014 -0800

gles2: Update gl2ext.h to revision 24614.

Reviewed-by: Anuj Phogat anuj.pho...@gmail.com

---

 include/GLES2/gl2ext.h | 2617 
 1 file changed, 1096 insertions(+), 1521 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=d519ebb34cd21cfc13987f2038d7a2ec353a5cfd
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glcpp: Define GL_EXT_shader_integer_mix in both GL and ES.

2014-01-23 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 66ef8feb4df2780e06c92c43b6523623aaa1b2eb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=66ef8feb4df2780e06c92c43b6523623aaa1b2eb

Author: Matt Turner matts...@gmail.com
Date:   Fri Jan 17 14:32:19 2014 -0800

glcpp: Define GL_EXT_shader_integer_mix in both GL and ES.

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/glsl/glcpp/glcpp-parse.y |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 89436d1..184e5c2 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -2102,9 +2102,6 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t 
*parser, intmax_t versio
  if (extensions-ARB_sample_shading)
 add_builtin_define(parser, GL_ARB_sample_shading, 1);
 
- if (extensions-EXT_shader_integer_mix)
-add_builtin_define(parser, GL_EXT_shader_integer_mix, 1);
-
  if (extensions-ARB_texture_gather)
 add_builtin_define(parser, GL_ARB_texture_gather, 1);
 
@@ -2119,6 +2116,11 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t 
*parser, intmax_t versio
   }
}
 
+   if (extensions != NULL) {
+  if (extensions-EXT_shader_integer_mix)
+ add_builtin_define(parser, GL_EXT_shader_integer_mix, 1);
+   }
+
if (version = 150)
add_builtin_define(parser, GL_core_profile, 1);
 

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


Mesa (master): glsl: Disable ARB_texture_rectangle in shader version 100.

2014-01-23 Thread Matt Turner
Module: Mesa
Branch: master
Commit: c907595ba77a0c74b18b6908f71fafc3c08e2886
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c907595ba77a0c74b18b6908f71fafc3c08e2886

Author: Anuj Phogat anuj.pho...@gmail.com
Date:   Fri Jan 17 12:23:05 2014 -0800

glsl: Disable ARB_texture_rectangle in shader version 100.

OpenGL with ARB_ES2_compatibility allows shaders that specify #version
100.

This fixes the Khronos OpenGL test(Texture_Rectangle_Samplers_frag.test)
failure.

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Matt Turner matts...@gmail.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Signed-off-by: Anuj Phogat anuj.pho...@gmail.com

---

 src/glsl/glsl_parser_extras.cpp |4 
 1 file changed, 4 insertions(+)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index e550187..87784ed 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -291,6 +291,10 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE 
*locp, int version,
   }
}
 
+   if (this-es_shader) {
+  this-ARB_texture_rectangle_enable = false;
+   }
+
this-language_version = version;
 
bool supported = false;

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


Mesa (master): gles2: Update gl2.h to revision 24614.

2014-01-23 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 117d8ce27b7929c42f46f818ac038580877b3086
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=117d8ce27b7929c42f46f818ac038580877b3086

Author: Matt Turner matts...@gmail.com
Date:   Wed Jan 22 14:12:13 2014 -0800

gles2: Update gl2.h to revision 24614.

Reviewed-by: Anuj Phogat anuj.pho...@gmail.com

---

 include/GLES2/gl2.h |  581 +--
 1 file changed, 243 insertions(+), 338 deletions(-)

diff --git a/include/GLES2/gl2.h b/include/GLES2/gl2.h
index c2d8357..665f6c3 100644
--- a/include/GLES2/gl2.h
+++ b/include/GLES2/gl2.h
@@ -1,56 +1,83 @@
 #ifndef __gl2_h_
-#define __gl2_h_
-
-/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */
-
-#include GLES2/gl2platform.h
+#define __gl2_h_ 1
 
 #ifdef __cplusplus
 extern C {
 #endif
 
 /*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-/*-
- * Data type definitions
- *---*/
+** Copyright (c) 2013 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** Materials), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision: 24614 $ on $Date: 2013-12-30 04:44:46 -0800 (Mon, 30 Dec 
2013) $
+*/
 
-typedef void GLvoid;
-typedef char GLchar;
-typedef unsigned int GLenum;
-typedef unsigned charGLboolean;
-typedef unsigned int GLbitfield;
-typedef khronos_int8_t   GLbyte;
-typedef shortGLshort;
-typedef int  GLint;
-typedef int  GLsizei;
-typedef khronos_uint8_t  GLubyte;
-typedef unsigned short   GLushort;
-typedef unsigned int GLuint;
-typedef khronos_float_t  GLfloat;
-typedef khronos_float_t  GLclampf;
-typedef khronos_int32_t  GLfixed;
+#include GLES2/gl2platform.h
 
-/* GL types for handling large vertex buffer objects */
-typedef khronos_intptr_t GLintptr;
-typedef khronos_ssize_t  GLsizeiptr;
+/* Generated on date 20131230 */
 
-/* OpenGL ES core versions */
-#define GL_ES_VERSION_2_0 1
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
 
-/* ClearBufferMask */
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include KHR/khrplatform.h
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef short GLshort;
+typedef unsigned short GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
 #define GL_DEPTH_BUFFER_BIT   0x0100
 #define GL_STENCIL_BUFFER_BIT 0x0400
 #define GL_COLOR_BUFFER_BIT   0x4000
-
-/* Boolean */
 #define GL_FALSE  0
 #define GL_TRUE   1
-
-/* BeginMode */
 #define GL_POINTS 0x
 #define GL_LINES  0x0001
 #define GL_LINE_LOOP  0x0002
@@ -58,18 +85,6 @@ typedef khronos_ssize_t  GLsizeiptr;
 #define GL_TRIANGLES  0x0004
 #define 

Mesa (master): glsl: Mark GLSL 4.40 as a known version.

2014-01-23 Thread Matt Turner
Module: Mesa
Branch: master
Commit: e0648015e96e6b484aa75cd6da1f0a506afb1636
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0648015e96e6b484aa75cd6da1f0a506afb1636

Author: Matt Turner matts...@gmail.com
Date:   Fri Jan 17 12:20:08 2014 -0800

glsl: Mark GLSL 4.40 as a known version.

Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/glsl/glsl_parser_extras.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index ba1c969..e550187 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -50,7 +50,7 @@ glsl_compute_version_string(void *mem_ctx, bool is_es, 
unsigned version)
 
 
 static unsigned known_desktop_glsl_versions[] =
-   { 110, 120, 130, 140, 150, 330, 400, 410, 420, 430 };
+   { 110, 120, 130, 140, 150, 330, 400, 410, 420, 430, 440 };
 
 
 _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,

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


Mesa (master): glcpp: Set extension defines after resolving the GLSL version.

2014-01-23 Thread Matt Turner
Module: Mesa
Branch: master
Commit: b2d1c579bb84a88179072a6a783f8827e218db55
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b2d1c579bb84a88179072a6a783f8827e218db55

Author: Matt Turner matts...@gmail.com
Date:   Fri Jan 17 14:22:49 2014 -0800

glcpp: Set extension defines after resolving the GLSL version.

Instead of defining preprocessor macros in glcpp_parser_create based on
the GL API, wait until the shader version has been resolved. Doing this
allows us to correctly set (and not set) preprocessor macros for
extensions allowed by the API but not the shader, as in the case of
ARB_ES3_compatibility.

The shader version has been resolved when the preprocessor encounters
the first preprocessor token, since the GLSL spec says

   The #version directive must occur in a shader before anything else,
except for comments and white space.

Specifically, if a #version token is found the version is known
explicitly, and if any other preprocessor token is found then the GLSL
version is implicitly 1.10.

Cc: mesa-sta...@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71630
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/glsl/glcpp/glcpp-parse.y |  304 ++
 src/glsl/glcpp/glcpp.h   |7 +-
 src/glsl/glcpp/pp.c  |4 +-
 3 files changed, 172 insertions(+), 143 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index e241521..e6b1c22 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -135,7 +135,7 @@ _glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, 
YYLTYPE *loc);
 
 static void
 _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t 
version,
- const char *ident);
+ const char *ident, bool 
explicitly_set);
 
 static int
 glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser);
@@ -194,12 +194,15 @@ line:
control_line {
ralloc_asprintf_rewrite_tail (parser-output, 
parser-output_length, \n);
}
-|  HASH_LINE pp_tokens NEWLINE {
+|  HASH_LINE {
+   glcpp_parser_resolve_version(parser);
+   } pp_tokens NEWLINE {
+
if (parser-skip_stack == NULL ||
parser-skip_stack-type == SKIP_NO_SKIP)
{
_glcpp_parser_expand_and_lex_from (parser,
-  LINE_EXPANDED, $2);
+  LINE_EXPANDED, $3);
}
}
 |  text_line {
@@ -238,25 +241,35 @@ expanded_line:
}
 ;
 
-control_line:
-   HASH_DEFINE OBJ_IDENTIFIER replacement_list NEWLINE {
-   _define_object_macro (parser,  @2, $2, $3);
+define:
+   OBJ_IDENTIFIER replacement_list NEWLINE {
+   _define_object_macro (parser,  @1, $1, $2);
}
-|  HASH_DEFINE FUNC_IDENTIFIER '(' ')' replacement_list NEWLINE {
-   _define_function_macro (parser,  @2, $2, NULL, $5);
+|  FUNC_IDENTIFIER '(' ')' replacement_list NEWLINE {
+   _define_function_macro (parser,  @1, $1, NULL, $4);
}
-|  HASH_DEFINE FUNC_IDENTIFIER '(' identifier_list ')' replacement_list 
NEWLINE {
-   _define_function_macro (parser,  @2, $2, $4, $6);
+|  FUNC_IDENTIFIER '(' identifier_list ')' replacement_list NEWLINE {
+   _define_function_macro (parser,  @1, $1, $3, $5);
}
-|  HASH_UNDEF IDENTIFIER NEWLINE {
-   macro_t *macro = hash_table_find (parser-defines, $2);
+;
+
+control_line:
+   HASH_DEFINE {
+   glcpp_parser_resolve_version(parser);
+   } define
+|  HASH_UNDEF {
+   glcpp_parser_resolve_version(parser);
+   } IDENTIFIER NEWLINE {
+   macro_t *macro = hash_table_find (parser-defines, $3);
if (macro) {
-   hash_table_remove (parser-defines, $2);
+   hash_table_remove (parser-defines, $3);
ralloc_free (macro);
}
-   ralloc_free ($2);
+   ralloc_free ($3);
}
-|  HASH_IF conditional_tokens NEWLINE {
+|  HASH_IF {
+   glcpp_parser_resolve_version(parser);
+   } conditional_tokens NEWLINE {
/* Be careful to only evaluate the 'if' expression if
 * we are not skipping. When we are skipping, we
 * simply push a new 0-valued 'if' onto the skip
@@ -268,7 +281,7 @@ control_line:
parser-skip_stack-type == SKIP_NO_SKIP)
{
_glcpp_parser_expand_and_lex_from (parser,
-  IF_EXPANDED, $2);
+  IF_EXPANDED, $3);
} 

Mesa (master): gles3: Update gl3.h to revision 24614.

2014-01-23 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 00c672086c31f94dd96609fa976300781f53792e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=00c672086c31f94dd96609fa976300781f53792e

Author: Matt Turner matts...@gmail.com
Date:   Wed Jan 22 14:12:15 2014 -0800

gles3: Update gl3.h to revision 24614.

Reviewed-by: Anuj Phogat anuj.pho...@gmail.com

---

 include/GLES3/gl3.h | 1922 ---
 1 file changed, 900 insertions(+), 1022 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=00c672086c31f94dd96609fa976300781f53792e
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glcpp: Remove unused gl_api bits.

2014-01-23 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 73c3c7e37d973cac8a2da7f9c5bf97c25e24e88c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=73c3c7e37d973cac8a2da7f9c5bf97c25e24e88c

Author: Matt Turner matts...@gmail.com
Date:   Fri Jan 17 14:24:01 2014 -0800

glcpp: Remove unused gl_api bits.

Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/glsl/glcpp/glcpp-parse.y |1 -
 src/glsl/glcpp/glcpp.c   |1 -
 2 files changed, 2 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index e6b1c22..89436d1 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -30,7 +30,6 @@
 
 #include glcpp.h
 #include main/core.h /* for struct gl_extensions */
-#include main/mtypes.h /* for gl_api enum */
 
 static void
 yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error);
diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c
index 6994d7b..c9c2ff2 100644
--- a/src/glsl/glcpp/glcpp.c
+++ b/src/glsl/glcpp/glcpp.c
@@ -101,7 +101,6 @@ load_text_file(void *ctx, const char *filename)
 static void
 init_fake_gl_context (struct gl_context *gl_ctx)
 {
-   gl_ctx-API = API_OPENGL_COMPAT;
gl_ctx-Const.DisableGLSLLineContinuations = false;
 }
 

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