[Mesa-dev] [PATCH] mesa: Silence GCC unused variable warnings.

2012-01-03 Thread Vinson Lee
Silences these GCC warnings.
warning: unused variable 'texelBytes'

Signed-off-by: Vinson Lee 
---
 src/mesa/main/texstore.c |   34 ++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index bb2fe25..90aa97d 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -981,6 +981,7 @@ _mesa_texstore_z32(TEXSTORE_PARAMS)
ASSERT(dstFormat == MESA_FORMAT_Z32 ||
   dstFormat == MESA_FORMAT_Z32_FLOAT);
ASSERT(texelBytes == sizeof(GLuint));
+   (void) texelBytes;
 
if (dstFormat == MESA_FORMAT_Z32)
   dstType = GL_UNSIGNED_INT;
@@ -1094,6 +1095,7 @@ _mesa_texstore_z16(TEXSTORE_PARAMS)
(void) dims;
ASSERT(dstFormat == MESA_FORMAT_Z16);
ASSERT(texelBytes == sizeof(GLushort));
+   (void) texelBytes;
 
if (ctx->Pixel.DepthScale == 1.0f &&
ctx->Pixel.DepthBias == 0.0f &&
@@ -1140,6 +1142,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS)
ASSERT(dstFormat == MESA_FORMAT_RGB565 ||
   dstFormat == MESA_FORMAT_RGB565_REV);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1245,6 +1248,7 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS)
   dstFormat == MESA_FORMAT_RGBX ||
   dstFormat == MESA_FORMAT_RGBX_REV);
ASSERT(texelBytes == 4);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1370,6 +1374,7 @@ _mesa_texstore_argb(TEXSTORE_PARAMS)
   dstFormat == MESA_FORMAT_XRGB ||
   dstFormat == MESA_FORMAT_XRGB_REV );
ASSERT(texelBytes == 4);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1564,6 +1569,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_RGB888);
ASSERT(texelBytes == 3);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1682,6 +1688,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_BGR888);
ASSERT(texelBytes == 3);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1781,6 +1788,7 @@ _mesa_texstore_argb(TEXSTORE_PARAMS)
ASSERT(dstFormat == MESA_FORMAT_ARGB ||
   dstFormat == MESA_FORMAT_ARGB_REV);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1845,6 +1853,7 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_RGBA5551);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1899,6 +1908,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS)
ASSERT(dstFormat == MESA_FORMAT_ARGB1555 ||
   dstFormat == MESA_FORMAT_ARGB1555_REV);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1964,6 +1974,7 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_ARGB2101010);
ASSERT(texelBytes == 4);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2043,6 +2054,7 @@ _mesa_texstore_unorm44(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_AL44);
ASSERT(texelBytes == 1);
+   (void) texelBytes;
 
{
   /* general path */
@@ -2090,6 +2102,7 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS)
   dstFormat == MESA_FORMAT_GR88 ||
   dstFormat == MESA_FORMAT_RG88);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2207,6 +2220,7 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS)
  dstFormat == MESA_FORMAT_RG1616 ||
   dstFormat == MESA_FORMAT_RG1616_REV);
ASSERT(texelBytes == 4);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2284,6 +2298,7 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS)
   dstFormat == MESA_FORMAT_L16 ||
   dstFormat == MESA_FORMAT_I16);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2338,6 +2353,7 @@ _mesa_texstore_rgba_16(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_RGBA_16);
ASSERT(texelBytes == 8);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2473,6 +2489,7 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_RGB332);
ASSERT(texelBytes == 1);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2529,6 +2546,7 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS)
   dstFormat == MESA_FORMAT_I8 ||
   dstFormat == MESA_FORMAT_R8);
ASSERT(texelBytes == 1);
+   (void) texelBytes;
 
if

[Mesa-dev] [PATCH] mesa: Silence GCC unused variable warnings.

2012-01-03 Thread Vinson Lee
Silences these GCC warnings.
warning: unused variable 'texelBytes'

Signed-off-by: Vinson Lee 
---
 src/mesa/main/texstore.c |   34 ++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index bb2fe25..90aa97d 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -981,6 +981,7 @@ _mesa_texstore_z32(TEXSTORE_PARAMS)
ASSERT(dstFormat == MESA_FORMAT_Z32 ||
   dstFormat == MESA_FORMAT_Z32_FLOAT);
ASSERT(texelBytes == sizeof(GLuint));
+   (void) texelBytes;
 
if (dstFormat == MESA_FORMAT_Z32)
   dstType = GL_UNSIGNED_INT;
@@ -1094,6 +1095,7 @@ _mesa_texstore_z16(TEXSTORE_PARAMS)
(void) dims;
ASSERT(dstFormat == MESA_FORMAT_Z16);
ASSERT(texelBytes == sizeof(GLushort));
+   (void) texelBytes;
 
if (ctx->Pixel.DepthScale == 1.0f &&
ctx->Pixel.DepthBias == 0.0f &&
@@ -1140,6 +1142,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS)
ASSERT(dstFormat == MESA_FORMAT_RGB565 ||
   dstFormat == MESA_FORMAT_RGB565_REV);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1245,6 +1248,7 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS)
   dstFormat == MESA_FORMAT_RGBX ||
   dstFormat == MESA_FORMAT_RGBX_REV);
ASSERT(texelBytes == 4);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1370,6 +1374,7 @@ _mesa_texstore_argb(TEXSTORE_PARAMS)
   dstFormat == MESA_FORMAT_XRGB ||
   dstFormat == MESA_FORMAT_XRGB_REV );
ASSERT(texelBytes == 4);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1564,6 +1569,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_RGB888);
ASSERT(texelBytes == 3);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1682,6 +1688,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_BGR888);
ASSERT(texelBytes == 3);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1781,6 +1788,7 @@ _mesa_texstore_argb(TEXSTORE_PARAMS)
ASSERT(dstFormat == MESA_FORMAT_ARGB ||
   dstFormat == MESA_FORMAT_ARGB_REV);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1845,6 +1853,7 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_RGBA5551);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1899,6 +1908,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS)
ASSERT(dstFormat == MESA_FORMAT_ARGB1555 ||
   dstFormat == MESA_FORMAT_ARGB1555_REV);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1964,6 +1974,7 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_ARGB2101010);
ASSERT(texelBytes == 4);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2043,6 +2054,7 @@ _mesa_texstore_unorm44(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_AL44);
ASSERT(texelBytes == 1);
+   (void) texelBytes;
 
{
   /* general path */
@@ -2090,6 +2102,7 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS)
   dstFormat == MESA_FORMAT_GR88 ||
   dstFormat == MESA_FORMAT_RG88);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2207,6 +2220,7 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS)
  dstFormat == MESA_FORMAT_RG1616 ||
   dstFormat == MESA_FORMAT_RG1616_REV);
ASSERT(texelBytes == 4);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2284,6 +2298,7 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS)
   dstFormat == MESA_FORMAT_L16 ||
   dstFormat == MESA_FORMAT_I16);
ASSERT(texelBytes == 2);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2338,6 +2353,7 @@ _mesa_texstore_rgba_16(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_RGBA_16);
ASSERT(texelBytes == 8);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2473,6 +2489,7 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS)
 
ASSERT(dstFormat == MESA_FORMAT_RGB332);
ASSERT(texelBytes == 1);
+   (void) texelBytes;
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -2529,6 +2546,7 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS)
   dstFormat == MESA_FORMAT_I8 ||
   dstFormat == MESA_FORMAT_R8);
ASSERT(texelBytes == 1);
+   (void) texelBytes;
 
if

[Mesa-dev] [PATCH] glsl: Add a lowering pass to remove reads of shader output variables.

2012-01-03 Thread Kenneth Graunke
From: Vincent Lejeune 

This is similar to Gallium's existing glsl_to_tgsi::remove_output_read
lowering pass, but done entirely inside the GLSL compiler.

Signed-off-by: Vincent Lejeune 
Signed-off-by: Kenneth Graunke 
---
 src/glsl/Makefile.sources   |1 +
 src/glsl/ir_optimization.h  |1 +
 src/glsl/lower_output_reads.cpp |  141 +++
 3 files changed, 143 insertions(+), 0 deletions(-)
 create mode 100644 src/glsl/lower_output_reads.cpp

v4 [Kayden]:
 - Use hash_table_call_foreach, as suggested by Ian, removing the need for
   an array and the replacement_pair struct.  (Thanks Ian!  I knew such a
   function had to exist, but somehow missed it the other day...)

diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index c65bfe4..5e80af2 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -60,6 +60,7 @@ LIBGLSL_CXX_SOURCES := \
lower_vec_index_to_cond_assign.cpp \
lower_vec_index_to_swizzle.cpp \
lower_vector.cpp \
+   lower_output_reads.cpp \
opt_algebraic.cpp \
opt_constant_folding.cpp \
opt_constant_propagation.cpp \
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 7b32e84..085b969 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -72,6 +72,7 @@ bool lower_variable_index_to_cond_assign(exec_list 
*instructions,
 bool lower_input, bool lower_output, bool lower_temp, bool lower_uniform);
 bool lower_quadop_vector(exec_list *instructions, bool dont_lower_swz);
 bool lower_clip_distance(exec_list *instructions);
+void lower_output_reads(exec_list *instructions);
 bool optimize_redundant_jumps(exec_list *instructions);
 
 ir_rvalue *
diff --git a/src/glsl/lower_output_reads.cpp b/src/glsl/lower_output_reads.cpp
new file mode 100644
index 000..415b541
--- /dev/null
+++ b/src/glsl/lower_output_reads.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright © 2012 Vincent Lejeune
+ * Copyright © 2012 Intel Corporation
+ *
+ * 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.
+ */
+
+#include "ir.h"
+#include "program/hash_table.h"
+
+/**
+ * \file lower_output_reads.cpp
+ *
+ * In GLSL, shader output variables (such as varyings) can be both read and
+ * written.  However, on some hardware, reading an output register causes
+ * trouble.
+ *
+ * This pass creates temporary shadow copies of every (used) shader output,
+ * and replaces all accesses to use those instead.  It also adds code to the
+ * main() function to copy the final values to the actual shader outputs.
+ */
+
+class output_read_remover : public ir_hierarchical_visitor {
+protected:
+   /**
+* A hash table mapping from the original ir_variable shader outputs
+* (ir_var_out mode) to the new temporaries to be used instead.
+*/
+   hash_table *replacements;
+
+   void *mem_ctx;
+public:
+   output_read_remover();
+   ~output_read_remover();
+   virtual ir_visitor_status visit(class ir_dereference_variable *);
+   virtual ir_visitor_status visit_leave(class ir_return *);
+   virtual ir_visitor_status visit_leave(class ir_function_signature *);
+};
+
+output_read_remover::output_read_remover()
+{
+   mem_ctx = ralloc_context(NULL);
+   replacements =
+  hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
+}
+
+output_read_remover::~output_read_remover()
+{
+   hash_table_dtor(replacements);
+   ralloc_free(mem_ctx);
+}
+
+ir_visitor_status
+output_read_remover::visit(ir_dereference_variable *ir)
+{
+   if (ir->var->mode != ir_var_out)
+  return visit_continue;
+
+   ir_variable *temp = (ir_variable *) hash_table_find(replacements, ir->var);
+
+   /* If we don't have an existing temporary, create one. */
+   if (temp == NULL) {
+  void *var_ctx = ralloc_parent(ir->var);
+  temp = new(var_ctx) ir_variable(ir->var->type, ir->var->name,
+  ir_var_te

Re: [Mesa-dev] [PATCH 1/2] mesa: XCB is no longer optional for GLX or DRI

2012-01-03 Thread Kenneth Graunke
On 01/02/2012 05:44 PM, Ian Romanick wrote:
> From: Ian Romanick 
> 
> Signed-off-by: Ian Romanick 
> ---
>  configure.ac |   28 ++--
>  1 files changed, 6 insertions(+), 22 deletions(-)

At some point, you'll want to check for libxcb >= 1.8, i.e. a version
that has the new support that you need.  Of course, until there is such
a release...not really sure what to do.

This is at least a good start, so you get a
Reviewed-by: Kenneth Graunke 

> diff --git a/configure.ac b/configure.ac
> index c29b0bb..e526d17 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -940,16 +940,8 @@ if test "x$enable_glx" = xyes -a "x$no_x" = xyes; then
>  AC_MSG_ERROR([X11 development libraries needed for GLX])
>  fi
>  
> -dnl XCB - this is only used for GLX right now
> -AC_ARG_ENABLE([xcb],
> -[AS_HELP_STRING([--enable-xcb],
> -[use XCB for GLX @<:@default=disabled@:>@])],
> -[enable_xcb="$enableval"],
> -[enable_xcb=no])
> -if test "x$enable_xcb" = xyes; then
> +if test "x$enable_glx" = xyes; then
>  DEFINES="$DEFINES -DUSE_XCB"
> -else
> -enable_xcb=no
>  fi
>  
>  dnl Direct rendering or just indirect rendering
> @@ -1008,7 +1000,7 @@ xyesno)
>  
>  # find the DRI deps for libGL
>  if test "$x11_pkgconfig" = yes; then
> -dri_modules="x11 xext xdamage xfixes"
> +dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx"
>  
>  # add xf86vidmode if available
>  PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, 
> HAVE_XF86VIDMODE=no)
> @@ -1016,11 +1008,6 @@ xyesno)
>  dri_modules="$dri_modules xxf86vm"
>  fi
>  
> -# add xcb modules if necessary
> -if test "$enable_xcb" = yes; then
> -dri_modules="$dri_modules x11-xcb xcb-glx"
> -fi
> -
>  PKG_CHECK_MODULES([DRIGL], [$dri_modules])
>  GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
>  X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
> @@ -1037,12 +1024,10 @@ xyesno)
>  GL_PC_CFLAGS="$X11_INCLUDES"
>  
>  # XCB can only be used from pkg-config
> -if test "$enable_xcb" = yes; then
> -PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
> -GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
> -X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
> -GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
> -fi
> +PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
> +GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
> +X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
> +GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
>  fi
>  
>  # need DRM libs, -lpthread, etc.
> @@ -1981,7 +1966,6 @@ xyesyes)
>  ;;
>  xyesno)
>  echo "GLX: DRI-based"
> -echo "Use XCB: $enable_xcb"
>  ;;
>  *)
>  echo "GLX: $enable_glx"

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


Re: [Mesa-dev] [PATCH 1/2] mesa: XCB is no longer optional for GLX or DRI

2012-01-03 Thread Dave Airlie
On Tue, Jan 3, 2012 at 10:25 AM, Kenneth Graunke  wrote:
> On 01/02/2012 05:44 PM, Ian Romanick wrote:
>> From: Ian Romanick 
>>
>> Signed-off-by: Ian Romanick 
>> ---
>>  configure.ac |   28 ++--
>>  1 files changed, 6 insertions(+), 22 deletions(-)
>
> At some point, you'll want to check for libxcb >= 1.8, i.e. a version
> that has the new support that you need.  Of course, until there is such
> a release...not really sure what to do.

His second patch means he doesn't need that,

I've pushed both of these just so I can get some work done today.

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


[Mesa-dev] [Bug 44407] git mesa/src/glx fails to compile

2012-01-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44407

Kenneth Graunke  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||NOTABUG

--- Comment #3 from Kenneth Graunke  2012-01-03 03:06:14 
PST ---
You need a git snapshot of both xcb-proto and libxcb itself.  I had the same
problem, and after upgrading both of those, it compiled without trouble.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: Add a lowering pass to remove reads of shader output variables.

2012-01-03 Thread Dave Airlie
On Tue, Jan 3, 2012 at 10:08 AM, Kenneth Graunke  wrote:
> From: Vincent Lejeune 
>
> This is similar to Gallium's existing glsl_to_tgsi::remove_output_read
> lowering pass, but done entirely inside the GLSL compiler.
>
> Signed-off-by: Vincent Lejeune 
> Signed-off-by: Kenneth Graunke 

All 3 work for me in testing here with softpipe.

so at least have a

Tested-by: Dave Airlie 

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


[Mesa-dev] [Bug 35945] GLX contexts are not resized properly when using XCBOwnsEventQueue

2012-01-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=35945

Uli Schlachter  changed:

   What|Removed |Added

 CC||psyc...@znc.in

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 35945] GLX contexts are not resized properly when using XCBOwnsEventQueue

2012-01-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=35945

Uli Schlachter  changed:

   What|Removed |Added

  Attachment #45213|0   |1
is obsolete||

--- Comment #1 from Uli Schlachter  2012-01-03 04:09:53 PST ---
Created attachment 55077
  --> https://bugs.freedesktop.org/attachment.cgi?id=55077
Samuel Rødal's code extended so that it prints events that are received
(compile with -lX11 -lX11-xcb -lGL -lxcb)

I added a little printf to see what events are received (and piped the output
through sort -u to make it less annoying).

The USE_XCB-version sees an event with type 75 which the Xlib version doesn't
see. Event 75 is DRI2's event base +1 here:

$ xdpyinfo -queryExtensions | grep DRI2
DRI2  (opcode: 137, base event: 74)

According to xcb's dri2.h, this is a DRI2_InvalidateBuffers event:

$ grep ' 1' projects/libxcb/src/dri2.h | tail -n1
#define XCB_DRI2_INVALIDATE_BUFFERS 1

So the question is: What happens to that event when using Xlib?
Mesa's src/glx/dri2.c, function DRI2WireToEvent() knows the answer. Mesa does
some internal processing for the event (function dri2InvalidateBuffers()) and
then returns "False" which means Xlib can't process the event and thus doesn't
return it to the application.

So the problem is that in the USE_XCB version dri2InvalidateBuffers() isn't
called.
To fix this, a new function has to be added to mesa which the application has
to call for DRI2_InvalidateBuffers events (with XCB there is no way for mesa to
hook into the event processing and get a callback from xcb). Or does anyone see
an alternative solution?

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: XCB is no longer optional for GLX or DRI

2012-01-03 Thread Laurent Carlier
> On Tue, Jan 3, 2012 at 10:25 AM, Kenneth Graunke  
> wrote:
> > On 01/02/2012 05:44 PM, Ian Romanick wrote:
> >> From: Ian Romanick 
> >>
> >> Signed-off-by: Ian Romanick 
> >> ---
> >>  configure.ac |   28 ++--
> >>  1 files changed, 6 insertions(+), 22 deletions(-)
> >
> > At some point, you'll want to check for libxcb >= 1.8, i.e. a version
> > that has the new support that you need.  Of course, until there is such
> > a release...not really sure what to do.
> 
> His second patch means he doesn't need that,
> 
> I've pushed both of these just so I can get some work done today.
> 
> Dave.
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Still fail here, it succeed to built but not to run :-)

Yes, mesa is built with --enable-xcb, here it's libxcb v1.7.

Here is the output of wine and ldd:
[lordh@archMain FurMark_1.9.2]$ wine FurMark.exe 
err:module:load_builtin_dll failed to load .so lib for builtin L"GLU32.dll": 
/usr/lib32/libGL.so.1: undefined symbol: xcb_glx_set_client_info_2arb
err:module:import_dll Loading library GLU32.dll (which is needed by 
L"C:\\Program Files\\Geeks3D\\Benchmarks\\FurMark_1.9.2\\core3d.dll") failed 
(error c07a).
err:module:load_builtin_dll failed to load .so lib for builtin L"OPENGL32.dll": 
/usr/lib32/libGL.so.1: undefined symbol: xcb_glx_set_client_info_2arb
err:module:import_dll Loading library OPENGL32.dll (which is needed by 
L"C:\\Program Files\\Geeks3D\\Benchmarks\\FurMark_1.9.2\\core3d.dll") failed 
(error c07a).
err:module:import_dll Library core3d.dll (which is needed by L"C:\\Program 
Files\\Geeks3D\\Benchmarks\\FurMark_1.9.2\\FurMark.exe") not found
err:module:load_builtin_dll failed to load .so lib for builtin L"OPENGL32.dll": 
/usr/lib32/libGL.so.1: undefined symbol: xcb_glx_set_client_info_2arb
err:module:import_dll Loading library OPENGL32.dll (which is needed by 
L"C:\\Program Files\\Geeks3D\\Benchmarks\\FurMark_1.9.2\\FurMark.exe") failed 
(error c07a).
err:module:LdrInitializeThunk Main exe initialization for L"C:\\Program 
Files\\Geeks3D\\Benchmarks\\FurMark_1.9.2\\FurMark.exe" failed, status c135
[lordh@archMain FurMark_1.9.2]$ ldd /usr/lib32/libGL.so.1
linux-gate.so.1 =>  (0xf77a6000)
libglapi.so.0 => /usr/lib32/libglapi.so.0 (0xf76e6000)
libXext.so.6 => /usr/lib32/libXext.so.6 (0xf76d3000)
libXdamage.so.1 => /usr/lib32/libXdamage.so.1 (0xf76d)
libXfixes.so.3 => /usr/lib32/libXfixes.so.3 (0xf76ca000)
libX11-xcb.so.1 => /usr/lib32/libX11-xcb.so.1 (0xf76c6000)
libX11.so.6 => /usr/lib32/libX11.so.6 (0xf758e000)
libxcb-glx.so.0 => /usr/lib32/libxcb-glx.so.0 (0xf757d000)
libxcb.so.1 => /usr/lib32/libxcb.so.1 (0xf7565000)
libXxf86vm.so.1 => /usr/lib32/libXxf86vm.so.1 (0xf756)
libdrm.so.2 => /usr/lib32/libdrm.so.2 (0xf7553000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf7537000)
libdl.so.2 => /lib32/libdl.so.2 (0xf7532000)
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf7449000)
libm.so.6 => /lib32/libm.so.6 (0xf741b000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf740)
libc.so.6 => /lib32/libc.so.6 (0xf725c000)
libXau.so.6 => /usr/lib32/libXau.so.6 (0xf7259000)
libXdmcp.so.6 => /usr/lib32/libXdmcp.so.6 (0xf7254000)
librt.so.1 => /lib32/librt.so.1 (0xf724b000)
/lib/ld-linux.so.2 (0xf77a7000)

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


[Mesa-dev] [Bug 43125] [bisected] Start screen in Amnesia too dark after "Rewrite the way uniforms are tracked and handled" commit

2012-01-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=43125

Alex Deucher  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #10 from Alex Deucher  2012-01-03 06:32:15 PST ---
pushed:
d4bf5cefb0943a196c603360187493e270a66442

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Silence GCC unused variable warnings.

2012-01-03 Thread Brian Paul

On 01/03/2012 01:03 AM, Vinson Lee wrote:

Silences these GCC warnings.
warning: unused variable 'texelBytes'

Signed-off-by: Vinson Lee
---
  src/mesa/main/texstore.c |   34 ++
  1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index bb2fe25..90aa97d 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -981,6 +981,7 @@ _mesa_texstore_z32(TEXSTORE_PARAMS)
 ASSERT(dstFormat == MESA_FORMAT_Z32 ||
dstFormat == MESA_FORMAT_Z32_FLOAT);
 ASSERT(texelBytes == sizeof(GLuint));
+   (void) texelBytes;

[...]

Hi Vinson,

Let's just remove the texelBytes declarations where they're only used 
for assertions.  I don't think they really serve any useful purpose 
anymore.


Thanks.

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


Re: [Mesa-dev] [PATCH 1/3] mesa: Fix typos in transform feedback error messages.

2012-01-03 Thread Brian Paul

On 01/02/2012 10:37 PM, Paul Berry wrote:

---
  src/mesa/main/shaderapi.c |2 +-
  src/mesa/main/transformfeedback.c |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index b71b44b..52a9bd4 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -751,7 +751,7 @@ link_program(struct gl_context *ctx, GLuint program)
   || shProg == ctx->Shader.CurrentGeometryProgram
   || shProg == ctx->Shader.CurrentFragmentProgram)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
-  "glLinkProgram(transform feedback active");
+  "glLinkProgram(transform feedback active)");
return;
 }

diff --git a/src/mesa/main/transformfeedback.c 
b/src/mesa/main/transformfeedback.c
index be0d0ff..305589d 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -461,7 +461,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index,

 if ((size<= 0) || (size&  0x3)) {
/* must be positive and multiple of four */
-  _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size%d)", (int) 
size);
+  _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", (int) 
size);
return;
 }



The series looks good to me.

Reviewed-by: Brian Paul 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium: use Haiku provided debug_printf in OS.h

2012-01-03 Thread Alexander von Gluck

---
 src/gallium/auxiliary/util/u_debug.h |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_debug.h 
b/src/gallium/auxiliary/util/u_debug.h

index b5ea405..3aa6aaf 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -91,8 +91,10 @@ debug_printf(const char *format, ...)
(void) format; /* silence warning */
 #endif
 }
-
-#endif /* !PIPE_OS_HAIKU */
+#else /* is Haiku */
+/* Haiku provides debug_printf in libroot with OS.h */
+#include 
+#endif

 /*
  * ... isn't portable so we need to pass arguments in parentheses.
--
1.7.7.2

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


Re: [Mesa-dev] [PATCH] gallium: fix behavior of pipe_buffer_map_range

2012-01-03 Thread Brian Paul
On Sun, Jan 1, 2012 at 10:27 AM, Marek Olšák  wrote:
> To match what transfer_map returns. Really, subtracting the offset leads
> to bugs if someone expects it to work exactly like transfer_map.
> ---
>  src/gallium/auxiliary/util/u_inlines.h       |    7 ++-
>  src/gallium/auxiliary/util/u_upload_mgr.c    |    4 +++-
>  src/gallium/drivers/svga/svga_state_vs.c     |    1 +
>  src/mesa/state_tracker/st_cb_bufferobjects.c |    4 
>  src/mesa/state_tracker/st_draw.c             |   11 ++-
>  5 files changed, 12 insertions(+), 15 deletions(-)
>

Looks good.

Reviewed-by: Brian Paul 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallium: use Haiku provided debug_printf in OS.h

2012-01-03 Thread Brian Paul
On Tue, Jan 3, 2012 at 7:56 AM, Alexander von Gluck
 wrote:
> ---
>  src/gallium/auxiliary/util/u_debug.h |    6 --
>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_debug.h
> b/src/gallium/auxiliary/util/u_debug.h
> index b5ea405..3aa6aaf 100644
> --- a/src/gallium/auxiliary/util/u_debug.h
> +++ b/src/gallium/auxiliary/util/u_debug.h
> @@ -91,8 +91,10 @@ debug_printf(const char *format, ...)
>    (void) format; /* silence warning */
>  #endif
>  }
> -
> -#endif /* !PIPE_OS_HAIKU */
> +#else /* is Haiku */
> +/* Haiku provides debug_printf in libroot with OS.h */
> +#include 
> +#endif
>
>  /*
>  * ... isn't portable so we need to pass arguments in parentheses.

I'll push this soon.

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


[Mesa-dev] [Bug 42131] Problem with resizing OpenGL windows when using XCB

2012-01-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=42131

Alex Deucher  changed:

   What|Removed |Added

 AssignedTo|dri-devel@lists.freedesktop |mesa-dev@lists.freedesktop.
   |.org|org
  Component|Drivers/Gallium/r600|Mesa core

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] u_upload_mgr: remove the 'flushed' parameter

2012-01-03 Thread Brian Paul
On Sun, Jan 1, 2012 at 10:28 AM, Marek Olšák  wrote:
> Not used by anybody.
> ---
>  src/gallium/auxiliary/util/u_upload_mgr.c        |   15 ---
>  src/gallium/auxiliary/util/u_upload_mgr.h        |    7 ++-
>  src/gallium/auxiliary/util/u_vbuf.c              |    6 ++
>  src/gallium/drivers/r300/r300_render_translate.c |    7 +++
>  src/gallium/drivers/r300/r300_screen_buffer.c    |    3 +--
>  src/gallium/drivers/r600/r600_buffer.c           |    8 +++-
>  src/gallium/drivers/r600/r600_translate.c        |    3 +--
>  src/gallium/drivers/svga/svga_draw_elements.c    |    4 +---
>  src/gallium/drivers/svga/svga_pipe_draw.c        |    4 +---
>  9 files changed, 18 insertions(+), 39 deletions(-)
>

Looks ok to me.

Reviewed-by: Brian Paul 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] Haiku Mesa status

2012-01-03 Thread Alexander von Gluck

Good morning!

I really appreciate Mesa being open to accepting the Haiku patches.

The Haiku support is close to done. Given the current patches applied (plus 
a few small tweaks mentioned below), Mesa (and a few Gallium drivers!) build 
under Haiku.


Here is whats left for the basic build...

 * Haiku makefile.
   - Mesa is moving away from makefiles to auto tools, while getting 
autotools to work for Haiku may be possible.. it is difficult and I have not 
succeeded yet.

   - Right now I am using an un-pushed haiku make "configs" file
 * libGLU will only build as a shared library
   - This seems incorrect as a few makefiles in the Mesa configs attempt to 
build it as static via "GLU_LIB_NAME = libGLU.a"



Anyway, I have a mesa build script which generates this file which is pulled 
in and used by the Haiku build process:

http://pub.haikufire.com/mesa/mesa-04e6db8-gcc4-x86.zip

So far things are looking good, we are getting close to a usable build 
process giving us the latest Mesa while putting minimal strain on the Mesa 
project as we don't have dedicated mesa developers.


Thanks!
 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Haiku Mesa status

2012-01-03 Thread Jakob Bornecrantz
- Original Message -
> Good morning!
> 
> I really appreciate Mesa being open to accepting the Haiku patches.

Glad to hear.

> 
> The Haiku support is close to done. Given the current patches applied
> (plus a few small tweaks mentioned below), Mesa (and a few Gallium
> drivers!) build under Haiku.
> 
> Here is whats left for the basic build...
> 
>   * Haiku makefile.
> - Mesa is moving away from makefiles to auto tools, while getting
> autotools to work for Haiku may be possible.. it is difficult and I
> have not succeeded yet.

It looks like Scons is available form Haiku-ports, could you use that?

> - Right now I am using an un-pushed haiku make "configs" file
>   * libGLU will only build as a shared library
> - This seems incorrect as a few makefiles in the Mesa configs
> attempt to build it as static via "GLU_LIB_NAME = libGLU.a"
> 
> 
> Anyway, I have a mesa build script which generates this file which is
> pulled in and used by the Haiku build process:
> http://pub.haikufire.com/mesa/mesa-04e6db8-gcc4-x86.zip
> 
> So far things are looking good, we are getting close to a usable
> build process giving us the latest Mesa while putting minimal strain
> on the Mesa project as we don't have dedicated mesa developers.
> 
> Thanks!
>   -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] vl: replace decode_buffers with auxiliary data field

2012-01-03 Thread Maarten Lankhorst
Hi Christian,

2012/1/2 Christian König :
> Hi Maarten,
>
> first of all: Happy new Year and sorry for the late reply, have been on
> vacation for the last week.
>
>
> On 29.12.2011 16:41, Maarten Lankhorst wrote:
>>
>> Hey Christian,
>>
>> Op 26-12-11 14:00, Christian König schreef:
>>>
>>> Based on patches from Maarten Lankhorst
>>>
>>> Signed-off-by: Christian König
>>>
>>> diff --git a/src/gallium/include/pipe/p_context.h
>>> b/src/gallium/include/pipe/p_context.h
>>> index de79a9b..f7ee522 100644
>>> --- a/src/gallium/include/pipe/p_context.h
>>> +++ b/src/gallium/include/pipe/p_context.h
>>> @@ -410,7 +410,8 @@ struct pipe_context {
>>>                                                         enum
>>> pipe_video_profile profile,
>>>                                                         enum
>>> pipe_video_entrypoint entrypoint,
>>>                                                         enum
>>> pipe_video_chroma_format chroma_format,
>>> -                                                       unsigned width,
>>> unsigned height, unsigned max_references );
>>> +                                                       unsigned width,
>>> unsigned height, unsigned max_references,
>>> +                                                       bool
>>> expect_chunked_decode);
>>>
>> I really don't like this part, isn't it implied from entrypoint>=
>> PIPE_VIDEO_ENTRYPOINT_IDCT?
>
> Not necessarily, I'm still trying to give this interface a more general look
> and feel.
>
> So for the current use case it can be deduced from the fact that XvMC only
> supports entry-points IDCT and MC, while VDPAU only supports bitstream, but
> that doesn't necessary have to be always the case.
Even if this is true, it seems like this is a limitation that only
applies to the shader based decoder. The nouveau pmpeg xvmc
implementation in mesa doesn't need it at all.

~Maarten
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 42131] Problem with resizing OpenGL windows when using XCB

2012-01-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=42131

--- Comment #2 from ikrabbe@gmail.com 2012-01-03 08:03:49 PST ---
Created attachment 55087
  --> https://bugs.freedesktop.org/attachment.cgi?id=55087
Demonstration how it may work

This program is a bit bigger, than actually needed for this bug, but I'm too
lazy to strip the example from my test repository.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 42131] Problem with resizing OpenGL windows when using XCB

2012-01-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=42131

--- Comment #3 from ikrabbe@gmail.com 2012-01-03 08:07:48 PST ---
Created attachment 55088
  --> https://bugs.freedesktop.org/attachment.cgi?id=55088
Complete with Makefile

Edit the MESA and XCB Variables in the Makefile or optionally in your own,
config.mk. Currently they are setup to compile against my test setup, with
quite recent git origin/master installations.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] softpipe: remove the 32bits limitation on depth(-stencil) formats

2012-01-03 Thread Dave Airlie
On Wed, Dec 7, 2011 at 8:30 PM, Morgan Armand  wrote:
> This patch remove the 32bits limitation. As a side effect, it bring the 
> support for the GL_ARB_depth_buffer_float extension.
> No regression have been found on piglit, and all tests for 
> GL_ARB_depth_buffer_float pass successfully.

Just realised this had fallen through the cracks.

It seems to be okay to me, I'll commit it now,

Thanks,
Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] Add .gitignore files to exclude unit test build artifacts from git

2012-01-03 Thread Paul Berry
With the addition of unit tests in commit
3ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4, several additional build
artifacts are created:

  bin/depcomp
  bin/missing
  tests/Makefile
  tests/Makefile.in
  tests/glx/Makefile
  tests/glx/Makefile.in
  tests/glx/.deps/

This patch adds all of these files to .gitignore.
---
 bin/.gitignore   |2 ++
 tests/.gitignore |3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
 create mode 100644 bin/.gitignore
 create mode 100644 tests/.gitignore

diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644
index 000..3b3f168
--- /dev/null
+++ b/bin/.gitignore
@@ -0,0 +1,2 @@
+/depcomp
+/missing
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 000..a963aad
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+.deps/
-- 
1.7.6.4

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


[Mesa-dev] [Bug 44405] Spring RTS crashes using r600g (5670, Redwood), kernel rejects relocations

2012-01-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44405

Michel Dänzer  changed:

   What|Removed |Added

 AssignedTo|dri-devel@lists.freedesktop |mesa-dev@lists.freedesktop.
   |.org|org
  Component|Drivers/Gallium/r600|Mesa core

--- Comment #2 from Michel Dänzer  2012-01-03 10:48:47 PST 
---
Looks like Gallium/Mesa core confusion about whether pipe_surface is a screen
or context object.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Remove 'texelBytes' declarations that are only used in assertions.

2012-01-03 Thread Vinson Lee
This patch also silences these GCC warnings.
warning: unused variable 'texelBytes'

Signed-off-by: Vinson Lee 
---
 src/mesa/main/texstore.c |   68 --
 1 files changed, 0 insertions(+), 68 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index bb2fe25..fdacb2e 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -975,12 +975,10 @@ static GLboolean
 _mesa_texstore_z32(TEXSTORE_PARAMS)
 {
const GLuint depthScale = 0x;
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
GLenum dstType;
(void) dims;
ASSERT(dstFormat == MESA_FORMAT_Z32 ||
   dstFormat == MESA_FORMAT_Z32_FLOAT);
-   ASSERT(texelBytes == sizeof(GLuint));
 
if (dstFormat == MESA_FORMAT_Z32)
   dstType = GL_UNSIGNED_INT;
@@ -1090,10 +1088,8 @@ static GLboolean
 _mesa_texstore_z16(TEXSTORE_PARAMS)
 {
const GLuint depthScale = 0x;
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
(void) dims;
ASSERT(dstFormat == MESA_FORMAT_Z16);
-   ASSERT(texelBytes == sizeof(GLushort));
 
if (ctx->Pixel.DepthScale == 1.0f &&
ctx->Pixel.DepthBias == 0.0f &&
@@ -1134,12 +1130,10 @@ _mesa_texstore_z16(TEXSTORE_PARAMS)
 static GLboolean
 _mesa_texstore_rgb565(TEXSTORE_PARAMS)
 {
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
ASSERT(dstFormat == MESA_FORMAT_RGB565 ||
   dstFormat == MESA_FORMAT_RGB565_REV);
-   ASSERT(texelBytes == 2);
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1237,14 +1231,12 @@ static GLboolean
 _mesa_texstore_rgba(TEXSTORE_PARAMS)
 {
const GLboolean littleEndian = _mesa_little_endian();
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
ASSERT(dstFormat == MESA_FORMAT_RGBA ||
   dstFormat == MESA_FORMAT_RGBA_REV ||
   dstFormat == MESA_FORMAT_RGBX ||
   dstFormat == MESA_FORMAT_RGBX_REV);
-   ASSERT(texelBytes == 4);
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1362,14 +1354,12 @@ static GLboolean
 _mesa_texstore_argb(TEXSTORE_PARAMS)
 {
const GLboolean littleEndian = _mesa_little_endian();
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = GL_RGBA;
 
ASSERT(dstFormat == MESA_FORMAT_ARGB ||
   dstFormat == MESA_FORMAT_ARGB_REV ||
   dstFormat == MESA_FORMAT_XRGB ||
   dstFormat == MESA_FORMAT_XRGB_REV );
-   ASSERT(texelBytes == 4);
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1559,11 +1549,9 @@ static GLboolean
 _mesa_texstore_rgb888(TEXSTORE_PARAMS)
 {
const GLboolean littleEndian = _mesa_little_endian();
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
ASSERT(dstFormat == MESA_FORMAT_RGB888);
-   ASSERT(texelBytes == 3);
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1677,11 +1665,9 @@ static GLboolean
 _mesa_texstore_bgr888(TEXSTORE_PARAMS)
 {
const GLboolean littleEndian = _mesa_little_endian();
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
ASSERT(dstFormat == MESA_FORMAT_BGR888);
-   ASSERT(texelBytes == 3);
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1775,12 +1761,10 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
 static GLboolean
 _mesa_texstore_argb(TEXSTORE_PARAMS)
 {
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
ASSERT(dstFormat == MESA_FORMAT_ARGB ||
   dstFormat == MESA_FORMAT_ARGB_REV);
-   ASSERT(texelBytes == 2);
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1840,11 +1824,9 @@ _mesa_texstore_argb(TEXSTORE_PARAMS)
 static GLboolean
 _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
 {
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
ASSERT(dstFormat == MESA_FORMAT_RGBA5551);
-   ASSERT(texelBytes == 2);
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -1893,12 +1875,10 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
 static GLboolean
 _mesa_texstore_argb1555(TEXSTORE_PARAMS)
 {
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
ASSERT(dstFormat == MESA_FORMAT_ARGB1555 ||
   dstFormat == MESA_FORMAT_ARGB1555_REV);
-   ASSERT(texelBytes == 2);
 
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
@@ -195

Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-03 Thread Mike Lothian
Hi

Ever since these tests went in I get failures during configure:


configure: creating ./config.status
config.status: creating configs/autoconf
config.status: error: cannot find input file: `tests/Makefile.in'

Before I raise a bug am I doing something stupid?

Cheers

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


Re: [Mesa-dev] [PATCH] vbo: introduce vbo_get_minmax_indices function

2012-01-03 Thread Roland Scheidegger
Ah index scanning...
I don't like that this will map/unmap the ib once for each prim, though
I don't really see a nice way to avoid that (I think if you have to
actually map the ib, you lose anyway). Hopefully won't hit that
performance hog often...
A comment inline.


Am 31.12.2011 07:32, schrieb Yuanhan Liu:
> Introduce vbo_get_minmax_indices() function to handle the min/max index
> computation for nr_prims(>= 1). The old code just compute the first
> prim's min/max index; this would results an error rendering if user
> called functions like glMultiDrawElements(). This patch servers as
> fixing this issue.
> 
> As when nr_prims = 1, we can pass 1 to paramter nr_prims, thus I made
> vbo_get_minmax_index() static.
> 
> Signed-off-by: Yuanhan Liu 
> ---
>  src/mesa/drivers/dri/i965/brw_draw.c |2 +-
>  src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c |3 +-
>  src/mesa/main/api_validate.c |2 +-
>  src/mesa/state_tracker/st_draw.c |3 +-
>  src/mesa/state_tracker/st_draw_feedback.c|2 +-
>  src/mesa/tnl/t_draw.c|2 +-
>  src/mesa/vbo/vbo.h   |6 ++--
>  src/mesa/vbo/vbo_exec_array.c|   29 
> +-
>  8 files changed, 39 insertions(+), 10 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
> b/src/mesa/drivers/dri/i965/brw_draw.c
> index 621195d..f50fffd 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> @@ -586,7 +586,7 @@ void brw_draw_prims( struct gl_context *ctx,
>  
> if (!vbo_all_varyings_in_vbos(arrays)) {
>if (!index_bounds_valid)
> -  vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index);
> +  vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, 
> nr_prims);
>  
>/* Decide if we want to rebase.  If so we end up recursing once
> * only into this function.
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
> b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
> index de04d18..59f1542 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
> @@ -437,7 +437,8 @@ TAG(vbo_render_prims)(struct gl_context *ctx,
>   struct nouveau_render_state *render = to_render_state(ctx);
>  
>   if (!index_bounds_valid)
> - vbo_get_minmax_index(ctx, prims, ib, &min_index, &max_index);
> + vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
> +nr_prims);
>  
>   vbo_choose_render_mode(ctx, arrays);
>   vbo_choose_attrs(ctx, arrays);
> diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
> index 945f127..b6871d0 100644
> --- a/src/mesa/main/api_validate.c
> +++ b/src/mesa/main/api_validate.c
> @@ -184,7 +184,7 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, 
> GLenum type,
> ib.ptr = indices;
> ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
>  
> -   vbo_get_minmax_index(ctx, &prim, &ib, &min, &max);
> +   vbo_get_minmax_indices(ctx, &prim, &ib, &min, &max, 1);
>  
> if ((int)(min + basevertex) < 0 ||
> max + basevertex > ctx->Array.ArrayObj->_MaxElement) {
> diff --git a/src/mesa/state_tracker/st_draw.c 
> b/src/mesa/state_tracker/st_draw.c
> index 954f15a..6327a4c 100644
> --- a/src/mesa/state_tracker/st_draw.c
> +++ b/src/mesa/state_tracker/st_draw.c
> @@ -933,7 +933,8 @@ st_draw_vbo(struct gl_context *ctx,
>/* Gallium probably doesn't want this in some cases. */
>if (!index_bounds_valid)
>   if (!all_varyings_in_vbos(arrays))
> -vbo_get_minmax_index(ctx, prims, ib, &min_index, &max_index);
> +vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
> +   nr_prims);
>  
>for (i = 0; i < nr_prims; i++) {
>   num_instances = MAX2(num_instances, prims[i].num_instances);
> diff --git a/src/mesa/state_tracker/st_draw_feedback.c 
> b/src/mesa/state_tracker/st_draw_feedback.c
> index a99eb2b..f38f44c 100644
> --- a/src/mesa/state_tracker/st_draw_feedback.c
> +++ b/src/mesa/state_tracker/st_draw_feedback.c
> @@ -119,7 +119,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
> st_validate_state(st);
>  
> if (!index_bounds_valid)
> -  vbo_get_minmax_index(ctx, prims, ib, &min_index, &max_index);
> +  vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index, 
> nr_prims);
>  
> /* must get these after state validation! */
> vp = st->vp;
> diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
> index f949c34..17042cf 100644
> --- a/src/mesa/tnl/t_draw.c
> +++ b/src/mesa/tnl/t_draw.c
> @@ -418,7 +418,7 @@ void _tnl_vbo_draw_prims(struct gl_context *ctx,
>struct gl_transform_feedback_object *tfb_vertcount)
>  {
> if (!index_bounds_valid)
> -  vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index);
> + 

Re: [Mesa-dev] softpipe and tgsi_exec.c FAST_MATH

2012-01-03 Thread Roland Scheidegger
Am 31.12.2011 17:46, schrieb Dave Airlie:
> Hi,
> 
> So in the interest of correctness > perf wrt softpipe, flicking
> tgsi_exec.c FAST_MATH to 0 fixes 15 piglit tests with 0 regressions,
> 
> I could probably be persuaded to make a SOFTPIPE_FAST_MATH run time
> set to 0 by default, anyone care one way or another?

Unless this makes a really large performance diff (say factor of 2 or
so) I think just switching it always off is fine.

Roland

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


Re: [Mesa-dev] [PATCH] Add .gitignore files to exclude unit test build artifacts from git

2012-01-03 Thread Ian Romanick

On 01/03/2012 08:19 AM, Paul Berry wrote:

With the addition of unit tests in commit
3ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4, several additional build
artifacts are created:

   bin/depcomp
   bin/missing
   tests/Makefile
   tests/Makefile.in
   tests/glx/Makefile
   tests/glx/Makefile.in
   tests/glx/.deps/

This patch adds all of these files to .gitignore.


I never build in tree, so I didn't even notice.  Shouldn't 
tests/glx_unittest also be ignored?



---
  bin/.gitignore   |2 ++
  tests/.gitignore |3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 bin/.gitignore
  create mode 100644 tests/.gitignore

diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644
index 000..3b3f168
--- /dev/null
+++ b/bin/.gitignore
@@ -0,0 +1,2 @@
+/depcomp
+/missing
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 000..a963aad
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+.deps/

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


[Mesa-dev] [PATCH] drisw: Fix drawable creation against non-default screens

2012-01-03 Thread Adam Jackson
There's no reason to only force the visual to be on the default screen,
and in fact good reason not to.

Signed-off-by: Adam Jackson 
---
 src/glx/drisw_glx.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 2d83a50..833ea7d 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -87,9 +87,8 @@ XCreateDrawable(struct drisw_drawable * pdp,
XChangeGC(dpy, pdp->swapgc, GCGraphicsExposures, &gcvalues);
 
/* visual */
-   visTemp.screen = DefaultScreen(dpy);
visTemp.visualid = visualid;
-   visMask = (VisualScreenMask | VisualIDMask);
+   visMask = VisualIDMask;
pdp->visinfo = XGetVisualInfo(dpy, visMask, &visTemp, &num_visuals);
 
/* create XImage */
-- 
1.7.7.4

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


Re: [Mesa-dev] [PATCH] mesa: Remove 'texelBytes' declarations that are only used in assertions.

2012-01-03 Thread Stéphane Marchesin
As far as I know, this check has value, why not replace the assert
with something like
ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLuint));
instead? That would silence the warning but keep the check.

Stéphane


On Tue, Jan 3, 2012 at 10:54, Vinson Lee  wrote:
> This patch also silences these GCC warnings.
> warning: unused variable 'texelBytes'
>
> Signed-off-by: Vinson Lee 
> ---
>  src/mesa/main/texstore.c |   68 
> --
>  1 files changed, 0 insertions(+), 68 deletions(-)
>
> diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
> index bb2fe25..fdacb2e 100644
> --- a/src/mesa/main/texstore.c
> +++ b/src/mesa/main/texstore.c
> @@ -975,12 +975,10 @@ static GLboolean
>  _mesa_texstore_z32(TEXSTORE_PARAMS)
>  {
>    const GLuint depthScale = 0x;
> -   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
>    GLenum dstType;
>    (void) dims;
>    ASSERT(dstFormat == MESA_FORMAT_Z32 ||
>           dstFormat == MESA_FORMAT_Z32_FLOAT);
> -   ASSERT(texelBytes == sizeof(GLuint));
>
>    if (dstFormat == MESA_FORMAT_Z32)
>       dstType = GL_UNSIGNED_INT;
> @@ -1090,10 +1088,8 @@ static GLboolean
>  _mesa_texstore_z16(TEXSTORE_PARAMS)
>  {
>    const GLuint depthScale = 0x;
> -   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
>    (void) dims;
>    ASSERT(dstFormat == MESA_FORMAT_Z16);
> -   ASSERT(texelBytes == sizeof(GLushort));
>
>    if (ctx->Pixel.DepthScale == 1.0f &&
>        ctx->Pixel.DepthBias == 0.0f &&
> @@ -1134,12 +1130,10 @@ _mesa_texstore_z16(TEXSTORE_PARAMS)
>  static GLboolean
>  _mesa_texstore_rgb565(TEXSTORE_PARAMS)
>  {
> -   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
>    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
>
>    ASSERT(dstFormat == MESA_FORMAT_RGB565 ||
>           dstFormat == MESA_FORMAT_RGB565_REV);
> -   ASSERT(texelBytes == 2);
>
>    if (!ctx->_ImageTransferState &&
>        !srcPacking->SwapBytes &&
> @@ -1237,14 +1231,12 @@ static GLboolean
>  _mesa_texstore_rgba(TEXSTORE_PARAMS)
>  {
>    const GLboolean littleEndian = _mesa_little_endian();
> -   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
>    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
>
>    ASSERT(dstFormat == MESA_FORMAT_RGBA ||
>           dstFormat == MESA_FORMAT_RGBA_REV ||
>           dstFormat == MESA_FORMAT_RGBX ||
>           dstFormat == MESA_FORMAT_RGBX_REV);
> -   ASSERT(texelBytes == 4);
>
>    if (!ctx->_ImageTransferState &&
>        !srcPacking->SwapBytes &&
> @@ -1362,14 +1354,12 @@ static GLboolean
>  _mesa_texstore_argb(TEXSTORE_PARAMS)
>  {
>    const GLboolean littleEndian = _mesa_little_endian();
> -   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
>    const GLenum baseFormat = GL_RGBA;
>
>    ASSERT(dstFormat == MESA_FORMAT_ARGB ||
>           dstFormat == MESA_FORMAT_ARGB_REV ||
>           dstFormat == MESA_FORMAT_XRGB ||
>           dstFormat == MESA_FORMAT_XRGB_REV );
> -   ASSERT(texelBytes == 4);
>
>    if (!ctx->_ImageTransferState &&
>        !srcPacking->SwapBytes &&
> @@ -1559,11 +1549,9 @@ static GLboolean
>  _mesa_texstore_rgb888(TEXSTORE_PARAMS)
>  {
>    const GLboolean littleEndian = _mesa_little_endian();
> -   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
>    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
>
>    ASSERT(dstFormat == MESA_FORMAT_RGB888);
> -   ASSERT(texelBytes == 3);
>
>    if (!ctx->_ImageTransferState &&
>        !srcPacking->SwapBytes &&
> @@ -1677,11 +1665,9 @@ static GLboolean
>  _mesa_texstore_bgr888(TEXSTORE_PARAMS)
>  {
>    const GLboolean littleEndian = _mesa_little_endian();
> -   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
>    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
>
>    ASSERT(dstFormat == MESA_FORMAT_BGR888);
> -   ASSERT(texelBytes == 3);
>
>    if (!ctx->_ImageTransferState &&
>        !srcPacking->SwapBytes &&
> @@ -1775,12 +1761,10 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
>  static GLboolean
>  _mesa_texstore_argb(TEXSTORE_PARAMS)
>  {
> -   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
>    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
>
>    ASSERT(dstFormat == MESA_FORMAT_ARGB ||
>           dstFormat == MESA_FORMAT_ARGB_REV);
> -   ASSERT(texelBytes == 2);
>
>    if (!ctx->_ImageTransferState &&
>        !srcPacking->SwapBytes &&
> @@ -1840,11 +1824,9 @@ _mesa_texstore_argb(TEXSTORE_PARAMS)
>  static GLboolean
>  _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
>  {
> -   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
>    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
>
>    ASSERT(dstFormat == MESA_FORMAT_RGBA5551);
> -   ASSERT(texelBytes == 2);
>
>    if (!ctx->_ImageTransferState &&
>        !srcPacking->SwapBytes &&
> @@ -1893,12 +1875,10 @@ _mesa_

Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-03 Thread Ian Romanick

On 01/03/2012 11:13 AM, Mike Lothian wrote:

Hi

Ever since these tests went in I get failures during configure:


configure: creating ./config.status
config.status: creating configs/autoconf
config.status: error: cannot find input file: `tests/Makefile.in'

Before I raise a bug am I doing something stupid?


It's possible that I didn't get the automake magic right when gtest 
isn't installed.  Is the program gtest-config in your path?

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


[Mesa-dev] [PATCH] glx: More hacking around versions of XCB that lack GLX_ARB_create_context support

2012-01-03 Thread Ian Romanick
From: Ian Romanick 

Detect whether a new enough version of XCB is installed at configure
time.  If it is not, don't enable the extension and don't build the
unit tests.

Signed-off-by: Ian Romanick 
---
Using this patch, I was able to successfully build and run both with
and without updated XCB bits installed.  I think the lesson learned
here is that it's nonsense for the GLX part of XCB to live in the XCB
library.  There's only one user, so it should live there.  Seriously.

 configure.ac |   19 +++
 src/glx/clientinfo.c |5 -
 src/glx/create_context.c |2 +-
 src/glx/glxextensions.c  |4 ++--
 tests/glx/Makefile.am|4 +++-
 5 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index e526d17..7517697 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1030,6 +1030,25 @@ xyesno)
 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
 fi
 
+# Check to see if the xcb-glx library is new enough to support
+# GLX_ARB_create_context.  This bit of hackery is necessary until XCB 1.8
+# is released.
+save_CPPFLAGS="$CPPFLAGS"
+save_LDFLAGS="$LDFLAGS"
+CPPFLAGS="$CPPFLAGS $X11_INCLUDES"
+LDFLAGS="$LDFLAGS $GL_LIB_DEPS"
+AC_CHECK_LIB(xcb-glx, xcb_glx_create_context_attribs_arb_checked,
+[HAVE_XCB_GLX_CREATE_CONTEXT=yes],
+[HAVE_XCB_GLX_CREATE_CONTEXT=no])
+AM_CONDITIONAL(HAVE_XCB_GLX_CREATE_CONTEXT,
+test x$HAVE_XCB_GLX_CREATE_CONTEXT = xyes)
+CPPFLAGS="$save_CPPFLAGS"
+LDFLAGS="$save_LDFLAGS"
+
+if test x$HAVE_XCB_GLX_CREATE_CONTEXT = xyes; then
+X11_INCLUDES="$X11_INCLUDES -DHAVE_XCB_GLX_CREATE_CONTEXT"
+fi
+
 # need DRM libs, -lpthread, etc.
 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
diff --git a/src/glx/clientinfo.c b/src/glx/clientinfo.c
index 429e9a3..461030f 100644
--- a/src/glx/clientinfo.c
+++ b/src/glx/clientinfo.c
@@ -123,6 +123,7 @@ __glX_send_client_info(struct glx_display *glx_dpy)
 * THE ORDER IS IMPORTANT.  We want to send the most recent version of the
 * protocol that the server can support.
 */
+#ifdef HAVE_XCB_GLX_CREATE_CONTEXT
if (glx_dpy->majorVersion == 1 && glx_dpy->minorVersion == 4
&& any_screen_has_ARB_create_context_profile) {
   xcb_glx_set_client_info_2arb(c,
@@ -145,7 +146,9 @@ __glX_send_client_info(struct glx_display *glx_dpy)
  gl_versions,
  gl_extension_string,
  glx_extensions);
-   } else {
+   } else
+#endif
+   {
   xcb_glx_client_info(c,
  GLX_MAJOR_VERSION, GLX_MINOR_VERSION,
  gl_extension_length,
diff --git a/src/glx/create_context.c b/src/glx/create_context.c
index 11f9340..714f0e5 100644
--- a/src/glx/create_context.c
+++ b/src/glx/create_context.c
@@ -94,7 +94,7 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
 * the protocol error and handle it.  Part of handling the error is freeing
 * the possibly non-NULL value returned by this function.
 */
-#ifdef XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB
+#ifdef HAVE_XCB_GLX_CREATE_CONTEXT
cookie =
   xcb_glx_create_context_attribs_arb_checked(c,
 gc->xid,
diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
index 0fcd8a9..86dc7d0 100644
--- a/src/glx/glxextensions.c
+++ b/src/glx/glxextensions.c
@@ -71,7 +71,7 @@ struct extension_info
 
 /* *INDENT-OFF* */
 static const struct extension_info known_glx_extensions[] = {
-#ifdef XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB
+#ifdef HAVE_XCB_GLX_CREATE_CONTEXT
{ GLX(ARB_create_context),  VER(0,0), Y, N, N, N },
{ GLX(ARB_create_context_profile),  VER(0,0), Y, N, N, N },
 #else
@@ -85,7 +85,7 @@ static const struct extension_info known_glx_extensions[] = {
{ GLX(EXT_visual_info), VER(0,0), Y, Y, N, N },
{ GLX(EXT_visual_rating),   VER(0,0), Y, Y, N, N },
{ GLX(EXT_framebuffer_sRGB),VER(0,0), Y, Y, N, N },
-#ifdef XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB
+#ifdef HAVE_XCB_GLX_CREATE_CONTEXT
{ GLX(EXT_create_context_es2_profile), VER(0,0), Y, N, N, Y },
 #else
{ GLX(EXT_create_context_es2_profile), VER(0,0), N, N, N, N },
diff --git a/tests/glx/Makefile.am b/tests/glx/Makefile.am
index 0b06117..cdebf5d 100644
--- a/tests/glx/Makefile.am
+++ b/tests/glx/Makefile.am
@@ -4,6 +4,7 @@ AM_CXXFLAGS = -I$(top_builddir)/src/glx 
-I$(top_builddir)/src/mapi \
$(X11_CFLAGS) $(GTEST_CFLAGS)
 
 if HAVE_GTEST
+if HAVE_XCB_GLX_CREATE_CONTEXT
 TESTS = glx_unittest
 check_PROGRAMS = glx_unittest
 
@@ -13,4 +14,5 @@ glx_unittest_SOURCES =\
 fake_glx_screen.cpp
 
 glx_unittest_LDADD = $(top_builddir)/src/glx/libglx.a $(GTEST_LIBS) 
-lgtest_main
-endif
\ No newline at end of file
+endif
+endif
-- 
1.7.6.4

__

Re: [Mesa-dev] [PATCH] glsl: Add a lowering pass to remove reads of shader output variables.

2012-01-03 Thread Ian Romanick

On 01/03/2012 02:08 AM, Kenneth Graunke wrote:

From: Vincent Lejeune

This is similar to Gallium's existing glsl_to_tgsi::remove_output_read
lowering pass, but done entirely inside the GLSL compiler.

Signed-off-by: Vincent Lejeune
Signed-off-by: Kenneth Graunke


Reviewed-by: Ian Romanick 

Now that we have some unit testing framework in place, we should add 
unit tests for things like this.  That will ensure that changes tested 
on platforms that don't need this pass don't break things for platforms 
that do.



---
  src/glsl/Makefile.sources   |1 +
  src/glsl/ir_optimization.h  |1 +
  src/glsl/lower_output_reads.cpp |  141 +++
  3 files changed, 143 insertions(+), 0 deletions(-)
  create mode 100644 src/glsl/lower_output_reads.cpp

v4 [Kayden]:
  - Use hash_table_call_foreach, as suggested by Ian, removing the need for
an array and the replacement_pair struct.  (Thanks Ian!  I knew such a
function had to exist, but somehow missed it the other day...)

diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index c65bfe4..5e80af2 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -60,6 +60,7 @@ LIBGLSL_CXX_SOURCES := \
lower_vec_index_to_cond_assign.cpp \
lower_vec_index_to_swizzle.cpp \
lower_vector.cpp \
+   lower_output_reads.cpp \
opt_algebraic.cpp \
opt_constant_folding.cpp \
opt_constant_propagation.cpp \
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 7b32e84..085b969 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -72,6 +72,7 @@ bool lower_variable_index_to_cond_assign(exec_list 
*instructions,
  bool lower_input, bool lower_output, bool lower_temp, bool lower_uniform);
  bool lower_quadop_vector(exec_list *instructions, bool dont_lower_swz);
  bool lower_clip_distance(exec_list *instructions);
+void lower_output_reads(exec_list *instructions);
  bool optimize_redundant_jumps(exec_list *instructions);

  ir_rvalue *
diff --git a/src/glsl/lower_output_reads.cpp b/src/glsl/lower_output_reads.cpp
new file mode 100644
index 000..415b541
--- /dev/null
+++ b/src/glsl/lower_output_reads.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright © 2012 Vincent Lejeune
+ * Copyright © 2012 Intel Corporation
+ *
+ * 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.
+ */
+
+#include "ir.h"
+#include "program/hash_table.h"
+
+/**
+ * \file lower_output_reads.cpp
+ *
+ * In GLSL, shader output variables (such as varyings) can be both read and
+ * written.  However, on some hardware, reading an output register causes
+ * trouble.
+ *
+ * This pass creates temporary shadow copies of every (used) shader output,
+ * and replaces all accesses to use those instead.  It also adds code to the
+ * main() function to copy the final values to the actual shader outputs.
+ */
+
+class output_read_remover : public ir_hierarchical_visitor {
+protected:
+   /**
+* A hash table mapping from the original ir_variable shader outputs
+* (ir_var_out mode) to the new temporaries to be used instead.
+*/
+   hash_table *replacements;
+
+   void *mem_ctx;
+public:
+   output_read_remover();
+   ~output_read_remover();
+   virtual ir_visitor_status visit(class ir_dereference_variable *);
+   virtual ir_visitor_status visit_leave(class ir_return *);
+   virtual ir_visitor_status visit_leave(class ir_function_signature *);
+};
+
+output_read_remover::output_read_remover()
+{
+   mem_ctx = ralloc_context(NULL);
+   replacements =
+  hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
+}
+
+output_read_remover::~output_read_remover()
+{
+   hash_table_dtor(replacements);
+   ralloc_free(mem_ctx);
+}
+
+ir_visitor_status
+output_read_remover::visit(ir_dereference_variable *ir)
+{
+   if (ir->var->mode != ir_var_out)
+  return visit_continue;
+
+   ir_variable *

Re: [Mesa-dev] [PATCH] mesa: Remove 'texelBytes' declarations that are only used in assertions.

2012-01-03 Thread Ian Romanick

On 01/03/2012 12:23 PM, Stéphane Marchesin wrote:

As far as I know, this check has value, why not replace the assert
with something like
ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLuint));
instead? That would silence the warning but keep the check.


I was going to suggest exactly the same thing.


Stéphane


On Tue, Jan 3, 2012 at 10:54, Vinson Lee  wrote:

This patch also silences these GCC warnings.
warning: unused variable 'texelBytes'

Signed-off-by: Vinson Lee
---
  src/mesa/main/texstore.c |   68 --
  1 files changed, 0 insertions(+), 68 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index bb2fe25..fdacb2e 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -975,12 +975,10 @@ static GLboolean
  _mesa_texstore_z32(TEXSTORE_PARAMS)
  {
const GLuint depthScale = 0x;
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
GLenum dstType;
(void) dims;
ASSERT(dstFormat == MESA_FORMAT_Z32 ||
   dstFormat == MESA_FORMAT_Z32_FLOAT);
-   ASSERT(texelBytes == sizeof(GLuint));

if (dstFormat == MESA_FORMAT_Z32)
   dstType = GL_UNSIGNED_INT;
@@ -1090,10 +1088,8 @@ static GLboolean
  _mesa_texstore_z16(TEXSTORE_PARAMS)
  {
const GLuint depthScale = 0x;
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
(void) dims;
ASSERT(dstFormat == MESA_FORMAT_Z16);
-   ASSERT(texelBytes == sizeof(GLushort));

if (ctx->Pixel.DepthScale == 1.0f&&
ctx->Pixel.DepthBias == 0.0f&&
@@ -1134,12 +1130,10 @@ _mesa_texstore_z16(TEXSTORE_PARAMS)
  static GLboolean
  _mesa_texstore_rgb565(TEXSTORE_PARAMS)
  {
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);

ASSERT(dstFormat == MESA_FORMAT_RGB565 ||
   dstFormat == MESA_FORMAT_RGB565_REV);
-   ASSERT(texelBytes == 2);

if (!ctx->_ImageTransferState&&
!srcPacking->SwapBytes&&
@@ -1237,14 +1231,12 @@ static GLboolean
  _mesa_texstore_rgba(TEXSTORE_PARAMS)
  {
const GLboolean littleEndian = _mesa_little_endian();
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);

ASSERT(dstFormat == MESA_FORMAT_RGBA ||
   dstFormat == MESA_FORMAT_RGBA_REV ||
   dstFormat == MESA_FORMAT_RGBX ||
   dstFormat == MESA_FORMAT_RGBX_REV);
-   ASSERT(texelBytes == 4);

if (!ctx->_ImageTransferState&&
!srcPacking->SwapBytes&&
@@ -1362,14 +1354,12 @@ static GLboolean
  _mesa_texstore_argb(TEXSTORE_PARAMS)
  {
const GLboolean littleEndian = _mesa_little_endian();
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = GL_RGBA;

ASSERT(dstFormat == MESA_FORMAT_ARGB ||
   dstFormat == MESA_FORMAT_ARGB_REV ||
   dstFormat == MESA_FORMAT_XRGB ||
   dstFormat == MESA_FORMAT_XRGB_REV );
-   ASSERT(texelBytes == 4);

if (!ctx->_ImageTransferState&&
!srcPacking->SwapBytes&&
@@ -1559,11 +1549,9 @@ static GLboolean
  _mesa_texstore_rgb888(TEXSTORE_PARAMS)
  {
const GLboolean littleEndian = _mesa_little_endian();
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);

ASSERT(dstFormat == MESA_FORMAT_RGB888);
-   ASSERT(texelBytes == 3);

if (!ctx->_ImageTransferState&&
!srcPacking->SwapBytes&&
@@ -1677,11 +1665,9 @@ static GLboolean
  _mesa_texstore_bgr888(TEXSTORE_PARAMS)
  {
const GLboolean littleEndian = _mesa_little_endian();
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);

ASSERT(dstFormat == MESA_FORMAT_BGR888);
-   ASSERT(texelBytes == 3);

if (!ctx->_ImageTransferState&&
!srcPacking->SwapBytes&&
@@ -1775,12 +1761,10 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
  static GLboolean
  _mesa_texstore_argb(TEXSTORE_PARAMS)
  {
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);

ASSERT(dstFormat == MESA_FORMAT_ARGB ||
   dstFormat == MESA_FORMAT_ARGB_REV);
-   ASSERT(texelBytes == 2);

if (!ctx->_ImageTransferState&&
!srcPacking->SwapBytes&&
@@ -1840,11 +1824,9 @@ _mesa_texstore_argb(TEXSTORE_PARAMS)
  static GLboolean
  _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
  {
-   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);

ASSERT(dstFormat == MESA_FORMAT_RGBA5551);
-   ASSERT(texelBytes == 2);

if (!ctx->_ImageTransferState&&
!srcPacking->SwapBytes&&
@@ -1893,12 +1875,10 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
  static GLboolean
  _mesa_texstore_argb1555(TE

[Mesa-dev] [PATCH] mesa/main: fix incorrect use of _mesa_ffsll. _mesa_ffsll may or may not be defined on GNUC

2012-01-03 Thread Alexander von Gluck

---
 src/mesa/main/arrayobj.c |2 +-
 src/mesa/main/imports.h  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 4b3e07b..29bfed8 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -303,7 +303,7 @@ _mesa_update_array_object_max_element(struct gl_context 
*ctx,

GLuint min = ~0u;

while (enabled) {
-  GLint attrib = _mesa_ffsll(enabled) - 1;
+  GLint attrib = ffsll(enabled) - 1;
   enabled &= ~BITFIELD64_BIT(attrib);
   min = update_min(min, &arrayObj->VertexAttrib[attrib]);
}
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index b7e8743..3cba312 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -568,7 +568,7 @@ _mesa_init_sqrt_table(void);

 #ifdef __GNUC__

-#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) || 
defined(__APPLE__)
+#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) || 
defined(__APPLE__) || defined(__HAIKU__)

 #define ffs __builtin_ffs
 #define ffsll __builtin_ffsll
 #endif
--
1.7.7.2

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


Re: [Mesa-dev] [PATCH] drisw: Fix drawable creation against non-default screens

2012-01-03 Thread Ian Romanick

On 01/03/2012 11:40 AM, Adam Jackson wrote:

There's no reason to only force the visual to be on the default screen,
and in fact good reason not to.


Is the visual ID enough information to uniquely identify it?  I may be 
mistaken (and horribly ignorant in this area), but I thought the visual 
ID namespace was per-screen, not per-display.



Signed-off-by: Adam Jackson
---
  src/glx/drisw_glx.c |3 +--
  1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 2d83a50..833ea7d 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -87,9 +87,8 @@ XCreateDrawable(struct drisw_drawable * pdp,
 XChangeGC(dpy, pdp->swapgc, GCGraphicsExposures,&gcvalues);

 /* visual */
-   visTemp.screen = DefaultScreen(dpy);
 visTemp.visualid = visualid;
-   visMask = (VisualScreenMask | VisualIDMask);
+   visMask = VisualIDMask;
 pdp->visinfo = XGetVisualInfo(dpy, visMask,&visTemp,&num_visuals);

 /* create XImage */


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


Re: [Mesa-dev] [PATCH] Add .gitignore files to exclude unit test build artifacts from git

2012-01-03 Thread Paul Berry
On 3 January 2012 11:28, Ian Romanick  wrote:

> On 01/03/2012 08:19 AM, Paul Berry wrote:
>
>> With the addition of unit tests in commit
>> 3ef3ba4d2eee36f64062a21ce030c3**f4d8c4cac4, several additional build
>> artifacts are created:
>>
>>   bin/depcomp
>>   bin/missing
>>   tests/Makefile
>>   tests/Makefile.in
>>   tests/glx/Makefile
>>   tests/glx/Makefile.in
>>   tests/glx/.deps/
>>
>> This patch adds all of these files to .gitignore.
>>
>
> I never build in tree, so I didn't even notice.  Shouldn't
> tests/glx_unittest also be ignored?


Whoops, yes.  You're right.  It turns out I didn't have gtest installed so
it wasn't being built.

I'll send out a revised patch.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] mesa: Check that all buffers are bound in BeginTransformFeedback.

2012-01-03 Thread Ian Romanick

On 01/02/2012 09:37 PM, Paul Berry wrote:

 From the EXT_transform_feedback spec:

 The error INVALID_OPERATION is generated by
 BeginTransformFeedbackEXT if any transform feedback buffer object
 binding point used in transform feedback mode does not have a
 buffer object bound.

This required adding a new NumBuffers field to the
gl_transform_feedback_info struct, to keep track of how many transform
feedback buffers are required by the current program.

Fixes Piglit tests:
- EXT_transform_feedback/api-errors interleaved_unbound
- EXT_transform_feedback/api-errors separate_unbound_0_1
- EXT_transform_feedback/api-errors separate_unbound_0_2
- EXT_transform_feedback/api-errors separate_unbound_1_2
---
  src/glsl/linker.cpp   |7 +--
  src/mesa/main/mtypes.h|5 +
  src/mesa/main/transformfeedback.c |   12 
  3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index ed9a5d7..43be205 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1889,11 +1889,14 @@ store_tfeedback_info(struct gl_context *ctx, struct 
gl_shader_program *prog,
   tfeedback_decl *tfeedback_decls)
  {
 unsigned total_tfeedback_components = 0;
+   bool separate_attribs_mode =
+  prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS;
 memset(&prog->LinkedTransformFeedback, 0,
sizeof(prog->LinkedTransformFeedback));
+   prog->LinkedTransformFeedback.NumBuffers =
+  separate_attribs_mode ? num_tfeedback_decls : 1;
 for (unsigned i = 0; i<  num_tfeedback_decls; ++i) {
-  unsigned buffer =
- prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS ? i : 0;
+  unsigned buffer = separate_attribs_mode ? i : 0;


Is this actually necessary?  If separate_attribs_mode is false, 
num_tfeedback_decls is 1, and i can only ever be 0.  Right?



if (!tfeedback_decls[i].store(prog,&prog->LinkedTransformFeedback,
  buffer))
   return false;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d520f98..456131f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1821,6 +1821,11 @@ struct gl_uniform_list;
  struct gl_transform_feedback_info {
 unsigned NumOutputs;

+   /**
+* Number of transform feedback buffers in use by this program.
+*/
+   unsigned NumBuffers;
+
 struct {
unsigned OutputRegister;
unsigned OutputBuffer;
diff --git a/src/mesa/main/transformfeedback.c 
b/src/mesa/main/transformfeedback.c
index 305589d..6e93b3b 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -342,9 +342,12 @@ void GLAPIENTRY
  _mesa_BeginTransformFeedback(GLenum mode)
  {
 struct gl_transform_feedback_object *obj;
+   struct gl_transform_feedback_info *info;
+   int i;
 GET_CURRENT_CONTEXT(ctx);

 obj = ctx->TransformFeedback.CurrentObject;
+   info =&ctx->Shader.CurrentVertexProgram->LinkedTransformFeedback;

 switch (mode) {
 case GL_POINTS:
@@ -363,6 +366,15 @@ _mesa_BeginTransformFeedback(GLenum mode)
return;
 }

+   for (i = 0; i<  info->NumBuffers; ++i) {
+  if (obj->BufferNames[i] == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBeginTransformFeedback(binding point %d does not have "
+ "a buffer object bound)", i);
+ return;
+  }
+   }
+
 FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
 obj->Active = GL_TRUE;
 ctx->TransformFeedback.Mode = mode;


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


Re: [Mesa-dev] [PATCH 1/3] mesa: Fix typos in transform feedback error messages.

2012-01-03 Thread Ian Romanick

On 01/02/2012 09:37 PM, Paul Berry wrote:

Patches 1/3 and 3/3 are

Reviewed-by: Ian Romanick 

I had a question about 2/3.


---
  src/mesa/main/shaderapi.c |2 +-
  src/mesa/main/transformfeedback.c |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index b71b44b..52a9bd4 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -751,7 +751,7 @@ link_program(struct gl_context *ctx, GLuint program)
   || shProg == ctx->Shader.CurrentGeometryProgram
   || shProg == ctx->Shader.CurrentFragmentProgram)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
-  "glLinkProgram(transform feedback active");
+  "glLinkProgram(transform feedback active)");
return;
 }

diff --git a/src/mesa/main/transformfeedback.c 
b/src/mesa/main/transformfeedback.c
index be0d0ff..305589d 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -461,7 +461,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index,

 if ((size<= 0) || (size&  0x3)) {
/* must be positive and multiple of four */
-  _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size%d)", (int) 
size);
+  _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", (int) 
size);
return;
 }



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


[Mesa-dev] [PATCH] Add .gitignore files to exclude unit test build artifacts from git

2012-01-03 Thread Paul Berry
With the addition of unit tests in commit
3ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4, several additional build
artifacts are created:

  bin/depcomp
  bin/missing
  tests/Makefile
  tests/Makefile.in
  tests/glx/Makefile
  tests/glx/Makefile.in
  tests/glx/.deps/
  tests/glx/.gitignore

This patch adds all of these files to .gitignore.
---
 bin/.gitignore   |2 ++
 tests/.gitignore |3 +++
 tests/glx/.gitignore |1 +
 3 files changed, 6 insertions(+), 0 deletions(-)
 create mode 100644 bin/.gitignore
 create mode 100644 tests/.gitignore
 create mode 100644 tests/glx/.gitignore

diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644
index 000..3b3f168
--- /dev/null
+++ b/bin/.gitignore
@@ -0,0 +1,2 @@
+/depcomp
+/missing
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 000..a963aad
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+.deps/
diff --git a/tests/glx/.gitignore b/tests/glx/.gitignore
new file mode 100644
index 000..dab7e97
--- /dev/null
+++ b/tests/glx/.gitignore
@@ -0,0 +1 @@
+/glx_unittest
-- 
1.7.6.5

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


Re: [Mesa-dev] [PATCH 2/3] mesa: Check that all buffers are bound in BeginTransformFeedback.

2012-01-03 Thread Paul Berry
On 3 January 2012 12:57, Ian Romanick  wrote:

> On 01/02/2012 09:37 PM, Paul Berry wrote:
>
>>  From the EXT_transform_feedback spec:
>>
>> The error INVALID_OPERATION is generated by
>> BeginTransformFeedbackEXT if any transform feedback buffer object
>> binding point used in transform feedback mode does not have a
>> buffer object bound.
>>
>> This required adding a new NumBuffers field to the
>> gl_transform_feedback_info struct, to keep track of how many transform
>> feedback buffers are required by the current program.
>>
>> Fixes Piglit tests:
>> - EXT_transform_feedback/api-**errors interleaved_unbound
>> - EXT_transform_feedback/api-**errors separate_unbound_0_1
>> - EXT_transform_feedback/api-**errors separate_unbound_0_2
>> - EXT_transform_feedback/api-**errors separate_unbound_1_2
>> ---
>>  src/glsl/linker.cpp   |7 +--
>>  src/mesa/main/mtypes.h|5 +
>>  src/mesa/main/**transformfeedback.c |   12 
>>  3 files changed, 22 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
>> index ed9a5d7..43be205 100644
>> --- a/src/glsl/linker.cpp
>> +++ b/src/glsl/linker.cpp
>> @@ -1889,11 +1889,14 @@ store_tfeedback_info(struct gl_context *ctx,
>> struct gl_shader_program *prog,
>>   tfeedback_decl *tfeedback_decls)
>>  {
>> unsigned total_tfeedback_components = 0;
>> +   bool separate_attribs_mode =
>> +  prog->TransformFeedback.**BufferMode == GL_SEPARATE_ATTRIBS;
>> memset(&prog->**LinkedTransformFeedback, 0,
>>sizeof(prog->**LinkedTransformFeedback));
>> +   prog->LinkedTransformFeedback.**NumBuffers =
>> +  separate_attribs_mode ? num_tfeedback_decls : 1;
>> for (unsigned i = 0; i<  num_tfeedback_decls; ++i) {
>> -  unsigned buffer =
>> - prog->TransformFeedback.**BufferMode == GL_SEPARATE_ATTRIBS ?
>> i : 0;
>> +  unsigned buffer = separate_attribs_mode ? i : 0;
>>
>
> Is this actually necessary?  If separate_attribs_mode is false,
> num_tfeedback_decls is 1, and i can only ever be 0.  Right?
>

No, num_tfeedback_decls is the value of "count" that was passed to
TransformFeedbackVaryings--it indicates the number of varyings that should
be captured.  So if separate_attribs_mode is false, and more than one
varying is being interleaved, then num_tfeedback_decls will be greater than
1.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Avoid segfault when getting an unbound transform feedback buffer name.

2012-01-03 Thread Paul Berry
Previously we were using
gl_transform_feedback_object::Buffers[i]->Name to service an indexed
get request for GL_TRANSFORM_FEEDBACK_BUFFER_BINDING.  However, if no
buffer has been bound, gl_transform_feedback_object::Buffers[i] is
NULL, so this was causing a segfault.

This patch switches to using
gl_transform_feedback_object::BufferNames[i], which is equal to
gl_transform_feedback_object::Buffers[i]->Name if
gl_transform_feedback_object::Buffers[i] is not NULL, and 0 if it is
NULL.

Fixes piglit test "EXT_transform_feedback/get-buffer-state
indexed_binding".
---
 src/mesa/main/get.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 0c9d6b3..5ad6012 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -2498,7 +2498,7 @@ find_value_indexed(const char *func, GLenum pname, int 
index, union value *v)
 goto invalid_value;
   if (!ctx->Extensions.EXT_transform_feedback)
 goto invalid_enum;
-  v->value_int = 
ctx->TransformFeedback.CurrentObject->Buffers[index]->Name;
+  v->value_int = ctx->TransformFeedback.CurrentObject->BufferNames[index];
   return TYPE_INT;
}
 
-- 
1.7.6.5

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


Re: [Mesa-dev] [PATCH] mesa: Remove 'texelBytes' declarations that are only used in assertions.

2012-01-03 Thread Brian Paul

On 01/03/2012 01:44 PM, Ian Romanick wrote:

On 01/03/2012 12:23 PM, Stéphane Marchesin wrote:

As far as I know, this check has value, why not replace the assert
with something like
ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLuint));
instead? That would silence the warning but keep the check.


I was going to suggest exactly the same thing.


I'd be OK with that too.

Sorry for the busy work, Vinson.

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


Re: [Mesa-dev] [PATCH] mesa/main: fix incorrect use of _mesa_ffsll. _mesa_ffsll may or may not be defined on GNUC

2012-01-03 Thread Brian Paul
On Tue, Jan 3, 2012 at 1:49 PM, Alexander von Gluck
 wrote:
> ---
>  src/mesa/main/arrayobj.c |    2 +-
>  src/mesa/main/imports.h  |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
> index 4b3e07b..29bfed8 100644
> --- a/src/mesa/main/arrayobj.c
> +++ b/src/mesa/main/arrayobj.c
> @@ -303,7 +303,7 @@ _mesa_update_array_object_max_element(struct gl_context
> *ctx,
>    GLuint min = ~0u;
>
>    while (enabled) {
> -      GLint attrib = _mesa_ffsll(enabled) - 1;
> +      GLint attrib = ffsll(enabled) - 1;

Why are you changing this line?  On a non-gnu platform we may not have ffsll().


>       enabled &= ~BITFIELD64_BIT(attrib);
>       min = update_min(min, &arrayObj->VertexAttrib[attrib]);
>    }
> diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
> index b7e8743..3cba312 100644
> --- a/src/mesa/main/imports.h
> +++ b/src/mesa/main/imports.h
> @@ -568,7 +568,7 @@ _mesa_init_sqrt_table(void);
>
>  #ifdef __GNUC__
>
> -#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) ||
> defined(__APPLE__)
> +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) ||
> defined(__APPLE__) || defined(__HAIKU__)
>  #define ffs __builtin_ffs
>  #define ffsll __builtin_ffsll
>  #endif
> --
> 1.7.7.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


Re: [Mesa-dev] [PATCH 2/3] mesa: Check that all buffers are bound in BeginTransformFeedback.

2012-01-03 Thread Ian Romanick

On 01/03/2012 01:07 PM, Paul Berry wrote:

On 3 January 2012 12:57, Ian Romanick mailto:i...@freedesktop.org>> wrote:

On 01/02/2012 09:37 PM, Paul Berry wrote:

  From the EXT_transform_feedback spec:

 The error INVALID_OPERATION is generated by
 BeginTransformFeedbackEXT if any transform feedback buffer
object
 binding point used in transform feedback mode does not have a
 buffer object bound.

This required adding a new NumBuffers field to the
gl_transform_feedback_info struct, to keep track of how many
transform
feedback buffers are required by the current program.

Fixes Piglit tests:
- EXT_transform_feedback/api-__errors interleaved_unbound
- EXT_transform_feedback/api-__errors separate_unbound_0_1
- EXT_transform_feedback/api-__errors separate_unbound_0_2
- EXT_transform_feedback/api-__errors separate_unbound_1_2
---
  src/glsl/linker.cpp   |7 +--
  src/mesa/main/mtypes.h|5 +
  src/mesa/main/__transformfeedback.c |   12 
  3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index ed9a5d7..43be205 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1889,11 +1889,14 @@ store_tfeedback_info(struct gl_context
*ctx, struct gl_shader_program *prog,
   tfeedback_decl *tfeedback_decls)
  {
 unsigned total_tfeedback_components = 0;
+   bool separate_attribs_mode =
+  prog->TransformFeedback.__BufferMode == GL_SEPARATE_ATTRIBS;
 memset(&prog->__LinkedTransformFeedback, 0,
sizeof(prog->__LinkedTransformFeedback));
+   prog->LinkedTransformFeedback.__NumBuffers =
+  separate_attribs_mode ? num_tfeedback_decls : 1;
 for (unsigned i = 0; i<  num_tfeedback_decls; ++i) {
-  unsigned buffer =
- prog->TransformFeedback.__BufferMode ==
GL_SEPARATE_ATTRIBS ? i : 0;
+  unsigned buffer = separate_attribs_mode ? i : 0;


Is this actually necessary?  If separate_attribs_mode is false,
num_tfeedback_decls is 1, and i can only ever be 0.  Right?


No, num_tfeedback_decls is the value of "count" that was passed to
TransformFeedbackVaryings--it indicates the number of varyings that
should be captured.  So if separate_attribs_mode is false, and more than
one varying is being interleaved, then num_tfeedback_decls will be
greater than 1.


Oh, right.  I misread the line before the loop.  I'll blame it on being 
sick.


Reviewed-by: Ian Romanick 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] drisw: Fix drawable creation against non-default screens

2012-01-03 Thread Adam Jackson

On 1/3/12 3:48 PM, Ian Romanick wrote:

On 01/03/2012 11:40 AM, Adam Jackson wrote:

There's no reason to only force the visual to be on the default screen,
and in fact good reason not to.


Is the visual ID enough information to uniquely identify it? I may be
mistaken (and horribly ignorant in this area), but I thought the visual
ID namespace was per-screen, not per-display.


Practically, yes.  VIDs and XIDs happen to use the same allocator in the 
sample implementation (and every vendor server I've seen) which means 
they're unique and not namespaced by screen.


According to the protocol spec, visuals may be listed for more than one 
depth or [1] more than one screen.  But that's fine: the visual ID will 
uniquely identify the capabilities of a given visual, and if it happens 
to be valid for multiple screens, awesome.  The requirement then is that 
visuals present on multiple screens actually _be_ compatible, but that's 
a server issue.


[1] - this is just "or" in the spec; it's not clear whether it's meant 
to be ^^ or ||, but || is probably the conservative interpretation.


- ajax

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


Re: [Mesa-dev] RFC [PATCH 0/7] Fix transform feedback of builtin "varyings".

2012-01-03 Thread Ian Romanick

On 12/29/2011 09:16 AM, Paul Berry wrote:

This patch series allows transform feedback to work properly on the
built-in vertex shader output variables gl_PointSize, gl_ClipVertex,
and gl_ClipDistance.  gl_PointSize and gl_ClipVertex were broken due
to bugs in the i965 driver, and were trivial to fix--those are fixed
in patches 1 and 2.

gl_ClipDistance was harder to fix, since on i965 its 8 floats are
packed into 2 vec4s, so the linker has to tell the back-end to select
a single component of one of the vec4's for streaming out.  This
required changing both core mesa and the back-ends, and adding a new
field to gl_transform_feedback_info.  However, the work seems worth it
because it lays some of the groundwork we will need when we get around
to packing varyings.  Patch 3 adds the new field, patches 4-5 cause
the back-ends to use it, and patches 6-7 update the linker to populate
it correctly for gl_ClipDistance.

I'm putting this patch series out as an RFC partly because I want to
find out if the new field in gl_transform_feedback_info makes sense
for other driver back-ends, and partly because it is not 100% clear
from the spec whether transform feedback is intended to work on all
vertex shader outputs, or just the "varyings" (the ones that are
interpolated across the surface of a primitive).  Here are the
arguments I can see for and against going through with this patch
series:

Arguments against: (1) The GL 3.0 spec says that "The varying
variables specified in  can be either built-in varying
variables (beginning with 'gl_') or user-defined ones".  But it also
explicitly states that gl_Position is not a varying variable.  And
GLSL 1.20 lists gl_Position, gl_PointSize, and gl_ClipVertex in
section 7.1 ("Vertex Shader Special Variables") rather than section
7.6 ("Varying Variables").  It seems clear that there was an intention
to distinguish between "varyings" and other vertex shader outputs, and
transform feedback is defined to work on varyings.  (2) In all
likelihood, most code that uses transform feedback uses it on
user-defined varyings anyhow, so fixing these built-in variables is
unlikely to make much difference.  (3) Making transform feedback work
on gl_ClipDistance adds a lot of complication for the benefit of a
tiny corner case.

Arguments in favor: (1) Because of transform feedback's intended use
and its position in the pipeline, the distinction between varyings and
other vertex shader outputs is irrelevant; in all likelihood the spec
writers intended for it to work on all vertex shader outputs.  (2) The
very use of the term "varying" (and hence, this distinction) has
largely disappeared from the standard as of GLSL 1.30.  (3) nVidia's
proprietary Linux driver supports transform feedback of all vertex
shader outputs (except gl_ClipVertex, which has many other bugs), so
it's conceivable that some code in the wild relies on this feature.
(4) Fixing transform feedback of gl_ClipVertex provides a nice
opportunity to prepare for the changes we will have to make to
transform feedback in order to support varying packing.


Here are the results on an AMD system:

[idr@oscar piglit]$ for i in gl_Color gl_SecondaryColor gl_TexCoord 
gl_FogFragCoord gl_Position gl_PointSize gl_ClipVertex gl_ClipDistance ; 
do echo $i; bin/ext_transform_feedback-builtin-varyings -auto $i; echo; done

gl_Color
PIGLIT: {'result': 'pass' }

gl_SecondaryColor
PIGLIT: {'result': 'pass' }

gl_TexCoord
PIGLIT: {'result': 'pass' }

gl_FogFragCoord
PIGLIT: {'result': 'pass' }

gl_Position
PIGLIT: {'result': 'pass' }

gl_PointSize
Failed to link: A variable name specified with the 
TransformFeedbackVaryings is not declared as an output in the geometry 
or vertex shader.


PIGLIT: {'result': 'fail' }

gl_ClipVertex
PIGLIT: {'result': 'pass' }

gl_ClipDistance
Failed to link: Vertex shader(s) failed to link.
gl_ClipDistance[2] was not declared as an output in current vertex shader!

PIGLIT: {'result': 'fail' }

It would be interesting to see how this test fares on OS X.


Personally, I'm swayed by the arguments in favor but I would like to
hear what others think.


I searched a bit through old meeting notes and mailing discussions from 
the OpenGL 3.0 time frame.  It seems to me that your suspicion that "the 
spec writers intended for it to work on all vertex shader outputs" is 
almost certainly correct.


I would consider the failing cases to just be bugs in those other 
implementations.



[PATCH 1/7] i965: Fix transform feedback of gl_PointSize.
[PATCH 2/7] i965: Fix transform feedback of gl_ClipVertex.
[PATCH 3/7] mesa: Add gl_transform_feedback_info::ComponentOffset.
[PATCH 4/7] i965: Make use of gl_transform_feedback_info::ComponentOffset.
[PATCH 5/7] gallium: Make use of gl_transform_feedback_info::ComponentOffset.
[PATCH 6/7] mesa: Make tfeedback_decl::var_name a const char *.
[PATCH 7/7] mesa: Fix transform feedback of gl_ClipDistance.
___
mesa-dev mailing list
mesa-dev@lists.freedeskt

[Mesa-dev] [PATCH] mesa: remove unused _mesa_init_teximage_fields() target parameter

2012-01-03 Thread Brian Paul
---
 src/mesa/drivers/dri/intel/intel_tex_image.c   |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_texture.c |2 +-
 src/mesa/drivers/dri/r200/r200_texstate.c  |2 +-
 src/mesa/drivers/dri/radeon/radeon_texstate.c  |2 +-
 src/mesa/drivers/dri/swrast/swrast.c   |2 +-
 src/mesa/main/mipmap.c |2 +-
 src/mesa/main/teximage.c   |   13 ++---
 src/mesa/main/teximage.h   |2 +-
 src/mesa/main/texobj.c |2 +-
 src/mesa/main/texstorage.c |6 +++---
 src/mesa/state_tracker/st_cb_eglimage.c|2 +-
 src/mesa/state_tracker/st_cb_texture.c |4 ++--
 src/mesa/state_tracker/st_gen_mipmap.c |2 +-
 src/mesa/state_tracker/st_manager.c|2 +-
 14 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 32f2e85..1f57435 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -291,7 +291,7 @@ intel_set_texture_image_region(struct gl_context *ctx,
struct gl_texture_object *texobj = image->TexObject;
struct intel_texture_object *intel_texobj = intel_texture_object(texobj);
 
-   _mesa_init_teximage_fields(&intel->ctx, target, image,
+   _mesa_init_teximage_fields(&intel->ctx, image,
  region->width, region->height, 1,
  0, internalFormat, format);
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index ae1ea37..b90ab9a 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -666,7 +666,7 @@ nouveau_set_texbuffer(__DRIcontext *dri_ctx,
 s->format = get_texbuffer_format(rb, format);
 
/* Update the image fields. */
-   _mesa_init_teximage_fields(ctx, target, ti, s->width, s->height,
+   _mesa_init_teximage_fields(ctx, ti, s->width, s->height,
   1, 0, s->cpp, s->format);
nti->base.RowStride = s->pitch / s->cpp;
 
diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c 
b/src/mesa/drivers/dri/r200/r200_texstate.c
index f2c5b94..4624b08 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -806,7 +806,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, 
GLint texture_format
break;
}
 
-   _mesa_init_teximage_fields(radeon->glCtx, target, texImage,
+   _mesa_init_teximage_fields(radeon->glCtx, texImage,
   rb->base.Width, rb->base.Height, 1, 0,
   rb->cpp, texFormat);
rImage->base.RowStride = rb->pitch / rb->cpp;
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c 
b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index ff9351a..67acb73 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -680,7 +680,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint 
target, GLint texture_form
break;
}
 
-   _mesa_init_teximage_fields(radeon->glCtx, target, texImage,
+   _mesa_init_teximage_fields(radeon->glCtx, texImage,
   rb->base.Width, rb->base.Height, 1, 0,
   rb->cpp, texFormat);
rImage->base.RowStride = rb->pitch / rb->cpp;
diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
b/src/mesa/drivers/dri/swrast/swrast.c
index ff74cc5..4f6d016 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -91,7 +91,7 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint 
target,
 else
texFormat = MESA_FORMAT_ARGB;
 
-_mesa_init_teximage_fields(&dri_ctx->Base, target, texImage,
+_mesa_init_teximage_fields(&dri_ctx->Base, texImage,
   w, h, 1, 0, internalFormat, texFormat);
 
 sPriv->swrast_loader->getImage(dPriv, x, y, w, h, (char *)swImage->Data,
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 9a6c6de..867506c 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1860,7 +1860,7 @@ _mesa_prepare_mipmap_level(struct gl_context *ctx,
  /* need to (re)allocate image */
  ctx->Driver.FreeTextureImageBuffer(ctx, dstImage);
 
- _mesa_init_teximage_fields(ctx, target, dstImage,
+ _mesa_init_teximage_fields(ctx, dstImage,
 width, height, depth,
 border, intFormat, format);
 
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d6275bb..6dd70b9 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1059,7 +1059,6 @@ clear_teximage_fields(struct gl_textu

Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-03 Thread Mike Lothian
On 3 January 2012 20:27, Ian Romanick  wrote:
> On 01/03/2012 11:13 AM, Mike Lothian wrote:
>>
>> Hi
>>
>> Ever since these tests went in I get failures during configure:
>>
>>
>> configure: creating ./config.status
>> config.status: creating configs/autoconf
>> config.status: error: cannot find input file: `tests/Makefile.in'
>>
>> Before I raise a bug am I doing something stupid?
>
>
> It's possible that I didn't get the automake magic right when gtest isn't
> installed.  Is the program gtest-config in your path?

Yes I have gtest-config in my path - it was apparently pulled in by
gmock which is required by Clementine

Should I un-install these, pass a configure parameter to mesa or is
there something extra required in the automake hocus pocus?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-03 Thread Mike Lothian
On 3 January 2012 20:27, Ian Romanick  wrote:
> On 01/03/2012 11:13 AM, Mike Lothian wrote:
>>
>> Hi
>>
>> Ever since these tests went in I get failures during configure:
>>
>>
>> configure: creating ./config.status
>> config.status: creating configs/autoconf
>> config.status: error: cannot find input file: `tests/Makefile.in'
>>
>> Before I raise a bug am I doing something stupid?
>
>
> It's possible that I didn't get the automake magic right when gtest isn't
> installed.  Is the program gtest-config in your path?

I still get the issue even if I uninstall gtest

I notice the log also contains:

/bin/sh: /var/tmp/portage/media-libs/mesa-/work/Mesa-/bin/missing:
No such file or directory
configure: WARNING: `missing' script is too old or missing

and I'm attaching the full build log too if that helps
 * Package:media-libs/mesa-
 * Repository: x11
 * Maintainer: x...@gentoo.org
 * USE:amd64 classic consolekit egl elibc_glibc g3dvl gallium gbm gles2 kernel_linux llvm multilib nptl openvg policykit shared-dricore shared-glapi userland_GNU video_cards_i965 video_cards_r600 xvmc
 * FEATURES:   sandbox
>>> Unpacking source...
GIT update -->
   repository:   git://anongit.freedesktop.org/mesa/mesa
   at the commit:7e291e922e53a70d84751538b15c6c16310cca7f
   branch:   master
   storage directory:"/usr/portage/distfiles/egit-src/mesa"
   checkout type:bare repository
Cloning into '/var/tmp/portage/media-libs/mesa-/work/Mesa-'...
done.
Branch branch-master set up to track remote branch master from origin.
Switched to a new branch 'branch-master'
>>> Unpacked to /var/tmp/portage/media-libs/mesa-/work/Mesa-
>>> Source unpacked in /var/tmp/portage/media-libs/mesa-/work
>>> Preparing source in /var/tmp/portage/media-libs/mesa-/work/Mesa- ...
 * Running eautoreconf in '/var/tmp/portage/media-libs/mesa-/work/Mesa-' ...
 * Running aclocal ...
 [ ok ]
 * Running autoconf ...
 [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/media-libs/mesa-/work/Mesa- ...
 * econf: updating Mesa-/bin/config.sub with /usr/share/gnuconfig/config.sub
 * econf: updating Mesa-/bin/config.guess with /usr/share/gnuconfig/config.guess
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --disable-dependency-tracking --disable-option-checking --enable-dri --enable-glx --enable-xcb --enable-texture-float --disable-debug --enable-egl --enable-gbm --disable-gles1 --enable-gles2 --enable-glx-tls --disable-osmesa --enable-asm --enable-shared-dricore --enable-shared-glapi --with-dri-drivers=,swrast,i965 --with-gallium-drivers=,swrast,r600 --with-egl-platforms=x11,drm --enable-gallium-egl --disable-d3d1x --enable-gallium-g3dvl --enable-gallium-llvm --enable-openvg --disable-vdpau --enable-xvmc
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/bin/sh: /var/tmp/portage/media-libs/mesa-/work/Mesa-/bin/missing: No such file or directory
configure: WARNING: `missing' script is too old or missing
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... yes
checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... none needed
checking dependency style of x86_64-pc-linux-gnu-gcc... none
checking how to run the C preprocessor... x86_64-pc-linux-gnu-gcc -E
checking for x86_64-pc-linux-gnu-gcc... (cached) x86_64-pc-linux-gnu-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... (cached) yes
checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... (cached) none needed
checking dependency style of x86_64-pc-linux-gnu-gcc... (cached) none
checking for x86_64-pc-linux-gnu-g++... x86_64-pc-linux-gnu-g++
checking whether we are using the GNU C++ compiler... yes
checking whether x86_64-pc-linux-gnu-g++ accepts -g... yes
checking dependency style of x86_64-pc-linux-gnu-g++... none
checking for gmake... 

Re: [Mesa-dev] [PATCH] ff_fragment_shader: Don't generate swizzles for scalar combiner inputs

2012-01-03 Thread Eric Anholt
On Mon, 02 Jan 2012 19:36:25 -0800, Ian Romanick  wrote:
> On 12/23/2011 10:35 PM, Eric Anholt wrote:
> > On Thu, 22 Dec 2011 17:43:57 -0800, "Ian Romanick"  
> > wrote:
> >> From: Ian Romanick
> >>
> >> There are a couple scenarios where the source could be zero and the
> >> operand could be either SRC_ALPHA or ONE_MINUS_SRC_ALPHA.  For
> >> example, if the source was ZERO.  This would result in something like
> >> (0).w, and a later call to ir_validate would get angry.
> >>
> >> Signed-off-by: Ian Romanick
> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42517
> >
> > In other cases of handling this in the code, I was using the little
> > smear() helper function.  I'd tend towards using that here as well, but
> > no strong feeling.
> 
> smear replicates the X component to all four components of a vec4.
> 
> This code either extracts the W component from a vec4 and returns it as 
> a scalar, or it returns the scalar unmodified.
> 
> Do you think there should be a new helper function for this case?

Looks like I fail at reviewing on both counts.  Go ahead with your patch.


pgpQ1Lzd1ybLY.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] mesa: Fix typos in transform feedback error messages.

2012-01-03 Thread Eric Anholt

This series is Reviewed-by: Eric Anholt 

With this and the fix I have for glGetTransformFeedbackVarying(), I
think we should be passing the oglc tests, except for one more case:
They try to ask for whole arrays to be fed back, without [] in the
declaration.  The clearest text I could find on this point was a
RESOLUTION: in the spec, but it kind of sounded to me like the
resolution was about working around "how to I get feedback from my huge
amount of varying data when I have so few TFB attributes available?"
Did you end up testing whether other drivers accepted non-subscripted
TFB varyings for varying arrays?


pgplrvuTxmQss.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: remove unused _mesa_init_teximage_fields() target parameter

2012-01-03 Thread Yuanhan Liu
On Tue, Jan 03, 2012 at 05:48:37PM -0700, Brian Paul wrote:
> ---
>  src/mesa/drivers/dri/intel/intel_tex_image.c   |2 +-
>  src/mesa/drivers/dri/nouveau/nouveau_texture.c |2 +-
>  src/mesa/drivers/dri/r200/r200_texstate.c  |2 +-
>  src/mesa/drivers/dri/radeon/radeon_texstate.c  |2 +-
>  src/mesa/drivers/dri/swrast/swrast.c   |2 +-
>  src/mesa/main/mipmap.c |2 +-
>  src/mesa/main/teximage.c   |   13 ++---
>  src/mesa/main/teximage.h   |2 +-
>  src/mesa/main/texobj.c |2 +-
>  src/mesa/main/texstorage.c |6 +++---
>  src/mesa/state_tracker/st_cb_eglimage.c|2 +-
>  src/mesa/state_tracker/st_cb_texture.c |4 ++--
>  src/mesa/state_tracker/st_gen_mipmap.c |2 +-
>  src/mesa/state_tracker/st_manager.c|2 +-
>  14 files changed, 22 insertions(+), 23 deletions(-)

Reviewed-by: Yuanhan Liu   

> 
> diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
> b/src/mesa/drivers/dri/intel/intel_tex_image.c
> index 32f2e85..1f57435 100644
> --- a/src/mesa/drivers/dri/intel/intel_tex_image.c
> +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
> @@ -291,7 +291,7 @@ intel_set_texture_image_region(struct gl_context *ctx,
> struct gl_texture_object *texobj = image->TexObject;
> struct intel_texture_object *intel_texobj = intel_texture_object(texobj);
>  
> -   _mesa_init_teximage_fields(&intel->ctx, target, image,
> +   _mesa_init_teximage_fields(&intel->ctx, image,
> region->width, region->height, 1,
> 0, internalFormat, format);
>  
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
> b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
> index ae1ea37..b90ab9a 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
> @@ -666,7 +666,7 @@ nouveau_set_texbuffer(__DRIcontext *dri_ctx,
>  s->format = get_texbuffer_format(rb, format);
>  
>   /* Update the image fields. */
> - _mesa_init_teximage_fields(ctx, target, ti, s->width, s->height,
> + _mesa_init_teximage_fields(ctx, ti, s->width, s->height,
>  1, 0, s->cpp, s->format);
>   nti->base.RowStride = s->pitch / s->cpp;
>  
> diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c 
> b/src/mesa/drivers/dri/r200/r200_texstate.c
> index f2c5b94..4624b08 100644
> --- a/src/mesa/drivers/dri/r200/r200_texstate.c
> +++ b/src/mesa/drivers/dri/r200/r200_texstate.c
> @@ -806,7 +806,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint 
> target, GLint texture_format
>   break;
>   }
>  
> - _mesa_init_teximage_fields(radeon->glCtx, target, texImage,
> + _mesa_init_teximage_fields(radeon->glCtx, texImage,
>  rb->base.Width, rb->base.Height, 1, 0,
>  rb->cpp, texFormat);
>   rImage->base.RowStride = rb->pitch / rb->cpp;
> diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c 
> b/src/mesa/drivers/dri/radeon/radeon_texstate.c
> index ff9351a..67acb73 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
> @@ -680,7 +680,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint 
> target, GLint texture_form
>   break;
>   }
>  
> - _mesa_init_teximage_fields(radeon->glCtx, target, texImage,
> + _mesa_init_teximage_fields(radeon->glCtx, texImage,
>  rb->base.Width, rb->base.Height, 1, 0,
>  rb->cpp, texFormat);
>   rImage->base.RowStride = rb->pitch / rb->cpp;
> diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
> b/src/mesa/drivers/dri/swrast/swrast.c
> index ff74cc5..4f6d016 100644
> --- a/src/mesa/drivers/dri/swrast/swrast.c
> +++ b/src/mesa/drivers/dri/swrast/swrast.c
> @@ -91,7 +91,7 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, 
> GLint target,
>  else
>   texFormat = MESA_FORMAT_ARGB;
>  
> -_mesa_init_teximage_fields(&dri_ctx->Base, target, texImage,
> +_mesa_init_teximage_fields(&dri_ctx->Base, texImage,
>  w, h, 1, 0, internalFormat, texFormat);
>  
>  sPriv->swrast_loader->getImage(dPriv, x, y, w, h, (char *)swImage->Data,
> diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
> index 9a6c6de..867506c 100644
> --- a/src/mesa/main/mipmap.c
> +++ b/src/mesa/main/mipmap.c
> @@ -1860,7 +1860,7 @@ _mesa_prepare_mipmap_level(struct gl_context *ctx,
>   /* need to (re)allocate image */
>   ctx->Driver.FreeTextureImageBuffer(ctx, dstImage);
>  
> - _mesa_init_teximage_fields(ctx, target, dstImage,
> + _mesa_init_teximage_fields(ctx, dstImage,
>  width, height, depth,
>

Re: [Mesa-dev] [PATCH] mesa: Avoid segfault when getting an unbound transform feedback buffer name.

2012-01-03 Thread Eric Anholt
On Tue,  3 Jan 2012 14:11:42 -0800, Paul Berry  wrote:
> Previously we were using
> gl_transform_feedback_object::Buffers[i]->Name to service an indexed
> get request for GL_TRANSFORM_FEEDBACK_BUFFER_BINDING.  However, if no
> buffer has been bound, gl_transform_feedback_object::Buffers[i] is
> NULL, so this was causing a segfault.

Reviewed-by: Eric Anholt 


pgpPDkrqhOb7O.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] Bug 44205 - read from pointer after free

2012-01-03 Thread Anuj Phogat
Coverity reported a read from pointer after free defect in
src/mesa/drivers/dri/intel/intel_mipmap_tree.c
In intel_miptree_all_slices_resolve() function, i = i->next was
executing after freeing i. I have defined a temporary variable
(next) to store the value of i->next before freeing i

Reported-by: Vinson Lee 
Signed-off-by: Anuj Phogat 
---
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 60cc694..7787c1a 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -640,12 +640,13 @@ intel_miptree_all_slices_resolve(struct intel_context 
*intel,
 resolve_func_t func)
 {
bool did_resolve = false;
-   struct intel_resolve_map *i;
+   struct intel_resolve_map *i, *next;
 
-   for (i = mt->hiz_map.next; i; i = i->next) {
+   for (i = mt->hiz_map.next; i; i = next) {
   if (i->need != need)
 continue;
   func(intel, mt, i->level, i->layer);
+  next = i->next;
   intel_resolve_map_remove(i);
   did_resolve = true;
}
-- 
1.7.7.4

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


Re: [Mesa-dev] RFC [PATCH 0/7] Fix transform feedback of builtin "varyings".

2012-01-03 Thread Paul Berry
On 3 January 2012 16:35, Ian Romanick  wrote:

> On 12/29/2011 09:16 AM, Paul Berry wrote:
>
>> This patch series allows transform feedback to work properly on the
>> built-in vertex shader output variables gl_PointSize, gl_ClipVertex,
>> and gl_ClipDistance.  gl_PointSize and gl_ClipVertex were broken due
>> to bugs in the i965 driver, and were trivial to fix--those are fixed
>> in patches 1 and 2.
>>
>> gl_ClipDistance was harder to fix, since on i965 its 8 floats are
>> packed into 2 vec4s, so the linker has to tell the back-end to select
>> a single component of one of the vec4's for streaming out.  This
>> required changing both core mesa and the back-ends, and adding a new
>> field to gl_transform_feedback_info.  However, the work seems worth it
>> because it lays some of the groundwork we will need when we get around
>> to packing varyings.  Patch 3 adds the new field, patches 4-5 cause
>> the back-ends to use it, and patches 6-7 update the linker to populate
>> it correctly for gl_ClipDistance.
>>
>> I'm putting this patch series out as an RFC partly because I want to
>> find out if the new field in gl_transform_feedback_info makes sense
>> for other driver back-ends, and partly because it is not 100% clear
>> from the spec whether transform feedback is intended to work on all
>> vertex shader outputs, or just the "varyings" (the ones that are
>> interpolated across the surface of a primitive).  Here are the
>> arguments I can see for and against going through with this patch
>> series:
>>
>> Arguments against: (1) The GL 3.0 spec says that "The varying
>> variables specified in  can be either built-in varying
>> variables (beginning with 'gl_') or user-defined ones".  But it also
>> explicitly states that gl_Position is not a varying variable.  And
>> GLSL 1.20 lists gl_Position, gl_PointSize, and gl_ClipVertex in
>> section 7.1 ("Vertex Shader Special Variables") rather than section
>> 7.6 ("Varying Variables").  It seems clear that there was an intention
>> to distinguish between "varyings" and other vertex shader outputs, and
>> transform feedback is defined to work on varyings.  (2) In all
>> likelihood, most code that uses transform feedback uses it on
>> user-defined varyings anyhow, so fixing these built-in variables is
>> unlikely to make much difference.  (3) Making transform feedback work
>> on gl_ClipDistance adds a lot of complication for the benefit of a
>> tiny corner case.
>>
>> Arguments in favor: (1) Because of transform feedback's intended use
>> and its position in the pipeline, the distinction between varyings and
>> other vertex shader outputs is irrelevant; in all likelihood the spec
>> writers intended for it to work on all vertex shader outputs.  (2) The
>> very use of the term "varying" (and hence, this distinction) has
>> largely disappeared from the standard as of GLSL 1.30.  (3) nVidia's
>> proprietary Linux driver supports transform feedback of all vertex
>> shader outputs (except gl_ClipVertex, which has many other bugs), so
>> it's conceivable that some code in the wild relies on this feature.
>> (4) Fixing transform feedback of gl_ClipVertex provides a nice
>> opportunity to prepare for the changes we will have to make to
>> transform feedback in order to support varying packing.
>>
>
> Here are the results on an AMD system:
>
> [idr@oscar piglit]$ for i in gl_Color gl_SecondaryColor gl_TexCoord
> gl_FogFragCoord gl_Position gl_PointSize gl_ClipVertex gl_ClipDistance ; do
> echo $i; bin/ext_transform_feedback-**builtin-varyings -auto $i; echo;
> done
> gl_Color
> PIGLIT: {'result': 'pass' }
>
> gl_SecondaryColor
> PIGLIT: {'result': 'pass' }
>
> gl_TexCoord
> PIGLIT: {'result': 'pass' }
>
> gl_FogFragCoord
> PIGLIT: {'result': 'pass' }
>
> gl_Position
> PIGLIT: {'result': 'pass' }
>
> gl_PointSize
> Failed to link: A variable name specified with the
> TransformFeedbackVaryings is not declared as an output in the geometry or
> vertex shader.
>
> PIGLIT: {'result': 'fail' }
>
> gl_ClipVertex
> PIGLIT: {'result': 'pass' }
>
> gl_ClipDistance
> Failed to link: Vertex shader(s) failed to link.
> gl_ClipDistance[2] was not declared as an output in current vertex shader!
>

Heh, sounds like we're not the only ones with a lowering pass that converts
gl_ClipDistance from a float[8] to a vec4[2] :)


>
> PIGLIT: {'result': 'fail' }
>
> It would be interesting to see how this test fares on OS X.
>
>
>  Personally, I'm swayed by the arguments in favor but I would like to
>> hear what others think.
>>
>
> I searched a bit through old meeting notes and mailing discussions from
> the OpenGL 3.0 time frame.  It seems to me that your suspicion that "the
> spec writers intended for it to work on all vertex shader outputs" is
> almost certainly correct.
>
> I would consider the failing cases to just be bugs in those other
> implementations.
>

Ok, sounds good.  I'm going to consider this an "acked-by" if that's all
right with you.  I haven't heard many comments on this patch series, b

Re: [Mesa-dev] [PATCH 1/3] mesa: Fix typos in transform feedback error messages.

2012-01-03 Thread Paul Berry
On 3 January 2012 18:16, Eric Anholt  wrote:

>
> This series is Reviewed-by: Eric Anholt 
>
> With this and the fix I have for glGetTransformFeedbackVarying(), I
> think we should be passing the oglc tests, except for one more case:
> They try to ask for whole arrays to be fed back, without [] in the
> declaration.  The clearest text I could find on this point was a
> RESOLUTION: in the spec, but it kind of sounded to me like the
> resolution was about working around "how to I get feedback from my huge
> amount of varying data when I have so few TFB attributes available?"
> Did you end up testing whether other drivers accepted non-subscripted
> TFB varyings for varying arrays?
>

No, I didn't write any tests of non-subscripted arrays.  My interpretation
of the spec had been that they weren't allowed, but now that I'm re-reading
it, I'm reconsidering.  I'll investigate on the nVidia proprietary linux
driver and let you know what I find out.

Do you have Piglit tests for glGetTransformFeedbackVarying()?  I was
starting to write some, but it was slow going and I don't want to duplicate
effort.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] mesa: Remove the dead Varyings list in the program.

2012-01-03 Thread Eric Anholt
---
 src/mesa/main/mtypes.h|1 -
 src/mesa/main/shaderobj.c |5 -
 2 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 9f0ef69..39ef245 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2292,7 +2292,6 @@ struct gl_shader_program
/** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
gl_texture_index SamplerTargets[MAX_SAMPLERS];
 
-   struct gl_program_parameter_list *Varying;
GLboolean LinkStatus;   /**< GL_LINK_STATUS */
GLboolean Validated;
GLboolean _Used;/**< Ever used for drawing? */
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 454007f..de66851 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -286,11 +286,6 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
   shProg->UniformHash = NULL;
}
 
-   if (shProg->Varying) {
-  _mesa_free_parameter_list(shProg->Varying);
-  shProg->Varying = NULL;
-   }
-
assert(shProg->InfoLog != NULL);
ralloc_free(shProg->InfoLog);
shProg->InfoLog = ralloc_strdup(shProg, "");
-- 
1.7.7.3

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


[Mesa-dev] [PATCH 1/2] mesa: Fix glGetTransformFeedbackVarying().

2012-01-03 Thread Eric Anholt
The current implementation was totally broken -- it was looking in an
unpopulated structure for varyings, and trying to do so using the
current list of varying names, not the list used at link time.
---
 src/glsl/linker.cpp   |   37 +++--
 src/mesa/main/mtypes.h|   21 -
 src/mesa/main/transformfeedback.c |   37 +++--
 3 files changed, 62 insertions(+), 33 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 6587008..bf72a55 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1382,7 +1382,8 @@ public:
bool assign_location(struct gl_context *ctx, struct gl_shader_program *prog,
 ir_variable *output_var);
bool store(struct gl_shader_program *prog,
-  struct gl_transform_feedback_info *info, unsigned buffer) const;
+  struct gl_transform_feedback_info *info, unsigned buffer,
+ unsigned varying) const;
 
 
/**
@@ -1413,7 +1414,7 @@ public:
 private:
/**
 * The name that was supplied to glTransformFeedbackVaryings.  Used for
-* error reporting.
+* error reporting and glGetTransformFeedbackVarying().
 */
const char *orig_name;
 
@@ -1449,6 +1450,9 @@ private:
 * if this variable is not a matrix.
 */
unsigned matrix_columns;
+
+   /** Type of the varying returned by glGetTransformFeedbackVarying() */
+   GLenum type;
 };
 
 
@@ -1520,8 +1524,9 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
   /* Array variable */
   if (!this->is_array) {
  linker_error(prog, "Transform feedback varying %s found, "
-  "but it's not an array ([] not expected).",
-  this->orig_name);
+  "but array dereference required for varying %s[%d]).",
+  this->orig_name,
+ output_var->name, output_var->type->length);
  return false;
   }
   /* Check array bounds. */
@@ -1538,6 +1543,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
   this->location = output_var->location + this->array_index * matrix_cols;
   this->vector_elements = output_var->type->fields.array->vector_elements;
   this->matrix_columns = matrix_cols;
+  this->type = GL_NONE;
} else {
   /* Regular variable (scalar, vector, or matrix) */
   if (this->is_array) {
@@ -1549,6 +1555,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
   this->location = output_var->location;
   this->vector_elements = output_var->type->vector_elements;
   this->matrix_columns = output_var->type->matrix_columns;
+  this->type = output_var->type->gl_type;
}
/* From GL_EXT_transform_feedback:
 *   A program will fail to link if:
@@ -1580,7 +1587,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
 bool
 tfeedback_decl::store(struct gl_shader_program *prog,
   struct gl_transform_feedback_info *info,
-  unsigned buffer) const
+  unsigned buffer, unsigned varying) const
 {
if (!this->is_assigned()) {
   /* From GL_EXT_transform_feedback:
@@ -1602,6 +1609,16 @@ tfeedback_decl::store(struct gl_shader_program *prog,
   ++info->NumOutputs;
   info->BufferStride[buffer] += this->vector_elements;
}
+
+   info->Varyings[varying].Name = ralloc_strdup(prog, this->orig_name);
+   info->Varyings[varying].Type = this->type;
+   /* Since we require that transform feedback varyings dereference
+* arrays, there's always only one element of the GL datatype above
+* present in this varying.
+*/
+   info->Varyings[varying].Size = 1;
+   info->NumVarying++;
+
return true;
 }
 
@@ -1865,13 +1882,21 @@ store_tfeedback_info(struct gl_context *ctx, struct 
gl_shader_program *prog,
  tfeedback_decl *tfeedback_decls)
 {
unsigned total_tfeedback_components = 0;
+
+   ralloc_free(prog->LinkedTransformFeedback.Varyings);
+
memset(&prog->LinkedTransformFeedback, 0,
   sizeof(prog->LinkedTransformFeedback));
+
+   prog->LinkedTransformFeedback.Varyings =
+  rzalloc_array(prog, struct gl_transform_feedback_varying_info,
+   num_tfeedback_decls);
+
for (unsigned i = 0; i < num_tfeedback_decls; ++i) {
   unsigned buffer =
  prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS ? i : 0;
   if (!tfeedback_decls[i].store(prog, &prog->LinkedTransformFeedback,
-buffer))
+buffer, i))
  return false;
   total_tfeedback_components += tfeedback_decls[i].num_components();
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 107371e..9f0ef69 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1817,6 +1817,12 @@ struct prog_instruction;
 struct gl_program_parameter_list;
 struct gl_uni

Re: [Mesa-dev] [PATCH 1/3] mesa: Fix typos in transform feedback error messages.

2012-01-03 Thread Eric Anholt
On Tue, 3 Jan 2012 18:51:24 -0800, Paul Berry  wrote:
> On 3 January 2012 18:16, Eric Anholt  wrote:
> 
> >
> > This series is Reviewed-by: Eric Anholt 
> >
> > With this and the fix I have for glGetTransformFeedbackVarying(), I
> > think we should be passing the oglc tests, except for one more case:
> > They try to ask for whole arrays to be fed back, without [] in the
> > declaration.  The clearest text I could find on this point was a
> > RESOLUTION: in the spec, but it kind of sounded to me like the
> > resolution was about working around "how to I get feedback from my huge
> > amount of varying data when I have so few TFB attributes available?"
> > Did you end up testing whether other drivers accepted non-subscripted
> > TFB varyings for varying arrays?
> >
> 
> No, I didn't write any tests of non-subscripted arrays.  My interpretation
> of the spec had been that they weren't allowed, but now that I'm re-reading
> it, I'm reconsidering.  I'll investigate on the nVidia proprietary linux
> driver and let you know what I find out.
> 
> Do you have Piglit tests for glGetTransformFeedbackVarying()?  I was
> starting to write some, but it was slow going and I don't want to duplicate
> effort.

Nope, I was meaning to get at least a test of the particular piece of
spec I was hung up on (GetTFVarying reflecting linked state, not next
state), and didn't get to it.


pgpPeySc4W5NI.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 44217] vertex attribute 0 inconsistencies.

2012-01-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44217

Anuj Phogat  changed:

   What|Removed |Added

 AssignedTo|mesa-dev@lists.freedesktop. |anuj.pho...@gmail.com
   |org |

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] Bug 44205 - read from pointer after free

2012-01-03 Thread Eric Anholt
On Tue,  3 Jan 2012 18:36:22 -0800, Anuj Phogat  wrote:
> Coverity reported a read from pointer after free defect in
> src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> In intel_miptree_all_slices_resolve() function, i = i->next was
> executing after freeing i. I have defined a temporary variable
> (next) to store the value of i->next before freeing i

Reviewed-by: Eric Anholt 


pgpSqgbeavCu3.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] mesa: Fix typos in transform feedback error messages.

2012-01-03 Thread Paul Berry
On 3 January 2012 18:56, Eric Anholt  wrote:

> On Tue, 3 Jan 2012 18:51:24 -0800, Paul Berry 
> wrote:
> > On 3 January 2012 18:16, Eric Anholt  wrote:
> >
> > >
> > > This series is Reviewed-by: Eric Anholt 
> > >
> > > With this and the fix I have for glGetTransformFeedbackVarying(), I
> > > think we should be passing the oglc tests, except for one more case:
> > > They try to ask for whole arrays to be fed back, without [] in the
> > > declaration.  The clearest text I could find on this point was a
> > > RESOLUTION: in the spec, but it kind of sounded to me like the
> > > resolution was about working around "how to I get feedback from my huge
> > > amount of varying data when I have so few TFB attributes available?"
> > > Did you end up testing whether other drivers accepted non-subscripted
> > > TFB varyings for varying arrays?
> > >
> >
> > No, I didn't write any tests of non-subscripted arrays.  My
> interpretation
> > of the spec had been that they weren't allowed, but now that I'm
> re-reading
> > it, I'm reconsidering.  I'll investigate on the nVidia proprietary linux
> > driver and let you know what I find out.
> >
> > Do you have Piglit tests for glGetTransformFeedbackVarying()?  I was
> > starting to write some, but it was slow going and I don't want to
> duplicate
> > effort.
>
> Nope, I was meaning to get at least a test of the particular piece of
> spec I was hung up on (GetTFVarying reflecting linked state, not next
> state), and didn't get to it.
>

Ok.  Since I've spent the last two weeks or so writing tests for code other
people wrote, would you mind writing the Piglit tests for
GetTransformFeedbackVarying?  That would have the side benefit of giving me
time to respond to your comments on my other Piglit tests that are still in
flight.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] Cross Compile Arm

2012-01-03 Thread Fabio Ferreira
I am Brazilian, 


how configure plataform to cross compile mesa for the ARM platform ? I am use 
Ubuntu. Download all basic archives and headers, libs, etc. 


Help me___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] Bug 44205 - read from pointer after free

2012-01-03 Thread Ian Romanick

On 01/03/2012 06:36 PM, Anuj Phogat wrote:

Coverity reported a read from pointer after free defect in
src/mesa/drivers/dri/intel/intel_mipmap_tree.c
In intel_miptree_all_slices_resolve() function, i = i->next was
executing after freeing i. I have defined a temporary variable
(next) to store the value of i->next before freeing i

Reported-by: Vinson Lee
Signed-off-by: Anuj Phogat


I suggest changing the short commit message to "Don't read node next 
pointer after freeing node" and adding


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

to the commit message.  Then it's

Reviewed-by: Ian Romanick 


---
  src/mesa/drivers/dri/intel/intel_mipmap_tree.c |5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 60cc694..7787c1a 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -640,12 +640,13 @@ intel_miptree_all_slices_resolve(struct intel_context 
*intel,
 resolve_func_t func)
  {
 bool did_resolve = false;
-   struct intel_resolve_map *i;
+   struct intel_resolve_map *i, *next;

-   for (i = mt->hiz_map.next; i; i = i->next) {
+   for (i = mt->hiz_map.next; i; i = next) {
if (i->need != need)
 continue;
func(intel, mt, i->level, i->layer);
+  next = i->next;
intel_resolve_map_remove(i);
did_resolve = true;
 }


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


Re: [Mesa-dev] [PATCH] mesa: remove unused _mesa_init_teximage_fields() target parameter

2012-01-03 Thread Ian Romanick

On 01/03/2012 04:48 PM, Brian Paul wrote:

Reviewed-by: Ian Roamnick 


---
  src/mesa/drivers/dri/intel/intel_tex_image.c   |2 +-
  src/mesa/drivers/dri/nouveau/nouveau_texture.c |2 +-
  src/mesa/drivers/dri/r200/r200_texstate.c  |2 +-
  src/mesa/drivers/dri/radeon/radeon_texstate.c  |2 +-
  src/mesa/drivers/dri/swrast/swrast.c   |2 +-
  src/mesa/main/mipmap.c |2 +-
  src/mesa/main/teximage.c   |   13 ++---
  src/mesa/main/teximage.h   |2 +-
  src/mesa/main/texobj.c |2 +-
  src/mesa/main/texstorage.c |6 +++---
  src/mesa/state_tracker/st_cb_eglimage.c|2 +-
  src/mesa/state_tracker/st_cb_texture.c |4 ++--
  src/mesa/state_tracker/st_gen_mipmap.c |2 +-
  src/mesa/state_tracker/st_manager.c|2 +-
  14 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 32f2e85..1f57435 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -291,7 +291,7 @@ intel_set_texture_image_region(struct gl_context *ctx,
 struct gl_texture_object *texobj = image->TexObject;
 struct intel_texture_object *intel_texobj = intel_texture_object(texobj);

-   _mesa_init_teximage_fields(&intel->ctx, target, image,
+   _mesa_init_teximage_fields(&intel->ctx, image,
  region->width, region->height, 1,
  0, internalFormat, format);

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index ae1ea37..b90ab9a 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -666,7 +666,7 @@ nouveau_set_texbuffer(__DRIcontext *dri_ctx,
  s->format = get_texbuffer_format(rb, format);

/* Update the image fields. */
-   _mesa_init_teximage_fields(ctx, target, ti, s->width, s->height,
+   _mesa_init_teximage_fields(ctx, ti, s->width, s->height,
   1, 0, s->cpp, s->format);
nti->base.RowStride = s->pitch / s->cpp;

diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c 
b/src/mesa/drivers/dri/r200/r200_texstate.c
index f2c5b94..4624b08 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -806,7 +806,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, 
GLint texture_format
break;
}

-   _mesa_init_teximage_fields(radeon->glCtx, target, texImage,
+   _mesa_init_teximage_fields(radeon->glCtx, texImage,
   rb->base.Width, rb->base.Height, 1, 0,
   rb->cpp, texFormat);
rImage->base.RowStride = rb->pitch / rb->cpp;
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c 
b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index ff9351a..67acb73 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -680,7 +680,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint 
target, GLint texture_form
break;
}

-   _mesa_init_teximage_fields(radeon->glCtx, target, texImage,
+   _mesa_init_teximage_fields(radeon->glCtx, texImage,
   rb->base.Width, rb->base.Height, 1, 0,
   rb->cpp, texFormat);
rImage->base.RowStride = rb->pitch / rb->cpp;
diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
b/src/mesa/drivers/dri/swrast/swrast.c
index ff74cc5..4f6d016 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -91,7 +91,7 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint 
target,
  else
texFormat = MESA_FORMAT_ARGB;

-_mesa_init_teximage_fields(&dri_ctx->Base, target, texImage,
+_mesa_init_teximage_fields(&dri_ctx->Base, texImage,
   w, h, 1, 0, internalFormat, texFormat);

  sPriv->swrast_loader->getImage(dPriv, x, y, w, h, (char *)swImage->Data,
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 9a6c6de..867506c 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1860,7 +1860,7 @@ _mesa_prepare_mipmap_level(struct gl_context *ctx,
   /* need to (re)allocate image */
   ctx->Driver.FreeTextureImageBuffer(ctx, dstImage);

- _mesa_init_teximage_fields(ctx, target, dstImage,
+ _mesa_init_teximage_fields(ctx, dstImage,
  width, height, depth,
  border, intFormat, format);

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d6275bb..6dd70b9 100644
--- a/src/mesa/main/teximage.c
+++

Re: [Mesa-dev] [PATCH] drisw: Fix drawable creation against non-default screens

2012-01-03 Thread Ian Romanick

On 01/03/2012 04:33 PM, Adam Jackson wrote:

On 1/3/12 3:48 PM, Ian Romanick wrote:

On 01/03/2012 11:40 AM, Adam Jackson wrote:

There's no reason to only force the visual to be on the default screen,
and in fact good reason not to.


Is the visual ID enough information to uniquely identify it? I may be
mistaken (and horribly ignorant in this area), but I thought the visual
ID namespace was per-screen, not per-display.


Practically, yes. VIDs and XIDs happen to use the same allocator in the
sample implementation (and every vendor server I've seen) which means
they're unique and not namespaced by screen.

According to the protocol spec, visuals may be listed for more than one
depth or [1] more than one screen. But that's fine: the visual ID will
uniquely identify the capabilities of a given visual, and if it happens
to be valid for multiple screens, awesome. The requirement then is that
visuals present on multiple screens actually _be_ compatible, but that's
a server issue.

[1] - this is just "or" in the spec; it's not clear whether it's meant
to be ^^ or ||, but || is probably the conservative interpretation.


Okay.  If some of that gets captured in the commit message, the change is

Reviewed-by: Ian Romanick 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: Fix glGetTransformFeedbackVarying().

2012-01-03 Thread Ian Romanick

On 01/03/2012 06:52 PM, Eric Anholt wrote:

The current implementation was totally broken -- it was looking in an
unpopulated structure for varyings, and trying to do so using the
current list of varying names, not the list used at link time.
---
  src/glsl/linker.cpp   |   37 +++--
  src/mesa/main/mtypes.h|   21 -
  src/mesa/main/transformfeedback.c |   37 +++--
  3 files changed, 62 insertions(+), 33 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 6587008..bf72a55 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1382,7 +1382,8 @@ public:
 bool assign_location(struct gl_context *ctx, struct gl_shader_program 
*prog,
  ir_variable *output_var);
 bool store(struct gl_shader_program *prog,
-  struct gl_transform_feedback_info *info, unsigned buffer) const;
+  struct gl_transform_feedback_info *info, unsigned buffer,
+ unsigned varying) const;


 /**
@@ -1413,7 +1414,7 @@ public:
  private:
 /**
  * The name that was supplied to glTransformFeedbackVaryings.  Used for
-* error reporting.
+* error reporting and glGetTransformFeedbackVarying().
  */
 const char *orig_name;

@@ -1449,6 +1450,9 @@ private:
  * if this variable is not a matrix.
  */
 unsigned matrix_columns;
+
+   /** Type of the varying returned by glGetTransformFeedbackVarying() */
+   GLenum type;
  };


@@ -1520,8 +1524,9 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
/* Array variable */
if (!this->is_array) {
   linker_error(prog, "Transform feedback varying %s found, "
-  "but it's not an array ([] not expected).",
-  this->orig_name);
+  "but array dereference required for varying %s[%d]).",
+  this->orig_name,
+ output_var->name, output_var->type->length);
   return false;
}
/* Check array bounds. */
@@ -1538,6 +1543,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
this->location = output_var->location + this->array_index * matrix_cols;
this->vector_elements = output_var->type->fields.array->vector_elements;
this->matrix_columns = matrix_cols;
+  this->type = GL_NONE;
 } else {
/* Regular variable (scalar, vector, or matrix) */
if (this->is_array) {
@@ -1549,6 +1555,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
this->location = output_var->location;
this->vector_elements = output_var->type->vector_elements;
this->matrix_columns = output_var->type->matrix_columns;
+  this->type = output_var->type->gl_type;
 }
 /* From GL_EXT_transform_feedback:
  *   A program will fail to link if:
@@ -1580,7 +1587,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
  bool
  tfeedback_decl::store(struct gl_shader_program *prog,
struct gl_transform_feedback_info *info,
-  unsigned buffer) const
+  unsigned buffer, unsigned varying) const
  {
 if (!this->is_assigned()) {
/* From GL_EXT_transform_feedback:
@@ -1602,6 +1609,16 @@ tfeedback_decl::store(struct gl_shader_program *prog,
++info->NumOutputs;
info->BufferStride[buffer] += this->vector_elements;
 }
+
+   info->Varyings[varying].Name = ralloc_strdup(prog, this->orig_name);


Judging from the ralloc_free in the next hunk, is prog the right 
context?  It seems like info->Varyings is better.



+   info->Varyings[varying].Type = this->type;
+   /* Since we require that transform feedback varyings dereference
+* arrays, there's always only one element of the GL datatype above
+* present in this varying.
+*/
+   info->Varyings[varying].Size = 1;
+   info->NumVarying++;
+
 return true;
  }

@@ -1865,13 +1882,21 @@ store_tfeedback_info(struct gl_context *ctx, struct 
gl_shader_program *prog,
   tfeedback_decl *tfeedback_decls)
  {
 unsigned total_tfeedback_components = 0;
+
+   ralloc_free(prog->LinkedTransformFeedback.Varyings);
+
 memset(&prog->LinkedTransformFeedback, 0,
sizeof(prog->LinkedTransformFeedback));
+
+   prog->LinkedTransformFeedback.Varyings =
+  rzalloc_array(prog, struct gl_transform_feedback_varying_info,
+   num_tfeedback_decls);
+
 for (unsigned i = 0; i<  num_tfeedback_decls; ++i) {
unsigned buffer =
   prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS ? i : 0;
if (!tfeedback_decls[i].store(prog,&prog->LinkedTransformFeedback,
-buffer))
+buffer, i))
   return false;
total_tfeedback_components += tfeedback_decls[i].num_components();
 }
diff --git a/src/mesa/main/m

Re: [Mesa-dev] [PATCH] vbo: introduce vbo_get_minmax_indices function

2012-01-03 Thread Yuanhan Liu
On Tue, Jan 03, 2012 at 08:25:31PM +0100, Roland Scheidegger wrote:
> Ah index scanning...
> I don't like that this will map/unmap the ib once for each prim,
Me either :)

> though
> I don't really see a nice way to avoid that (I think if you have to

Well, I thought a while, we may do some combine to reduce some
map/unmap.


> actually map the ib, you lose anyway). Hopefully won't hit that
> performance hog often...
> A comment inline.
> 
> 
> Am 31.12.2011 07:32, schrieb Yuanhan Liu:
[snip]...

> > +   for (i = 0; i < nr_prims; i++) {
> > +  tmp_ib.ptr = ib->ptr + prims[i].start * vbo_sizeof_ib_type(ib->type);
> I think you should not use a temporary ib. Figuring out the correct
> start offset clearly looks like it should be handled by
> vbo_get_minmax_index() itself (it should have done this previously
> probably, as there might never have been a guarantee that it is always 0
> even if there's only a single primitive).

Nice suggestion, thanks! Will fix it in the next patch.

--
Yuanhan Liu
> 
> > +  vbo_get_minmax_index(ctx, &prims[i], &tmp_ib, &tmp_min, &tmp_max);
> > +  *min_index = MIN2(*min_index, tmp_min);
> > +  *max_index = MAX2(*max_index, tmp_max);
> > +   }
> > +}
> > +
> >  
> >  /**
> >   * Check that element 'j' of the array has reasonable data.
> 
> Otherwise looks ok to me.
> 
> Roland
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: Fix glGetTransformFeedbackVarying().

2012-01-03 Thread Paul Berry
On 3 January 2012 19:19, Ian Romanick  wrote:

> On 01/03/2012 06:52 PM, Eric Anholt wrote:
>
>> The current implementation was totally broken -- it was looking in an
>> unpopulated structure for varyings, and trying to do so using the
>> current list of varying names, not the list used at link time.
>> ---
>>  src/glsl/linker.cpp   |   37 ++*
>> *+--
>>  src/mesa/main/mtypes.h|   21 -
>>  src/mesa/main/**transformfeedback.c |   37
>> +++---**---
>>  3 files changed, 62 insertions(+), 33 deletions(-)
>>
>> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
>> index 6587008..bf72a55 100644
>> --- a/src/glsl/linker.cpp
>> +++ b/src/glsl/linker.cpp
>> @@ -1382,7 +1382,8 @@ public:
>> bool assign_location(struct gl_context *ctx, struct gl_shader_program
>> *prog,
>>  ir_variable *output_var);
>> bool store(struct gl_shader_program *prog,
>> -  struct gl_transform_feedback_info *info, unsigned buffer)
>> const;
>> +  struct gl_transform_feedback_info *info, unsigned buffer,
>> + unsigned varying) const;
>>
>>
>> /**
>> @@ -1413,7 +1414,7 @@ public:
>>  private:
>> /**
>>  * The name that was supplied to glTransformFeedbackVaryings.  Used
>> for
>> -* error reporting.
>> +* error reporting and glGetTransformFeedbackVarying(**).
>>  */
>> const char *orig_name;
>>
>> @@ -1449,6 +1450,9 @@ private:
>>  * if this variable is not a matrix.
>>  */
>> unsigned matrix_columns;
>> +
>> +   /** Type of the varying returned by glGetTransformFeedbackVarying(**)
>> */
>> +   GLenum type;
>>  };
>>
>>
>> @@ -1520,8 +1524,9 @@ tfeedback_decl::assign_**location(struct
>> gl_context *ctx,
>>/* Array variable */
>>if (!this->is_array) {
>>   linker_error(prog, "Transform feedback varying %s found, "
>> -  "but it's not an array ([] not expected).",
>> -  this->orig_name);
>> +  "but array dereference required for varying
>> %s[%d]).",
>> +  this->orig_name,
>> + output_var->name, output_var->type->length);
>>   return false;
>>}
>>/* Check array bounds. */
>> @@ -1538,6 +1543,7 @@ tfeedback_decl::assign_**location(struct
>> gl_context *ctx,
>>this->location = output_var->location + this->array_index *
>> matrix_cols;
>>this->vector_elements = output_var->type->fields.**
>> array->vector_elements;
>>this->matrix_columns = matrix_cols;
>> +  this->type = GL_NONE;
>> } else {
>>/* Regular variable (scalar, vector, or matrix) */
>>if (this->is_array) {
>> @@ -1549,6 +1555,7 @@ tfeedback_decl::assign_**location(struct
>> gl_context *ctx,
>>this->location = output_var->location;
>>this->vector_elements = output_var->type->vector_**elements;
>>this->matrix_columns = output_var->type->matrix_**columns;
>> +  this->type = output_var->type->gl_type;
>> }
>> /* From GL_EXT_transform_feedback:
>>  *   A program will fail to link if:
>> @@ -1580,7 +1587,7 @@ tfeedback_decl::assign_**location(struct
>> gl_context *ctx,
>>  bool
>>  tfeedback_decl::store(struct gl_shader_program *prog,
>>struct gl_transform_feedback_info *info,
>> -  unsigned buffer) const
>> +  unsigned buffer, unsigned varying) const
>>  {
>> if (!this->is_assigned()) {
>>/* From GL_EXT_transform_feedback:
>> @@ -1602,6 +1609,16 @@ tfeedback_decl::store(struct gl_shader_program
>> *prog,
>>++info->NumOutputs;
>>info->BufferStride[buffer] += this->vector_elements;
>> }
>> +
>> +   info->Varyings[varying].Name = ralloc_strdup(prog, this->orig_name);
>>
>
> Judging from the ralloc_free in the next hunk, is prog the right context?
>  It seems like info->Varyings is better.
>

I was just about to make a similar comment.  With that change, these two
patches are

Reviewed-by: Paul Berry 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] intel: Re-enable GL_OES_standard_derivatives on GEN4+

2012-01-03 Thread Ian Romanick
From: Ian Romanick 

This extension only needs to be enabled on GEN3.

Signed-off-by: Ian Romanick 
---
There are some other GLES extensions that we should look at enabling
after the release.  It's too close to the wire now to go mucking about
with that.

 src/mesa/drivers/dri/intel/intel_extensions_es.c |   22 +-
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es.c 
b/src/mesa/drivers/dri/intel/intel_extensions_es.c
index aef981a..29eb8ea 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions_es.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions_es.c
@@ -28,6 +28,7 @@
 #include "main/extensions.h"
 #include "main/mfeatures.h"
 
+#include "intel_context.h"
 #include "intel_extensions.h"
 
 static const char *common_extensions[] = {
@@ -110,17 +111,6 @@ intelInitExtensionsES1(struct gl_context *ctx)
 }
 
 /**
- * \brief Extensions to disable.
- *
- * These extensions must be manually disabled because they may have been
- * enabled by default.
- */
-static const char* es2_extensions_disabled[] = {
-   "GL_OES_standard_derivatives",
-   NULL,
-};
-
-/**
  * Initializes potential list of extensions if ctx == NULL, or actually enables
  * extensions for a context.
  */
@@ -128,11 +118,17 @@ void
 intelInitExtensionsES2(struct gl_context *ctx)
 {
int i;
+   struct intel_context *intel = intel_context(ctx);
 
for (i = 0; common_extensions[i]; i++)
   _mesa_enable_extension(ctx, common_extensions[i]);
for (i = 0; es2_extensions[i]; i++)
   _mesa_enable_extension(ctx, es2_extensions[i]);
-   for (i = 0; es2_extensions_disabled[i]; i++)
-  _mesa_disable_extension(ctx, es2_extensions_disabled[i]);
+
+   /* This extension must be manually disabled on GEN3 because it may have
+* been enabled by default.
+*/
+   if (intel->gen < 4) {
+  ctx->Extensions.OES_standard_derivatives = false;
+   }
 }
-- 
1.7.6.4

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


Re: [Mesa-dev] [PATCH 1/3] mesa: Fix typos in transform feedback error messages.

2012-01-03 Thread Paul Berry
On 3 January 2012 18:51, Paul Berry  wrote:

> On 3 January 2012 18:16, Eric Anholt  wrote:
>
>>
>> This series is Reviewed-by: Eric Anholt 
>>
>> With this and the fix I have for glGetTransformFeedbackVarying(), I
>> think we should be passing the oglc tests, except for one more case:
>> They try to ask for whole arrays to be fed back, without [] in the
>> declaration.  The clearest text I could find on this point was a
>> RESOLUTION: in the spec, but it kind of sounded to me like the
>> resolution was about working around "how to I get feedback from my huge
>> amount of varying data when I have so few TFB attributes available?"
>> Did you end up testing whether other drivers accepted non-subscripted
>> TFB varyings for varying arrays?
>>
>
> No, I didn't write any tests of non-subscripted arrays.  My interpretation
> of the spec had been that they weren't allowed, but now that I'm re-reading
> it, I'm reconsidering.  I'll investigate on the nVidia proprietary linux
> driver and let you know what I find out.
>

Argh, nVidia supports non-subscripted arrays just fine, even on
gl_ClipDistance.

I had been hoping we wouldn't have to deal with this, based on the same
RESOLUTION you saw.  But in retrospect that was wishful thinking.  It's
clear from the rest of the EXT_transform_feedback spec that non-subscripted
arrays have always been intended to work.  The clincher is the "size"
argument of GetTransformFeedbackVarying(), which would be pointless if
non-subscripted arrays weren't allowed.

I feel responsible for this bug since my wishful thinking prevented it from
being discovered earlier.  I'll get a fix, and some tests, out to the list
ASAP.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-03 Thread Ian Romanick

On 01/03/2012 06:06 PM, Mike Lothian wrote:

On 3 January 2012 20:27, Ian Romanick  wrote:

On 01/03/2012 11:13 AM, Mike Lothian wrote:


Hi

Ever since these tests went in I get failures during configure:


configure: creating ./config.status
config.status: creating configs/autoconf
config.status: error: cannot find input file: `tests/Makefile.in'

Before I raise a bug am I doing something stupid?



It's possible that I didn't get the automake magic right when gtest isn't
installed.  Is the program gtest-config in your path?


I still get the issue even if I uninstall gtest

I notice the log also contains:

/bin/sh: /var/tmp/portage/media-libs/mesa-/work/Mesa-/bin/missing:
No such file or directory
configure: WARNING: `missing' script is too old or missing

and I'm attaching the full build log too if that helps


You should build from GIT, not from some tarball.  I think Gaetan was 
correct.  Some files aren't getting into the tarball.  I'll have to fix 
that later, but I have much bigger fish to try in the mean time.

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


Re: [Mesa-dev] [PATCH] vbo: introduce vbo_get_minmax_indices function

2012-01-03 Thread Yuanhan Liu
On Wed, Jan 04, 2012 at 11:20:07AM +0800, Yuanhan Liu wrote:
> On Tue, Jan 03, 2012 at 08:25:31PM +0100, Roland Scheidegger wrote:
> > Ah index scanning...
> > I don't like that this will map/unmap the ib once for each prim,
> Me either :)
> 
> > though
> > I don't really see a nice way to avoid that (I think if you have to
> 
> Well, I thought a while, we may do some combine to reduce some
> map/unmap.

Ok, here is the new patch, please help to review it.

And Brian, since it touches the mesa core, it would be nice if you'd
review it.

Thanks,
Yuanhan Liu


--

>From 7956b5c93bdfd0e94b6d3e25336c99cd7457f550 Mon Sep 17 00:00:00 2001
From: Yuanhan Liu 
Date: Sat, 31 Dec 2011 14:22:46 +0800
Subject: [PATCH] vbo: introduce vbo_get_minmax_indices function

Introduce vbo_get_minmax_indices() function to handle the min/max index
computation for nr_prims(>= 1). The old code just compute the first
prim's min/max index; this would results an error rendering if user
called functions like glMultiDrawElements(). This patch servers as
fixing this issue.

As when nr_prims = 1, we can pass 1 to paramter nr_prims, thus I made
vbo_get_minmax_index() static.

v2: per Roland's suggestion, put the indices address compuation into
vbo_get_minmax_index() instead.

Also do comination if possible to reduce map/unmap count

Signed-off-by: Yuanhan Liu 
---
 src/mesa/drivers/dri/i965/brw_draw.c |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c |3 +-
 src/mesa/main/api_validate.c |2 +-
 src/mesa/state_tracker/st_draw.c |3 +-
 src/mesa/state_tracker/st_draw_feedback.c|2 +-
 src/mesa/tnl/t_draw.c|2 +-
 src/mesa/vbo/vbo.h   |6 ++--
 src/mesa/vbo/vbo_exec_array.c|   49 +
 8 files changed, 52 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index 621195d..f50fffd 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -586,7 +586,7 @@ void brw_draw_prims( struct gl_context *ctx,
 
if (!vbo_all_varyings_in_vbos(arrays)) {
   if (!index_bounds_valid)
-vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index);
+vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, 
nr_prims);
 
   /* Decide if we want to rebase.  If so we end up recursing once
* only into this function.
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index de04d18..59f1542 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -437,7 +437,8 @@ TAG(vbo_render_prims)(struct gl_context *ctx,
struct nouveau_render_state *render = to_render_state(ctx);
 
if (!index_bounds_valid)
-   vbo_get_minmax_index(ctx, prims, ib, &min_index, &max_index);
+   vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
+  nr_prims);
 
vbo_choose_render_mode(ctx, arrays);
vbo_choose_attrs(ctx, arrays);
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 945f127..b6871d0 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -184,7 +184,7 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, 
GLenum type,
ib.ptr = indices;
ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
 
-   vbo_get_minmax_index(ctx, &prim, &ib, &min, &max);
+   vbo_get_minmax_indices(ctx, &prim, &ib, &min, &max, 1);
 
if ((int)(min + basevertex) < 0 ||
max + basevertex > ctx->Array.ArrayObj->_MaxElement) {
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 954f15a..6327a4c 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -933,7 +933,8 @@ st_draw_vbo(struct gl_context *ctx,
   /* Gallium probably doesn't want this in some cases. */
   if (!index_bounds_valid)
  if (!all_varyings_in_vbos(arrays))
-vbo_get_minmax_index(ctx, prims, ib, &min_index, &max_index);
+vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
+   nr_prims);
 
   for (i = 0; i < nr_prims; i++) {
  num_instances = MAX2(num_instances, prims[i].num_instances);
diff --git a/src/mesa/state_tracker/st_draw_feedback.c 
b/src/mesa/state_tracker/st_draw_feedback.c
index a99eb2b..f38f44c 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -119,7 +119,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
st_validate_state(st);
 
if (!index_bounds_valid)
-  vbo_get_minmax_index(ctx, prims, ib, &min_index, &max_index);
+  vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index, nr_prims);
 
/* must get these after state valida

[Mesa-dev] [PATCH] glx/dri2: print FPS when env var MESA_SHOW_FPS is 1

2012-01-03 Thread Marek Olšák
This is useful for apps which don't print FPS.
Only enabled in SwapBuffers.
---
 src/glx/dri2_glx.c |   36 +++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index a9bcebf..394823a 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "xf86drm.h"
 #include "dri2.h"
 #include "dri_common.h"
@@ -90,12 +91,17 @@ struct dri2_screen {
 
void *driver;
int fd;
+
+   Bool show_fps;
 };
 
 struct dri2_context
 {
struct glx_context base;
__DRIcontext *driContext;
+
+   double previous_time;
+   unsigned frames;
 };
 
 struct dri2_drawable
@@ -576,6 +582,26 @@ unsigned dri2GetSwapEventType(Display* dpy, XID drawable)
   return glx_dpy->codes->first_event + GLX_BufferSwapComplete;
 }
 
+static void show_fps()
+{
+   struct glx_context *gc = __glXGetCurrentContext();
+   struct dri2_context *ctx = (struct dri2_context *)gc;
+   struct timeval tv;
+   double current_time;
+
+   gettimeofday(&tv, 0);
+   current_time = (double)tv.tv_sec + (double)tv.tv_usec * 0.01;
+
+   ctx->frames++;
+
+   if (ctx->previous_time + 1 < current_time) {
+  fprintf(stderr, "Mesa: FPS = %.1f\n",
+  ctx->frames / (current_time - ctx->previous_time));
+  ctx->frames = 0;
+  ctx->previous_time = current_time;
+   }
+}
+
 static int64_t
 dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
int64_t remainder)
@@ -611,9 +637,14 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t 
target_msc, int64_t divisor,
 
DRI2SwapBuffers(psc->base.dpy, pdraw->xDrawable,
   target_msc, divisor, remainder, &ret);
+
 #endif
 }
 
+if (psc->show_fps) {
+   show_fps();
+}
+
 /* Old servers don't send invalidate events */
 if (!pdp->invalidateAvailable)
dri2InvalidateBuffers(dpyPriv->dpy, pdraw->xDrawable);
@@ -870,7 +901,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
struct dri2_screen *psc;
__GLXDRIscreen *psp;
struct glx_config *configs = NULL, *visuals = NULL;
-   char *driverName, *deviceName;
+   char *driverName, *deviceName, *tmp;
drm_magic_t magic;
int i;
 
@@ -1002,6 +1033,9 @@ dri2CreateScreen(int screen, struct glx_display * priv)
Xfree(driverName);
Xfree(deviceName);
 
+   tmp = getenv("MESA_SHOW_FPS");
+   psc->show_fps = tmp && strcmp(tmp, "1") == 0;
+
return &psc->base;
 
 handle_error:
-- 
1.7.4.1

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


Re: [Mesa-dev] [PATCH 18/20] mesa: Rewrite the way uniforms are tracked and handled

2012-01-03 Thread Marek Olšák
On Fri, Oct 28, 2011 at 7:42 PM, Ian Romanick  wrote:
> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
> index db2f200..50a724b 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -22,15 +22,16 @@
>  * 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.
>  */
> +#include 
>  #include "main/core.h"
>  #include "main/context.h"
>  #include "ir.h"
>  #include "ir_uniform.h"
> +#include "program/hash_table.h"
>  #include "../glsl/program.h"
>  #include "../glsl/ir_uniform.h"
>
>  extern "C" {
> -#include "main/image.h"
>  #include "main/shaderapi.h"
>  #include "main/shaderobj.h"
>  #include "uniforms.h"
> @@ -44,42 +45,30 @@ _mesa_GetActiveUniformARB(GLhandleARB program, GLuint 
> index,
>    GET_CURRENT_CONTEXT(ctx);
>    struct gl_shader_program *shProg =
>       _mesa_lookup_shader_program_err(ctx, program, "glGetActiveUniform");
> -   const struct gl_program_parameter *param;
>
>    if (!shProg)
>       return;
>
> -   if (!shProg->Uniforms || index >= shProg->Uniforms->NumUniforms) {
> +   if (index >= shProg->NumUserUniformStorage) {
>       _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)");
>       return;
>    }
>
> -   param = get_uniform_parameter(shProg, index);
> -   if (!param)
> -      return;
> -
> -   const struct gl_uniform *const uni = &shProg->Uniforms->Uniforms[index];
> +   const struct gl_uniform_storage *const uni = 
> &shProg->UniformStorage[index];
>
>    if (nameOut) {
> -      _mesa_copy_string(nameOut, maxLength, length, param->Name);
> +      _mesa_copy_string(nameOut, maxLength, length, uni->name);
>    }
>
>    if (size) {
> -      GLint typeSize = _mesa_sizeof_glsl_type(uni->Type->gl_type);
> -      if ((GLint) param->Size > typeSize) {
> -         /* This is an array.
> -          * Array elements are placed on vector[4] boundaries so they're
> -          * a multiple of four floats.  We round typeSize up to next multiple
> -          * of four to get the right size below.
> -          */
> -         typeSize = (typeSize + 3) & ~3;
> -      }
> -      /* Note that the returned size is in units of the , not bytes */
> -      *size = param->Size / typeSize;
> +      /* array_elements is zero for non-arrays, but the API requires that 1 
> be
> +       * returned.
> +       */
> +      *size = MAX2(1, uni->array_elements);
>    }
>
>    if (type) {
> -      *type = uni->Type->gl_type;
> +      *type = uni->type->gl_type;
>    }
>  }
>
> @@ -409,12 +398,21 @@ validate_uniform_parameters(struct gl_context *ctx,
>
>    _mesa_uniform_split_location_offset(location, loc, array_index);
>
> -   if (*loc >= shProg->Uniforms->NumUniforms) {
> +   if (*loc >= shProg->NumUserUniformStorage) {
>       _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
>                  caller, location);
>       return false;
>    }
>
> +   /* This case should be impossible.  The implication is that a call like
> +    * glGetUniformLocation(prog, "foo[8]") was successful but "foo" is not an
> +    * array.
> +    */
> +   if (*array_index != 0 && shProg->UniformStorage[*loc].array_elements == 
> 0) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
> +                 caller, location);
> +      return false;
> +   }
>    return true;
>  }
>
> @@ -423,72 +421,81 @@ validate_uniform_parameters(struct gl_context *ctx,
>  */
>  extern "C" void
>  _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
> -                 GLsizei bufSize, GLenum returnType, GLvoid *paramsOut)
> +                 GLsizei bufSize, enum glsl_base_type returnType,
> +                 GLvoid *paramsOut)
>  {
>    struct gl_shader_program *shProg =
>       _mesa_lookup_shader_program_err(ctx, program, "glGetUniformfv");
> -   struct gl_program *prog;
> -   GLint paramPos;
> +   struct gl_uniform_storage *uni;
>    unsigned loc, offset;
>
>    if (!validate_uniform_parameters(ctx, shProg, location, 1,
>                                    &loc, &offset, "glGetUniform", true))
>       return;
>
> -   if (!find_uniform_parameter_pos(shProg, loc, &prog, ¶mPos)) {
> -      _mesa_error(ctx, GL_INVALID_OPERATION,  "glGetUniformfv(location)");
> -   }
> -   else {
> -      const struct gl_program_parameter *p =
> -         &prog->Parameters->Parameters[paramPos];
> -      gl_constant_value (*values)[4];
> -      GLint rows, cols, i, j, k;
> -      GLsizei numBytes;
> -      GLenum storage_type;
> -
> -      values = prog->Parameters->ParameterValues + paramPos + offset;
> -
> -      get_uniform_rows_cols(p, &rows, &cols);
> -
> -      numBytes = rows * cols * _mesa_sizeof_type(returnType);
> -      if (bufSize < numBytes) {
> -         _mesa_error( ctx, GL_INVALID_OPERATION,
> -                     "glGetnUniformfvARB(out of bounds: bufSize is %d,"
> -                     " but %d bytes are required)", bufSize, numBytes )

[Mesa-dev] [PATCH] mesa: Fix transform feedback of unsubscripted arrays.

2012-01-03 Thread Paul Berry
It is not explicitly stated in the GL 3.0 spec that transform feedback
can be performed on a whole varying array (without supplying a
subscript).  However, it seems clear from context that this was the
intent.  Section 2.15 (TransformFeedback) says this:

When writing varying variables that are arrays, individual array
elements are written in order.

And section 2.20.3 (Shader Variables), says this, in the description
of GetTransformFeedbackVarying:

For the selected varying variable, its type is returned into
type. The size of the varying is returned into size. The value in
size is in units of the type returned in type.

If it were not possible to perform transform feedback on an
unsubscripted array, the returned size would always be 1.

This patch fixes the linker so that transform feedback on an
unsubscripted array is supported.

Fixes piglit tests "EXT_transform_feedback/builtin-varyings
gl_ClipDistance[{4,8}]-no-subscript" and
"EXT_transform_feedback/output_type *[2]-no-subscript".

Note: on back-ends that set
gl_shader_compiler_options::LowerClipDistance (for example i965),
tests "EXT_transform_feedback/builtin-varyings
gl_ClipDistance[{1,2,3,5,6,7}]" still fail.  I hope to address this in
a later patch.
---
 src/glsl/linker.cpp |   99 ---
 1 files changed, 54 insertions(+), 45 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 45edafb..883a635 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1426,12 +1426,12 @@ private:
/**
 * True if the declaration in orig_name represents an array.
 */
-   bool is_array;
+   bool is_subscripted;
 
/**
-* If is_array is true, the array index that was specified in orig_name.
+* If is_subscripted is true, the subscript that was specified in orig_name.
 */
-   unsigned array_index;
+   unsigned array_subscript;
 
/**
 * Which component to extract from the vertex shader output location that
@@ -1460,6 +1460,12 @@ private:
 
/** Type of the varying returned by glGetTransformFeedbackVarying() */
GLenum type;
+
+   /**
+* If location != -1, the size that should be returned by
+* glGetTransformFeedbackVarying().
+*/
+   unsigned size;
 };
 
 
@@ -1484,14 +1490,14 @@ tfeedback_decl::init(struct gl_context *ctx, struct 
gl_shader_program *prog,
 
if (bracket) {
   this->var_name = ralloc_strndup(mem_ctx, input, bracket - input);
-  if (sscanf(bracket, "[%u]", &this->array_index) != 1) {
+  if (sscanf(bracket, "[%u]", &this->array_subscript) != 1) {
  linker_error(prog, "Cannot parse transform feedback varying %s", 
input);
  return false;
   }
-  this->is_array = true;
+  this->is_subscripted = true;
} else {
   this->var_name = ralloc_strdup(mem_ctx, input);
-  this->is_array = false;
+  this->is_subscripted = false;
}
 
/* For drivers that lower gl_ClipDistance to gl_ClipDistanceMESA, we need
@@ -1501,8 +1507,10 @@ tfeedback_decl::init(struct gl_context *ctx, struct 
gl_shader_program *prog,
if (ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].LowerClipDistance &&
strcmp(this->var_name, "gl_ClipDistance") == 0) {
   this->var_name = "gl_ClipDistanceMESA";
-  this->single_component = this->array_index % 4;
-  this->array_index /= 4;
+  if (this->is_subscripted) {
+ this->single_component = this->array_subscript % 4;
+ this->array_subscript /= 4;
+  }
}
 
return true;
@@ -1518,9 +1526,9 @@ tfeedback_decl::is_same(const tfeedback_decl &x, const 
tfeedback_decl &y)
 {
if (strcmp(x.var_name, y.var_name) != 0)
   return false;
-   if (x.is_array != y.is_array)
+   if (x.is_subscripted != y.is_subscripted)
   return false;
-   if (x.is_array && x.array_index != y.array_index)
+   if (x.is_subscripted && x.array_subscript != y.array_subscript)
   return false;
if (x.single_component != y.single_component)
   return false;
@@ -1542,37 +1550,39 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
 {
if (output_var->type->is_array()) {
   /* Array variable */
-  if (!this->is_array) {
- linker_error(prog, "Transform feedback varying %s found, "
-  "but array dereference required for varying %s[%d]).",
-  this->orig_name,
- output_var->name, output_var->type->length);
- return false;
-  }
-  /* Check array bounds. */
-  if (this->array_index >=
-  (unsigned) output_var->type->array_size()) {
- linker_error(prog, "Transform feedback varying %s has index "
-  "%i, but the array size is %i.",
-  this->orig_name, this->array_index,
-  output_var->type->array_size());
- return false;
-  }
   const unsigned matrix_cols =
  output_var->type->fields.array->matrix_columns;
-  this->loc

Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-03 Thread Gaetan Nadon
On 12-01-03 03:27 PM, Ian Romanick wrote:
> On 01/03/2012 11:13 AM, Mike Lothian wrote:
>> Hi
>>
>> Ever since these tests went in I get failures during configure:
>>
>>
>> configure: creating ./config.status
>> config.status: creating configs/autoconf
>> config.status: error: cannot find input file: `tests/Makefile.in'
>>
>> Before I raise a bug am I doing something stupid?
>
> It's possible that I didn't get the automake magic right when gtest
> isn't installed.  Is the program gtest-config in your path?
This is usually because tests/Makefile.in did not get generataed by
Automake. This is most likely to happen from a tarball where Makefile.in
was not distributed. I noticed the toplevel Makefile does not navigate
down to the tests subdir, so make dist would probably not include
Makefile.in. You have "inserted" an orphan Automake subdir so there is
probably some additional wiring to do. There is a section in the
Automake manual to integrate custom makefiles, but I don't know if it
covers your scenario.
> ___
> xorg-de...@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>

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


Re: [Mesa-dev] [PATCH] glx/dri2: print FPS when env var MESA_SHOW_FPS is 1

2012-01-03 Thread Michel Dänzer
On Mit, 2012-01-04 at 06:05 +0100, Marek Olšák wrote: 
> This is useful for apps which don't print FPS.
> Only enabled in SwapBuffers.
> ---
>  src/glx/dri2_glx.c |   36 +++-
>  1 files changed, 35 insertions(+), 1 deletions(-)
> 
> diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
> index a9bcebf..394823a 100644
> --- a/src/glx/dri2_glx.c
> +++ b/src/glx/dri2_glx.c
> @@ -576,6 +582,26 @@ unsigned dri2GetSwapEventType(Display* dpy, XID drawable)
>return glx_dpy->codes->first_event + GLX_BufferSwapComplete;
>  }
>  
> +static void show_fps()
> +{
> +   struct glx_context *gc = __glXGetCurrentContext();
> +   struct dri2_context *ctx = (struct dri2_context *)gc;

glXSwapBuffers doesn't require a current context (or that the drawable
being swapped is bound to the current context). The information should
probably be tracked per drawable instead.


> @@ -611,9 +637,14 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t 
> target_msc, int64_t divisor,
>  
> DRI2SwapBuffers(psc->base.dpy, pdraw->xDrawable,
>  target_msc, divisor, remainder, &ret);
> +

Spurious whitespace-only change.


> #endif
>  }
>  
> +if (psc->show_fps) {
> +   show_fps();
> +}
> +
>  /* Old servers don't send invalidate events */
>  if (!pdp->invalidateAvailable)
> dri2InvalidateBuffers(dpyPriv->dpy, pdraw->xDrawable);

This really measures how quickly requests are sent to the X server. When
possible, it might be more accurate to use the information from the
completion events instead. Not a blocker though.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev