Re: [Mesa-dev] [Mesa-announce] Mesa 9.2 release candidate 2

2013-08-23 Thread Andreas Boll
2013/8/23 Ian Romanick i...@freedesktop.org:
 Mesa 9.2 release candidate 2 is now available for testing.

 The tag in the GIT repository for Mesa 9.2-rc2 is 'mesa-9.2-rc2'.

 Mesa 9.2 release candidate 2 is available for download at
 ftp://freedesktop.org/pub/mesa/9.2/

 md5sums:

 4cde5bbe49658431951e6f51814a9c05  MesaLib-9.2.0-rc2.tar.gz
 1b06e7a85fed9b571764affaea51e3e6  MesaLib-9.2.0-rc2.tar.bz2
 4a528e491c76e387ba9c6d77e690e4df  MesaLib-9.2.0-rc2.zip

 I have verified building from the .tar.bz2 file by doing:

 tar -xjf Mesa-9.2.0-rc1.tar.bz2
 cd Mesa-9.2.0-rc1
 ./configure --enable-gallium-llvm --with-llvm-shared-libs
 make -j6
 make install

 I have also verified that I pushed the tag.

I doubt that.


 Baring any unforeseen catastrophes, Mesa 9.2 will be released on Tuesday,
 August 27th.  I will ping people on freenode #dri-devel before making the
 final release.

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


Re: [Mesa-dev] [PATCH] [RFC] r600g: enable SB backend by default

2013-08-23 Thread Christian König

Am 22.08.2013 18:20, schrieb Vadim Girlin:

Signed-off-by: Vadim Girlin vadimgir...@gmail.com


Sounds good if it's stable enough.

Reviewed-by: Christian König christian.koe...@amd.com


---
  src/gallium/drivers/r600/r600_asm.c| 3 ++-
  src/gallium/drivers/r600/r600_pipe.c   | 4 ++--
  src/gallium/drivers/r600/r600_pipe.h   | 2 +-
  src/gallium/drivers/r600/r600_shader.c | 2 +-
  4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c 
b/src/gallium/drivers/r600/r600_asm.c
index b8eedae..a0492a6 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -2281,7 +2281,8 @@ void *r600_create_vertex_fetch_shader(struct pipe_context 
*ctx,
uint32_t *bytecode;
int i, j, r, fs_size;
struct r600_fetch_shader *shader;
-   unsigned sb_disasm = rctx-screen-debug_flags  (DBG_SB_DISASM | 
DBG_SB);
+   unsigned no_sb = rctx-screen-debug_flags  DBG_NO_SB;
+   unsigned sb_disasm = !no_sb || (rctx-screen-debug_flags  
DBG_SB_DISASM);
  
  	assert(count  32);
  
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c

index 2be5910..edd50f0 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -67,8 +67,8 @@ static const struct debug_named_value debug_options[] = {
{ noinvalrange, DBG_NO_DISCARD_RANGE, Disable handling of 
INVALIDATE_RANGE map flags },
  
  	/* shader backend */

-   { sb, DBG_SB, Enable optimization of graphics shaders },
-   { sbcl, DBG_SB_CS, Enable optimization of compute shaders },
+   { nosb, DBG_NO_SB, Disable sb backend for graphics shaders },
+   { sbcl, DBG_SB_CS, Enable sb backend for compute shaders },
{ sbdry, DBG_SB_DRY_RUN, Don't use optimized bytecode (just print the 
dumps) },
{ sbstat, DBG_SB_STAT, Print optimization statistics for shaders },
{ sbdump, DBG_SB_DUMP, Print IR dumps after some optimization 
passes },
diff --git a/src/gallium/drivers/r600/r600_pipe.h 
b/src/gallium/drivers/r600/r600_pipe.h
index 21d68c9..398ac89 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -249,7 +249,7 @@ typedef boolean (*r600g_dma_blit_t)(struct pipe_context 
*ctx,
  #define DBG_NO_ASYNC_DMA  (1  19)
  #define DBG_NO_DISCARD_RANGE  (1  20)
  /* shader backend */
-#define DBG_SB (1  21)
+#define DBG_NO_SB  (1  21)
  #define DBG_SB_CS (1  22)
  #define DBG_SB_DRY_RUN(1  23)
  #define DBG_SB_STAT   (1  24)
diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index fb766c4..1563430 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -140,7 +140,7 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
int r, i;
uint32_t *ptr;
bool dump = r600_can_dump_shader(rctx-screen, 
tgsi_get_processor_type(sel-tokens));
-   unsigned use_sb = rctx-screen-debug_flags  DBG_SB;
+   unsigned use_sb = !(rctx-screen-debug_flags  DBG_NO_SB);
unsigned sb_disasm = use_sb || (rctx-screen-debug_flags  
DBG_SB_DISASM);
  
  	shader-shader.bc.isa = rctx-isa;


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


[Mesa-dev] mesa compiling problem

2013-08-23 Thread ZhiLi
Hi every one,
I am trying to compile Mesa Library version 9.0.3. There is an error,
 ../../../src/mapi/mapi/stub.c: error: ‘MAPI_TABLE_NUM_STATIC’ undeclared here 
(not in a function)I trace the source code, and find it is not defined.Did this 
happen to anyone? Can anyone give me some help?Thanks in advance.
Li Zhi___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] gallium/osmesa: Always link with the c++ linker.

2013-08-23 Thread Jon Severinsson
Just like all other gallium targets...

CC: 9.2 mesa-sta...@lists.freedesktop.org
---
 src/gallium/targets/osmesa/Makefile.am |   11 ++-
 1 fil ändrad, 2 tillägg(+), 9 borttagningar(-)

diff --git a/src/gallium/targets/osmesa/Makefile.am 
b/src/gallium/targets/osmesa/Makefile.am
index de78d8cc..25fee6f4 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -57,19 +57,12 @@ lib@OSMESA_LIB@_la_LIBADD = \
$(CLOCK_LIB)
 
 
+nodist_EXTRA_lib@OSMESA_LIB@_la_SOURCES = dummy.cpp
 
 if HAVE_MESA_LLVM
-lib@OSMESA_LIB@_la_LINK = $(CXXLINK) $(lib@OSMESA_LIB@_la_LDFLAGS)
-# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
-nodist_EXTRA_lib@OSMESA_LIB@_la_SOURCES = dummy-cpp.cpp
-
-lib@OSMESA_LIB@_la_LIBADD += 
$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
 lib@OSMESA_LIB@_la_LDFLAGS += $(LLVM_LDFLAGS)
-else
-lib@OSMESA_LIB@_la_LINK = $(CXXLINK) $(lib@OSMESA_LIB@_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_lib@OSMESA_LIB@_la_SOURCES = dummy-c.c
+lib@OSMESA_LIB@_la_LIBADD += 
$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
 endif
 
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 1/3] gallium/osmesa: Make and install an osmesa.pc.

2013-08-23 Thread Jon Severinsson
As of 2f142d59 build: Add --enable-gallium-osmesa flag. the pkgconfig
file from classic osmesa is no longer installed when building gallium
osmesa, so copy it to gallium osmesa and install the copy instead.

CC: 9.2 mesa-sta...@lists.freedesktop.org
---
 configure.ac|1 +
 src/gallium/targets/osmesa/Makefile.am  |5 ++---
 src/gallium/targets/osmesa/osmesa.pc.in |   12 
 3 filer ändrade, 15 tillägg(+), 3 borttagningar(-)
 create mode 100644 src/gallium/targets/osmesa/osmesa.pc.in

diff --git a/configure.ac b/configure.ac
index 95d9b721..9644914b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2066,6 +2066,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/gbm/Makefile
src/gallium/targets/opencl/Makefile
src/gallium/targets/osmesa/Makefile
+   src/gallium/targets/osmesa/osmesa.pc
src/gallium/targets/pipe-loader/Makefile
src/gallium/targets/libgl-xlib/Makefile
src/gallium/targets/vdpau-nouveau/Makefile
diff --git a/src/gallium/targets/osmesa/Makefile.am 
b/src/gallium/targets/osmesa/Makefile.am
index 38dbeb85..de78d8cc 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -85,6 +85,5 @@ all-local: lib@OSMESA_LIB@.la
cp .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@.0.0 
$(top_builddir)/$(LIB_DIR)/gallium/
 endif
 
-# XXX fix-up?
-#pkgconfigdir = $(libdir)/pkgconfig
-#pkgconfig_DATA = osmesa.pc
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = osmesa.pc
diff --git a/src/gallium/targets/osmesa/osmesa.pc.in 
b/src/gallium/targets/osmesa/osmesa.pc.in
new file mode 100644
index ..cd77fd76
--- /dev/null
+++ b/src/gallium/targets/osmesa/osmesa.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: osmesa
+Description: Mesa Off-screen Rendering library
+Requires: @OSMESA_PC_REQ@
+Version: @OSMESA_VERSION@
+Libs: -L${libdir} -l@OSMESA_LIB@
+Libs.private: @OSMESA_PC_LIB_PRIV@
+Cflags: -I${includedir}
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 3/3] gallium/osmesa: Link, not copy, the shared library to the LIB_DIR.

2013-08-23 Thread Jon Severinsson
Just like all other mesa libraries...

CC: 9.2 mesa-sta...@lists.freedesktop.org
---
 src/gallium/targets/osmesa/Makefile.am |2 +-
 1 fil ändrad, 1 tillägg(+), 1 borttagning(-)

diff --git a/src/gallium/targets/osmesa/Makefile.am 
b/src/gallium/targets/osmesa/Makefile.am
index 25fee6f4..8e6aff6c 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -75,7 +75,7 @@ all-local: lib@OSMESA_LIB@.la
$(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium;
ln -f .libs/lib@OSMESA_LIB@.so 
$(top_builddir)/$(LIB_DIR)/gallium/lib@OSMESA_LIB@.so;
ln -f .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@ 
$(top_builddir)/$(LIB_DIR)/gallium/lib@OSMESA_LIB@.so.@OSMESA_VERSION@;
-   cp .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@.0.0 
$(top_builddir)/$(LIB_DIR)/gallium/
+   ln -f .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@.0.0 
$(top_builddir)/$(LIB_DIR)/gallium/
 endif
 
 pkgconfigdir = $(libdir)/pkgconfig
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH] mesa: Fix assertion error with glDebugMessageControl

2013-08-23 Thread Brian Paul

On 08/22/2013 05:33 PM, Timothy Arceri wrote:

Hi guys,

As I'm yet to receive feedback I thought I'd explain more thoroughly what my 
patch does to make reviewing it easier.

Currently glDebugMessageControlARB() ALWAYS throws an assertion whenever the 
count parameter it set to anything greater than 0.
This is because the gl_enum_to_debug_* functions are called twice which means 
that type, severity and source are ALWAYS equal
to MESA_DEBUG_*_COUNT
I also removed the assert because _mesa_DebugMessageControlARB already does 
this same test and returns with an GL_INVALID_OPERATION
error so the assert would never be true once the extra enum conversion is 
removed.

As this is a bug that stops glDebugMessageControlARB() from working properly I 
would also say this is probably a good candidate for the stable branches.

Thanks for your time,
Tim



- Original Message -
From: Timothy Arceri t_arc...@yahoo.com.au
To: mesa-dev@lists.freedesktop.org
Cc: Timothy Arceri t_arc...@yahoo.com.au
Sent: Wednesday, 21 August 2013 4:18 PM
Subject: [PATCH] mesa: Fix assertion error with glDebugMessageControl

enums were being converted twice resulting in incorrect values.
The extra conversion has been remove and the redundant assert is
removed also.

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
---
src/mesa/main/errors.c | 15 ++-
1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 5a0758d..cc93d3b 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -609,11 +609,6 @@ control_app_messages(struct gl_context *ctx, GLenum 
esource, GLenum etype,
 enum mesa_debug_type type = gl_enum_to_debug_type(etype);
 enum mesa_debug_severity severity = gl_enum_to_debug_severity(eseverity);

-   if (count)
-  assert(severity == MESA_DEBUG_SEVERITY_COUNT
-  type != MESA_DEBUG_TYPE_COUNT
-  source != MESA_DEBUG_SOURCE_COUNT);
-
 for (i = 0; i  count; i++)
set_message_state(ctx, source, type, ids[i], enabled);

@@ -629,9 +624,6 @@ _mesa_DebugMessageControlARB(GLenum gl_source, GLenum 
gl_type,
   GLsizei count, const GLuint *ids,
   GLboolean enabled)
{
-   enum mesa_debug_source source;
-   enum mesa_debug_type type;
-   enum mesa_debug_severity severity;
 GET_CURRENT_CONTEXT(ctx);

 if (count  0) {
@@ -651,11 +643,8 @@ _mesa_DebugMessageControlARB(GLenum gl_source, GLenum 
gl_type,
return;
 }

-   source = gl_enum_to_debug_source(gl_source);
-   type = gl_enum_to_debug_type(gl_type);
-   severity = gl_enum_to_debug_severity(gl_severity);
-
-   control_app_messages(ctx, source, type, severity, count, ids, enabled);
+   control_app_messages(ctx, gl_source, gl_type, gl_severity,
+count, ids, enabled);
}

void GLAPIENTRY



Looks good.  Thanks.

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

I presume you need someone to commit this for you- I'll take care of 
that and mark this for the 9.2 branch.


-Brian

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


Re: [Mesa-dev] [PATCH] i965: Remove redundant (and uninitialized) field vec4_generator::ctx.

2013-08-23 Thread Ian Romanick

On 08/22/2013 05:23 PM, Paul Berry wrote:

We never noticed that this field was uninitialized because it is only
used in an error path that reports internal Mesa errors.

But it's silly to have it around anyway because brw-ctx is
equivalent.

Should fix Coverity defect CID 1063351: Uninitialized pointer field
(UNINIT_CTOR) /src/mesa/drivers/dri/i965/brw_vec4_emit.cpp: 148


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


---
  src/mesa/drivers/dri/i965/brw_vec4.h| 1 -
  src/mesa/drivers/dri/i965/brw_vec4_emit.cpp | 4 ++--
  2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index 111b105..894ff1d 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -599,7 +599,6 @@ private:
 void mark_surface_used(unsigned surf_index);

 struct brw_context *brw;
-   struct gl_context *ctx;

 struct brw_compile *p;

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index ce9bcd0..0364ced 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -893,10 +893,10 @@ 
vec4_generator::generate_vec4_instruction(vec4_instruction *instruction,

 default:
if (inst-opcode  (int) ARRAY_SIZE(opcode_descs)) {
- _mesa_problem(ctx, Unsupported opcode in `%s' in VS\n,
+ _mesa_problem(brw-ctx, Unsupported opcode in `%s' in VS\n,
 opcode_descs[inst-opcode].name);
} else {
- _mesa_problem(ctx, Unsupported opcode %d in VS, inst-opcode);
+ _mesa_problem(brw-ctx, Unsupported opcode %d in VS, inst-opcode);
}
abort();
 }



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


Re: [Mesa-dev] [PATCH 02/15] glsl: Add support for new fma built-in in ARB_gpu_shader5.

2013-08-23 Thread Ian Romanick

Constant folding support?

On 08/22/2013 04:08 PM, Matt Turner wrote:

---
  src/glsl/ir.cpp| 1 +
  src/glsl/ir.h  | 7 +++
  src/glsl/ir_validate.cpp   | 1 +
  src/mesa/program/ir_to_mesa.cpp| 1 +
  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 +
  5 files changed, 11 insertions(+)

diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 99dceac..c6d96d8 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -515,6 +515,7 @@ static const char *const operator_strs[] = {
 bfm,
 ubo_load,
 vector_extract,
+   fma,
 lrp,
 bfi,
 bitfield_extract,
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 62e3b27..b45e6cb 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -1169,6 +1169,13 @@ enum ir_expression_operation {
  */
 ir_last_binop = ir_binop_vector_extract,

+   /**
+* \name Fused floating-point multiply-add, part of ARB_gpu_shader5.
+*/
+   /*@{*/
+   ir_triop_fma,
+   /*@}*/
+
 ir_triop_lrp,

 /**
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index ce96f68..37f26fe 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -522,6 +522,7 @@ ir_validate::visit_leave(ir_expression *ir)
ir-operands[1]-type-is_integer());
break;

+   case ir_triop_fma:
 case ir_triop_lrp:
assert(ir-operands[0]-type-base_type == GLSL_TYPE_FLOAT);
assert(ir-operands[0]-type == ir-operands[1]-type);
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index f612f41..340a449 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1492,6 +1492,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir)

 case ir_binop_vector_extract:
 case ir_binop_bfm:
+   case ir_triop_fma:
 case ir_triop_bfi:
 case ir_triop_bitfield_extract:
 case ir_triop_vector_insert:
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 4e29e45..37779d4 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1972,6 +1972,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
 case ir_unop_find_msb:
 case ir_unop_find_lsb:
 case ir_binop_bfm:
+   case ir_triop_fma:
 case ir_triop_bfi:
 case ir_triop_bitfield_extract:
 case ir_quadop_bitfield_insert:



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


[Mesa-dev] [PATCH] radeonsi: Also set the depth component mask bit for stencil-only exports

2013-08-23 Thread Michel Dänzer
From: Michel Dänzer michel.daen...@amd.com

The stencil values come out wrong without this for some reason.

50 more little piglits.

Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Michel Dänzer michel.daen...@amd.com
---
 src/gallium/drivers/radeonsi/radeonsi_shader.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c 
b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index a1dec17..2b1928a 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -826,7 +826,10 @@ handle_semantic:
args[7] =
args[8] =
args[6] = LLVMBuildLoad(base-gallivm-builder, 
out_ptr, );
-   mask |= 0x2;
+   /* Only setting the stencil component bit (0x2) here
+* breaks some stencil piglit tests
+*/
+   mask |= 0x3;
 
if (depth_index  0)
args[5] = args[6];
-- 
1.8.4.rc3

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


Re: [Mesa-dev] mesa compiling problem

2013-08-23 Thread Brian Paul

On 08/23/2013 05:13 AM, ZhiLi wrote:

Hi every one,

I am trying to compile Mesa Library version 9.0.3. There is an error,

../../../src/mapi/mapi/stub.c: error: ‘MAPI_TABLE_NUM_STATIC’


undeclared here (not in a function)


I trace the source code, and find it is not defined.

Did this happen to anyone? Can anyone give me some help?

Thanks in advance.


I don't see where that would be defined either, but haven't run into 
this issue either.


What's your ./configure or ./autogen.sh command line?

-Brian


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


Re: [Mesa-dev] [PATCH 03/15] i965/fs: Add support for translating ir_triop_fma into MAD.

2013-08-23 Thread Paul Berry
On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:

 ---
  src/mesa/drivers/dri/i965/brw_fs.cpp | 1 +
  src/mesa/drivers/dri/i965/brw_fs.h   | 1 +
  src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp | 1 +
  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 7 +++
  4 files changed, 10 insertions(+)

 diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
 b/src/mesa/drivers/dri/i965/brw_fs.cpp
 index 52fa6f4..b770c0e 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
 @@ -179,6 +179,7 @@ ALU3(BFI2)
  ALU1(FBH)
  ALU1(FBL)
  ALU1(CBIT)
 +ALU3(MAD)

  /** Gen4 predicated IF. */
  fs_inst *
 diff --git a/src/mesa/drivers/dri/i965/brw_fs.h
 b/src/mesa/drivers/dri/i965/brw_fs.h
 index 9d240b5..cb4ac3b 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.h
 +++ b/src/mesa/drivers/dri/i965/brw_fs.h
 @@ -285,6 +285,7 @@ public:
 fs_inst *FBH(fs_reg dst, fs_reg value);
 fs_inst *FBL(fs_reg dst, fs_reg value);
 fs_inst *CBIT(fs_reg dst, fs_reg value);
 +   fs_inst *MAD(fs_reg dst, fs_reg c, fs_reg b, fs_reg a);

 int type_size(const struct glsl_type *type);
 fs_inst *get_instruction_generating_reg(fs_inst *start,
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 index 4afae24..fa02d9b 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 @@ -360,6 +360,7 @@
 ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
assert(!not yet supported);
break;

 +   case ir_triop_fma:
 case ir_triop_lrp:
 case ir_triop_bitfield_extract:
for (i = 0; i  vector_elements; i++) {
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 index 964ad40..ac85d25 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 @@ -717,6 +717,13 @@ fs_visitor::visit(ir_expression *ir)
break;
 }

 +   case ir_triop_fma:
 +  /* Note that the instruction's argument order is reversed from GLSL
 +   * and the IR.
 +   */
 +  emit(MAD(this-result, op[2], op[1], op[0]));
 +  break;
 +


What happens if one of the ops is in a form that we can't encode in a 3-op
instruction (e.g. a constant)?  That's handled in patch 4/15 for the vs,
and it's handled inside emit_lrp, but I don't see it handled here.


 case ir_triop_lrp:
emit_lrp(this-result, op[0], op[1], op[2]);
break;
 --
 1.8.3.2

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

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


Re: [Mesa-dev] [PATCH 05/15] glsl: Add new {fr, ld}exp built-ins IR and prototypes.

2013-08-23 Thread Paul Berry
On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:

 ---
  src/glsl/builtins/ir/frexp.ir   | 25
 +
  src/glsl/builtins/ir/ldexp.ir   | 25
 +
  src/glsl/builtins/profiles/ARB_gpu_shader5.glsl | 10 ++
  3 files changed, 60 insertions(+)
  create mode 100644 src/glsl/builtins/ir/frexp.ir
  create mode 100644 src/glsl/builtins/ir/ldexp.ir

 diff --git a/src/glsl/builtins/ir/frexp.ir b/src/glsl/builtins/ir/frexp.ir
 new file mode 100644
 index 000..a514994
 --- /dev/null
 +++ b/src/glsl/builtins/ir/frexp.ir
 @@ -0,0 +1,25 @@
 +((function frexp
 +   (signature float
 + (parameters
 +   (declare (in) float x)
 +   (declare (out) int exp))
 + ((return (expression float frexp (var_ref x) (var_ref exp)


Having an ir_expression that writes to one of its parameters is going to
break assumptions in a lot of our optimization passes.  For example, if
opt_tree_grafting encounters this code:

uniform float u;
void main()
{
  int exp;
  float f = frexp(u, out exp);
  float g = float(exp)/256.0;
  float h = float(exp) + 1.0;
  gl_FragColor = vec4(f, g, h, g + h);
}

it may try to optimize it to this:

uniform float u;
void main()
{
  int exp;
  float g = float(exp)/256.0;
  float h = float(exp) + 1.0;
  gl_FragColor = vec4(frexp(u, out exp), g, h, g + h);
}

I think what we need to do is either:

1. Punt on the frexp_to_arith lowering pass for now, and instead just put
the lowered code right here, or

2. In patch 7, replace ir_binop_frexp with two unary ops, one that computes
the mantissa (return value of frexp()), and one that computes the integer
exponent.  Then this code will be effectively:

float frexp(float x, out int exp)
{
   exp = ir_unop_frexp_mantissa(x);
   return ir_unop_frexp_exponent(x);
}

 I'm leaning toward option 1, because I suspect it will generate more
efficient code (option 2 is likely to cause the if test in frexp_to_arith
to be duplicated).


 +
 +   (signature vec2
 + (parameters
 +   (declare (in) vec2 x)
 +   (declare (out) ivec2 exp))
 + ((return (expression vec2 frexp (var_ref x) (var_ref exp)
 +
 +   (signature vec3
 + (parameters
 +   (declare (in) vec3 x)
 +   (declare (out) ivec3 exp))
 + ((return (expression vec3 frexp (var_ref x) (var_ref exp)
 +
 +   (signature vec4
 + (parameters
 +   (declare (in) vec4 x)
 +   (declare (out) ivec4 exp))
 + ((return (expression vec4 frexp (var_ref x) (var_ref exp)
 +))
 diff --git a/src/glsl/builtins/ir/ldexp.ir b/src/glsl/builtins/ir/ldexp.ir
 new file mode 100644
 index 000..dd25f5a
 --- /dev/null
 +++ b/src/glsl/builtins/ir/ldexp.ir
 @@ -0,0 +1,25 @@
 +((function ldexp
 +   (signature float
 + (parameters
 +   (declare (in) float x)
 +   (declare (in) int exp))
 + ((return (expression float ldexp (var_ref x) (var_ref exp)


Note: ldexp is fine as a binop, since both its parameters are inputs.


 +
 +   (signature vec2
 + (parameters
 +   (declare (in) vec2 x)
 +   (declare (in) ivec2 exp))
 + ((return (expression vec2 ldexp (var_ref x) (var_ref exp)
 +
 +   (signature vec3
 + (parameters
 +   (declare (in) vec3 x)
 +   (declare (in) ivec3 exp))
 + ((return (expression vec3 ldexp (var_ref x) (var_ref exp)
 +
 +   (signature vec4
 + (parameters
 +   (declare (in) vec4 x)
 +   (declare (in) ivec4 exp))
 + ((return (expression vec4 ldexp (var_ref x) (var_ref exp)
 +))
 diff --git a/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl
 b/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl
 index 3f76283..36fc0de 100644
 --- a/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl
 +++ b/src/glsl/builtins/profiles/ARB_gpu_shader5.glsl
 @@ -59,3 +59,13 @@ float fma(float a, float b, float c);
  vec2  fma(vec2  a, vec2  b, vec2  c);
  vec3  fma(vec3  a, vec3  b, vec3  c);
  vec4  fma(vec4  a, vec4  b, vec4  c);
 +
 +float frexp(float x, out int   exp);
 +vec2  frexp(vec2  x, out ivec2 exp);
 +vec3  frexp(vec3  x, out ivec3 exp);
 +vec4  frexp(vec4  x, out ivec4 exp);
 +
 +float ldexp(float x, int   exp);
 +vec2  ldexp(vec2  x, ivec2 exp);
 +vec3  ldexp(vec3  x, ivec3 exp);
 +vec4  ldexp(vec4  x, ivec4 exp);
 --
 1.8.3.2

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

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


Re: [Mesa-dev] [PATCH 08/15] glsl: Add heuristics to print floating-point numbers better.

2013-08-23 Thread Paul Berry
On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:

 ---
  src/glsl/ir_print_visitor.cpp | 12 +++-
  1 file changed, 11 insertions(+), 1 deletion(-)

 diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
 index 541231a..b518310 100644
 --- a/src/glsl/ir_print_visitor.cpp
 +++ b/src/glsl/ir_print_visitor.cpp
 @@ -406,7 +406,17 @@ void ir_print_visitor::visit(ir_constant *ir)
  switch (ir-type-base_type) {
  case GLSL_TYPE_UINT:  printf(%u, ir-value.u[i]); break;
  case GLSL_TYPE_INT:   printf(%d, ir-value.i[i]); break;
 -case GLSL_TYPE_FLOAT: printf(%f, ir-value.f[i]); break;
 +case GLSL_TYPE_FLOAT:
 +if (ir-value.f[i] == 0.0f)
 +   /* 0.0 == -0.0, so print with %f to get the proper sign. */
 +   printf(%.1f, ir-value.f[i]);
 +else if (abs(ir-value.f[i])  0.01f)
 +   printf(%a, ir-value.f[i]);
 +else if (abs(ir-value.f[i])  100.0f)
 +   printf(%e, ir-value.f[i]);
 +else
 +   printf(%f, ir-value.f[i]);
 +break;
  case GLSL_TYPE_BOOL:  printf(%d, ir-value.b[i]); break;
  default: assert(0);
  }


Unfortunately, this patch breaks make check, because
src/glsl/tests/optimization-test does a strict character-by-character diff
between the expected and actual output of optimization passes (I'm not
thrilled that the optimization tests do this, but off hand I can't think of
a better way that wouldn't be a pain to implement).

I believe you can fix it by replacing (0.00) with (0.0) in all the
*.expected files in src/glsl/tests/lower_jumps/.

With the make check issue fixed, this patch is:

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


Re: [Mesa-dev] [PATCH 10/15] i965: Allow immediates to be folded into logical and shift instructions.

2013-08-23 Thread Paul Berry
On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:

 These instructions will be used with immediate arguments in the upcoming
 frexp and ldexp lowering passes.
 ---
  src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 11 +++
  1 file changed, 11 insertions(+)

 diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
 b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
 index 2780ab6..034ebef 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
 @@ -341,9 +341,20 @@ fs_visitor::try_constant_propagate(fs_inst *inst,
 acp_entry *entry)
   progress = true;
   break;

 +  case BRW_OPCODE_SHL:
 +  case BRW_OPCODE_SHR:
 + if (i == 1) {
 +inst-src[i] = entry-src;
 +progress = true;
 + }
 + break;
 +
case BRW_OPCODE_MACH:
case BRW_OPCODE_MUL:
case BRW_OPCODE_ADD:
 +  case BRW_OPCODE_OR:
 +  case BRW_OPCODE_AND:
 +  case BRW_OPCODE_XOR:
   if (i == 1) {
  inst-src[i] = entry-src;
  progress = true;
 --
 1.8.3.2


Shouldn't we make a similar change to brw_vec4_copy_propagation.cpp?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 11/15] glsl: Add conditional-select IR.

2013-08-23 Thread Paul Berry
On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:

 It's a ?: that operates per-component on vectors. Will be used in
 upcoming lowering passes for frexp and ldexp.


Should we modify the boolean variants of mix() in src/glsl/builtins/ir/
mix.ir to make use of this new IR operation?


 ---
  src/glsl/ir.cpp| 25 +
  src/glsl/ir.h  | 18 ++
  src/glsl/ir_builder.cpp| 14 ++
  src/glsl/ir_builder.h  |  2 ++
  src/glsl/ir_constant_expression.cpp|  8 
  src/glsl/ir_validate.cpp   |  7 +++
  src/mesa/program/ir_to_mesa.cpp|  1 +
  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |  1 +
  8 files changed, 76 insertions(+)

 diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
 index c8d8802..46bc608 100644
 --- a/src/glsl/ir.cpp
 +++ b/src/glsl/ir.cpp
 @@ -409,6 +409,30 @@ ir_expression::ir_expression(int op, ir_rvalue *op0,
 ir_rvalue *op1)
 }
  }

 +ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1,
 ir_rvalue *op2)
 +{
 +   this-ir_type = ir_type_expression;
 +
 +   this-operation = ir_expression_operation(op);
 +   this-operands[0] = op0;
 +   this-operands[1] = op1;
 +   this-operands[2] = op2;
 +   this-operands[3] = NULL;
 +
 +   assert(op  ir_last_binop);
 +
 +   switch (this-operation) {
 +   case ir_triop_cond_sel:
 +  this-type = op1-type;
 +  break;
 +
 +   default:
 +  assert(!not reached: missing automatic type setup for
 ir_expression);
 +  this-type = op0-type;
 +  break;
 +   }
 +}
 +
  unsigned int
  ir_expression::get_num_operands(ir_expression_operation op)
  {
 @@ -519,6 +543,7 @@ static const char *const operator_strs[] = {
 vector_extract,
 fma,
 lrp,
 +   cond_sel,
 bfi,
 bitfield_extract,
 vector_insert,
 diff --git a/src/glsl/ir.h b/src/glsl/ir.h
 index df6a36d..1c55758 100644
 --- a/src/glsl/ir.h
 +++ b/src/glsl/ir.h
 @@ -1182,6 +1182,19 @@ enum ir_expression_operation {
 ir_triop_lrp,

 /**
 +* \name Conditional Select
 +*
 +* A vector conditional select instruction (like ?:, but operating per-
 +* component on vectors).
 +*
 +* \see lower_instructions_visitor::ldexp_to_arith
 +* \see lower_instructions_visitor::frexp_to_arith
 +*/
 +   /*@{*/
 +   ir_triop_cond_sel,
 +   /*@}*/
 +
 +   /**
  * \name Second half of a lowered bitfieldInsert() operation.
  *
  * \see lower_instructions::bitfield_insert_to_bfm_bfi
 @@ -1237,6 +1250,11 @@ public:
  */
 ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1);

 +   /**
 +* Constructor for ternary operation expressions
 +*/
 +   ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1, ir_rvalue *op2);
 +
 virtual ir_expression *as_expression()
 {
return this;
 diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
 index 7d9cf5e..1f05f84 100644
 --- a/src/glsl/ir_builder.cpp
 +++ b/src/glsl/ir_builder.cpp
 @@ -173,6 +173,14 @@ expr(ir_expression_operation op, operand a, operand b)
 return new(mem_ctx) ir_expression(op, a.val, b.val);
  }

 +ir_expression *
 +expr(ir_expression_operation op, operand a, operand b, operand c)
 +{
 +   void *mem_ctx = ralloc_parent(a.val);
 +
 +   return new(mem_ctx) ir_expression(op, a.val, b.val, c.val);
 +}
 +
  ir_expression *add(operand a, operand b)
  {
 return expr(ir_binop_add, a, b);
 @@ -381,6 +389,12 @@ b2i(operand a)
 return expr(ir_unop_b2i, a);
  }

 +ir_expression *
 +cond_sel(operand a, operand b, operand c)
 +{
 +   return expr(ir_triop_cond_sel, a, b, c);
 +}
 +
  ir_if*
  if_tree(operand condition,
  ir_instruction *then_branch)
 diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
 index 7049476..01f7d18 100644
 --- a/src/glsl/ir_builder.h
 +++ b/src/glsl/ir_builder.h
 @@ -165,6 +165,8 @@ ir_expression *u2i(operand a);
  ir_expression *b2i(operand a);
  ir_expression *i2b(operand a);

 +ir_expression *cond_sel(operand a, operand b, operand c);
 +
  /**
   * Swizzle away later components, but preserve the ordering.
   */
 diff --git a/src/glsl/ir_constant_expression.cpp
 b/src/glsl/ir_constant_expression.cpp
 index 539e032..8beb7fc 100644
 --- a/src/glsl/ir_constant_expression.cpp
 +++ b/src/glsl/ir_constant_expression.cpp
 @@ -396,6 +396,7 @@ ir_expression::constant_expression_value(struct
 hash_table *variable_context)
case ir_binop_rshift:
case ir_binop_ldexp:
case ir_binop_vector_extract:
 +  case ir_triop_cond_sel:
case ir_triop_bitfield_extract:
   break;

 @@ -1398,6 +1399,13 @@ ir_expression::constant_expression_value(struct
 hash_table *variable_context)
break;
 }

 +   case ir_triop_cond_sel:
 +  for (unsigned c = 0; c  components; c++) {
 + data.u[c] = op[0]-value.b[c] ? op[1]-value.u[c]
 +   : op[2]-value.u[c];
 

Re: [Mesa-dev] [PATCH 12/15] i965: Add support for ir_triop_cond_sel.

2013-08-23 Thread Paul Berry
On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:

 ---
  src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp | 1 +
  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 6 ++
  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp   | 6 ++
  3 files changed, 13 insertions(+)

 diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 index 6ee6d01..34dbc90 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 @@ -362,6 +362,7 @@
 ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)

 case ir_triop_fma:
 case ir_triop_lrp:
 +   case ir_triop_cond_sel:
 case ir_triop_bitfield_extract:
for (i = 0; i  vector_elements; i++) {
  ir_rvalue *op0 = get_element(op_var[0], i);
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 index 4b54bee..27887d6 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 @@ -735,6 +735,12 @@ fs_visitor::visit(ir_expression *ir)
 case ir_triop_lrp:
emit_lrp(this-result, op[0], op[1], op[2]);
break;
 +
 +   case ir_triop_cond_sel:
 +  emit(CMP(reg_null_d, op[0], fs_reg(0), BRW_CONDITIONAL_NZ));
 +  inst = emit(BRW_OPCODE_SEL, this-result, op[1], op[2]);
 +  inst-predicate = BRW_PREDICATE_NORMAL;
 +  break;
 }
  }


For the uses of ir_triop_cond_sel we have currently (the lowering passes in
patch 14), I believe this will generate efficient code.  But if we adapt
the mix() functions to use it, then there are probably going to be a lot of
uses like this:

x = mix(y, z, a  b);

Which will compile down to this silly assembly (please excuse the
pseudocode--I can't remember the assembly syntax exactly):

CMP.lt tmp a b
CMP.nz null tmp 0
SEL.f0 x y z

What if we modify the loop that calls ir-operands[operand]-accept(this)
on each operand (near the top of the visitor) so that it skips operand 0
when the expression is ir_triop_cond_sel.  Then, in the switch statement,
we can do something like this:

emit_bool_to_cond_code(ir-operands[0]);
inst = emit(BRW_OPCODE_SEL, this-result, op[1], op[2]);
inst-predicate = BRW_PREDICATE_NORMAL;

That should produce the assembly we want, which is:

CMP.lt null a b
SEL.fo x y z




 diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
 b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
 index fbdf73d..0615309 100644
 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
 @@ -1731,6 +1731,12 @@ vec4_visitor::visit(ir_expression *ir)
emit(LRP(result_dst, op[2], op[1], op[0]));
break;

 +   case ir_triop_cond_sel:
 +  emit(CMP(dst_null_d(), op[0], src_reg(0), BRW_CONDITIONAL_NZ));
 +  inst = emit(BRW_OPCODE_SEL, result_dst, op[1], op[2]);
 +  inst-predicate = BRW_PREDICATE_NORMAL;
 +  break;
 +


A nearly identical optimization ought to be possible here.


 case ir_triop_bfi:
op[0] = fix_3src_operand(op[0]);
op[1] = fix_3src_operand(op[1]);
 --
 1.8.3.2

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

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


Re: [Mesa-dev] [PATCH 13/15] glsl: Add ldexp_to_arith lowering pass.

2013-08-23 Thread Paul Berry
On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:

 ---
  src/glsl/ir_optimization.h  |   1 +
  src/glsl/lower_instructions.cpp | 128
 
  2 files changed, 129 insertions(+)

 diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
 index b79c2b7..074686c 100644
 --- a/src/glsl/ir_optimization.h
 +++ b/src/glsl/ir_optimization.h
 @@ -38,6 +38,7 @@
  #define INT_DIV_TO_MUL_RCP 0x40
  #define LRP_TO_ARITH   0x80
  #define BITFIELD_INSERT_TO_BFM_BFI 0x100
 +#define LDEXP_TO_ARITH 0x200

  /**
   * \see class lower_packing_builtins_visitor
 diff --git a/src/glsl/lower_instructions.cpp
 b/src/glsl/lower_instructions.cpp
 index d32ec80..8b0a8e1 100644
 --- a/src/glsl/lower_instructions.cpp
 +++ b/src/glsl/lower_instructions.cpp
 @@ -37,6 +37,7 @@
   * - POW_TO_EXP2
   * - LOG_TO_LOG2
   * - MOD_TO_FRACT
 + * - LDEXP_TO_ARITH
   * - LRP_TO_ARITH
   * - BITFIELD_INSERT_TO_BFM_BFI
   *
 @@ -82,6 +83,10 @@
   * if we have to break it down like this anyway, it gives an
   * opportunity to do things like constant fold the (1.0 / op1) easily.
   *
 + * LDEXP_TO_ARITH:
 + * -
 + * Converts ir_binop_ldexp to arithmetic and bit operations.
 + *
   * LRP_TO_ARITH:
   * -
   * Converts ir_triop_lrp to (op0 * (1.0f - op2)) + (op1 * op2).
 @@ -125,6 +130,7 @@ private:
 void log_to_log2(ir_expression *);
 void lrp_to_arith(ir_expression *);
 void bitfield_insert_to_bfm_bfi(ir_expression *);
 +   void ldexp_to_arith(ir_expression *);
  };

  /**
 @@ -332,6 +338,123 @@
 lower_instructions_visitor::bitfield_insert_to_bfm_bfi(ir_expression *ir)
 this-progress = true;
  }

 +void
 +lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
 +{
 +   /* Translates
 +*ir_binop_ldexp x exp
 +* into
 +*
 +*extracted_biased_exp = rshift(bitcast_f2i(abs(x)), exp_shift);
 +*resulting_biased_exp = extracted_biased_exp + exp;


This comment is a little difficult to follow since it refers to exp_shift,
which you don't define until down in the code.  You might want to add a
comment saying something like (where exp_shift = 23, the bit location of
the exponent part of an IEEE float)


 +*
 +*if (resulting_biased_exp  1) {
 +*   return copysign(0.0, x);
 +*}
 +*
 +*return bitcast_u2f((bitcast_f2u(x)  sign_mantissa_mask) |
 +*   lshift(i2u(resulting_biased_exp), exp_shift));
 +*
 +* which we can't actually implement as such, since the GLSL IR doesn't
 +* have vectorized if-statements. We actually implement it without
 branches
 +* using conditional-select:
 +*
 +*extracted_biased_exp = rshift(bitcast_f2i(abs(x)), exp_shift);
 +*resulting_biased_exp = extracted_biased_exp + exp;
 +*
 +*is_not_zero_or_underflow = gequal(resulting_biased_exp, 1);
 +*x = cond_sel(is_not_zero_or_underflow, x, copysign(0.0f, x));
 +*resulting_biased_exp = cond_sel(is_not_zero_or_underflow,
 +*resulting_biased_exp, 0);
 +*
 +*return bitcast_u2f((bitcast_f2u(x)  sign_mantissa_mask) |
 +*   lshift(i2u(resulting_biased_exp), exp_shift));
 +*/
 +
 +   const unsigned vec_elem = ir-type-vector_elements;
 +
 +   /* Types */
 +   const glsl_type *ivec = glsl_type::get_instance(GLSL_TYPE_INT,
 vec_elem, 1);
 +   const glsl_type *bvec = glsl_type::get_instance(GLSL_TYPE_BOOL,
 vec_elem, 1);
 +
 +   /* Constants */
 +   ir_constant *zeroi = ir_constant::zero(ir, ivec);
 +   ir_constant *zerof = ir_constant::zero(ir, ir-type);
 +
 +   ir_constant *sign_mantissa_mask = new(ir) ir_constant(0x807fu,
 vec_elem);
 +   ir_constant *sign_mask = new(ir) ir_constant(0x8000u, vec_elem);
 +
 +   ir_constant *exp_shift = new(ir) ir_constant(23u, vec_elem);
 +
 +   /* Temporary variables */
 +   ir_variable *x = new(ir) ir_variable(ir-type, x, ir_var_temporary);
 +   ir_variable *exp = new(ir) ir_variable(ivec, exp, ir_var_temporary);
 +
 +   ir_variable *zero_sign_x = new(ir) ir_variable(ir-type, zero_sign_x,
 +  ir_var_temporary);
 +
 +   ir_variable *extracted_biased_exp =
 +  new(ir) ir_variable(ivec, extracted_biased_exp, ir_var_temporary);
 +   ir_variable *resulting_biased_exp =
 +  new(ir) ir_variable(ivec, resulting_biased_exp, ir_var_temporary);
 +
 +   ir_variable *is_not_zero_or_underflow =
 +  new(ir) ir_variable(bvec, is_not_zero_or_underflow,
 ir_var_temporary);
 +
 +   ir_instruction i = *base_ir;
 +
 +   /* Copy x and exp arguments. */
 +   i.insert_before(x);
 +   i.insert_before(assign(x, ir-operands[0]));
 +   i.insert_before(exp);
 +   i.insert_before(assign(exp, ir-operands[1]));
 +
 +   /* Extract the biased exponent from x. */
 +   i.insert_before(extracted_biased_exp);
 +   i.insert_before(assign(extracted_biased_exp,
 +  

Re: [Mesa-dev] [PATCH 14/15] glsl: Add frexp_to_arith lowering pass.

2013-08-23 Thread Paul Berry
On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:

 ---
  src/glsl/ir_optimization.h  |   1 +
  src/glsl/lower_instructions.cpp | 106
 
  2 files changed, 107 insertions(+)


Depending on how we decide to resolve the ir_expression writing to one of
its parameters issue I brought up in patch 5, I believe this patch will
either need to go away or get substantially rewritten.  Patch 15 may also
need a small tweak.

I've sent comments on patches 3, 5, 8, 10, 11, 12, and 13.  Patches 1, 2,
4, 6, 7, 9, and 15 are:

Reviewed-by: Paul Berry stereotype...@gmail.com



 diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
 index 074686c..51c73bb 100644
 --- a/src/glsl/ir_optimization.h
 +++ b/src/glsl/ir_optimization.h
 @@ -39,6 +39,7 @@
  #define LRP_TO_ARITH   0x80
  #define BITFIELD_INSERT_TO_BFM_BFI 0x100
  #define LDEXP_TO_ARITH 0x200
 +#define FREXP_TO_ARITH 0x400

  /**
   * \see class lower_packing_builtins_visitor
 diff --git a/src/glsl/lower_instructions.cpp
 b/src/glsl/lower_instructions.cpp
 index 8b0a8e1..495c232 100644
 --- a/src/glsl/lower_instructions.cpp
 +++ b/src/glsl/lower_instructions.cpp
 @@ -87,6 +87,10 @@
   * -
   * Converts ir_binop_ldexp to arithmetic and bit operations.
   *
 + * FREXP_TO_ARITH:
 + * -
 + * Converts ir_binop_frexp to arithmetic and bit operations.
 + *
   * LRP_TO_ARITH:
   * -
   * Converts ir_triop_lrp to (op0 * (1.0f - op2)) + (op1 * op2).
 @@ -131,6 +135,7 @@ private:
 void lrp_to_arith(ir_expression *);
 void bitfield_insert_to_bfm_bfi(ir_expression *);
 void ldexp_to_arith(ir_expression *);
 +   void frexp_to_arith(ir_expression *);
  };

  /**
 @@ -455,6 +460,102 @@
 lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
 this-progress = true;
  }

 +void
 +lower_instructions_visitor::frexp_to_arith(ir_expression *ir)
 +{
 +   /* Translates
 +*ir_binop_frexp x_input exp
 +* into:
 +*
 +*x = x_input;
 +*exp = 0;
 +*
 +*if (abs(x) != 0.0) {
 +*   bits = bitcast_f2u(x);
 +*
 +*   exp += (bitcast_f2u(abs(x))  exp_shift) + exp_bias;
 +*   bits = sign_mantissa_mask;
 +*   bits |= exponent_mask;
 +*   x = bitcast_u2f(bits);
 +*}
 +*return x;
 +*
 +* which we can't actually implement as such, since the GLSL IR doesn't
 +* have vectorized if-statements. We actually implement it without
 branches
 +* using conditional-select:
 +*
 +*x = x_input;
 +*
 +*is_not_zero = abs(x) != 0.0f;
 +*
 +*exp = u2i(bitcast_f2u(abs(x))  exp_shift);
 +*exp += cond_sel(is_not_zero, exp_bias, 0);
 +*
 +*bits = bitcast_f2u(x);
 +*bits = sign_mantissa_mask;
 +*bits |= cond_sel(is_not_zero, exponent_mask, 0u);
 +*x = bitcast_u2f(bits);
 +*return x;
 +*/
 +
 +   const unsigned vec_elem = ir-type-vector_elements;
 +
 +   /* Types */
 +   const glsl_type *uvec = glsl_type::get_instance(GLSL_TYPE_UINT,
 vec_elem, 1);
 +   const glsl_type *bvec = glsl_type::get_instance(GLSL_TYPE_BOOL,
 vec_elem, 1);
 +   const glsl_type *ivec = glsl_type::get_instance(GLSL_TYPE_INT,
 vec_elem, 1);
 +
 +   /* Constants */
 +   ir_constant *zeroi = ir_constant::zero(ir, ivec);
 +   ir_constant *zerou = ir_constant::zero(ir, uvec);
 +   ir_constant *zerof = ir_constant::zero(ir, ir-type);
 +
 +   ir_constant *exp_bias = new(ir) ir_constant(-126, vec_elem);
 +   ir_constant *exp_shift = new(ir) ir_constant(23u, vec_elem);
 +
 +   ir_constant *sign_mantissa_mask = new(ir) ir_constant(0x807fu,
 vec_elem);
 +   ir_constant *exponent_mask = new(ir) ir_constant(0x3f00u,
 vec_elem);
 +
 +   /* Temporary variables */
 +   ir_variable *x = new(ir) ir_variable(ir-type, x, ir_var_temporary);
 +
 +   ir_variable *bits = new(ir) ir_variable(uvec, bits,
 ir_var_temporary);
 +
 +   ir_variable *is_not_zero = new(ir) ir_variable(bvec, is_not_zero,
 +  ir_var_temporary);
 +
 +   /* Variable passed as exp parameter */
 +   ir_variable *exponent = ir-operands[1]-variable_referenced();
 +
 +
 +   ir_instruction i = *base_ir;
 +
 +   /* Initialize x = x_input; exponent = 0; */
 +   i.insert_before(x);
 +   i.insert_before(assign(x, ir-operands[0]));
 +   i.insert_before(is_not_zero);
 +   i.insert_before(assign(is_not_zero, nequal(abs(x), zerof)));
 +
 +   /* Calculate exponent */
 +   /* Use bitcast to unsigned to get shr, not asr. */
 +   i.insert_before(assign(exponent, add(u2i(rshift(bitcast_f2u(abs(x)),
 +   exp_shift)),
 +cond_sel(is_not_zero, exp_bias,
 +  zeroi;
 +
 +   /* Calculate mantissa */
 +   i.insert_before(bits);
 +   i.insert_before(assign(bits, bit_and(bitcast_f2u(x),
 

Re: [Mesa-dev] [PATCH 00/30] i965/gen7: Initial geometry shader support.

2013-08-23 Thread Matt Turner
On Thu, Aug 22, 2013 at 8:35 AM, Paul Berry stereotype...@gmail.com wrote:
 Ian gave his review to patches 1-22, assuming the noted changes are made.
 If anyone else would like to be mentioned in Reviewed-by tags, let me
 know.

On second thought, you can put my Reviewed-by on 1-22 as well.

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


Re: [Mesa-dev] [PATCH 02/15] glsl: Add support for new fma built-in in ARB_gpu_shader5.

2013-08-23 Thread Matt Turner
On Fri, Aug 23, 2013 at 8:02 AM, Ian Romanick i...@freedesktop.org wrote:
 Constant folding support?

Oh, looks like I forgot to rebase in my fixup:

+   case ir_triop_fma:
+  assert(op[0]-type-base_type == GLSL_TYPE_FLOAT);
+  assert(op[1]-type-base_type == GLSL_TYPE_FLOAT);
+  assert(op[2]-type-base_type == GLSL_TYPE_FLOAT);
+
+  for (unsigned c = 0; c  components; c++) {
+ data.f[c] = op[0]-value.f[c] * op[1]-value.f[c]
+   + op[2]-value.f[c];
+  }
+  break;
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] mesa compiling problem

2013-08-23 Thread Kenneth Graunke

On 08/23/2013 08:06 AM, Brian Paul wrote:

On 08/23/2013 05:13 AM, ZhiLi wrote:

Hi every one,

I am trying to compile Mesa Library version 9.0.3. There is an error,

../../../src/mapi/mapi/stub.c: error: ‘MAPI_TABLE_NUM_STATIC’


undeclared here (not in a function)


I trace the source code, and find it is not defined.

Did this happen to anyone? Can anyone give me some help?

Thanks in advance.


I don't see where that would be defined either, but haven't run into
this issue either.

What's your ./configure or ./autogen.sh command line?

-Brian


At least on master, it's defined in

src/mapi/shared-glapi/glapi_mapi_tmp.h

which is automatically generated by build time scripts.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 9.2 release candidate 2

2013-08-23 Thread Clemens Eisserer
Hi,

 I have verified building from the .tar.bz2 file by doing:

 tar -xjf Mesa-9.2.0-rc1.tar.bz2
 cd Mesa-9.2.0-rc1
 ./configure --enable-gallium-llvm --with-llvm-shared-libs
 make -j6

I tried to compile it on Fedora-19 + updates-testing with:
  ./configure --with-dri-drivers=i965 --with-gallium-drivers=
--enable-32-bit --enable-64-bit
  gmake

and ended up with:

[ce@localhost Mesa-9.2.0-rc2]$ gmake
CDPATH=${ZSH_VERSION+.}:  cd .  /bin/sh
/home/ce/Mesa-9.2.0-rc2/bin/missing --run aclocal-1.12 -I m4
/home/ce/Mesa-9.2.0-rc2/bin/missing: line 51: aclocal-1.12: command not found
WARNING: 'aclocal-1.12' is missing on your system.  You should only need it if
 you modified 'acinclude.m4' or 'configure.ac'.  You might want
 to install the Automake and Perl packages.  Grab them from
 any GNU archive site.
 cd .  /bin/sh /home/ce/Mesa-9.2.0-rc2/bin/missing --run
automake-1.12 --foreign
/home/ce/Mesa-9.2.0-rc2/bin/missing: line 51: automake-1.12: command not found
WARNING: 'automake-1.12' is missing on your system.  You should only need it if
 you modified 'Makefile.am', 'acinclude.m4' or 'configure.ac'.
 You might want to install the Automake and Perl packages.
 Grab them from any GNU archive site.
CDPATH=${ZSH_VERSION+.}:  cd .  /bin/sh
/home/ce/Mesa-9.2.0-rc2/bin/missing --run autoconf
/usr/bin/m4:aclocal.m4:1379: cannot open `m4/libtool.m4': No such file
or directory
/usr/bin/m4:aclocal.m4:1380: cannot open `m4/ltoptions.m4': No such
file or directory
/usr/bin/m4:aclocal.m4:1381: cannot open `m4/ltsugar.m4': No such file
or directory
/usr/bin/m4:aclocal.m4:1382: cannot open `m4/ltversion.m4': No such
file or directory
/usr/bin/m4:aclocal.m4:1383: cannot open `m4/lt~obsolete.m4': No such
file or directory
autom4te: /usr/bin/m4 failed with exit status: 1
gmake: *** [configure] Error 1


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


Re: [Mesa-dev] Mesa 9.2 release candidate 2

2013-08-23 Thread Clemens Eisserer
After performing autoreconf -fi I get a bit further:

/usr/bin/ld: .libs/entry.o: relocation R_X86_64_32S against
`_glapi_Dispatch' can not be used when making a shared object;
recompile with -fPIC
.libs/entry.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
gmake[4]: *** [libglapi.la] Error 1

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


[Mesa-dev] [PATCH] mesa: Set query-EverBound in glQueryCounter().

2013-08-23 Thread Kenneth Graunke
glIsQuery is supposed to return false for names returned by glGenQueries
until their first use.  BeginQuery is a use, but QueryCounter is also a
use.

Fixes Piglit's spec/ARB_timer_query/query-lifetime.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
Cc: mesa-sta...@lists.freedesktop.org
---
 src/mesa/main/queryobj.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index b74898c..60356b8 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -485,6 +485,7 @@ _mesa_QueryCounter(GLuint id, GLenum target)
q-Target = target;
q-Result = 0;
q-Ready = GL_FALSE;
+   q-EverBound = GL_TRUE;
 
if (ctx-Driver.QueryCounter) {
   ctx-Driver.QueryCounter(ctx, q);
-- 
1.8.3.4

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


Re: [Mesa-dev] Mesa 9.2 release candidate 2

2013-08-23 Thread Chad Versace

On 08/23/2013 10:30 AM, Clemens Eisserer wrote:

Hi,


I have verified building from the .tar.bz2 file by doing:

tar -xjf Mesa-9.2.0-rc1.tar.bz2
cd Mesa-9.2.0-rc1
./configure --enable-gallium-llvm --with-llvm-shared-libs
make -j6


I tried to compile it on Fedora-19 + updates-testing with:
   ./configure --with-dri-drivers=i965 --with-gallium-drivers=
--enable-32-bit --enable-64-bit
   gmake



I don't think it's valid to use both --enable-32-bit and --enable-64-bit.
You should choose only one.

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


Re: [Mesa-dev] [PATCH] mesa: Set query-EverBound in glQueryCounter().

2013-08-23 Thread Chad Versace

On 08/23/2013 10:40 AM, Kenneth Graunke wrote:

glIsQuery is supposed to return false for names returned by glGenQueries
until their first use.  BeginQuery is a use, but QueryCounter is also a
use.

Fixes Piglit's spec/ARB_timer_query/query-lifetime.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
Cc: mesa-sta...@lists.freedesktop.org
---
  src/mesa/main/queryobj.c | 1 +
  1 file changed, 1 insertion(+)


Yep, the ARB_timer_query spec says so:


A timer query object is created with the command

 void QueryCounter(uint id, enum target);

[...] If id is an unused query object name, the
name is marked as used [...]


Reviewed-by: Chad Versace chad.vers...@linux.intel.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965: Don't try to fall back when creating unrecognized program targets.

2013-08-23 Thread Paul Berry
If brwNewProgram is asked to create a program for an unrecognized
target, don't bother falling back on _mesa_new_program().  That just
hides bugs.
---
 src/mesa/drivers/dri/i965/brw_program.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program.c 
b/src/mesa/drivers/dri/i965/brw_program.c
index c40d506..b683681 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -114,7 +114,8 @@ static struct gl_program *brwNewProgram( struct gl_context 
*ctx,
}
 
default:
-  return _mesa_new_program(ctx, target, id);
+  _mesa_problem(ctx, Unsupported target %d in brwNewProgram()\n, target);
+  return NULL;
}
 }
 
-- 
1.8.3.4

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


Re: [Mesa-dev] [PATCH] i965: Don't try to fall back when creating unrecognized program targets.

2013-08-23 Thread Matt Turner
Reviewed-by: Matt Turner matts...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: Don't try to fall back when creating unrecognized program targets.

2013-08-23 Thread Anuj Phogat
On Fri, Aug 23, 2013 at 11:50 AM, Paul Berry stereotype...@gmail.com wrote:
 If brwNewProgram is asked to create a program for an unrecognized
 target, don't bother falling back on _mesa_new_program().  That just
 hides bugs.
 ---
  src/mesa/drivers/dri/i965/brw_program.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_program.c 
 b/src/mesa/drivers/dri/i965/brw_program.c
 index c40d506..b683681 100644
 --- a/src/mesa/drivers/dri/i965/brw_program.c
 +++ b/src/mesa/drivers/dri/i965/brw_program.c
 @@ -114,7 +114,8 @@ static struct gl_program *brwNewProgram( struct 
 gl_context *ctx,
 }

 default:
 -  return _mesa_new_program(ctx, target, id);
 +  _mesa_problem(ctx, Unsupported target %d in brwNewProgram()\n, 
 target);
 +  return NULL;
 }
  }

 --
 1.8.3.4

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

Reviewed-by: Anuj Phogat anuj.pho...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] mesa: Set query-EverBound in glQueryCounter().

2013-08-23 Thread Ian Romanick

On 08/23/2013 10:40 AM, Kenneth Graunke wrote:

glIsQuery is supposed to return false for names returned by glGenQueries
until their first use.  BeginQuery is a use, but QueryCounter is also a
use.

Fixes Piglit's spec/ARB_timer_query/query-lifetime.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
Cc: mesa-sta...@lists.freedesktop.org


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


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

diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index b74898c..60356b8 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -485,6 +485,7 @@ _mesa_QueryCounter(GLuint id, GLenum target)
 q-Target = target;
 q-Result = 0;
 q-Ready = GL_FALSE;
+   q-EverBound = GL_TRUE;

 if (ctx-Driver.QueryCounter) {
ctx-Driver.QueryCounter(ctx, q);



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


Re: [Mesa-dev] [PATCH 1/3] gallium/osmesa: Make and install an osmesa.pc.

2013-08-23 Thread Matt Turner
All three are

Reviewed-by: Matt Turner matts...@gmail.com

I've committed them to master and will pick them to 9.2 before the release.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 05/15] glsl: Add new {fr, ld}exp built-ins IR and prototypes.

2013-08-23 Thread Matt Turner
On Fri, Aug 23, 2013 at 8:55 AM, Paul Berry stereotype...@gmail.com wrote:
 On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:

 ---
  src/glsl/builtins/ir/frexp.ir   | 25
 +
  src/glsl/builtins/ir/ldexp.ir   | 25
 +
  src/glsl/builtins/profiles/ARB_gpu_shader5.glsl | 10 ++
  3 files changed, 60 insertions(+)
  create mode 100644 src/glsl/builtins/ir/frexp.ir
  create mode 100644 src/glsl/builtins/ir/ldexp.ir

 diff --git a/src/glsl/builtins/ir/frexp.ir b/src/glsl/builtins/ir/frexp.ir
 new file mode 100644
 index 000..a514994
 --- /dev/null
 +++ b/src/glsl/builtins/ir/frexp.ir
 @@ -0,0 +1,25 @@
 +((function frexp
 +   (signature float
 + (parameters
 +   (declare (in) float x)
 +   (declare (out) int exp))
 + ((return (expression float frexp (var_ref x) (var_ref exp)


 Having an ir_expression that writes to one of its parameters is going to
 break assumptions in a lot of our optimization passes.

I'm concerned that that may be a problem we have to solve anyway.

While our hardware doesn't support an frexp instruction (like e.g.,
AMD does) and we could probably do what you suggest, we do have
instructions that correspond directly to the uaddCarry() and
usubBorrow() built-ins in this same extension. They return a value and
also have an out parameter.

genUType uaddCarry(genUType x, genUType y, out genUType carry);
genUType usubBorrow(genUType x, genUType y, out genUType borrow);

We could probably avoid the problem you describe by lowering them, but
it's feeling increasingly distasteful.

Your code would make a good piglit test. I'll do some experiments.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] --libdir config option not working?

2013-08-23 Thread Brian Paul


I don't normally do a 'make install' when I'm working, but I'm trying to 
do that now on a 64-bit fedora 19 system.


I want libGL.so*, etc to go into /usr/lib64/ so I configured like this:

./configure --prefix=/usr --libdir=/usr/lib64 
--with-gallium-drivers=svga --with-dri-drivers=swrast --enable-xa


But 'make install' fails:

[...]
gmake[6]: Entering directory 
`/home/brian/projects/VM/mesa/src/mesa/drivers/dri/swrast'

gmake[6]: Nothing to be done for `install-exec-am'.
 /bin/mkdir -p '/usr/lib64/dri'
 /bin/sh ../../../../../libtool   --mode=install /bin/install -c 
swrast_dri.la '/usr/lib64/dri'
libtool: install: error: cannot install `swrast_dri.la' to a directory 
not ending in /usr/lib/dri

gmake[6]: *** [install-driLTLIBRARIES] Error 1
gmake[6]: Leaving directory 
`/home/brian/projects/VM/mesa/src/mesa/drivers/dri/swrast'


For some reason, libtool doesn't like /usr/lib64/dri

Any ideas?

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


[Mesa-dev] [PATCH] glsl: add default switch case to silence uninitialized variable warning

2013-08-23 Thread Brian Paul
---
 src/glsl/ast_to_hir.cpp |3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index feff586..24efec6 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1933,6 +1933,9 @@ validate_binding_qualifier(struct _mesa_glsl_parse_state 
*state,
   case fragment_shader:
  limit = ctx-Const.FragmentProgram.MaxTextureImageUnits;
  break;
+  default:
+ limit = 0;
+ assert(!Unexpected shader type);
   }
 
   if (max_index = limit) {
-- 
1.7.10.4

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


Re: [Mesa-dev] --libdir config option not working?

2013-08-23 Thread Matt Turner
On Fri, Aug 23, 2013 at 1:20 PM, Brian Paul bri...@vmware.com wrote:

 I don't normally do a 'make install' when I'm working, but I'm trying to do
 that now on a 64-bit fedora 19 system.

 I want libGL.so*, etc to go into /usr/lib64/ so I configured like this:

 ./configure --prefix=/usr --libdir=/usr/lib64 --with-gallium-drivers=svga
 --with-dri-drivers=swrast --enable-xa

 But 'make install' fails:

 [...]
 gmake[6]: Entering directory
 `/home/brian/projects/VM/mesa/src/mesa/drivers/dri/swrast'
 gmake[6]: Nothing to be done for `install-exec-am'.
  /bin/mkdir -p '/usr/lib64/dri'
  /bin/sh ../../../../../libtool   --mode=install /bin/install -c
 swrast_dri.la '/usr/lib64/dri'
 libtool: install: error: cannot install `swrast_dri.la' to a directory not
 ending in /usr/lib/dri
 gmake[6]: *** [install-driLTLIBRARIES] Error 1
 gmake[6]: Leaving directory
 `/home/brian/projects/VM/mesa/src/mesa/drivers/dri/swrast'

 For some reason, libtool doesn't like /usr/lib64/dri

 Any ideas?

I just configured my mesa directory with your configuration line, and
ended up with a similar error upon make install.

I think it was because my previously configured and built tree was
built with some other prefix and libdir.

After running git clean -dfx (although make clean would probably be
fine) and configuring with your line, it worked.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: add default switch case to silence uninitialized variable warning

2013-08-23 Thread Matt Turner
On Fri, Aug 23, 2013 at 1:24 PM, Brian Paul bri...@vmware.com wrote:
 ---
  src/glsl/ast_to_hir.cpp |3 +++
  1 file changed, 3 insertions(+)

 diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
 index feff586..24efec6 100644
 --- a/src/glsl/ast_to_hir.cpp
 +++ b/src/glsl/ast_to_hir.cpp
 @@ -1933,6 +1933,9 @@ validate_binding_qualifier(struct 
 _mesa_glsl_parse_state *state,
case fragment_shader:
   limit = ctx-Const.FragmentProgram.MaxTextureImageUnits;
   break;
 +  default:
 + limit = 0;
 + assert(!Unexpected shader type);
}

if (max_index = limit) {
 --
 1.7.10.4

I can't see why this would be necessary, since the switch statement
switches over a variable of type _mesa_glsl_parser_targets, and the
switch has cases for all elements in the enum.

enum _mesa_glsl_parser_targets {
   vertex_shader,
   geometry_shader,
   fragment_shader
};
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: add default switch case to silence uninitialized variable warning

2013-08-23 Thread Brian Paul

On 08/23/2013 02:39 PM, Matt Turner wrote:

On Fri, Aug 23, 2013 at 1:24 PM, Brian Paul bri...@vmware.com wrote:

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

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index feff586..24efec6 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1933,6 +1933,9 @@ validate_binding_qualifier(struct _mesa_glsl_parse_state 
*state,
case fragment_shader:
   limit = ctx-Const.FragmentProgram.MaxTextureImageUnits;
   break;
+  default:
+ limit = 0;
+ assert(!Unexpected shader type);
}

if (max_index = limit) {
--
1.7.10.4


I can't see why this would be necessary, since the switch statement
switches over a variable of type _mesa_glsl_parser_targets, and the
switch has cases for all elements in the enum.

enum _mesa_glsl_parser_targets {
vertex_shader,
geometry_shader,
fragment_shader
};



gcc 4.8.1 on Fedora 19:

../../../src/glsl/ast_to_hir.cpp: In function 'void 
apply_type_qualifier_to_variable(const ast_type_qualifier*, 
ir_variable*, _mesa_glsl_parse_state*, YYLTYPE*, bool, bool)':
../../../src/glsl/ast_to_hir.cpp:1917:66: warning: 'limit' may be used 
uninitialized in this function [-Wmaybe-uninitialized]

   (%d), qual-binding, elements, limit);
  ^
../../../src/glsl/ast_to_hir.cpp:1901:16: note: 'limit' was declared here
   unsigned limit;
^

-Brian

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


Re: [Mesa-dev] [PATCH 05/15] glsl: Add new {fr, ld}exp built-ins IR and prototypes.

2013-08-23 Thread Paul Berry
On 23 August 2013 13:19, Matt Turner matts...@gmail.com wrote:

 On Fri, Aug 23, 2013 at 8:55 AM, Paul Berry stereotype...@gmail.com
 wrote:
  On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:
 
  ---
   src/glsl/builtins/ir/frexp.ir   | 25
  +
   src/glsl/builtins/ir/ldexp.ir   | 25
  +
   src/glsl/builtins/profiles/ARB_gpu_shader5.glsl | 10 ++
   3 files changed, 60 insertions(+)
   create mode 100644 src/glsl/builtins/ir/frexp.ir
   create mode 100644 src/glsl/builtins/ir/ldexp.ir
 
  diff --git a/src/glsl/builtins/ir/frexp.ir b/src/glsl/builtins/ir/
 frexp.ir
  new file mode 100644
  index 000..a514994
  --- /dev/null
  +++ b/src/glsl/builtins/ir/frexp.ir
  @@ -0,0 +1,25 @@
  +((function frexp
  +   (signature float
  + (parameters
  +   (declare (in) float x)
  +   (declare (out) int exp))
  + ((return (expression float frexp (var_ref x) (var_ref exp)
 
 
  Having an ir_expression that writes to one of its parameters is going to
  break assumptions in a lot of our optimization passes.

 I'm concerned that that may be a problem we have to solve anyway.

 While our hardware doesn't support an frexp instruction (like e.g.,
 AMD does) and we could probably do what you suggest, we do have
 instructions that correspond directly to the uaddCarry() and
 usubBorrow() built-ins in this same extension. They return a value and
 also have an out parameter.

 genUType uaddCarry(genUType x, genUType y, out genUType carry);
 genUType usubBorrow(genUType x, genUType y, out genUType borrow);

 We could probably avoid the problem you describe by lowering them, but
 it's feeling increasingly distasteful.

 Your code would make a good piglit test. I'll do some experiments.


Hmm, interesting.

The way LLVM solves this problem, as I understand it, is through so-called
intrinsic functions (http://llvm.org/docs/LangRef.html#intrinsic-functions).
I wonder if we should start doing that in Mesa.

Briefly, here is what it would look like, using uaddCarry as an example:

1. First we do an inefficient implementation of uaddCarry in terms of
existing GLSL functions, much like you did for frexp in your frexp_to_arith
lowering pass, except that we do it in
src/glsl/builtins/glsl/uaddCarry.glsl, so it's a little easier to review
:).  Optimization passes already deal with function out parameters
properly, and function inlining automatically splices in the proper code
during linking.

2. For back-ends that don't have an efficient native way to do uaddCarry,
we're done.  The uaddCarry function works as is.

3. For back-ends that do have an efficient way to do uaddCarry, we add a
mechanism to allow the back-end to tell the linker: don't inline the
definition of this built-in.  Just leave it as an ir_call because I have my
own special implementation of it*.

4. In the back-end visitor code, the ir_call visitor looks at the name of
the function being called.  If it's uaddCarry, then the back-end visitor
just emits the efficient back-end code.  Any other ir_calls should have
been eliminated by the function inlining.

*We'll need to be careful to make sure that the right thing happens if the
user overrides uaddCarry with their own user-defined function, of course :)


Now that I've actually thought through it, I'm really excited about this
idea.  It seems way more straightforward than what we are currently doing
(e.g. in lower_packing_builtins.cpp), and it works nicely with the other
back-ends because if a back-end doesn't advertise an intrinsic definition
of a given function, it automtically gets the version declared in
src/glsl/builtins without having to do any extra work.

What do you think?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: add default switch case to silence uninitialized variable warning

2013-08-23 Thread Paul Berry
On 23 August 2013 13:55, Brian Paul bri...@vmware.com wrote:

 On 08/23/2013 02:39 PM, Matt Turner wrote:

 On Fri, Aug 23, 2013 at 1:24 PM, Brian Paul bri...@vmware.com wrote:

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

 diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
 index feff586..24efec6 100644
 --- a/src/glsl/ast_to_hir.cpp
 +++ b/src/glsl/ast_to_hir.cpp
 @@ -1933,6 +1933,9 @@ validate_binding_qualifier(**struct
 _mesa_glsl_parse_state *state,
 case fragment_shader:
limit = ctx-Const.FragmentProgram.**MaxTextureImageUnits;
break;
 +  default:
 + limit = 0;
 + assert(!Unexpected shader type);
 }

 if (max_index = limit) {
 --
 1.7.10.4


 I can't see why this would be necessary, since the switch statement
 switches over a variable of type _mesa_glsl_parser_targets, and the
 switch has cases for all elements in the enum.

 enum _mesa_glsl_parser_targets {
 vertex_shader,
 geometry_shader,
 fragment_shader
 };


 gcc 4.8.1 on Fedora 19:

 ../../../src/glsl/ast_to_hir.**cpp: In function 'void
 apply_type_qualifier_to_**variable(const ast_type_qualifier*,
 ir_variable*, _mesa_glsl_parse_state*, YYLTYPE*, bool, bool)':
 ../../../src/glsl/ast_to_hir.**cpp:1917:66: warning: 'limit' may be used
 uninitialized in this function [-Wmaybe-uninitialized]
(%d), qual-binding, elements, limit);
   ^
 ../../../src/glsl/ast_to_hir.**cpp:1901:16: note: 'limit' was declared
 here
unsigned limit;
 ^


In that case, let's fix it by initializing limit to 0 at its declaration.
That way we will get a (helpful) compiler warning in the inevitable future
event that we add new values to _mesa_glsl_parser_targets.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] softpipe: support nested/overlapping queries for all query types

2013-08-23 Thread sroland
From: Roland Scheidegger srol...@vmware.com

There's just no way resetting the counters is working with nested/overlapping
queries.
---
 src/gallium/drivers/softpipe/sp_prim_vbuf.c |2 +-
 src/gallium/drivers/softpipe/sp_query.c |   33 +--
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c 
b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
index 5d0b5e1..80c6450 100644
--- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c
+++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
@@ -595,7 +595,7 @@ sp_vbuf_so_info(struct vbuf_render *vbr, uint primitives, 
uint vertices,
struct softpipe_context *softpipe = cvbr-softpipe;
 
softpipe-so_stats.num_primitives_written += primitives;
-   softpipe-so_stats.primitives_storage_needed =
+   softpipe-so_stats.primitives_storage_needed +=
   vertices * 4 /*sizeof(float|int32)*/ * 4 /*x,y,z,w*/;
softpipe-num_primitives_generated += prim_generated;
 }
diff --git a/src/gallium/drivers/softpipe/sp_query.c 
b/src/gallium/drivers/softpipe/sp_query.c
index daeef53..ca15f03 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -99,22 +99,17 @@ softpipe_begin_query(struct pipe_context *pipe, struct 
pipe_query *q)
   sq-start = os_time_get_nano();
   break;
case PIPE_QUERY_SO_STATISTICS:
-  sq-so.primitives_storage_needed = 0;
-  sq-num_primitives_generated = 0;
-  softpipe-num_primitives_generated = 0;
-  sq-so.num_primitives_written = 0;
-  softpipe-so_stats.num_primitives_written = 0;
+  sq-so.num_primitives_written = 
softpipe-so_stats.num_primitives_written;
+  sq-so.primitives_storage_needed = softpipe-num_primitives_generated;
   break;
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
   sq-end = FALSE;
   break;
case PIPE_QUERY_PRIMITIVES_EMITTED:
-  sq-so.num_primitives_written = 0;
-  softpipe-so_stats.num_primitives_written = 0;
+  sq-so.num_primitives_written = 
softpipe-so_stats.num_primitives_written;
   break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
-  sq-num_primitives_generated = 0;
-  softpipe-num_primitives_generated = 0;
+  sq-num_primitives_generated = softpipe-num_primitives_generated;
   break;
case PIPE_QUERY_TIMESTAMP:
case PIPE_QUERY_GPU_FINISHED:
@@ -158,21 +153,25 @@ softpipe_end_query(struct pipe_context *pipe, struct 
pipe_query *q)
   sq-end = os_time_get_nano();
   break;
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
-  sq-end = (softpipe-num_primitives_generated 
- softpipe-so_stats.num_primitives_written);
+  sq-so.num_primitives_written =
+ softpipe-so_stats.num_primitives_written - 
sq-so.num_primitives_written;
+  sq-num_primitives_generated =
+ softpipe-num_primitives_generated - sq-num_primitives_generated;
+  sq-end = sq-num_primitives_generated  sq-so.num_primitives_written;
   break;
case PIPE_QUERY_SO_STATISTICS:
-  sq-num_primitives_generated =
- softpipe-num_primitives_generated;
   sq-so.num_primitives_written =
- softpipe-so_stats.num_primitives_written;
+ softpipe-so_stats.num_primitives_written - 
sq-so.num_primitives_written;
+  sq-so.primitives_storage_needed =
+ softpipe-num_primitives_generated - sq-so.primitives_storage_needed;
   break;
case PIPE_QUERY_PRIMITIVES_EMITTED:
   sq-so.num_primitives_written =
- softpipe-so_stats.num_primitives_written;
+ softpipe-so_stats.num_primitives_written - 
sq-so.num_primitives_written;
   break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
-  sq-num_primitives_generated = softpipe-num_primitives_generated;
+  sq-num_primitives_generated =
+ softpipe-num_primitives_generated - sq-num_primitives_generated;
   break;
case PIPE_QUERY_GPU_FINISHED:
case PIPE_QUERY_TIMESTAMP_DISJOINT:
@@ -219,7 +218,7 @@ softpipe_get_query_result(struct pipe_context *pipe,
   struct pipe_query_data_so_statistics *stats =
  (struct pipe_query_data_so_statistics *)vresult;
   stats-num_primitives_written = sq-so.num_primitives_written;
-  stats-primitives_storage_needed = sq-num_primitives_generated;
+  stats-primitives_storage_needed = sq-so.primitives_storage_needed;
}
   break;
case PIPE_QUERY_PIPELINE_STATISTICS:
-- 
1.7.9.5
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] llvmpipe: support nested/overlapping queries for all query types

2013-08-23 Thread sroland
From: Roland Scheidegger srol...@vmware.com

There's just no way resetting the counters is working with nested/overlapping
queries.
---
 src/gallium/drivers/llvmpipe/lp_query.c  |   35 ++
 src/gallium/drivers/llvmpipe/lp_query.h  |1 -
 src/gallium/drivers/llvmpipe/lp_setup_vbuf.c |2 +-
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_query.c 
b/src/gallium/drivers/llvmpipe/lp_query.c
index cea2d07..4fb707b 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -154,7 +154,7 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
   *result = pq-num_primitives_written;
   break;
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
-  vresult-b = pq-so_has_overflown;
+  vresult-b = pq-num_primitives_generated  pq-num_primitives_written;
   break;
case PIPE_QUERY_SO_STATISTICS: {
   struct pipe_query_data_so_statistics *stats =
@@ -204,21 +204,18 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct 
pipe_query *q)
 
switch (pq-type) {
case PIPE_QUERY_PRIMITIVES_EMITTED:
-  pq-num_primitives_written = 0;
-  llvmpipe-so_stats.num_primitives_written = 0;
+  pq-num_primitives_written = llvmpipe-so_stats.num_primitives_written;
   break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
-  pq-num_primitives_generated = 0;
-  llvmpipe-num_primitives_generated = 0;
+  pq-num_primitives_generated = llvmpipe-num_primitives_generated;
   break;
case PIPE_QUERY_SO_STATISTICS:
-  pq-num_primitives_written = 0;
-  llvmpipe-so_stats.num_primitives_written = 0;
-  pq-num_primitives_generated = 0;
-  llvmpipe-num_primitives_generated = 0;
+  pq-num_primitives_written = llvmpipe-so_stats.num_primitives_written;
+  pq-num_primitives_generated = llvmpipe-num_primitives_generated;
   break;
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
-  pq-so_has_overflown = FALSE;
+  pq-num_primitives_written = llvmpipe-so_stats.num_primitives_written;
+  pq-num_primitives_generated = llvmpipe-num_primitives_generated;
   break;
case PIPE_QUERY_PIPELINE_STATISTICS:
   /* reset our cache */
@@ -251,18 +248,24 @@ llvmpipe_end_query(struct pipe_context *pipe, struct 
pipe_query *q)
switch (pq-type) {
 
case PIPE_QUERY_PRIMITIVES_EMITTED:
-  pq-num_primitives_written = llvmpipe-so_stats.num_primitives_written;
+  pq-num_primitives_written =
+ llvmpipe-so_stats.num_primitives_written - 
pq-num_primitives_written;
   break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
-  pq-num_primitives_generated = llvmpipe-num_primitives_generated;
+  pq-num_primitives_generated =
+ llvmpipe-num_primitives_generated - pq-num_primitives_generated;
   break;
case PIPE_QUERY_SO_STATISTICS:
-  pq-num_primitives_written = llvmpipe-so_stats.num_primitives_written;
-  pq-num_primitives_generated = llvmpipe-num_primitives_generated;
+  pq-num_primitives_written =
+ llvmpipe-so_stats.num_primitives_written - 
pq-num_primitives_written;
+  pq-num_primitives_generated =
+ llvmpipe-num_primitives_generated - pq-num_primitives_generated;
   break;
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
-  pq-so_has_overflown = (llvmpipe-num_primitives_generated 
-  llvmpipe-so_stats.num_primitives_written);
+  pq-num_primitives_written =
+ llvmpipe-so_stats.num_primitives_written - 
pq-num_primitives_written;
+  pq-num_primitives_generated =
+ llvmpipe-num_primitives_generated - pq-num_primitives_generated;
   break;
case PIPE_QUERY_PIPELINE_STATISTICS:
   pq-stats.ia_vertices =
diff --git a/src/gallium/drivers/llvmpipe/lp_query.h 
b/src/gallium/drivers/llvmpipe/lp_query.h
index 62ad5fd..cd47fb0 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.h
+++ b/src/gallium/drivers/llvmpipe/lp_query.h
@@ -48,7 +48,6 @@ struct llvmpipe_query {
unsigned type;   /* PIPE_QUERY_* */
unsigned num_primitives_generated;
unsigned num_primitives_written;
-   boolean so_has_overflown;
 
struct pipe_query_data_pipeline_statistics stats;
 };
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c 
b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
index 1ea6bcf..9e69591 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
@@ -542,7 +542,7 @@ lp_setup_so_info(struct vbuf_render *vbr, uint primitives, 
uint vertices,
struct llvmpipe_context *lp = llvmpipe_context(setup-pipe);
 
lp-so_stats.num_primitives_written += primitives;
-   lp-so_stats.primitives_storage_needed =
+   lp-so_stats.primitives_storage_needed +=
   vertices * 4 /*sizeof(float|int32)*/ * 4 /*x,y,z,w*/;
lp-num_primitives_generated += prim_generated;
 }
-- 
1.7.9.5
___
mesa-dev mailing list

[Mesa-dev] [PATCH 3/3] draw: clean up setting stream out information a bit

2013-08-23 Thread sroland
From: Roland Scheidegger srol...@vmware.com

In particular noone is interested in the vertex count, so drop that,
and also drop the duplicated num_primitives_generated /
so.primitives_storage_needed variables in drivers. I am unable for now to figure
out if primitives_storage_needed in SO stats (used for d3d10) should
increase if SO is disabled, though the equivalent num_primitives_generated
used for OpenGL definitely should increase. In any case we were only counting
when SO is active both in softpipe and llvmpipe anyway so don't pretend there's
an independent num_primitives_generated counter which would count always.
(This means the PIPE_QUERY_PRIMITIVES_GENERATED count will still be wrong just
as before, should eventually fix this by doing either separate counting for this
query or adjust the code so it always counts this even if SO is inactive 
depending
on what's correct for d3d10.)
---
 src/gallium/auxiliary/draw/draw_pt_so_emit.c |4 
 src/gallium/auxiliary/draw/draw_vbuf.h   |1 -
 src/gallium/docs/source/context.rst  |2 ++
 src/gallium/drivers/llvmpipe/lp_context.h|1 -
 src/gallium/drivers/llvmpipe/lp_query.c  |   12 ++--
 src/gallium/drivers/llvmpipe/lp_setup_vbuf.c |   16 +++-
 src/gallium/drivers/softpipe/sp_context.h|1 -
 src/gallium/drivers/softpipe/sp_prim_vbuf.c  |   16 +++-
 src/gallium/drivers/softpipe/sp_query.c  |   20 +---
 9 files changed, 39 insertions(+), 34 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c 
b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
index a6d1da4..7cef17c 100644
--- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
@@ -48,7 +48,6 @@ struct pt_so_emit {
boolean use_pre_clip_pos;
int pos_idx;
unsigned emitted_primitives;
-   unsigned emitted_vertices;
unsigned generated_primitives;
 };
 
@@ -214,7 +213,6 @@ static void so_emit_prim(struct pt_so_emit *so,
  }
   }
}
-   so-emitted_vertices += num_vertices;
++so-emitted_primitives;
 }
 
@@ -274,7 +272,6 @@ void draw_pt_so_emit( struct pt_so_emit *emit,
if (!draw-so.num_targets)
   return;
 
-   emit-emitted_vertices = 0;
emit-emitted_primitives = 0;
emit-generated_primitives = 0;
emit-input_vertex_stride = input_verts-stride;
@@ -302,7 +299,6 @@ void draw_pt_so_emit( struct pt_so_emit *emit,
 
render-set_stream_output_info(render,
   emit-emitted_primitives,
-  emit-emitted_vertices,
   emit-generated_primitives);
 }
 
diff --git a/src/gallium/auxiliary/draw/draw_vbuf.h 
b/src/gallium/auxiliary/draw/draw_vbuf.h
index bf1c73c..2df0c0e 100644
--- a/src/gallium/auxiliary/draw/draw_vbuf.h
+++ b/src/gallium/auxiliary/draw/draw_vbuf.h
@@ -125,7 +125,6 @@ struct vbuf_render {
 */
void (*set_stream_output_info)( struct vbuf_render *vbufr,
unsigned primitive_count,
-   unsigned vertices_count,
unsigned primitive_generated );
 
/**
diff --git a/src/gallium/docs/source/context.rst 
b/src/gallium/docs/source/context.rst
index bfd58a4..95f6b22 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -350,6 +350,8 @@ the result of
 ``PIPE_QUERY_PRIMITIVES_EMITTED`` and
 the number of primitives that would have been written to stream output buffers
 if they had infinite space available (primitives_storage_needed), in this 
order.
+XXX the 2nd value is equivalent to ``PIPE_QUERY_PRIMITIVES_GENERATED`` but it 
is
+unclear if it should be increased if stream output is not active.
 
 ``PIPE_QUERY_SO_OVERFLOW_PREDICATE`` returns a boolean value indicating
 whether the stream output targets have overflowed as a result of the
diff --git a/src/gallium/drivers/llvmpipe/lp_context.h 
b/src/gallium/drivers/llvmpipe/lp_context.h
index fc948a7..106288a 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_context.h
@@ -92,7 +92,6 @@ struct llvmpipe_context {
struct draw_so_target *so_targets[PIPE_MAX_SO_BUFFERS];
int num_so_targets;
struct pipe_query_data_so_statistics so_stats;
-   unsigned num_primitives_generated;
 
struct pipe_query_data_pipeline_statistics pipeline_statistics;
unsigned active_statistics_queries;
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c 
b/src/gallium/drivers/llvmpipe/lp_query.c
index 4fb707b..e6cae16 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -207,15 +207,15 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct 
pipe_query *q)
   pq-num_primitives_written = llvmpipe-so_stats.num_primitives_written;
   break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
-  pq-num_primitives_generated = 

[Mesa-dev] [PATCH] glsl: init limit=0 to silence uninitialized var warning

2013-08-23 Thread Brian Paul
---
 src/glsl/ast_to_hir.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index feff586..0db6b45 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1922,7 +1922,7 @@ validate_binding_qualifier(struct _mesa_glsl_parse_state 
*state,
*  with an array of size N, all elements of the array from binding
*  through binding + N - 1 must be within this range.
*/
-  unsigned limit;
+  unsigned limit = 0;
   switch (state-target) {
   case vertex_shader:
  limit = ctx-Const.VertexProgram.MaxTextureImageUnits;
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH] glsl: init limit=0 to silence uninitialized var warning

2013-08-23 Thread Paul Berry
On 23 August 2013 14:12, Brian Paul bri...@vmware.com wrote:

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

 diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
 index feff586..0db6b45 100644
 --- a/src/glsl/ast_to_hir.cpp
 +++ b/src/glsl/ast_to_hir.cpp
 @@ -1922,7 +1922,7 @@ validate_binding_qualifier(struct
 _mesa_glsl_parse_state *state,
 *  with an array of size N, all elements of the array from binding
 *  through binding + N - 1 must be within this range.
 */
 -  unsigned limit;
 +  unsigned limit = 0;
switch (state-target) {
case vertex_shader:
   limit = ctx-Const.VertexProgram.MaxTextureImageUnits;


Thanks, Brian.

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


[Mesa-dev] [RFC PATCH] i965: Allow C++ type safety in the use of enum brw_urb_write_flags.

2013-08-23 Thread Paul Berry
(From a suggestion by Francisco Jerez)

If an enum represents a bitfield of flags, e.g.:

enum E {
  A = 1,
  B = 2,
  C = 4,
  D = 8,
};

then C++ normally prohibits statements like this:

enum E x = A | B;

because A and B are implicitly converted to ints before OR-ing them,
and an int can't be stored in an enum without a type cast.  C, on the
other hand, allows an int to be implicitly converted to an enum
without casting.

In the past we've dealt with this situation by storing flag bitfields
as ints.  This avoids ugly casting at the expense of some type safety
that C++ would normally have offered (e.g. we get no warning if we
accidentally use the wrong enum type).

However, we can get the best of both worlds if we override the |
operator.  The ugly casting is confined to the operator overload, and
we still get the benefit of C++ making sure we don't use the wrong
enum type.

The disadvantages are that (a) we need an explicit enum value for 0,
and (b) we can't use related operators like |= unless we define
additional overloads.

So what do folks think?  Is it worth it?

Cc: Francisco Jerez curroje...@riseup.net
---
 src/mesa/drivers/dri/i965/brw_clip.h   |  2 +-
 src/mesa/drivers/dri/i965/brw_clip_util.c  |  2 +-
 src/mesa/drivers/dri/i965/brw_eu.h | 16 +++-
 src/mesa/drivers/dri/i965/brw_eu_emit.c|  4 ++--
 src/mesa/drivers/dri/i965/brw_sf_emit.c| 12 
 src/mesa/drivers/dri/i965/brw_vec4.h   |  2 +-
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |  3 ++-
 7 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_clip.h 
b/src/mesa/drivers/dri/i965/brw_clip.h
index 5af0ad3..41f5c75 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.h
+++ b/src/mesa/drivers/dri/i965/brw_clip.h
@@ -173,7 +173,7 @@ void brw_clip_init_planes( struct brw_clip_compile *c );
 
 void brw_clip_emit_vue(struct brw_clip_compile *c, 
   struct brw_indirect vert,
-   unsigned flags,
+   enum brw_urb_write_flags flags,
   GLuint header);
 
 void brw_clip_kill_thread(struct brw_clip_compile *c);
diff --git a/src/mesa/drivers/dri/i965/brw_clip_util.c 
b/src/mesa/drivers/dri/i965/brw_clip_util.c
index d5c50d7..24d053e 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_util.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_util.c
@@ -313,7 +313,7 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c,
 
 void brw_clip_emit_vue(struct brw_clip_compile *c, 
   struct brw_indirect vert,
-   unsigned flags,
+   enum brw_urb_write_flags flags,
   GLuint header)
 {
struct brw_compile *p = c-func;
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
b/src/mesa/drivers/dri/i965/brw_eu.h
index 9053ea2..069b223 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -229,6 +229,8 @@ void brw_set_dp_write_message(struct brw_compile *p,
  GLuint send_commit_msg);
 
 enum brw_urb_write_flags {
+   BRW_URB_WRITE_NO_FLAGS = 0,
+
/**
 * Causes a new URB entry to be allocated, and its address stored in the
 * destination register (gen  7).
@@ -271,11 +273,23 @@ enum brw_urb_write_flags {
   BRW_URB_WRITE_ALLOCATE | BRW_URB_WRITE_COMPLETE,
 };
 
+#ifdef __cplusplus
+/**
+ * Allow brw_urb_write_flags enums to be ORed together (normally C++ wouldn't
+ * allow this without a type cast).
+ */
+inline enum brw_urb_write_flags
+operator|(enum brw_urb_write_flags x, enum brw_urb_write_flags y)
+{
+   return (enum brw_urb_write_flags) ((int) x | (int) y);
+}
+#endif
+
 void brw_urb_WRITE(struct brw_compile *p,
   struct brw_reg dest,
   GLuint msg_reg_nr,
   struct brw_reg src0,
-   unsigned flags,
+   enum brw_urb_write_flags flags,
   GLuint msg_length,
   GLuint response_length,
   GLuint offset,
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index b55b57e..ecf8597 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -515,7 +515,7 @@ static void brw_set_ff_sync_message(struct brw_compile *p,
 
 static void brw_set_urb_message( struct brw_compile *p,
 struct brw_instruction *insn,
- unsigned flags,
+ enum brw_urb_write_flags flags,
 GLuint msg_length,
 GLuint response_length,
 GLuint offset,
@@ -2213,7 +2213,7 @@ void brw_urb_WRITE(struct brw_compile *p,
   struct brw_reg dest,
   GLuint msg_reg_nr,
   struct brw_reg src0,
-   unsigned flags,
+

Re: [Mesa-dev] --libdir config option not working?

2013-08-23 Thread Brian Paul

On 08/23/2013 02:35 PM, Matt Turner wrote:

On Fri, Aug 23, 2013 at 1:20 PM, Brian Paul bri...@vmware.com wrote:


I don't normally do a 'make install' when I'm working, but I'm trying to do
that now on a 64-bit fedora 19 system.

I want libGL.so*, etc to go into /usr/lib64/ so I configured like this:

./configure --prefix=/usr --libdir=/usr/lib64 --with-gallium-drivers=svga
--with-dri-drivers=swrast --enable-xa

But 'make install' fails:

[...]
gmake[6]: Entering directory
`/home/brian/projects/VM/mesa/src/mesa/drivers/dri/swrast'
gmake[6]: Nothing to be done for `install-exec-am'.
  /bin/mkdir -p '/usr/lib64/dri'
  /bin/sh ../../../../../libtool   --mode=install /bin/install -c
swrast_dri.la '/usr/lib64/dri'
libtool: install: error: cannot install `swrast_dri.la' to a directory not
ending in /usr/lib/dri
gmake[6]: *** [install-driLTLIBRARIES] Error 1
gmake[6]: Leaving directory
`/home/brian/projects/VM/mesa/src/mesa/drivers/dri/swrast'

For some reason, libtool doesn't like /usr/lib64/dri

Any ideas?


I just configured my mesa directory with your configuration line, and
ended up with a similar error upon make install.

I think it was because my previously configured and built tree was
built with some other prefix and libdir.

After running git clean -dfx (although make clean would probably be
fine) and configuring with your line, it worked


Thanks, Matt.  I repeated my experiment with a 'make clean' and that 
worked (though I swear I had tried that earlier).


-Brian

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


Re: [Mesa-dev] [RFC PATCH] i965: Allow C++ type safety in the use of enum brw_urb_write_flags.

2013-08-23 Thread Mark Mueller
This is a nice improvement over the explicit cast, which is how I've always
done it in the past - which is the ugly part of an otherwise great method
for flags. Also I use  a lot with enum for clearing bits.


On Fri, Aug 23, 2013 at 3:18 PM, Paul Berry stereotype...@gmail.com wrote:

 (From a suggestion by Francisco Jerez)

 If an enum represents a bitfield of flags, e.g.:

 enum E {
   A = 1,
   B = 2,
   C = 4,
   D = 8,
 };

 then C++ normally prohibits statements like this:

 enum E x = A | B;

 because A and B are implicitly converted to ints before OR-ing them,
 and an int can't be stored in an enum without a type cast.  C, on the
 other hand, allows an int to be implicitly converted to an enum
 without casting.

 In the past we've dealt with this situation by storing flag bitfields
 as ints.  This avoids ugly casting at the expense of some type safety
 that C++ would normally have offered (e.g. we get no warning if we
 accidentally use the wrong enum type).

 However, we can get the best of both worlds if we override the |
 operator.  The ugly casting is confined to the operator overload, and
 we still get the benefit of C++ making sure we don't use the wrong
 enum type.

 The disadvantages are that (a) we need an explicit enum value for 0,
 and (b) we can't use related operators like |= unless we define
 additional overloads.

 So what do folks think?  Is it worth it?

 Cc: Francisco Jerez curroje...@riseup.net
 ---
  src/mesa/drivers/dri/i965/brw_clip.h   |  2 +-
  src/mesa/drivers/dri/i965/brw_clip_util.c  |  2 +-
  src/mesa/drivers/dri/i965/brw_eu.h | 16 +++-
  src/mesa/drivers/dri/i965/brw_eu_emit.c|  4 ++--
  src/mesa/drivers/dri/i965/brw_sf_emit.c| 12 
  src/mesa/drivers/dri/i965/brw_vec4.h   |  2 +-
  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |  3 ++-
  7 files changed, 30 insertions(+), 11 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_clip.h
 b/src/mesa/drivers/dri/i965/brw_clip.h
 index 5af0ad3..41f5c75 100644
 --- a/src/mesa/drivers/dri/i965/brw_clip.h
 +++ b/src/mesa/drivers/dri/i965/brw_clip.h
 @@ -173,7 +173,7 @@ void brw_clip_init_planes( struct brw_clip_compile *c
 );

  void brw_clip_emit_vue(struct brw_clip_compile *c,
struct brw_indirect vert,
 -   unsigned flags,
 +   enum brw_urb_write_flags flags,
GLuint header);

  void brw_clip_kill_thread(struct brw_clip_compile *c);
 diff --git a/src/mesa/drivers/dri/i965/brw_clip_util.c
 b/src/mesa/drivers/dri/i965/brw_clip_util.c
 index d5c50d7..24d053e 100644
 --- a/src/mesa/drivers/dri/i965/brw_clip_util.c
 +++ b/src/mesa/drivers/dri/i965/brw_clip_util.c
 @@ -313,7 +313,7 @@ void brw_clip_interp_vertex( struct brw_clip_compile
 *c,

  void brw_clip_emit_vue(struct brw_clip_compile *c,
struct brw_indirect vert,
 -   unsigned flags,
 +   enum brw_urb_write_flags flags,
GLuint header)
  {
 struct brw_compile *p = c-func;
 diff --git a/src/mesa/drivers/dri/i965/brw_eu.h
 b/src/mesa/drivers/dri/i965/brw_eu.h
 index 9053ea2..069b223 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu.h
 +++ b/src/mesa/drivers/dri/i965/brw_eu.h
 @@ -229,6 +229,8 @@ void brw_set_dp_write_message(struct brw_compile *p,
   GLuint send_commit_msg);

  enum brw_urb_write_flags {
 +   BRW_URB_WRITE_NO_FLAGS = 0,
 +
 /**
  * Causes a new URB entry to be allocated, and its address stored in
 the
  * destination register (gen  7).
 @@ -271,11 +273,23 @@ enum brw_urb_write_flags {
BRW_URB_WRITE_ALLOCATE | BRW_URB_WRITE_COMPLETE,
  };

 +#ifdef __cplusplus
 +/**
 + * Allow brw_urb_write_flags enums to be ORed together (normally C++
 wouldn't
 + * allow this without a type cast).
 + */
 +inline enum brw_urb_write_flags
 +operator|(enum brw_urb_write_flags x, enum brw_urb_write_flags y)
 +{
 +   return (enum brw_urb_write_flags) ((int) x | (int) y);
 +}
 +#endif
 +
  void brw_urb_WRITE(struct brw_compile *p,
struct brw_reg dest,
GLuint msg_reg_nr,
struct brw_reg src0,
 -   unsigned flags,
 +   enum brw_urb_write_flags flags,
GLuint msg_length,
GLuint response_length,
GLuint offset,
 diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c
 b/src/mesa/drivers/dri/i965/brw_eu_emit.c
 index b55b57e..ecf8597 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
 +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
 @@ -515,7 +515,7 @@ static void brw_set_ff_sync_message(struct brw_compile
 *p,

  static void brw_set_urb_message( struct brw_compile *p,
  struct brw_instruction *insn,
 - unsigned flags,
 + enum brw_urb_write_flags flags,
 

Re: [Mesa-dev] [PATCH] i965: Don't try to fall back when creating unrecognized program targets.

2013-08-23 Thread Kenneth Graunke

On 08/23/2013 11:50 AM, Paul Berry wrote:

If brwNewProgram is asked to create a program for an unrecognized
target, don't bother falling back on _mesa_new_program().  That just
hides bugs.
---
  src/mesa/drivers/dri/i965/brw_program.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program.c 
b/src/mesa/drivers/dri/i965/brw_program.c
index c40d506..b683681 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -114,7 +114,8 @@ static struct gl_program *brwNewProgram( struct gl_context 
*ctx,
 }

 default:
-  return _mesa_new_program(ctx, target, id);
+  _mesa_problem(ctx, Unsupported target %d in brwNewProgram()\n, target);
+  return NULL;
 }
  }


Why not do:

assert(!Unsupported target in brwNewProgram());
return NULL;

I'd really like it to abort...

Still, this is better than the old crap, so,
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

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


[Mesa-dev] [PATCH 1/2] glsl: Bump standalone compiler versions to 3.30.

2013-08-23 Thread Kenneth Graunke
These are necessary in order to compile the built-in functions.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/glsl/builtins/tools/generate_builtins.py | 4 ++--
 src/glsl/main.cpp| 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/builtins/tools/generate_builtins.py 
b/src/glsl/builtins/tools/generate_builtins.py
index 54c5a49..70e9d75 100755
--- a/src/glsl/builtins/tools/generate_builtins.py
+++ b/src/glsl/builtins/tools/generate_builtins.py
@@ -174,7 +174,7 @@ read_builtins(GLenum target, const char *protos, const char 
**functions, unsigne
 {
struct gl_context fakeCtx;
fakeCtx.API = API_OPENGL_COMPAT;
-   fakeCtx.Const.GLSLVersion = 150;
+   fakeCtx.Const.GLSLVersion = 330;
fakeCtx.Extensions.ARB_ES2_compatibility = true;
fakeCtx.Extensions.ARB_ES3_compatibility = true;
fakeCtx.Const.ForceGLSLExtensionsWarn = false;
@@ -182,7 +182,7 @@ read_builtins(GLenum target, const char *protos, const char 
**functions, unsigne
struct _mesa_glsl_parse_state *st =
   new(sh) _mesa_glsl_parse_state(fakeCtx, target, sh);
 
-   st-language_version = 150;
+   st-language_version = 330;
st-symbols-separate_function_namespace = false;
st-ARB_texture_rectangle_enable = true;
st-EXT_texture_array_enable = true;
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 60bc628..e13d5c4 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -46,7 +46,7 @@ initialize_context(struct gl_context *ctx, gl_api api)
/* The standalone compiler needs to claim support for almost
 * everything in order to compile the built-in functions.
 */
-   ctx-Const.GLSLVersion = 150;
+   ctx-Const.GLSLVersion = 330;
ctx-Extensions.ARB_ES3_compatibility = true;
 
ctx-Const.MaxClipPlanes = 8;
-- 
1.8.3.4

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


[Mesa-dev] [PATCH 2/2] glsl: Add built-in function prototypes for GLSL 3.30

2013-08-23 Thread Kenneth Graunke
330.frag is a direct copy of 150.frag.
330.glsl is 150.glsl combined with ARB_shader_bit_encoding.glsl.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/glsl/builtins/profiles/330.frag |  140 +
 src/glsl/builtins/profiles/330.glsl | 1029 +++
 2 files changed, 1169 insertions(+)
 create mode 100644 src/glsl/builtins/profiles/330.frag
 create mode 100644 src/glsl/builtins/profiles/330.glsl

diff --git a/src/glsl/builtins/profiles/330.frag 
b/src/glsl/builtins/profiles/330.frag
new file mode 100644
index 000..224854b
--- /dev/null
+++ b/src/glsl/builtins/profiles/330.frag
@@ -0,0 +1,140 @@
+#version 330
+/* texture - bias variants */
+ vec4 texture( sampler1D sampler, float P, float bias);
+ivec4 texture(isampler1D sampler, float P, float bias);
+uvec4 texture(usampler1D sampler, float P, float bias);
+
+ vec4 texture( sampler2D sampler, vec2 P, float bias);
+ivec4 texture(isampler2D sampler, vec2 P, float bias);
+uvec4 texture(usampler2D sampler, vec2 P, float bias);
+
+ vec4 texture( sampler3D sampler, vec3 P, float bias);
+ivec4 texture(isampler3D sampler, vec3 P, float bias);
+uvec4 texture(usampler3D sampler, vec3 P, float bias);
+
+ vec4 texture( samplerCube sampler, vec3 P, float bias);
+ivec4 texture(isamplerCube sampler, vec3 P, float bias);
+uvec4 texture(usamplerCube sampler, vec3 P, float bias);
+
+float texture(sampler1DShadow   sampler, vec3 P, float bias);
+float texture(sampler2DShadow   sampler, vec3 P, float bias);
+float texture(samplerCubeShadow sampler, vec4 P, float bias);
+
+ vec4 texture( sampler1DArray sampler, vec2 P, float bias);
+ivec4 texture(isampler1DArray sampler, vec2 P, float bias);
+uvec4 texture(usampler1DArray sampler, vec2 P, float bias);
+
+ vec4 texture( sampler2DArray sampler, vec3 P, float bias);
+ivec4 texture(isampler2DArray sampler, vec3 P, float bias);
+uvec4 texture(usampler2DArray sampler, vec3 P, float bias);
+
+float texture(sampler1DArrayShadow sampler, vec3 P, float bias);
+
+/* textureProj - bias variants */
+ vec4 textureProj( sampler1D sampler, vec2 P, float bias);
+ivec4 textureProj(isampler1D sampler, vec2 P, float bias);
+uvec4 textureProj(usampler1D sampler, vec2 P, float bias);
+ vec4 textureProj( sampler1D sampler, vec4 P, float bias);
+ivec4 textureProj(isampler1D sampler, vec4 P, float bias);
+uvec4 textureProj(usampler1D sampler, vec4 P, float bias);
+
+ vec4 textureProj( sampler2D sampler, vec3 P, float bias);
+ivec4 textureProj(isampler2D sampler, vec3 P, float bias);
+uvec4 textureProj(usampler2D sampler, vec3 P, float bias);
+ vec4 textureProj( sampler2D sampler, vec4 P, float bias);
+ivec4 textureProj(isampler2D sampler, vec4 P, float bias);
+uvec4 textureProj(usampler2D sampler, vec4 P, float bias);
+
+ vec4 textureProj( sampler3D sampler, vec4 P, float bias);
+ivec4 textureProj(isampler3D sampler, vec4 P, float bias);
+uvec4 textureProj(usampler3D sampler, vec4 P, float bias);
+
+float textureProj(sampler1DShadow sampler, vec4 P, float bias);
+float textureProj(sampler2DShadow sampler, vec4 P, float bias);
+
+/* textureOffset - bias variants */
+ vec4 textureOffset( sampler1D sampler, float P, int offset, float bias);
+ivec4 textureOffset(isampler1D sampler, float P, int offset, float bias);
+uvec4 textureOffset(usampler1D sampler, float P, int offset, float bias);
+
+ vec4 textureOffset( sampler2D sampler, vec2 P, ivec2 offset, float bias);
+ivec4 textureOffset(isampler2D sampler, vec2 P, ivec2 offset, float bias);
+uvec4 textureOffset(usampler2D sampler, vec2 P, ivec2 offset, float bias);
+
+ vec4 textureOffset( sampler3D sampler, vec3 P, ivec3 offset, float bias);
+ivec4 textureOffset(isampler3D sampler, vec3 P, ivec3 offset, float bias);
+uvec4 textureOffset(usampler3D sampler, vec3 P, ivec3 offset, float bias);
+
+float textureOffset(sampler1DShadow sampler, vec3 P, int offset, float bias);
+float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset, float bias);
+
+ vec4 textureOffset( sampler1DArray sampler, vec2 P, int offset, float bias);
+ivec4 textureOffset(isampler1DArray sampler, vec2 P, int offset, float bias);
+uvec4 textureOffset(usampler1DArray sampler, vec2 P, int offset, float bias);
+
+ vec4 textureOffset( sampler2DArray sampler, vec3 P, ivec2 offset, float bias);
+ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset, float bias);
+uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset, float bias);
+
+float textureOffset(sampler1DArrayShadow samp, vec3 P, int offset, float bias);
+
+/* textureProjOffsetOffset - bias variants */
+ vec4 textureProjOffset( sampler1D sampler, vec2 P, int offset, float bias);
+ivec4 textureProjOffset(isampler1D sampler, vec2 P, int offset, float bias);
+uvec4 textureProjOffset(usampler1D sampler, vec2 P, int offset, float bias);
+ vec4 textureProjOffset( sampler1D sampler, vec4 P, int offset, float bias);
+ivec4 textureProjOffset(isampler1D sampler, vec4 P, int offset, float bias);
+uvec4 

Re: [Mesa-dev] [RFC PATCH] i965: Allow C++ type safety in the use of enum brw_urb_write_flags.

2013-08-23 Thread Chad Versace

On 08/23/2013 02:18 PM, Paul Berry wrote:


The disadvantages are that (a) we need an explicit enum value for 0,
and (b) we can't use related operators like |= unless we define
additional overloads.


Disadvantage (a) is trivial, not really a problem.

Disadvantage (b) can be made painless with the macro I discuss below.



So what do folks think?  Is it worth it?



Yes, I think it's worth it. The code becomes more readable and
more type safe, as evidenced by the diff lines like this:
 -   unsigned flags,
 +   enum brw_urb_write_flags flags,

If we continue to do this to other enums, then we should probably
define a convenience macro to define all the needed overloaded
bit operators. Like this:

  #define BRW_CXX_ENUM_OPS(type_name) \
  static inline type_name \
  operator|(type_name x, type_name y) \
  { \
 return (type_name) ((int) x | (int) y); \
  } \
  \
  static inline type_name \
  operator() \
   and more operators



+/**
+ * Allow brw_urb_write_flags enums to be ORed together (normally C++ wouldn't
+ * allow this without a type cast).
+ */
+inline enum brw_urb_write_flags
+operator|(enum brw_urb_write_flags x, enum brw_urb_write_flags y)
+{
+   return (enum brw_urb_write_flags) ((int) x | (int) y);
+}
+#endif


I think the comment is distracting rather than helpful. There is no need for C++
code to apologize for being C++ code.

For what it's worth, this patch is
Reviewed-by: Chad Versace chad.vers...@linux.intel.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: Don't try to fall back when creating unrecognized program targets.

2013-08-23 Thread Chad Versace

On 08/23/2013 11:50 AM, Paul Berry wrote:

If brwNewProgram is asked to create a program for an unrecognized
target, don't bother falling back on _mesa_new_program().  That just
hides bugs.
---
  src/mesa/drivers/dri/i965/brw_program.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)


Me too!
Reviewed-by: Chad Versace chad.vers...@linux.intel.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: add default switch case to silence uninitialized variable warning

2013-08-23 Thread Chad Versace

On 08/23/2013 02:05 PM, Paul Berry wrote:

On 23 August 2013 13:55, Brian Paul bri...@vmware.com wrote:


On 08/23/2013 02:39 PM, Matt Turner wrote:


On Fri, Aug 23, 2013 at 1:24 PM, Brian Paul bri...@vmware.com wrote:



In that case, let's fix it by initializing limit to 0 at its declaration.
That way we will get a (helpful) compiler warning in the inevitable future
event that we add new values to _mesa_glsl_parser_targets.


I second Paul's advice here.

Let's not add default cases to switch statements that suppose to handle all
possible enum values. Otherwise, we may silence helpful compiler warnings
in the future.

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


Re: [Mesa-dev] [PATCH 1/6] st/clover: Profiling support

2013-08-23 Thread Tom Stellard
On Fri, Aug 09, 2013 at 11:59:25AM +0200, Niels Ole Salscheider wrote:

I've pushed the radeonsi patches, I think Francisco is still trying to
review the clover patches.

-Tom

 Signed-off-by: Niels Ole Salscheider niels_...@salscheider-online.de
 ---
  src/gallium/state_trackers/clover/api/event.cpp  |  26 -
  src/gallium/state_trackers/clover/core/event.cpp | 116 
 ---
  src/gallium/state_trackers/clover/core/event.hpp |  18 +++-
  3 Dateien geändert, 142 Zeilen hinzugefügt(+), 18 Zeilen entfernt(-)
 
 diff --git a/src/gallium/state_trackers/clover/api/event.cpp 
 b/src/gallium/state_trackers/clover/api/event.cpp
 index 39a647b..ea1576c 100644
 --- a/src/gallium/state_trackers/clover/api/event.cpp
 +++ b/src/gallium/state_trackers/clover/api/event.cpp
 @@ -217,7 +217,31 @@ clEnqueueWaitForEvents(cl_command_queue q, cl_uint 
 num_evs,
  PUBLIC cl_int
  clGetEventProfilingInfo(cl_event ev, cl_profiling_info param,
  size_t size, void *buf, size_t *size_ret) {
 -   return CL_PROFILING_INFO_NOT_AVAILABLE;
 +   hard_event *hev = dynamic_casthard_event *(ev);
 +   soft_event *sev = dynamic_castsoft_event *(ev);
 +
 +   if (!hev  !sev)
 +  return CL_INVALID_EVENT;
 +   if (!hev || !(hev-queue()-props()  CL_QUEUE_PROFILING_ENABLE) ||
 +   hev-status() != CL_COMPLETE)
 +  return CL_PROFILING_INFO_NOT_AVAILABLE;
 +
 +   switch (param) {
 +   case CL_PROFILING_COMMAND_QUEUED:
 +  return scalar_propertycl_ulong(buf, size, size_ret, 
 hev-ts_queued());
 +
 +   case CL_PROFILING_COMMAND_SUBMIT:
 +  return scalar_propertycl_ulong(buf, size, size_ret, 
 hev-ts_submit());
 +
 +   case CL_PROFILING_COMMAND_START:
 +  return scalar_propertycl_ulong(buf, size, size_ret, hev-ts_start());
 +
 +   case CL_PROFILING_COMMAND_END:
 +  return scalar_propertycl_ulong(buf, size, size_ret, hev-ts_end());
 +
 +   default:
 +  return CL_INVALID_VALUE;
 +   }
  }
  
  PUBLIC cl_int
 diff --git a/src/gallium/state_trackers/clover/core/event.cpp 
 b/src/gallium/state_trackers/clover/core/event.cpp
 index 93d3b58..de21f0c 100644
 --- a/src/gallium/state_trackers/clover/core/event.cpp
 +++ b/src/gallium/state_trackers/clover/core/event.cpp
 @@ -38,18 +38,6 @@ _cl_event::~_cl_event() {
  }
  
  void
 -_cl_event::trigger() {
 -   if (!--wait_count) {
 -  action_ok(*this);
 -
 -  while (!__chain.empty()) {
 - __chain.back()-trigger();
 - __chain.pop_back();
 -  }
 -   }
 -}
 -
 -void
  _cl_event::abort(cl_int status) {
 __status = status;
 action_fail(*this);
 @@ -77,14 +65,61 @@ _cl_event::chain(clover::event *ev) {
  hard_event::hard_event(clover::command_queue q, cl_command_type command,
 std::vectorclover::event * deps, action action) :
 _cl_event(q.ctx, deps, action, [](event ev){}),
 -   __queue(q), __command(command), __fence(NULL) {
 +   __queue(q), __command(command), __fence(NULL),
 +   __query_start(NULL), __query_end(NULL) {
 q.sequence(this);
 +
 +   if(q.props()  CL_QUEUE_PROFILING_ENABLE) {
 +  pipe_screen *screen = q.dev.pipe;
 +  __ts_queued = screen-get_timestamp(screen);
 +   }
 +
 trigger();
  }
  
  hard_event::~hard_event() {
 pipe_screen *screen = queue()-dev.pipe;
 +   pipe_context *pipe = queue()-pipe;
 screen-fence_reference(screen, __fence, NULL);
 +
 +   if(__query_start) {
 +  pipe-destroy_query(pipe, __query_start);
 +  __query_start = 0;
 +   }
 +
 +   if(__query_end) {
 +  pipe-destroy_query(pipe, __query_end);
 +  __query_end = 0;
 +   }
 +}
 +
 +void
 +hard_event::trigger() {
 +   if (!--wait_count) {
 +   /* XXX: Currently, a timestamp query gives wrong results for memory
 +* transfers. This is, because we use memcpy instead of the DMA engines. 
 */
 +
 +  if(queue()-props()  CL_QUEUE_PROFILING_ENABLE) {
 + pipe_context *pipe = queue()-pipe;
 + __query_start = pipe-create_query(pipe, PIPE_QUERY_TIMESTAMP);
 + pipe-end_query(queue()-pipe, __query_start);
 +  }
 +
 +  action_ok(*this);
 +
 +  if(queue()-props()  CL_QUEUE_PROFILING_ENABLE) {
 + pipe_context *pipe = queue()-pipe;
 + pipe_screen *screen = queue()-dev.pipe;
 + __query_end = pipe-create_query(pipe, PIPE_QUERY_TIMESTAMP);
 + pipe-end_query(pipe, __query_end);
 + __ts_submit = screen-get_timestamp(screen);
 +  }
 +
 +  while (!__chain.empty()) {
 + __chain.back()-trigger();
 + __chain.pop_back();
 +  }
 +   }
  }
  
  cl_int
 @@ -126,6 +161,49 @@ hard_event::wait() const {
throw error(CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST);
  }
  
 +cl_ulong
 +hard_event::ts_queued() const {
 +   return __ts_queued;
 +}
 +
 +cl_ulong
 +hard_event::ts_submit() const {
 +   return __ts_submit;
 +}
 +
 +cl_ulong
 +hard_event::ts_start() {
 +   get_query_results();
 +   return __ts_start;
 +}
 +
 +cl_ulong
 +hard_event::ts_end() {
 +   get_query_results();
 +   

Re: [Mesa-dev] [PATCH 1/2] glsl: Bump standalone compiler versions to 3.30.

2013-08-23 Thread Matt Turner
On Fri, Aug 23, 2013 at 4:57 PM, Kenneth Graunke kenn...@whitecape.org wrote:
 These are necessary in order to compile the built-in functions.

 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---

Both are Reviewed-by: Matt Turner matts...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 03/15] i965/fs: Add support for translating ir_triop_fma into MAD.

2013-08-23 Thread Matt Turner
On Fri, Aug 23, 2013 at 8:27 AM, Paul Berry stereotype...@gmail.com wrote:
 On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:

 ---
  src/mesa/drivers/dri/i965/brw_fs.cpp | 1 +
  src/mesa/drivers/dri/i965/brw_fs.h   | 1 +
  src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp | 1 +
  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 7 +++
  4 files changed, 10 insertions(+)

 diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
 b/src/mesa/drivers/dri/i965/brw_fs.cpp
 index 52fa6f4..b770c0e 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
 @@ -179,6 +179,7 @@ ALU3(BFI2)
  ALU1(FBH)
  ALU1(FBL)
  ALU1(CBIT)
 +ALU3(MAD)

  /** Gen4 predicated IF. */
  fs_inst *
 diff --git a/src/mesa/drivers/dri/i965/brw_fs.h
 b/src/mesa/drivers/dri/i965/brw_fs.h
 index 9d240b5..cb4ac3b 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.h
 +++ b/src/mesa/drivers/dri/i965/brw_fs.h
 @@ -285,6 +285,7 @@ public:
 fs_inst *FBH(fs_reg dst, fs_reg value);
 fs_inst *FBL(fs_reg dst, fs_reg value);
 fs_inst *CBIT(fs_reg dst, fs_reg value);
 +   fs_inst *MAD(fs_reg dst, fs_reg c, fs_reg b, fs_reg a);

 int type_size(const struct glsl_type *type);
 fs_inst *get_instruction_generating_reg(fs_inst *start,
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 index 4afae24..fa02d9b 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
 @@ -360,6 +360,7 @@
 ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
assert(!not yet supported);
break;

 +   case ir_triop_fma:
 case ir_triop_lrp:
 case ir_triop_bitfield_extract:
for (i = 0; i  vector_elements; i++) {
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 index 964ad40..ac85d25 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 @@ -717,6 +717,13 @@ fs_visitor::visit(ir_expression *ir)
break;
 }

 +   case ir_triop_fma:
 +  /* Note that the instruction's argument order is reversed from GLSL
 +   * and the IR.
 +   */
 +  emit(MAD(this-result, op[2], op[1], op[0]));
 +  break;
 +


 What happens if one of the ops is in a form that we can't encode in a 3-op
 instruction (e.g. a constant)?  That's handled in patch 4/15 for the vs, and
 it's handled inside emit_lrp, but I don't see it handled here.

I read your reply and thought oh crap, I bet that doesn't work but
it actually does work. I honestly don't have any idea how or why.

With fma(a, b, c) I get:

mad(8) g141F g34,1,1F.x   g2.44,1,1F.x g24,1,1F.x
mad(8) g131F g3.14,1,1F.x g2.54,1,1F.x g2.14,1,1F.x
mad(8) g121F g3.24,1,1F.x g2.64,1,1F.x g2.24,1,1F.x
mad(8) g111F g3.34,1,1F.x g2.74,1,1F.x g2.34,1,1F.x

With fma(a, vec4(1.0, 1.0, 2.0, 2.0), c) I get:

mov(8) g131F 1F
mov(8) g101F 1F
mov(8) g71F  2F
mov(8) g41F  2F
mad(8) g141F g2.44,1,1F.x g134,1,1F g24,1,1F.x
mad(8) g111F g2.54,1,1F.x g104,1,1F g2.14,1,1F.x
mad(8) g81F  g2.64,1,1F.x g74,1,1F  g2.24,1,1F.x
mad(8) g51F  g2.74,1,1F.x g44,1,1F  g2.34,1,1F.x

The IR just looks like it contains inline (constant float (...)) in
the fma expression, so it doesn't seem to be something in the frontend
doing it.

Any guess what's going on?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/15] glsl: Add heuristics to print floating-point numbers better.

2013-08-23 Thread Matt Turner
On Fri, Aug 23, 2013 at 8:57 AM, Paul Berry stereotype...@gmail.com wrote:
 On 22 August 2013 16:08, Matt Turner matts...@gmail.com wrote:
 Unfortunately, this patch breaks make check, because
 src/glsl/tests/optimization-test does a strict character-by-character diff
 between the expected and actual output of optimization passes (I'm not
 thrilled that the optimization tests do this, but off hand I can't think of
 a better way that wouldn't be a pain to implement).

 I believe you can fix it by replacing (0.00) with (0.0) in all the
 *.expected files in src/glsl/tests/lower_jumps/.

 With the make check issue fixed, this patch is:

 Reviewed-by: Paul Berry strereotype...@gmail.com

Thanks for the heads up. I've folded in this change which fixes make check:

find -name '*.expected' -exec sed -i -e 's/0.00/0.0/' {} +
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/15] i965: Allow immediates to be folded into logical and shift instructions.

2013-08-23 Thread Matt Turner
On Fri, Aug 23, 2013 at 9:02 AM, Paul Berry stereotype...@gmail.com wrote:
 Shouldn't we make a similar change to brw_vec4_copy_propagation.cpp?

Yes, thanks.

I've folded this change into the patch:

--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -95,9 +95,20 @@ try_constant_propagation(vec4_instruction *inst,
int arg, src_reg *values[4])
   inst-src[arg] = value;
   return true;

+   case BRW_OPCODE_SHL:
+   case BRW_OPCODE_SHR:
+  if (arg == 1) {
+ inst-src[arg] = value;
+ return true;
+  }
+  break;
+
case BRW_OPCODE_MACH:
case BRW_OPCODE_MUL:
case BRW_OPCODE_ADD:
+   case BRW_OPCODE_OR:
+   case BRW_OPCODE_AND:
+   case BRW_OPCODE_XOR:
   if (arg == 1) {
 inst-src[arg] = value;
 return true;

(Don't you love the subtle differences between the vec4 and fs? like
progress = true; ... return progress; vs return true or that it's
try_constant_propagate in the fs backend and try_constant_propagation
in the vec4 backend.)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 50482] git mesa fails to build

2013-08-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=50482

Henry henry_rosario_gonza...@hotmail.com changed:

   What|Removed |Added

 OS|All |Solaris

-- 
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 68493] New: piglit ARB_uniform_buffer_object compiler layout-column_major-non-uniform regression

2013-08-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=68493

  Priority: medium
Bug ID: 68493
  Keywords: regression
CC: i...@freedesktop.org
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: piglit ARB_uniform_buffer_object compiler
layout-column_major-non-uniform regression
  Severity: normal
Classification: Unclassified
OS: Linux (All)
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Mesa core
   Product: Mesa

mesa: 288a25252386d2cc372a5938fd4ff05879efd3ca (master)

piglit layout-column_major-non-uniform regressed on softpipe and llvmpipe.


$ ./bin/glslparsertest
tests/spec/arb_uniform_buffer_object/compiler/layout-column_major-non-uniform.frag
fail 1.20
Successfully compiled fragment shader
tests/spec/arb_uniform_buffer_object/compiler/layout-column_major-non-uniform.frag:
0:21(28): warning: uniform block layout qualifiers row_major and column_major
applied to non-matrix types may be rejected by older compilers

Shader source:
// [config]
// expect_result: fail
// glsl_version: 1.20
// require_extensions: GL_ARB_uniform_buffer_object
// [end config]

/* From the GL_ARB_uniform_buffer_object_spec:
 *
 * Uniform block layout qualifiers can be declared at global
 *  scope, on a single uniform block, or on a single block member.
 *
 *  At global scope, it is an error to use layout qualifiers to
 *  declare a variable. Instead, at global scope, layout
 *  qualifiers apply just to the keyword uniform and establish
 *  default qualification for subsequent blocks:
 */

#version 120
#extension GL_ARB_uniform_buffer_object: require

layout(column_major) vec4 a;

vec4 foo(void) {
return a;
}

PIGLIT: {'result': 'fail' }


dded321f92e4727584a98b71d7aaa15d4f01fb24 is the first bad commit
commit dded321f92e4727584a98b71d7aaa15d4f01fb24
Author: Ian Romanick ian.d.roman...@intel.com
Date:   Thu Aug 15 11:24:11 2013 -0700

glsl: Give a warning, not an error, for UBO qualifiers on non-matrices.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59648
Reviewed-by: Matt Turner matts...@gmail.com
Signed-off-by: Ian Romanick ian.d.roman...@intel.com

:04 04 2e6215681d169859bfba5df48f0d6bf7f8d761d3
e4792099b2f2a89ae3d09e802b97c62086ce573a Msrc
bisect run success

-- 
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 68493] piglit ARB_uniform_buffer_object compiler layout-column_major-non-uniform regression

2013-08-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=68493

Matt Turner matts...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Matt Turner matts...@gmail.com ---


*** This bug has been marked as a duplicate of bug 68460 ***

-- 
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] r600g/llvm: don't export more colors than the number of CBs

2013-08-23 Thread Vadim Girlin
Currently llvm backend always exports at least one color in pixel
shader even if no color buffers are enabled. With depth/stencil exports
this can result in the following code:

EXPORT PIXEL 0 R0.xyzw  VPM
EXPORT PIXEL 61R1.x___  VPM
EXPORT_DONEPIXEL 61R0._x__  VPM  EOP

AFAIU with zero color buffers no memory is reserved for colors in the export
ring and all exports in this example actually write to the same location.
The code above still works fine in this particular case, because correct
values are written last, but reordering can break it (especially with SB
which tends to reorder the exports).

Signed-off-by: Vadim Girlin vadimgir...@gmail.com
---

This fixes regressions with LLVM+SB, so I consider it as a prerequisite
for enabling SB by default. Also it fixes some issues with LLVM backend alone.
Tested on evergreen only (I don't have other hw), needs testing on
pre-evergreen GPUs.

 src/gallium/drivers/r600/r600_llvm.c   | 2 +-
 src/gallium/drivers/r600/r600_shader.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_llvm.c 
b/src/gallium/drivers/r600/r600_llvm.c
index 03a68e4..d2f4aff 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -333,8 +333,8 @@ static void llvm_emit_epilogue(struct lp_build_tgsi_context 
* bld_base)
} else if (ctx-type == TGSI_PROCESSOR_FRAGMENT) {
switch (ctx-r600_outputs[i].name) {
case TGSI_SEMANTIC_COLOR:
-   has_color = true;
if ( color_count  ctx-color_buffer_count) {
+   has_color = true;
LLVMValueRef args[3];
args[0] = output;
if (ctx-fs_color_all) {
diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index fb766c4..85f8469 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1130,7 +1130,7 @@ static int r600_shader_from_tgsi(struct r600_screen 
*rscreen,
radeon_llvm_ctx.face_gpr = ctx.face_gpr;
radeon_llvm_ctx.r600_inputs = ctx.shader-input;
radeon_llvm_ctx.r600_outputs = ctx.shader-output;
-   radeon_llvm_ctx.color_buffer_count = MAX2(key.nr_cbufs , 1);
+   radeon_llvm_ctx.color_buffer_count = key.nr_cbufs;
radeon_llvm_ctx.chip_class = ctx.bc-chip_class;
radeon_llvm_ctx.fs_color_all = shader-fs_write_all  
(rscreen-chip_class = EVERGREEN);
radeon_llvm_ctx.stream_outputs = so;
-- 
1.8.3.1

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


[Mesa-dev] [PATCH] nouveau/video: avoid overwriting base codec init with template

2013-08-23 Thread Ilia Mirkin
Commit 53e20b8b introduced the use of a template to initialize some
common fields. Move this copying of fields to before the common vp3
fields are initialized.

Reported-by: Martin Peres martin.pe...@labri.fr
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
---
 src/gallium/drivers/nv50/nv98_video.c | 2 +-
 src/gallium/drivers/nvc0/nvc0_video.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv98_video.c 
b/src/gallium/drivers/nv50/nv98_video.c
index 0fa3a62..8a13044 100644
--- a/src/gallium/drivers/nv50/nv98_video.c
+++ b/src/gallium/drivers/nv50/nv98_video.c
@@ -86,6 +86,7 @@ nv98_create_decoder(struct pipe_context *context,
if (!dec)
   return NULL;
dec-client = screen-client;
+   dec-base = *templ;
nouveau_vp3_decoder_init_common(dec-base);
 
dec-bsp_idx = 5;
@@ -136,7 +137,6 @@ nv98_create_decoder(struct pipe_context *context,
for (i = 0; i  5; i++)
   PUSH_DATA (push[2], nv04_data.vram);
 
-   dec-base = *templ;
dec-base.context = context;
dec-base.decode_bitstream = nv98_decoder_decode_bitstream;
 
diff --git a/src/gallium/drivers/nvc0/nvc0_video.c 
b/src/gallium/drivers/nvc0/nvc0_video.c
index f3a301e..52a634a 100644
--- a/src/gallium/drivers/nvc0/nvc0_video.c
+++ b/src/gallium/drivers/nvc0/nvc0_video.c
@@ -86,6 +86,7 @@ nvc0_create_decoder(struct pipe_context *context,
if (!dec)
   return NULL;
dec-client = screen-client;
+   dec-base = *templ;
nouveau_vp3_decoder_init_common(dec-base);
 
if (!kepler) {
@@ -162,7 +163,6 @@ nvc0_create_decoder(struct pipe_context *context,
BEGIN_NVC0(push[2], SUBC_PPP(NV01_SUBCHAN_OBJECT), 1);
PUSH_DATA (push[2], dec-ppp-handle);
 
-   dec-base = *templ;
dec-base.context = context;
dec-base.decode_bitstream = nvc0_decoder_decode_bitstream;
 
-- 
1.8.1.5

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