Re: [Mesa-dev] [PATCH] glxinfo: add support for creating/querying core-profile contexts (v2.1)

2013-01-16 Thread Matt Turner
On Tue, Jan 15, 2013 at 7:29 PM, Mike Lothian  wrote:
> Silly question but what does:
>
> OpenGL context flags: (none)
> OpenGL core profile context flags: (none)
>
> Actually mean?

Check out context_flags_string() in the patch. The current options are
forward-compatible and robust-access.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 59383] src/glsl/tests/Makefile.am missing $(top_srcdir)/include

2013-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59383

Andreas Boll  changed:

   What|Removed |Added

Summary|src/glsl/tests/Makefile.am  |src/glsl/tests/Makefile.am
   |missing |missing
   |$(top_builddir)/include |$(top_srcdir)/include

-- 
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] (9.0) tests: AM_CPPFLAGS must include $(top_srcdir) instead of $(top_builddir).

2013-01-16 Thread Andreas Boll
From: Johannes Obermayr 

Reviewed-by: Andreas Boll 
(cherry picked from commit ebcabb88cfd19b35cd1b0a327fa055fff0c1b2be)

Additionally it fixes the missing $(top_srcdir)/include in
src/glsl/tests/Makefile.am

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59383
---
 src/glsl/tests/Makefile.am  |9 +
 src/glx/tests/Makefile.am   |   10 +-
 src/mapi/shared-glapi/tests/Makefile.am |6 +++---
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/glsl/tests/Makefile.am b/src/glsl/tests/Makefile.am
index 957bb55..eaf5a3c 100644
--- a/src/glsl/tests/Makefile.am
+++ b/src/glsl/tests/Makefile.am
@@ -1,8 +1,9 @@
 AM_CPPFLAGS = \
-   -I$(top_builddir)/src/gtest/include \
-   -I$(top_builddir)/src/mesa \
-   -I$(top_builddir)/src/mapi \
-   -I$(top_builddir)/src/glsl
+   -I$(top_srcdir)/src/gtest/include \
+   -I$(top_srcdir)/src/mesa \
+   -I$(top_srcdir)/src/mapi \
+   -I$(top_srcdir)/src/glsl \
+   -I$(top_srcdir)/include
 
 TESTS_ENVIRONMENT= \
export PYTHON2=$(PYTHON2); \
diff --git a/src/glx/tests/Makefile.am b/src/glx/tests/Makefile.am
index 83626fd..d940712 100644
--- a/src/glx/tests/Makefile.am
+++ b/src/glx/tests/Makefile.am
@@ -1,11 +1,11 @@
 if HAVE_SHARED_GLAPI
 AM_CFLAGS = $(PTHREAD_CFLAGS)
 AM_CPPFLAGS = \
-   -I$(top_builddir)/src/gtest/include \
-   -I$(top_builddir)/src/mapi \
-   -I$(top_builddir)/src/mesa \
-   -I$(top_builddir)/src/glx \
-   -I$(top_builddir)/include \
+   -I$(top_srcdir)/src/gtest/include \
+   -I$(top_srcdir)/src/mapi \
+   -I$(top_srcdir)/src/mesa \
+   -I$(top_srcdir)/src/glx \
+   -I$(top_srcdir)/include \
$(X11_CFLAGS)
 
 TESTS = glx-test
diff --git a/src/mapi/shared-glapi/tests/Makefile.am 
b/src/mapi/shared-glapi/tests/Makefile.am
index 23d0208..98065fc 100644
--- a/src/mapi/shared-glapi/tests/Makefile.am
+++ b/src/mapi/shared-glapi/tests/Makefile.am
@@ -1,9 +1,9 @@
 if HAVE_SHARED_GLAPI
 AM_CFLAGS = $(PTHREAD_CFLAGS)
 AM_CPPFLAGS = \
-   -I$(top_builddir)/src/gtest/include \
-   -I$(top_builddir)/src/mapi \
-   -I$(top_builddir)/include
+   -I$(top_srcdir)/src/gtest/include \
+   -I$(top_srcdir)/src/mapi \
+   -I$(top_srcdir)/include
 
 TESTS = shared-glapi-test
 check_PROGRAMS = shared-glapi-test
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 1/3] R600/SI: Derive all sample intrinsics from a single class.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 


Signed-off-by: Michel Dänzer 
---
 lib/Target/R600/SIIntrinsics.td |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/Target/R600/SIIntrinsics.td b/lib/Target/R600/SIIntrinsics.td
index c322fef..0d1064e 100644
--- a/lib/Target/R600/SIIntrinsics.td
+++ b/lib/Target/R600/SIIntrinsics.td
@@ -22,9 +22,11 @@ let TargetPrefix = "SI", isTarget = 1 in {
   def int_SI_vs_load_input : Intrinsic <[llvm_v4f32_ty], [llvm_v4i32_ty, 
llvm_i16_ty, llvm_i32_ty], [IntrReadMem]> ;
   def int_SI_wqm : Intrinsic <[], [], []>;
 
-  def int_SI_sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, 
llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;
-  def int_SI_sample_bias : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, 
llvm_v4f32_ty, llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;
-  def int_SI_sample_lod : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, 
llvm_v4f32_ty, llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;
+  class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, 
llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;
+
+  def int_SI_sample : Sample;
+  def int_SI_sample_bias : Sample;
+  def int_SI_sample_lod : Sample;
 
   /* Interpolation Intrinsics */
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 2/3] R600/SI: Take target parameter for sample intrinsics.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 


Signed-off-by: Michel Dänzer 
---

This is a prerequisite for patch 3 (and probably more similar changes in the
future). Unfortunately, it introduces a couple of (non-fatal) error messages
such as below during the R600 target build. Tom or anyone, any ideas for
silencing these?

anonymous.105:  (intrinsic_w_chain:v4f32 2651:iPTR, (imm:i32):$writemask, 
VReg_128:v4f32:$coord, SReg_256:v8i32:$rsrc, SReg_128:v4i32:$sampler, 
(imm:i32):$textureTarget)
Included from /home/daenzer/src/llvm-git/llvm/lib/Target/R600/AMDGPU.td:40:
Included from 
/home/daenzer/src/llvm-git/llvm/lib/Target/R600/AMDGPUInstructions.td:189:
Included from 
/home/daenzer/src/llvm-git/llvm/lib/Target/R600/SIInstrInfo.td:591:
/home/daenzer/src/llvm-git/llvm/lib/Target/R600/SIInstructions.td:1188:1: 
error: In anonymous.105: Pattern has dead named input: $textureTarget
def : Pat <
^

 lib/Target/R600/SIInstructions.td |6 +++---
 lib/Target/R600/SIIntrinsics.td   |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/Target/R600/SIInstructions.td 
b/lib/Target/R600/SIInstructions.td
index cac42da..01c6ec1 100644
--- a/lib/Target/R600/SIInstructions.td
+++ b/lib/Target/R600/SIInstructions.td
@@ -1186,21 +1186,21 @@ def : Pat <
 
 /* int_SI_sample */
 def : Pat <
-  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm:$textureTarget),
   (IMAGE_SAMPLE imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
 SReg_256:$rsrc, SReg_128:$sampler)
 >;
 
 /* int_SI_sample_lod */
 def : Pat <
-  (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm:$textureTarget),
   (IMAGE_SAMPLE_L imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
   SReg_256:$rsrc, SReg_128:$sampler)
 >;
 
 /* int_SI_sample_bias */
 def : Pat <
-  (int_SI_sample_bias imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample_bias imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm:$textureTarget),
   (IMAGE_SAMPLE_B imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
   SReg_256:$rsrc, SReg_128:$sampler)
 >;
diff --git a/lib/Target/R600/SIIntrinsics.td b/lib/Target/R600/SIIntrinsics.td
index 0d1064e..4393144 100644
--- a/lib/Target/R600/SIIntrinsics.td
+++ b/lib/Target/R600/SIIntrinsics.td
@@ -22,7 +22,7 @@ let TargetPrefix = "SI", isTarget = 1 in {
   def int_SI_vs_load_input : Intrinsic <[llvm_v4f32_ty], [llvm_v4i32_ty, 
llvm_i16_ty, llvm_i32_ty], [IntrReadMem]> ;
   def int_SI_wqm : Intrinsic <[], [], []>;
 
-  class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, 
llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;
+  class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, 
llvm_v8i32_ty, llvm_v4i32_ty, llvm_i32_ty], [IntrReadMem]>;
 
   def int_SI_sample : Sample;
   def int_SI_sample_bias : Sample;
-- 
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] R600/SI: Use unnormalized coordinates for sampling with the RECT target.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 


Signed-off-by: Michel Dänzer 
---
 lib/Target/R600/R600Instructions.td |7 +++
 lib/Target/R600/SIInstructions.td   |6 ++
 2 files changed, 13 insertions(+)

diff --git a/lib/Target/R600/R600Instructions.td 
b/lib/Target/R600/R600Instructions.td
index 64bab18..b15ea76 100644
--- a/lib/Target/R600/R600Instructions.td
+++ b/lib/Target/R600/R600Instructions.td
@@ -342,6 +342,13 @@ def TEX_SHADOW : PatLeaf<
   }]
 >;
 
+def TEX_RECT : PatLeaf<
+  (imm),
+  [{uint32_t TType = (uint32_t)N->getZExtValue();
+return TType == 5;
+  }]
+>;
+
 class EG_CF_RAT  cf_inst, bits <6> rat_inst, bits<4> rat_id, dag outs,
  dag ins, string asm, list pattern> :
 InstR600ISA  {
diff --git a/lib/Target/R600/SIInstructions.td 
b/lib/Target/R600/SIInstructions.td
index 01c6ec1..74dfacc 100644
--- a/lib/Target/R600/SIInstructions.td
+++ b/lib/Target/R600/SIInstructions.td
@@ -1191,6 +1191,12 @@ def : Pat <
 SReg_256:$rsrc, SReg_128:$sampler)
 >;
 
+def : Pat <
+  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, TEX_RECT:$textureTarget),
+  (IMAGE_SAMPLE imm:$writemask, 1, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
+SReg_256:$rsrc, SReg_128:$sampler)
+>;
+
 /* int_SI_sample_lod */
 def : Pat <
   (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm:$textureTarget),
-- 
1.7.10.4

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


[Mesa-dev] [PATCH] radeonsi: Pass texture type to sampling intrinsics.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 


Signed-off-by: Michel Dänzer 
---
 src/gallium/drivers/radeonsi/radeonsi_shader.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c 
b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 5dab46e..4843330 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -845,12 +845,10 @@ static void tex_fetch_args(
ptr, offset);
 
/* Dimensions */
-   /* XXX: We might want to pass this information to the shader at some. */
-/* emit_data->args[4] = lp_build_const_int32(bld_base->base.gallivm,
+   emit_data->args[4] = lp_build_const_int32(bld_base->base.gallivm,
emit_data->inst->Texture.Texture);
-*/
 
-   emit_data->arg_count = 4;
+   emit_data->arg_count = 5;
/* XXX: To optimize, we could use a float or v2f32, if the last bits of
 * the writemask are clear */
emit_data->dst_type = LLVMVectorType(
-- 
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/6] radeonsi: Use proper hardware format for stencil texturing.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 

Fixes piglit 'spec/ARB_depth_buffer_float/fbo-clear-formats stencil' crash.

Signed-off-by: Michel Dänzer 
---
 src/gallium/drivers/radeonsi/si_state.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 46112f7..fd046c6 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1136,10 +1136,11 @@ static uint32_t si_translate_texformat(struct 
pipe_screen *screen,
case PIPE_FORMAT_Z24X8_UNORM:
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
return V_008F14_IMG_DATA_FORMAT_24_8;
-   case PIPE_FORMAT_S8X24_UINT:
case PIPE_FORMAT_X8Z24_UNORM:
case PIPE_FORMAT_S8_UINT_Z24_UNORM:
return V_008F14_IMG_DATA_FORMAT_8_24;
+   case PIPE_FORMAT_X32_S8X24_UINT:
+   case PIPE_FORMAT_S8X24_UINT:
case PIPE_FORMAT_S8_UINT:
return V_008F14_IMG_DATA_FORMAT_8;
case PIPE_FORMAT_Z32_FLOAT:
-- 
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/6] radeonsi: Consolidate calculation of tile mode index.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 

Signed-off-by: Michel Dänzer 
---
 src/gallium/drivers/radeonsi/si_state.c |  182 ---
 1 file changed, 71 insertions(+), 111 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 2b574f3..46112f7 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1496,6 +1496,64 @@ boolean si_is_format_supported(struct pipe_screen 
*screen,
return retval == usage;
 }
 
+static unsigned si_tile_mode_index(struct r600_resource_texture *rtex, 
unsigned level)
+{
+   if (util_format_is_depth_or_stencil(rtex->real_format)) {
+   if (rtex->surface.level[level].mode == RADEON_SURF_MODE_1D) {
+   return 4;
+   } else if (rtex->surface.level[level].mode == 
RADEON_SURF_MODE_2D) {
+   switch (rtex->real_format) {
+   case PIPE_FORMAT_Z16_UNORM:
+   return 5;
+   case PIPE_FORMAT_Z24X8_UNORM:
+   case PIPE_FORMAT_Z24_UNORM_S8_UINT:
+   case PIPE_FORMAT_Z32_FLOAT:
+   case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
+   return 6;
+   default:
+   return 7;
+   }
+   }
+   }
+
+   switch (rtex->surface.level[level].mode) {
+   default:
+   assert(!"Invalid surface mode");
+   /* Fall through */
+   case RADEON_SURF_MODE_LINEAR_ALIGNED:
+   return 8;
+   case RADEON_SURF_MODE_1D:
+   return 9;
+   case RADEON_SURF_MODE_2D:
+   if (rtex->surface.flags & RADEON_SURF_SCANOUT) {
+   switch (util_format_get_blocksize(rtex->real_format)) {
+   case 1:
+   return 10;
+   case 2:
+   return 11;
+   default:
+   assert(!"Invalid block size");
+   /* Fall through */
+   case 4:
+   return 12;
+   }
+   } else {
+   switch (util_format_get_blocksize(rtex->real_format)) {
+   case 1:
+   return 14;
+   case 2:
+   return 15;
+   case 4:
+   return 16;
+   case 8:
+   return 17;
+   default:
+   return 13;
+   }
+   }
+   }
+}
+
 /*
  * framebuffer handling
  */
@@ -1507,10 +1565,10 @@ static void si_cb(struct r600_context *rctx, struct 
si_pm4_state *pm4,
struct r600_surface *surf;
unsigned level = state->cbufs[cb]->u.tex.level;
unsigned pitch, slice;
-   unsigned color_info, color_attrib;
+   unsigned color_info;
+   unsigned tile_mode_index;
unsigned format, swap, ntype, endian;
uint64_t offset;
-   unsigned blocksize;
const struct util_format_description *desc;
int i;
unsigned blend_clamp = 0, blend_bypass = 0;
@@ -1518,7 +1576,6 @@ static void si_cb(struct r600_context *rctx, struct 
si_pm4_state *pm4,
 
surf = (struct r600_surface *)state->cbufs[cb];
rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
-   blocksize = util_format_get_blocksize(rtex->real_format);
 
if (rtex->depth)
rctx->have_depth_fb = TRUE;
@@ -1539,46 +1596,7 @@ static void si_cb(struct r600_context *rctx, struct 
si_pm4_state *pm4,
slice = slice - 1;
}
 
-   color_attrib = S_028C74_TILE_MODE_INDEX(8);
-   switch (rtex->surface.level[level].mode) {
-   case RADEON_SURF_MODE_LINEAR_ALIGNED:
-   color_attrib = S_028C74_TILE_MODE_INDEX(8);
-   break;
-   case RADEON_SURF_MODE_1D:
-   color_attrib = S_028C74_TILE_MODE_INDEX(9);
-   break;
-   case RADEON_SURF_MODE_2D:
-   if (rtex->resource.b.b.bind & PIPE_BIND_SCANOUT) {
-   switch (blocksize) {
-   case 1:
-   color_attrib = S_028C74_TILE_MODE_INDEX(10);
-   break;
-   case 2:
-   color_attrib = S_028C74_TILE_MODE_INDEX(11);
-   break;
-   case 4:
-   color_attrib = S_028C74_TILE_MODE_INDEX(12);
-   break;
-   }
-   break;
-   } else switch (blocksize) {
-   case 1:
- 

[Mesa-dev] [PATCH 2/6] radeonsi: Enable tiling for depth/stencil resources.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 

Enabling it for all resources still seems to cause problems, but depth/stencil
buffers are always accessed with tiling by the DB block.

Signed-off-by: Michel Dänzer 
---
 src/gallium/drivers/radeonsi/r600_texture.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/r600_texture.c 
b/src/gallium/drivers/radeonsi/r600_texture.c
index de46640..6ea6220 100644
--- a/src/gallium/drivers/radeonsi/r600_texture.c
+++ b/src/gallium/drivers/radeonsi/r600_texture.c
@@ -521,14 +521,13 @@ struct pipe_resource *si_texture_create(struct 
pipe_screen *screen,
unsigned array_mode = V_009910_ARRAY_LINEAR_ALIGNED;
int r;
 
-#if 0
if (!(templ->flags & R600_RESOURCE_FLAG_TRANSFER) &&
-   !(templ->bind & PIPE_BIND_SCANOUT)) {
+   !(templ->bind & PIPE_BIND_SCANOUT) &&
+   util_format_is_depth_or_stencil(templ->format)) {
if (permit_hardware_blit(screen, templ)) {
array_mode = V_009910_ARRAY_2D_TILED_THIN1;
}
}
-#endif
 
r = r600_init_surface(rscreen, &surface, templ, array_mode,
  templ->flags & R600_RESOURCE_FLAG_FLUSHED_DEPTH);
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 4/6] radeonsi: Set SPI_SHADER_COL_FORMAT to what the pixel shader actually exports.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 

Instead of deriving it from the colour buffer formats only.

Fixes a number of piglit tests which export depth from the pixel shader.

Signed-off-by: Michel Dänzer 
---
 src/gallium/drivers/radeonsi/radeonsi_pipe.h   |1 -
 src/gallium/drivers/radeonsi/radeonsi_shader.c |   10 ++
 src/gallium/drivers/radeonsi/radeonsi_shader.h |1 +
 src/gallium/drivers/radeonsi/si_state.c|7 +--
 src/gallium/drivers/radeonsi/si_state_draw.c   |2 ++
 5 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h 
b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index 29e8960..686ed05 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -134,7 +134,6 @@ struct r600_context {
/* shader information */
unsignedsprite_coord_enable;
unsignedexport_16bpc;
-   unsignedspi_shader_col_format;
struct r600_textures_info   vs_samplers;
struct r600_textures_info   ps_samplers;
struct si_resource  *border_color_table;
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c 
b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 4843330..52ecef9 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -478,6 +478,13 @@ static void si_llvm_init_export_args(struct 
lp_build_tgsi_context *bld_base,
if (cbuf >= 0 && cbuf < 8) {
struct r600_context *rctx = si_shader_ctx->rctx;
compressed = (si_shader_ctx->key.export_16bpc >> cbuf) 
& 0x1;
+
+   if (compressed)
+   si_shader_ctx->shader->spi_shader_col_format |=
+   V_028714_SPI_SHADER_FP16_ABGR << (4 * 
cbuf);
+   else
+   si_shader_ctx->shader->spi_shader_col_format |=
+   V_028714_SPI_SHADER_32_ABGR << (4 * 
cbuf);
}
}
 
@@ -759,6 +766,9 @@ static void si_llvm_emit_epilogue(struct 
lp_build_tgsi_context * bld_base)
last_args[6]= uint->zero;
last_args[7]= uint->zero;
last_args[8]= uint->zero;
+
+   si_shader_ctx->shader->spi_shader_col_format |=
+   V_028714_SPI_SHADER_32_ABGR;
}
 
/* Specify whether the EXEC mask represents the valid mask */
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.h 
b/src/gallium/drivers/radeonsi/radeonsi_shader.h
index 6f12e76..07b2f9f 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.h
@@ -94,6 +94,7 @@ struct si_pipe_shader {
unsignednum_sgprs;
unsignednum_vgprs;
unsignedspi_ps_input_ena;
+   unsignedspi_shader_col_format;
unsignedsprite_coord_enable;
unsignedso_strides[4];
struct si_shader_keykey;
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index fd046c6..2ec8287 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1685,9 +1685,7 @@ static void si_cb(struct r600_context *rctx, struct 
si_pm4_state *pm4,
 max_comp_size <= 10) ||
(ntype == V_028C70_NUMBER_FLOAT && max_comp_size <= 16)) {
rctx->export_16bpc |= 1 << cb;
-   rctx->spi_shader_col_format |= V_028714_SPI_SHADER_FP16_ABGR << 
(4 * cb);
-   } else
-   rctx->spi_shader_col_format |= V_028714_SPI_SHADER_32_ABGR << 
(4 * cb);
+   }
 }
 
 static void si_db(struct r600_context *rctx, struct si_pm4_state *pm4,
@@ -1785,7 +1783,6 @@ static void si_set_framebuffer_state(struct pipe_context 
*ctx,
/* build states */
rctx->have_depth_fb = 0;
rctx->export_16bpc = 0;
-   rctx->spi_shader_col_format = 0;
for (int i = 0; i < state->nr_cbufs; i++) {
si_cb(rctx, pm4, state, i);
}
@@ -1815,8 +1812,6 @@ static void si_set_framebuffer_state(struct pipe_context 
*ctx,
si_pm4_set_reg(pm4, R_028200_PA_SC_WINDOW_OFFSET, 0x);
si_pm4_set_reg(pm4, R_028230_PA_SC_EDGERULE, 0x);
si_pm4_set_reg(pm4, R_02823C_CB_SHADER_MASK, shader_mask);
-   si_pm4_set_reg(pm4, R_028714_SPI_SHADER_COL_FORMAT,
-  rctx->spi_shader_col_format);
si_pm4_set_reg(pm4, R_028BE0_PA_SC_AA_CONFIG, 0x);
 
si_pm4_set_state(rctx, framebuffer, pm4);
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index 257bf1e..6178

[Mesa-dev] [PATCH 5/6] radeonsi: Fix Z24 texture formats.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 

About half a dozen more piglits.

Signed-off-by: Michel Dänzer 
---
 src/gallium/drivers/radeonsi/si_state.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 2ec8287..cc9f7ae 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1135,10 +1135,10 @@ static uint32_t si_translate_texformat(struct 
pipe_screen *screen,
case PIPE_FORMAT_X24S8_UINT:
case PIPE_FORMAT_Z24X8_UNORM:
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
-   return V_008F14_IMG_DATA_FORMAT_24_8;
+   return V_008F14_IMG_DATA_FORMAT_8_24;
case PIPE_FORMAT_X8Z24_UNORM:
case PIPE_FORMAT_S8_UINT_Z24_UNORM:
-   return V_008F14_IMG_DATA_FORMAT_8_24;
+   return V_008F14_IMG_DATA_FORMAT_24_8;
case PIPE_FORMAT_X32_S8X24_UINT:
case PIPE_FORMAT_S8X24_UINT:
case PIPE_FORMAT_S8_UINT:
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 6/6] radeonsi: Actually keep track if we are using depth textures for samplers.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 

20-odd more piglits.

Signed-off-by: Michel Dänzer 
---
 src/gallium/drivers/radeonsi/si_state.c |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index cc9f7ae..f7fe603 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2197,7 +2197,8 @@ static struct si_pm4_state *si_set_sampler_view(struct 
r600_context *rctx,
struct si_pipe_sampler_view **resource = (struct si_pipe_sampler_view 
**)views;
struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
int i, j;
-   int has_depth = 0;
+
+   rctx->have_depth_texture = FALSE;
 
if (!count)
goto out;
@@ -2210,8 +2211,12 @@ static struct si_pm4_state *si_set_sampler_view(struct 
r600_context *rctx,
(struct pipe_sampler_view **)&samplers->views[i],
views[i]);
 
-   if (views[i])
+   if (resource[i]) {
+   struct r600_resource_texture *rtex =
+   (struct r600_resource_texture 
*)views[i]->texture;
+   rctx->have_depth_texture |= rtex->depth && 
!rtex->is_flushing_texture;
si_pm4_add_bo(pm4, resource[i]->resource, 
RADEON_USAGE_READ);
+   }
 
for (j = 0; j < Elements(resource[i]->state); ++j) {
si_pm4_sh_data_add(pm4, resource[i] ? 
resource[i]->state[j] : 0);
@@ -2226,7 +2231,6 @@ static struct si_pm4_state *si_set_sampler_view(struct 
r600_context *rctx,
si_pm4_sh_data_end(pm4, user_data_reg, SI_SGPR_RESOURCE);
 
 out:
-   rctx->have_depth_texture = has_depth;
rctx->ps_samplers.n_views = count;
return pm4;
 }
-- 
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 1/3] R600/SI: Derive all sample intrinsics from a single class.

2013-01-16 Thread Christian König

On 16.01.2013 10:42, Michel Dänzer wrote:

From: Michel Dänzer 


Signed-off-by: Michel Dänzer 


Reviewed-by: Christian König 


---
  lib/Target/R600/SIIntrinsics.td |8 +---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/Target/R600/SIIntrinsics.td b/lib/Target/R600/SIIntrinsics.td
index c322fef..0d1064e 100644
--- a/lib/Target/R600/SIIntrinsics.td
+++ b/lib/Target/R600/SIIntrinsics.td
@@ -22,9 +22,11 @@ let TargetPrefix = "SI", isTarget = 1 in {
def int_SI_vs_load_input : Intrinsic <[llvm_v4f32_ty], [llvm_v4i32_ty, 
llvm_i16_ty, llvm_i32_ty], [IntrReadMem]> ;
def int_SI_wqm : Intrinsic <[], [], []>;
  
-  def int_SI_sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;

-  def int_SI_sample_bias : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, 
llvm_v4f32_ty, llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;
-  def int_SI_sample_lod : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, 
llvm_v4f32_ty, llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;
+  class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, 
llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;
+
+  def int_SI_sample : Sample;
+  def int_SI_sample_bias : Sample;
+  def int_SI_sample_lod : Sample;
  
/* Interpolation Intrinsics */
  


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


Re: [Mesa-dev] [PATCH 2/3] R600/SI: Take target parameter for sample intrinsics.

2013-01-16 Thread Christian König

On 16.01.2013 10:42, Michel Dänzer wrote:

From: Michel Dänzer 


Signed-off-by: Michel Dänzer 
---

This is a prerequisite for patch 3 (and probably more similar changes in the
future). Unfortunately, it introduces a couple of (non-fatal) error messages
such as below during the R600 target build. Tom or anyone, any ideas for
silencing these?


See below.



anonymous.105:  (intrinsic_w_chain:v4f32 2651:iPTR, (imm:i32):$writemask, 
VReg_128:v4f32:$coord, SReg_256:v8i32:$rsrc, SReg_128:v4i32:$sampler, 
(imm:i32):$textureTarget)
Included from /home/daenzer/src/llvm-git/llvm/lib/Target/R600/AMDGPU.td:40:
Included from 
/home/daenzer/src/llvm-git/llvm/lib/Target/R600/AMDGPUInstructions.td:189:
Included from 
/home/daenzer/src/llvm-git/llvm/lib/Target/R600/SIInstrInfo.td:591:
/home/daenzer/src/llvm-git/llvm/lib/Target/R600/SIInstructions.td:1188:1: 
error: In anonymous.105: Pattern has dead named input: $textureTarget
def : Pat <
^

  lib/Target/R600/SIInstructions.td |6 +++---
  lib/Target/R600/SIIntrinsics.td   |2 +-
  2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/Target/R600/SIInstructions.td 
b/lib/Target/R600/SIInstructions.td
index cac42da..01c6ec1 100644
--- a/lib/Target/R600/SIInstructions.td
+++ b/lib/Target/R600/SIInstructions.td
@@ -1186,21 +1186,21 @@ def : Pat <
  
  /* int_SI_sample */

  def : Pat <
-  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm:$textureTarget),
(IMAGE_SAMPLE imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
  SReg_256:$rsrc, SReg_128:$sampler)
  >;


Not 100% sure, but try declaring it like this:

def : Pat <
-  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, 0),
   (IMAGE_SAMPLE imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
 SReg_256:$rsrc, SReg_128:$sampler)

;


And I won't commit it with those warning, that definitely looks like a good 
source for bugs.

Christian.

  
  /* int_SI_sample_lod */

  def : Pat <
-  (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm:$textureTarget),
(IMAGE_SAMPLE_L imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
SReg_256:$rsrc, SReg_128:$sampler)
  >;
  
  /* int_SI_sample_bias */

  def : Pat <
-  (int_SI_sample_bias imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample_bias imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm:$textureTarget),
(IMAGE_SAMPLE_B imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
SReg_256:$rsrc, SReg_128:$sampler)
  >;
diff --git a/lib/Target/R600/SIIntrinsics.td b/lib/Target/R600/SIIntrinsics.td
index 0d1064e..4393144 100644
--- a/lib/Target/R600/SIIntrinsics.td
+++ b/lib/Target/R600/SIIntrinsics.td
@@ -22,7 +22,7 @@ let TargetPrefix = "SI", isTarget = 1 in {
def int_SI_vs_load_input : Intrinsic <[llvm_v4f32_ty], [llvm_v4i32_ty, 
llvm_i16_ty, llvm_i32_ty], [IntrReadMem]> ;
def int_SI_wqm : Intrinsic <[], [], []>;
  
-  class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;

+  class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, 
llvm_v8i32_ty, llvm_v4i32_ty, llvm_i32_ty], [IntrReadMem]>;
  
def int_SI_sample : Sample;

def int_SI_sample_bias : Sample;


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


Re: [Mesa-dev] [PATCH 1/6] radeonsi: Consolidate calculation of tile mode index.

2013-01-16 Thread Christian König

On 16.01.2013 11:55, Michel Dänzer wrote:

From: Michel Dänzer 

Signed-off-by: Michel Dänzer 


For this series: Reviewed-by: Christian König 


---
  src/gallium/drivers/radeonsi/si_state.c |  182 ---
  1 file changed, 71 insertions(+), 111 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 2b574f3..46112f7 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1496,6 +1496,64 @@ boolean si_is_format_supported(struct pipe_screen 
*screen,
return retval == usage;
  }
  
+static unsigned si_tile_mode_index(struct r600_resource_texture *rtex, unsigned level)

+{
+   if (util_format_is_depth_or_stencil(rtex->real_format)) {
+   if (rtex->surface.level[level].mode == RADEON_SURF_MODE_1D) {
+   return 4;
+   } else if (rtex->surface.level[level].mode == 
RADEON_SURF_MODE_2D) {
+   switch (rtex->real_format) {
+   case PIPE_FORMAT_Z16_UNORM:
+   return 5;
+   case PIPE_FORMAT_Z24X8_UNORM:
+   case PIPE_FORMAT_Z24_UNORM_S8_UINT:
+   case PIPE_FORMAT_Z32_FLOAT:
+   case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
+   return 6;
+   default:
+   return 7;
+   }
+   }
+   }
+
+   switch (rtex->surface.level[level].mode) {
+   default:
+   assert(!"Invalid surface mode");
+   /* Fall through */
+   case RADEON_SURF_MODE_LINEAR_ALIGNED:
+   return 8;
+   case RADEON_SURF_MODE_1D:
+   return 9;
+   case RADEON_SURF_MODE_2D:
+   if (rtex->surface.flags & RADEON_SURF_SCANOUT) {
+   switch (util_format_get_blocksize(rtex->real_format)) {
+   case 1:
+   return 10;
+   case 2:
+   return 11;
+   default:
+   assert(!"Invalid block size");
+   /* Fall through */
+   case 4:
+   return 12;
+   }
+   } else {
+   switch (util_format_get_blocksize(rtex->real_format)) {
+   case 1:
+   return 14;
+   case 2:
+   return 15;
+   case 4:
+   return 16;
+   case 8:
+   return 17;
+   default:
+   return 13;
+   }
+   }
+   }
+}
+
  /*
   * framebuffer handling
   */
@@ -1507,10 +1565,10 @@ static void si_cb(struct r600_context *rctx, struct 
si_pm4_state *pm4,
struct r600_surface *surf;
unsigned level = state->cbufs[cb]->u.tex.level;
unsigned pitch, slice;
-   unsigned color_info, color_attrib;
+   unsigned color_info;
+   unsigned tile_mode_index;
unsigned format, swap, ntype, endian;
uint64_t offset;
-   unsigned blocksize;
const struct util_format_description *desc;
int i;
unsigned blend_clamp = 0, blend_bypass = 0;
@@ -1518,7 +1576,6 @@ static void si_cb(struct r600_context *rctx, struct 
si_pm4_state *pm4,
  
  	surf = (struct r600_surface *)state->cbufs[cb];

rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
-   blocksize = util_format_get_blocksize(rtex->real_format);
  
  	if (rtex->depth)

rctx->have_depth_fb = TRUE;
@@ -1539,46 +1596,7 @@ static void si_cb(struct r600_context *rctx, struct 
si_pm4_state *pm4,
slice = slice - 1;
}
  
-	color_attrib = S_028C74_TILE_MODE_INDEX(8);

-   switch (rtex->surface.level[level].mode) {
-   case RADEON_SURF_MODE_LINEAR_ALIGNED:
-   color_attrib = S_028C74_TILE_MODE_INDEX(8);
-   break;
-   case RADEON_SURF_MODE_1D:
-   color_attrib = S_028C74_TILE_MODE_INDEX(9);
-   break;
-   case RADEON_SURF_MODE_2D:
-   if (rtex->resource.b.b.bind & PIPE_BIND_SCANOUT) {
-   switch (blocksize) {
-   case 1:
-   color_attrib = S_028C74_TILE_MODE_INDEX(10);
-   break;
-   case 2:
-   color_attrib = S_028C74_TILE_MODE_INDEX(11);
-   break;
-   case 4:
-   color_attrib = S_028C74_TILE_MODE_INDEX(12);
-   break;
-   }
-   break

[Mesa-dev] [PATCH] radeonsi/vdpau: remove nonsense state tracker dep

2013-01-16 Thread Christian König
From: Christian König 

Added with automake conversion, but makes no sense at all.

Signed-off-by: Christian König 
---
 src/gallium/targets/vdpau-radeonsi/Makefile.am |1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gallium/targets/vdpau-radeonsi/Makefile.am 
b/src/gallium/targets/vdpau-radeonsi/Makefile.am
index 98d828e..beae309 100644
--- a/src/gallium/targets/vdpau-radeonsi/Makefile.am
+++ b/src/gallium/targets/vdpau-radeonsi/Makefile.am
@@ -47,7 +47,6 @@ libvdpau_radeonsi_la_LDFLAGS = \
 libvdpau_radeonsi_la_LIBADD = \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
-   $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
$(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \
$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH] radeonsi/vdpau: remove nonsense state tracker dep

2013-01-16 Thread Andreas Boll
2013/1/16 Christian König :
> From: Christian König 
>
> Added with automake conversion, but makes no sense at all.
>
> Signed-off-by: Christian König 

Reviewed-by: Andreas Boll 

> ---
>  src/gallium/targets/vdpau-radeonsi/Makefile.am |1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/src/gallium/targets/vdpau-radeonsi/Makefile.am 
> b/src/gallium/targets/vdpau-radeonsi/Makefile.am
> index 98d828e..beae309 100644
> --- a/src/gallium/targets/vdpau-radeonsi/Makefile.am
> +++ b/src/gallium/targets/vdpau-radeonsi/Makefile.am
> @@ -47,7 +47,6 @@ libvdpau_radeonsi_la_LDFLAGS = \
>  libvdpau_radeonsi_la_LIBADD = \
> $(top_builddir)/src/gallium/auxiliary/libgallium.la \
> $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
> -   $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
> $(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \
> $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
> $(top_builddir)/src/gallium/drivers/trace/libtrace.la \
> --
> 1.7.9.5
>
> ___
> 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 V4 5/6] intel: implement create image from texture

2013-01-16 Thread Abdiel Janulgue
On Tuesday, January 15, 2013 02:05:00 PM Eric Anholt wrote:
> > +static void
> > +intel_image_set_level_info(__DRIimage *image, struct intel_mipmap_tree
> > *mt, +   int level, int slice,
> > +   uint32_t mask_x,  uint32_t mask_y)
> > +{
> > +   image->width = mt->level[level].width;
> > +   image->height = mt->level[level].height;
> > +   image->level_x = mt->level[level].level_x;
> > +   image->level_y = mt->level[level].level_y;
> > +   image->slice_x_offset = mt->level[level].slice[slice].x_offset;
> > +   image->slice_y_offset = mt->level[level].slice[slice].y_offset;
> > +
> > +   image->offset = intel_region_get_aligned_offset(mt->region,
> > +   image->slice_x_offset
> > & ~mask_x, +  
> > image->slice_y_offset & ~mask_y, +   
> >false);
> > +}
> 
> I think you end up double-counting the slice_x/y_offset offset here --
> you have a tile-aligned byte offset from the base of the region (which I
> don't think you want at all), and then you reference from
> slice_x/y_offset from that offset when texturing.
> 

Aren't you supposed to reference the x/y offsets (used in SURFACE_STATE[5] in 
gen6 and gen7) in addition to the surface base address in tiled surfaces when 
resolving to higher miplevels? Or I am probably missing something?

I agree though that the level /slice differentation definitely needs to be 
dropped as you mentioned earlier. I got an update that only accounts for the 
x/y offsets to the image. It works correctly as well and I'll post it soon.

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


[Mesa-dev] [PATCH 2/3 v2] R600/SI: Take target parameter for sample intrinsics.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 


Signed-off-by: Michel Dänzer 
---

v2: Leave the target parameter unnamed to prevent noisy if harmless
build error messages.

 lib/Target/R600/SIInstructions.td |6 +++---
 lib/Target/R600/SIIntrinsics.td   |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/Target/R600/SIInstructions.td 
b/lib/Target/R600/SIInstructions.td
index cac42da..0f9d572 100644
--- a/lib/Target/R600/SIInstructions.td
+++ b/lib/Target/R600/SIInstructions.td
@@ -1186,21 +1186,21 @@ def : Pat <
 
 /* int_SI_sample */
 def : Pat <
-  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm),
   (IMAGE_SAMPLE imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
 SReg_256:$rsrc, SReg_128:$sampler)
 >;
 
 /* int_SI_sample_lod */
 def : Pat <
-  (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm),
   (IMAGE_SAMPLE_L imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
   SReg_256:$rsrc, SReg_128:$sampler)
 >;
 
 /* int_SI_sample_bias */
 def : Pat <
-  (int_SI_sample_bias imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample_bias imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm),
   (IMAGE_SAMPLE_B imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
   SReg_256:$rsrc, SReg_128:$sampler)
 >;
diff --git a/lib/Target/R600/SIIntrinsics.td b/lib/Target/R600/SIIntrinsics.td
index 0d1064e..4393144 100644
--- a/lib/Target/R600/SIIntrinsics.td
+++ b/lib/Target/R600/SIIntrinsics.td
@@ -22,7 +22,7 @@ let TargetPrefix = "SI", isTarget = 1 in {
   def int_SI_vs_load_input : Intrinsic <[llvm_v4f32_ty], [llvm_v4i32_ty, 
llvm_i16_ty, llvm_i32_ty], [IntrReadMem]> ;
   def int_SI_wqm : Intrinsic <[], [], []>;
 
-  class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, 
llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;
+  class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, 
llvm_v8i32_ty, llvm_v4i32_ty, llvm_i32_ty], [IntrReadMem]>;
 
   def int_SI_sample : Sample;
   def int_SI_sample_bias : Sample;
-- 
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 v2] R600/SI: Use unnormalized coordinates for sampling with the RECT target.

2013-01-16 Thread Michel Dänzer
From: Michel Dänzer 


Signed-off-by: Michel Dänzer 
---

v2: Leave the target parameter unnamed to prevent noisy if harmless
build error messages.

 lib/Target/R600/R600Instructions.td |7 +++
 lib/Target/R600/SIInstructions.td   |6 ++
 2 files changed, 13 insertions(+)

diff --git a/lib/Target/R600/R600Instructions.td 
b/lib/Target/R600/R600Instructions.td
index 64bab18..b15ea76 100644
--- a/lib/Target/R600/R600Instructions.td
+++ b/lib/Target/R600/R600Instructions.td
@@ -342,6 +342,13 @@ def TEX_SHADOW : PatLeaf<
   }]
 >;
 
+def TEX_RECT : PatLeaf<
+  (imm),
+  [{uint32_t TType = (uint32_t)N->getZExtValue();
+return TType == 5;
+  }]
+>;
+
 class EG_CF_RAT  cf_inst, bits <6> rat_inst, bits<4> rat_id, dag outs,
  dag ins, string asm, list pattern> :
 InstR600ISA  {
diff --git a/lib/Target/R600/SIInstructions.td 
b/lib/Target/R600/SIInstructions.td
index 0f9d572..4164c55 100644
--- a/lib/Target/R600/SIInstructions.td
+++ b/lib/Target/R600/SIInstructions.td
@@ -1191,6 +1191,12 @@ def : Pat <
 SReg_256:$rsrc, SReg_128:$sampler)
 >;
 
+def : Pat <
+  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, TEX_RECT),
+  (IMAGE_SAMPLE imm:$writemask, 1, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
+SReg_256:$rsrc, SReg_128:$sampler)
+>;
+
 /* int_SI_sample_lod */
 def : Pat <
   (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm),
-- 
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 2/3] R600/SI: Take target parameter for sample intrinsics.

2013-01-16 Thread Michel Dänzer
On Mit, 2013-01-16 at 12:16 +0100, Christian König wrote: 
> On 16.01.2013 10:42, Michel Dänzer wrote:
> > From: Michel Dänzer 
> >
> >
> > Signed-off-by: Michel Dänzer 
> > ---
> >
> > This is a prerequisite for patch 3 (and probably more similar changes in the
> > future). Unfortunately, it introduces a couple of (non-fatal) error messages
> > such as below during the R600 target build. Tom or anyone, any ideas for
> > silencing these?
> 
> See below.
> 
> >
> > anonymous.105:  (intrinsic_w_chain:v4f32 2651:iPTR, 
> > (imm:i32):$writemask, VReg_128:v4f32:$coord, SReg_256:v8i32:$rsrc, 
> > SReg_128:v4i32:$sampler, (imm:i32):$textureTarget)
> > Included from /home/daenzer/src/llvm-git/llvm/lib/Target/R600/AMDGPU.td:40:
> > Included from 
> > /home/daenzer/src/llvm-git/llvm/lib/Target/R600/AMDGPUInstructions.td:189:
> > Included from 
> > /home/daenzer/src/llvm-git/llvm/lib/Target/R600/SIInstrInfo.td:591:
> > /home/daenzer/src/llvm-git/llvm/lib/Target/R600/SIInstructions.td:1188:1: 
> > error: In anonymous.105: Pattern has dead named input: $textureTarget
> > def : Pat <
> > ^
> >
> >   lib/Target/R600/SIInstructions.td |6 +++---
> >   lib/Target/R600/SIIntrinsics.td   |2 +-
> >   2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/Target/R600/SIInstructions.td 
> > b/lib/Target/R600/SIInstructions.td
> > index cac42da..01c6ec1 100644
> > --- a/lib/Target/R600/SIInstructions.td
> > +++ b/lib/Target/R600/SIInstructions.td
> > @@ -1186,21 +1186,21 @@ def : Pat <
> >   
> >   /* int_SI_sample */
> >   def : Pat <
> > -  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
> > SReg_128:$sampler),
> > +  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
> > SReg_128:$sampler, imm:$textureTarget),
> > (IMAGE_SAMPLE imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
> >   SReg_256:$rsrc, SReg_128:$sampler)
> >   >;
> 
> Not 100% sure, but try declaring it like this:
> 
> def : Pat <
> -  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
> SReg_128:$sampler),
> +  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
> SReg_128:$sampler, 0),
> (IMAGE_SAMPLE imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
>   SReg_256:$rsrc, SReg_128:$sampler)
> >;

That results in failure to select the intrinsic at runtime.

I figured out how to leave the parameter unnamed, which prevents the
messages. See the v2 patches.

Thanks anyway,


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


Re: [Mesa-dev] [PATCH 2/3 v2] R600/SI: Take target parameter for sample intrinsics.

2013-01-16 Thread Christian König

On 16.01.2013 15:27, Michel Dänzer wrote:

From: Michel Dänzer 


Signed-off-by: Michel Dänzer 
---

v2: Leave the target parameter unnamed to prevent noisy if harmless
build error messages.


For both patches:

Reviewed-by Christian König 



  lib/Target/R600/SIInstructions.td |6 +++---
  lib/Target/R600/SIIntrinsics.td   |2 +-
  2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/Target/R600/SIInstructions.td 
b/lib/Target/R600/SIInstructions.td
index cac42da..0f9d572 100644
--- a/lib/Target/R600/SIInstructions.td
+++ b/lib/Target/R600/SIInstructions.td
@@ -1186,21 +1186,21 @@ def : Pat <
  
  /* int_SI_sample */

  def : Pat <
-  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm),
(IMAGE_SAMPLE imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
  SReg_256:$rsrc, SReg_128:$sampler)
  >;
  
  /* int_SI_sample_lod */

  def : Pat <
-  (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample_lod imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm),
(IMAGE_SAMPLE_L imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
SReg_256:$rsrc, SReg_128:$sampler)
  >;
  
  /* int_SI_sample_bias */

  def : Pat <
-  (int_SI_sample_bias imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler),
+  (int_SI_sample_bias imm:$writemask, VReg_128:$coord, SReg_256:$rsrc, 
SReg_128:$sampler, imm),
(IMAGE_SAMPLE_B imm:$writemask, 0, 0, 0, 0, 0, 0, 0, VReg_128:$coord,
SReg_256:$rsrc, SReg_128:$sampler)
  >;
diff --git a/lib/Target/R600/SIIntrinsics.td b/lib/Target/R600/SIIntrinsics.td
index 0d1064e..4393144 100644
--- a/lib/Target/R600/SIIntrinsics.td
+++ b/lib/Target/R600/SIIntrinsics.td
@@ -22,7 +22,7 @@ let TargetPrefix = "SI", isTarget = 1 in {
def int_SI_vs_load_input : Intrinsic <[llvm_v4f32_ty], [llvm_v4i32_ty, 
llvm_i16_ty, llvm_i32_ty], [IntrReadMem]> ;
def int_SI_wqm : Intrinsic <[], [], []>;
  
-  class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, llvm_v8i32_ty, llvm_v4i32_ty], [IntrReadMem]>;

+  class Sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, 
llvm_v8i32_ty, llvm_v4i32_ty, llvm_i32_ty], [IntrReadMem]>;
  
def int_SI_sample : Sample;

def int_SI_sample_bias : Sample;


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


[Mesa-dev] [PATCH] allow Android to use out-of-tree mesa sources

2013-01-16 Thread groleo
From: Adrian Marius Negreanu 

this helps when compiling mesa for Android, but
the mesa sources resides outside of the Android tree.

Signed-off-by: Adrian Marius Negreanu 
---
 src/mapi/mapi/mapi_abi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index 30ffe7b..7ae8c05 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -29,7 +29,7 @@
 import sys
 # make it possible to import glapi
 import os
-GLAPI = "./%s/../glapi/gen" % (os.path.dirname(sys.argv[0]))
+GLAPI = "%s/../glapi/gen" % (os.path.dirname(sys.argv[0]))
 sys.path.append(GLAPI)
 
 import re
-- 
1.8.0

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


[Mesa-dev] [PATCH] mesa: add missing ASSERT_OUTSIDE_BEGIN_END() in _mesa_GetInternalformativ()

2013-01-16 Thread Brian Paul
---
 src/mesa/main/formatquery.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index f08ab66..bd895e8 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -22,6 +22,7 @@
  */
 
 #include "mtypes.h"
+#include "context.h"
 #include "glformats.h"
 #include "macros.h"
 #include "mfeatures.h"
@@ -37,6 +38,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum 
internalformat, GLenum pname,
GLsizei count = 0;
GET_CURRENT_CONTEXT(ctx);
 
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
if (!ctx->Extensions.ARB_internalformat_query) {
   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetInternalformativ");
   return;
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 1/2] st/mesa: simplify some src/dst surface setup in BlitFramebuffer

2013-01-16 Thread Brian Paul
Use the renderbuffer attachment pointers that we grabbed earlier.
---
 src/mesa/state_tracker/st_cb_blit.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_blit.c 
b/src/mesa/state_tracker/st_cb_blit.c
index 603c8d4..d6194bf 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -243,16 +243,16 @@ st_BlitFramebuffer(struct gl_context *ctx,
  &drawFB->Attachment[BUFFER_STENCIL];
 
   struct st_renderbuffer *srcDepthRb =
- st_renderbuffer(readFB->Attachment[BUFFER_DEPTH].Renderbuffer);
+ st_renderbuffer(srcDepth->Renderbuffer);
   struct st_renderbuffer *dstDepthRb = 
- st_renderbuffer(drawFB->Attachment[BUFFER_DEPTH].Renderbuffer);
+ st_renderbuffer(dstDepth->Renderbuffer);
   struct pipe_surface *dstDepthSurf =
  dstDepthRb ? dstDepthRb->surface : NULL;
 
   struct st_renderbuffer *srcStencilRb =
- st_renderbuffer(readFB->Attachment[BUFFER_STENCIL].Renderbuffer);
+ st_renderbuffer(srcStencil->Renderbuffer);
   struct st_renderbuffer *dstStencilRb =
- st_renderbuffer(drawFB->Attachment[BUFFER_STENCIL].Renderbuffer);
+ st_renderbuffer(dstStencil->Renderbuffer);
   struct pipe_surface *dstStencilSurf =
  dstStencilRb ? dstStencilRb->surface : NULL;
 
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 2/2] st/mesa: a couple fixes for st_BlitFramebuffer()

2013-01-16 Thread Brian Paul
1. Loop over multiple destination color buffers.  If we set
glDrawBuffers(GL_FRONT_AND_BACK) we need to loop over multiple color
buffers, blitting to each.

2. Add checks for null src/dst surface pointers.  This fixes a crash
in the piglit fbo-missing-attachment-blit test.
See bug http://bugs.freedesktop.org/show_bug.cgi?id=59450
---
 src/mesa/state_tracker/st_cb_blit.c |   85 +-
 1 files changed, 52 insertions(+), 33 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_blit.c 
b/src/mesa/state_tracker/st_cb_blit.c
index d6194bf..c284f06 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -184,48 +184,67 @@ st_BlitFramebuffer(struct gl_context *ctx,
   blit.mask = PIPE_MASK_RGBA;
 
   if (srcAtt->Type == GL_TEXTURE) {
- struct st_texture_object *srcObj =
-st_texture_object(srcAtt->Texture);
- struct st_renderbuffer *dstRb =
-st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
- struct pipe_surface *dstSurf = dstRb->surface;
-
- assert(srcObj->pt);
- if (!srcObj->pt) {
+ struct st_texture_object *srcObj = st_texture_object(srcAtt->Texture);
+ GLuint i;
+
+ if (!srcObj || !srcObj->pt) {
 return;
  }
 
- blit.dst.resource = dstSurf->texture;
- blit.dst.level = dstSurf->u.tex.level;
- blit.dst.box.z = dstSurf->u.tex.first_layer;
- blit.dst.format = util_format_linear(dstSurf->format);
+ for (i = 0; i < drawFB->_NumColorDrawBuffers; i++) {
+struct st_renderbuffer *dstRb =
+   st_renderbuffer(drawFB->_ColorDrawBuffers[i]);
 
- blit.src.resource = srcObj->pt;
- blit.src.level = srcAtt->TextureLevel;
- blit.src.box.z = srcAtt->Zoffset + srcAtt->CubeMapFace;
- blit.src.format = util_format_linear(srcObj->pt->format);
+if (dstRb) {
+   struct pipe_surface *dstSurf = dstRb->surface;
 
- st->pipe->blit(st->pipe, &blit);
+   blit.dst.resource = dstSurf->texture;
+   blit.dst.level = dstSurf->u.tex.level;
+   blit.dst.box.z = dstSurf->u.tex.first_layer;
+   blit.dst.format = util_format_linear(dstSurf->format);
+
+   blit.src.resource = srcObj->pt;
+   blit.src.level = srcAtt->TextureLevel;
+   blit.src.box.z = srcAtt->Zoffset + srcAtt->CubeMapFace;
+   blit.src.format = util_format_linear(srcObj->pt->format);
+
+   st->pipe->blit(st->pipe, &blit);
+}
+ }
   }
   else {
  struct st_renderbuffer *srcRb =
 st_renderbuffer(readFB->_ColorReadBuffer);
- struct st_renderbuffer *dstRb =
-st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
- struct pipe_surface *srcSurf = srcRb->surface;
- struct pipe_surface *dstSurf = dstRb->surface;
+ struct pipe_surface *srcSurf;
+ GLuint i;
+
+ if (!srcRb || !srcRb->surface)
+return;
 
- blit.dst.resource = dstSurf->texture;
- blit.dst.level = dstSurf->u.tex.level;
- blit.dst.box.z = dstSurf->u.tex.first_layer;
- blit.dst.format = util_format_linear(dstSurf->format);
+ srcSurf = srcRb->surface;
 
- blit.src.resource = srcSurf->texture;
- blit.src.level = srcSurf->u.tex.level;
- blit.src.box.z = srcSurf->u.tex.first_layer;
- blit.src.format = util_format_linear(srcSurf->format);
+ for (i = 0; i < drawFB->_NumColorDrawBuffers; i++) {
+struct st_renderbuffer *dstRb =
+   st_renderbuffer(drawFB->_ColorDrawBuffers[i]);
 
- st->pipe->blit(st->pipe, &blit);
+if (dstRb) {
+   struct pipe_surface *dstSurf = dstRb->surface;
+
+   if (dstSurf) {
+  blit.dst.resource = dstSurf->texture;
+  blit.dst.level = dstSurf->u.tex.level;
+  blit.dst.box.z = dstSurf->u.tex.first_layer;
+  blit.dst.format = util_format_linear(dstSurf->format);
+
+  blit.src.resource = srcSurf->texture;
+  blit.src.level = srcSurf->u.tex.level;
+  blit.src.box.z = srcSurf->u.tex.first_layer;
+  blit.src.format = util_format_linear(srcSurf->format);
+
+  st->pipe->blit(st->pipe, &blit);
+   }
+}
+ }
   }
}
 
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH 2/2] st/mesa: a couple fixes for st_BlitFramebuffer()

2013-01-16 Thread Marek Olšák
For the series: Reviewed-by: Marek Olšák 

Marek

On Wed, Jan 16, 2013 at 4:58 PM, Brian Paul  wrote:
> 1. Loop over multiple destination color buffers.  If we set
> glDrawBuffers(GL_FRONT_AND_BACK) we need to loop over multiple color
> buffers, blitting to each.
>
> 2. Add checks for null src/dst surface pointers.  This fixes a crash
> in the piglit fbo-missing-attachment-blit test.
> See bug http://bugs.freedesktop.org/show_bug.cgi?id=59450
> ---
>  src/mesa/state_tracker/st_cb_blit.c |   85 +-
>  1 files changed, 52 insertions(+), 33 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_cb_blit.c 
> b/src/mesa/state_tracker/st_cb_blit.c
> index d6194bf..c284f06 100644
> --- a/src/mesa/state_tracker/st_cb_blit.c
> +++ b/src/mesa/state_tracker/st_cb_blit.c
> @@ -184,48 +184,67 @@ st_BlitFramebuffer(struct gl_context *ctx,
>blit.mask = PIPE_MASK_RGBA;
>
>if (srcAtt->Type == GL_TEXTURE) {
> - struct st_texture_object *srcObj =
> -st_texture_object(srcAtt->Texture);
> - struct st_renderbuffer *dstRb =
> -st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
> - struct pipe_surface *dstSurf = dstRb->surface;
> -
> - assert(srcObj->pt);
> - if (!srcObj->pt) {
> + struct st_texture_object *srcObj = 
> st_texture_object(srcAtt->Texture);
> + GLuint i;
> +
> + if (!srcObj || !srcObj->pt) {
>  return;
>   }
>
> - blit.dst.resource = dstSurf->texture;
> - blit.dst.level = dstSurf->u.tex.level;
> - blit.dst.box.z = dstSurf->u.tex.first_layer;
> - blit.dst.format = util_format_linear(dstSurf->format);
> + for (i = 0; i < drawFB->_NumColorDrawBuffers; i++) {
> +struct st_renderbuffer *dstRb =
> +   st_renderbuffer(drawFB->_ColorDrawBuffers[i]);
>
> - blit.src.resource = srcObj->pt;
> - blit.src.level = srcAtt->TextureLevel;
> - blit.src.box.z = srcAtt->Zoffset + srcAtt->CubeMapFace;
> - blit.src.format = util_format_linear(srcObj->pt->format);
> +if (dstRb) {
> +   struct pipe_surface *dstSurf = dstRb->surface;
>
> - st->pipe->blit(st->pipe, &blit);
> +   blit.dst.resource = dstSurf->texture;
> +   blit.dst.level = dstSurf->u.tex.level;
> +   blit.dst.box.z = dstSurf->u.tex.first_layer;
> +   blit.dst.format = util_format_linear(dstSurf->format);
> +
> +   blit.src.resource = srcObj->pt;
> +   blit.src.level = srcAtt->TextureLevel;
> +   blit.src.box.z = srcAtt->Zoffset + srcAtt->CubeMapFace;
> +   blit.src.format = util_format_linear(srcObj->pt->format);
> +
> +   st->pipe->blit(st->pipe, &blit);
> +}
> + }
>}
>else {
>   struct st_renderbuffer *srcRb =
>  st_renderbuffer(readFB->_ColorReadBuffer);
> - struct st_renderbuffer *dstRb =
> -st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
> - struct pipe_surface *srcSurf = srcRb->surface;
> - struct pipe_surface *dstSurf = dstRb->surface;
> + struct pipe_surface *srcSurf;
> + GLuint i;
> +
> + if (!srcRb || !srcRb->surface)
> +return;
>
> - blit.dst.resource = dstSurf->texture;
> - blit.dst.level = dstSurf->u.tex.level;
> - blit.dst.box.z = dstSurf->u.tex.first_layer;
> - blit.dst.format = util_format_linear(dstSurf->format);
> + srcSurf = srcRb->surface;
>
> - blit.src.resource = srcSurf->texture;
> - blit.src.level = srcSurf->u.tex.level;
> - blit.src.box.z = srcSurf->u.tex.first_layer;
> - blit.src.format = util_format_linear(srcSurf->format);
> + for (i = 0; i < drawFB->_NumColorDrawBuffers; i++) {
> +struct st_renderbuffer *dstRb =
> +   st_renderbuffer(drawFB->_ColorDrawBuffers[i]);
>
> - st->pipe->blit(st->pipe, &blit);
> +if (dstRb) {
> +   struct pipe_surface *dstSurf = dstRb->surface;
> +
> +   if (dstSurf) {
> +  blit.dst.resource = dstSurf->texture;
> +  blit.dst.level = dstSurf->u.tex.level;
> +  blit.dst.box.z = dstSurf->u.tex.first_layer;
> +  blit.dst.format = util_format_linear(dstSurf->format);
> +
> +  blit.src.resource = srcSurf->texture;
> +  blit.src.level = srcSurf->u.tex.level;
> +  blit.src.box.z = srcSurf->u.tex.first_layer;
> +  blit.src.format = util_format_linear(srcSurf->format);
> +
> +  st->pipe->blit(st->pipe, &blit);
> +   }
> +}
> + }
>}
> }
>
> --
> 1.7.3.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/

Re: [Mesa-dev] [PATCH] radeonsi/vdpau: remove nonsense state tracker dep

2013-01-16 Thread Matt Turner
On Wed, Jan 16, 2013 at 6:18 AM, Christian König
 wrote:
> From: Christian König 
>
> Added with automake conversion, but makes no sense at all.

Not according to git...? See e3b2160a1ffcfba0ff60cb47c17bd1a41afb63db.
It looks like it was in the old Makefile too.

In fact, it looks like libdridrm has been part of vdpau-radeonsi since
/you/ added the Makefile in 41625afa :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: Transcode RGB ETC1/2 textures to DXT1 or FXT1.

2013-01-16 Thread Eric Anholt
Ian Romanick  writes:

> On 01/11/2013 08:54 PM, Eric Anholt wrote:
>> The previous solution of transcoding to ARGB gave exact results, but
>> below the expected performance.  Given that the user has gone out of
>> their way to give us compressed data for performance reasons, try to
>> respect their wishes by doing the best compression we can handle.  We
>> expect DXT1 compression to be better quality, but it may not always be
>> available, in which case FXT1 seems like a reasonable fallback.
>>
>> This regresses OES_compressed_ETC1_RGB8_texture/miptree (which expects
>> exact results, which we no longer provide), but it improves GLBenchmark
>> 2.1 offscreen performance by 3.2% +/- 2.1% (n=11/10, throttling
>> outliers removed).
>
> There are ETC1 and ETC2 conformance tests.  Do they pass?

My gles2conform has continued passing, but I haven't tried this on the
gles3 branch with a gles3 conformance suite.


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


[Mesa-dev] [Bug 59364] Mesa build fails: clientattrib.c:33:22: fatal error: indirect.h: No such file or directory

2013-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59364

--- Comment #1 from Tom Stellard  ---
Note that in order to reproduce this, you will have to run make clean or even
make distclean, because the indirect.h file might be left over from a previous
build.

-- 
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] i965: Lower textureGrad() with samplerCubeShadow on pre-Haswell.

2013-01-16 Thread Kenneth Graunke
Fixes regressions since commit 899017fc54c40c969b5239b33f3a17b311878b0d
Author: Kenneth Graunke 
Date:   Fri Jan 4 07:53:09 2013 -0800

i965: Use Haswell's sample_d_c for textureGrad with shadow samplers.

That patch assumed that all instances were lowered.  However, we weren't
lowering textureGrad() with samplerCubeShadow because I couldn't figure
out the LOD calculations.  It turns out they're easy: you just have to
use 1 for the depth.  This causes it to pass oglconform's four tests.

Signed-off-by: Kenneth Graunke 
Cc: Anuj Phogat 
Cc: Ian Romanick 
---
 src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp 
b/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp
index dfbb983..9e661a1 100644
--- a/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp
+++ b/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp
@@ -27,6 +27,7 @@
 
 #include "glsl/ir.h"
 #include "glsl/ir_builder.h"
+#include "program/prog_instruction.h"
 
 using namespace ir_builder;
 
@@ -89,10 +90,6 @@ lower_texture_grad_visitor::visit_leave(ir_texture *ir)
if (ir->op != ir_txd || !ir->shadow_comparitor)
   return visit_continue;
 
-   /* Cubes are broken.  Avoid assertion failures when swizzling. */
-   if (ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE)
-  return visit_continue;
-
void *mem_ctx = ralloc_parent(ir);
 
const glsl_type *grad_type = ir->lod_info.grad.dPdx->type;
@@ -106,8 +103,14 @@ lower_texture_grad_visitor::visit_leave(ir_texture *ir)
txs->lod_info.lod = new(mem_ctx) ir_constant(0);
ir_variable *size =
   new(mem_ctx) ir_variable(grad_type, "size", ir_var_temporary);
-   emit(size, expr(ir_unop_i2f,
-  swizzle_for_size(txs, grad_type->vector_elements)));
+   if (ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) {
+  base_ir->insert_before(size);
+  base_ir->insert_before(assign(size, expr(ir_unop_i2f, txs), 
WRITEMASK_XY));
+  base_ir->insert_before(assign(size, new(mem_ctx) ir_constant(1.0f), 
WRITEMASK_Z));
+   } else {
+  emit(size, expr(ir_unop_i2f,
+  swizzle_for_size(txs, grad_type->vector_elements)));
+   }
 
/* Scale the gradients by width and height.  Effectively, the incoming
 * gradients are s'(x,y), t'(x,y), and r'(x,y) from equation 3.19 in the
-- 
1.8.1

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


Re: [Mesa-dev] [PATCH] i965: Transcode RGB ETC1/2 textures to DXT1 or FXT1.

2013-01-16 Thread Matt Turner
On Tue, Jan 15, 2013 at 3:49 PM, Ian Romanick  wrote:
> On 01/11/2013 08:54 PM, Eric Anholt wrote:
>>
>> The previous solution of transcoding to ARGB gave exact results, but
>> below the expected performance.  Given that the user has gone out of
>> their way to give us compressed data for performance reasons, try to
>> respect their wishes by doing the best compression we can handle.  We
>> expect DXT1 compression to be better quality, but it may not always be
>> available, in which case FXT1 seems like a reasonable fallback.
>>
>> This regresses OES_compressed_ETC1_RGB8_texture/miptree (which expects
>> exact results, which we no longer provide), but it improves GLBenchmark
>> 2.1 offscreen performance by 3.2% +/- 2.1% (n=11/10, throttling
>> outliers removed).
>
>
> There are ETC1 and ETC2 conformance tests.  Do they pass?

In es3conform it regresses compressed_etc1_rgb8_texture.test and
gl_compressed_rgb8_etc2.

The first fails because of slight inaccuracies, eg (0.71, 0.698,
0.776) instead of (0.698, 0.698, 0.765). The second looks like it
finds some potentially bad cases, eg (0.0 0.0 0.0 255.0) instead of
(0.0 255.0 0.0 255.0).
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Allow TexImage3D on depth/stencil textures in ES 3.0.

2013-01-16 Thread Kenneth Graunke
ES 3.0 supports 2D array textures, which are populated via TexImage3D.

Fixes es3conform's shadow_execution_frag test.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/main/glformats.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 7969f77..9831ab4 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2068,7 +2068,7 @@ _mesa_es3_error_check_format_and_type(GLenum format, 
GLenum type,
   break;
 
case GL_DEPTH_COMPONENT:
-  if (dimensions != 2) {
+  if (dimensions == 1) {
  return GL_INVALID_OPERATION;
   }
   switch (type) {
@@ -2098,7 +2098,7 @@ _mesa_es3_error_check_format_and_type(GLenum format, 
GLenum type,
   break;
 
case GL_DEPTH_STENCIL:
-  if (dimensions != 2) {
+  if (dimensions == 1) {
  return GL_INVALID_OPERATION;
   }
   switch (type) {
-- 
1.8.1

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


Re: [Mesa-dev] [PATCH] mesa: Allow TexImage3D on depth/stencil textures in ES 3.0.

2013-01-16 Thread Ian Romanick

On 01/16/2013 01:49 PM, Kenneth Graunke wrote:

ES 3.0 supports 2D array textures, which are populated via TexImage3D.

Fixes es3conform's shadow_execution_frag test.

Signed-off-by: Kenneth Graunke 
---
  src/mesa/main/glformats.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 7969f77..9831ab4 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2068,7 +2068,7 @@ _mesa_es3_error_check_format_and_type(GLenum format, 
GLenum type,
break;

 case GL_DEPTH_COMPONENT:
-  if (dimensions != 2) {
+  if (dimensions == 1) {


These checks are suck. :(  Won't this let you specify depth component 
textures for GL_TEXTURE_3D textures too?



   return GL_INVALID_OPERATION;
}
switch (type) {
@@ -2098,7 +2098,7 @@ _mesa_es3_error_check_format_and_type(GLenum format, 
GLenum type,
break;

 case GL_DEPTH_STENCIL:
-  if (dimensions != 2) {
+  if (dimensions == 1) {
   return GL_INVALID_OPERATION;
}
switch (type) {



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


[Mesa-dev] [PATCH 00/10] Support UBOs with instance names pre-series

2013-01-16 Thread Ian Romanick
This is the "warm up" series before my series to make UBOs with
instances names (and arrays of UBOs) work.  These are both required
features of GLSL ES 3.00 that are not added to desktop GLSL until 1.50.
This series is just a bunch of minor fixes and small refactors.

This series fixes 4 gles3conform tests.  There are about a dozen more
patches coming in the next few day to fix the remaining 14 UBO tests.

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


[Mesa-dev] [PATCH 02/10] glsl: Track UBO block names in the symbol table.

2013-01-16 Thread Ian Romanick
From: Kenneth Graunke 

The GLSL 1.40 spec says:

"Uniform block names and variable names declared within uniform
blocks are scoped at the program level."

Track the block name in the symbol table and emit errors when conflicts
exist.

Fixes es3conform's uniform_buffer_object_block_name_conflict test, and
fixes the piglit block-name-clashes-with-{variable,function,struct}.vert
tests.

NOTE: This is a candidate for the 9.0 branch.

Reviewed-by: Ian Romanick 
---
 src/glsl/ast_to_hir.cpp|  6 ++
 src/glsl/glsl_symbol_table.cpp | 14 +++---
 src/glsl/glsl_symbol_table.h   |  1 +
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index ea5e3b7..31dd51a 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4132,6 +4132,12 @@ ast_uniform_block::hir(exec_list *instructions,
struct gl_uniform_block *ubo = get_next_uniform_block(state);
ubo->Name = ralloc_strdup(state->uniform_blocks, this->block_name);
 
+   if (!state->symbols->add_uniform_block(ubo)) {
+  YYLTYPE loc = this->get_location();
+  _mesa_glsl_error(&loc, state, "Uniform block name `%s' already taken in "
+   "the current scope.\n", ubo->Name);
+   }
+
unsigned int num_variables = 0;
foreach_list_typed(ast_declarator_list, decl_list, link, &declarations) {
   foreach_list_const(node, &decl_list->declarations) {
diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp
index f934ea8..6171a27 100644
--- a/src/glsl/glsl_symbol_table.cpp
+++ b/src/glsl/glsl_symbol_table.cpp
@@ -41,13 +41,15 @@ public:
   ralloc_free(entry);
}
 
-   symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {}
-   symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {}
-   symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) {}
+   symbol_table_entry(ir_variable *v)   : v(v), f(0), t(0), u(0) {}
+   symbol_table_entry(ir_function *f)   : v(0), f(f), t(0), u(0) {}
+   symbol_table_entry(const glsl_type *t)   : v(0), f(0), t(t), u(0) {}
+   symbol_table_entry(struct gl_uniform_block *u)   : v(0), f(0), t(t), u(u) {}
 
ir_variable *v;
ir_function *f;
const glsl_type *t;
+   struct gl_uniform_block *u;
 };
 
 glsl_symbol_table::glsl_symbol_table()
@@ -132,6 +134,12 @@ bool glsl_symbol_table::add_function(ir_function *f)
return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0;
 }
 
+bool glsl_symbol_table::add_uniform_block(struct gl_uniform_block *u)
+{
+   symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(u);
+   return _mesa_symbol_table_add_symbol(table, -1, u->Name, entry) == 0;
+}
+
 void glsl_symbol_table::add_global_function(ir_function *f)
 {
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h
index 9f56027..f95fb8a 100644
--- a/src/glsl/glsl_symbol_table.h
+++ b/src/glsl/glsl_symbol_table.h
@@ -99,6 +99,7 @@ public:
bool add_variable(ir_variable *v);
bool add_type(const char *name, const glsl_type *t);
bool add_function(ir_function *f);
+   bool add_uniform_block(struct gl_uniform_block *u);
/*@}*/
 
/**
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 01/10] glsl: Reject row_major and column_major on non-matrix types

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

About both row_major and column_major layout qualifiers, the GLSL spec
says:

"It only affects the layout of matrices."

However, the OpenGL ES 3.0 conformance tests have taken this to mean it
is an error use it elsewhere.  This seems logical given that
'layout(row_major) vec4 foo' is probably not what the programmer meant.

The only catch is dealing with structures that contain matrices.  Layout
qualifiers cannot be applied directly to fields of structures, so the
only way to affect the layout of the fields is to apply a qualifier to
the structure declaration itself.  There is ongoing debate about this
within Khronos, and it seems to be settling in favor of allowing the
qualifiers on structures.  I light of this, I have chosen to allow the
qualifiers on structures but emit a warning since the usage may not be
portable.

Fixes gles3conform test
uniform_buffer_object_layouts_not_for_matrix_type and causes no
regressions.

Signed-off-by: Ian Romanick 
---
 src/glsl/ast_to_hir.cpp | 39 +--
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index f934c8e..ea5e3b7 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1933,6 +1933,31 @@ is_varying_var(ir_variable *var, 
_mesa_glsl_parser_targets target)
 }
 
 
+/**
+ * Matrix layout qualifiers are only allowed on certain types
+ */
+static void
+validate_matrix_layout_for_type(struct _mesa_glsl_parse_state *state,
+   YYLTYPE *loc,
+   const glsl_type *type)
+{
+   if (!type->is_matrix() && !type->is_record()) {
+  _mesa_glsl_error(loc, state,
+   "uniform block layout qualifiers row_major and "
+   "column_major can only be applied to matrix and "
+   "structure types");
+   } else if (type->is_record()) {
+  /* We allow 'layout(row_major)' on structure types because it's the only
+   * way to get row-major layouts on matrices contained in structures.
+   */
+  _mesa_glsl_warning(loc, state,
+ "uniform block layout qualifiers row_major and "
+ "column_major applied to structure types is not "
+ "strictly conformant and my be rejected by other "
+ "compilers");
+   }
+}
+
 static void
 apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
 ir_variable *var,
@@ -2251,12 +2276,14 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
   "members");
}
 
-   if (!ubo_qualifiers_valid &&
-   (qual->flags.q.row_major || qual->flags.q.column_major)) {
-  _mesa_glsl_error(loc, state,
-   "uniform block layout qualifiers row_major and "
-  "column_major can only be applied to uniform block "
-  "members");
+   if (qual->flags.q.row_major || qual->flags.q.column_major) {
+  if (!ubo_qualifiers_valid) {
+_mesa_glsl_error(loc, state,
+ "uniform block layout qualifiers row_major and "
+ "column_major can only be applied to uniform block "
+ "members");
+  } else
+validate_matrix_layout_for_type(state, loc, var->type);
}
 }
 
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 04/10] linker: Use helper variable sh

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

This looks like a copy-and-paste left over.

Signed-off-by: Ian Romanick 
---
 src/glsl/linker.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 70f3d5b..63548e0 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -885,8 +885,8 @@ link_intrastage_shaders(void *mem_ctx,
for (unsigned i = 0; i < num_shaders; i++) {
   struct gl_shader *sh = shader_list[i];
 
-  for (unsigned j = 0; j < shader_list[i]->NumUniformBlocks; j++) {
-link_assign_uniform_block_offsets(shader_list[i]);
+  for (unsigned j = 0; j < sh->NumUniformBlocks; j++) {
+link_assign_uniform_block_offsets(sh);
 
 int index = link_cross_validate_uniform_block(mem_ctx,
   &uniform_blocks,
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 03/10] glsl: Remove stale comment

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/glsl/ir_clone.cpp | 4 
 1 file changed, 4 deletions(-)

diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index 4314efa..c62c1fc 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -36,10 +36,6 @@ ir_rvalue::clone(void *mem_ctx, struct hash_table *ht) const
 
 /**
  * Duplicate an IR variable
- *
- * \note
- * This will probably be made \c virtual and moved to the base class
- * eventually.
  */
 ir_variable *
 ir_variable::clone(void *mem_ctx, struct hash_table *ht) const
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 05/10] mesa: Remove unused field gl_uniform_buffer_variable::Buffer

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/glsl/ast_to_hir.cpp | 1 -
 src/mesa/main/mtypes.h  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 31dd51a..de3ce90 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4166,7 +4166,6 @@ ast_uniform_block::hir(exec_list *instructions,
 
 ubo_var->Name = ralloc_strdup(state->uniform_blocks, var->name);
 ubo_var->Type = var->type;
-ubo_var->Buffer = ubo - state->uniform_blocks;
 ubo_var->Offset = 0; /* Assigned at link time. */
 
 if (var->type->is_matrix() ||
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d0c0e24..e696d30 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2274,7 +2274,6 @@ struct gl_uniform_buffer_variable
 {
char *Name;
const struct glsl_type *Type;
-   unsigned int Buffer;
unsigned int Offset;
GLboolean RowMajor;
 };
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 06/10] glsl: Remove unused loc parameter from generate_call

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/glsl/ast_function.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index b56a3c7..dc7a58b 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -183,7 +183,7 @@ verify_parameter_modes(_mesa_glsl_parse_state *state,
  */
 static ir_rvalue *
 generate_call(exec_list *instructions, ir_function_signature *sig,
- YYLTYPE *loc, exec_list *actual_parameters,
+ exec_list *actual_parameters,
  ir_call **call_ir,
  struct _mesa_glsl_parse_state *state)
 {
@@ -1501,7 +1501,7 @@ ast_function_expression::hir(exec_list *instructions,
 /* an error has already been emitted */
 value = ir_rvalue::error_value(ctx);
   } else {
-value = generate_call(instructions, sig, &loc, &actual_parameters,
+value = generate_call(instructions, sig, &actual_parameters,
   &call, state);
   }
 
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 07/10] glsl: Eliminate link_update_uniform_buffer_variables return value

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

It always returns true, so there's no point in having a return value.

Signed-off-by: Ian Romanick 
---
 src/glsl/link_uniforms.cpp | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index aa8a8b3..07d9c18 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -452,7 +452,7 @@ link_cross_validate_uniform_block(void *mem_ctx,
  * would point at the uniform block list in one of the pre-linked
  * shaders).
  */
-static bool
+static void
 link_update_uniform_buffer_variables(struct gl_shader *shader)
 {
foreach_list(node, shader->ir) {
@@ -478,8 +478,6 @@ link_update_uniform_buffer_variables(struct gl_shader 
*shader)
   }
   assert(found);
}
-
-   return true;
 }
 
 void
@@ -544,8 +542,7 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog)
   if (prog->_LinkedShaders[i] == NULL)
 continue;
 
-  if (!link_update_uniform_buffer_variables(prog->_LinkedShaders[i]))
-return;
+  link_update_uniform_buffer_variables(prog->_LinkedShaders[i]);
}
 
/* First pass: Count the uniform resources used by the user-defined
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 08/10] mesa: Refactor getting a uniform's name to a helper function

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

We currently have a bug in this code, and I don't want to fix it in two
places.

Signed-off-by: Ian Romanick 
---
 src/mesa/main/uniform_query.cpp |  2 +-
 src/mesa/main/uniforms.c| 12 ++--
 src/mesa/main/uniforms.h|  5 +
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index efff8f3..ec08ed4 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -59,7 +59,7 @@ _mesa_GetActiveUniform(GLhandleARB program, GLuint index,
const struct gl_uniform_storage *const uni = &shProg->UniformStorage[index];
 
if (nameOut) {
-  _mesa_copy_string(nameOut, maxLength, length, uni->name);
+  _mesa_get_uniform_name(uni, maxLength, length, nameOut);
}
 
if (size) {
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 77b195e..edb4477 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -795,7 +795,15 @@ _mesa_GetActiveUniformName(GLuint program, GLuint 
uniformIndex,
}
 
if (uniformName) {
-  _mesa_copy_string(uniformName, bufSize, length,
-   shProg->UniformStorage[uniformIndex].name);
+  _mesa_get_uniform_name(& shProg->UniformStorage[uniformIndex],
+ bufSize, length, uniformName);
}
 }
+
+void
+_mesa_get_uniform_name(const struct gl_uniform_storage *uni,
+   GLsizei maxLength, GLsizei *length,
+   GLchar *nameOut)
+{
+   _mesa_copy_string(nameOut, maxLength, length, uni->name);
+}
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
index 287d710..f175031 100644
--- a/src/mesa/main/uniforms.h
+++ b/src/mesa/main/uniforms.h
@@ -213,6 +213,11 @@ _mesa_sampler_uniforms_are_valid(const struct 
gl_shader_program *shProg,
 extern const struct gl_program_parameter *
 get_uniform_parameter(struct gl_shader_program *shProg, GLint index);
 
+extern void
+_mesa_get_uniform_name(const struct gl_uniform_storage *uni,
+   GLsizei maxLength, GLsizei *length,
+   GLchar *nameOut);
+
 struct gl_builtin_uniform_element {
const char *field;
int tokens[STATE_LENGTH];
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 09/10] mesa: Array uniform names are supposed to have [0] appended

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

This is required by OpenGL ES 3.0 and desktop OpenGL 4.2.  Previous
version were ambiguous.  This also matches the behavior of NVIDIA's
closed-source driver (version 304.64).

Fixed gles3conformance test uniform_buffer_object_getactiveuniform.

Several piglit tests expect glGetActiveUniform to *not* include the [0]
on the end.  These tests were already failing on NVIDIA, and this change
regresses them on Mesa.  Patches have been sent to the piglit mailing
list to fix the tests.

Signed-off-by: Ian Romanick 
---
 src/mesa/main/uniforms.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index edb4477..15248fa 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -805,5 +805,36 @@ _mesa_get_uniform_name(const struct gl_uniform_storage 
*uni,
GLsizei maxLength, GLsizei *length,
GLchar *nameOut)
 {
+   GLsizei localLength;
+
+   if (length == NULL)
+  length = &localLength;
+
_mesa_copy_string(nameOut, maxLength, length, uni->name);
+
+   /* Page 61 (page 73 of the PDF) in section 2.11 of the OpenGL ES 3.0
+* spec says:
+*
+* "If the active uniform is an array, the uniform name returned in
+* name will always be the name of the uniform array appended with
+* "[0]"."
+*
+* The same text also appears in the OpenGL 4.2 spec.  It does not,
+* however, appear in any previous spec.  Previous specifications are
+* ambiguous in this regard.  However, either name can later be passed
+* to glGetUniformLocation (and related APIs), so there shouldn't be any
+* harm in always appending "[0]" to uniform array names.
+*/
+   if (uni->array_elements != 0) {
+  unsigned i;
+
+  /* The comparison is strange because *length does *NOT* include the
+   * terminating NUL, but maxLength does.
+   */
+  for (i = 0; i < 3 && (*length + i + 1) < maxLength; i++)
+ nameOut[*length + i] = "[0]"[i];
+
+  nameOut[*length + i] = '\0';
+  *length += i;
+   }
 }
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 10/10] mesa: Array uniform name length includes length of [0]

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

This is required by OpenGL ES 3.0 and desktop OpenGL 4.2.  Previous
version were ambiguous.  This also matches the behavior of NVIDIA's
closed-source driver (version 304.64).

Fixed gles3conformance test uniform_buffer_object_getactiveuniformsiv
and uniform_buffer_object_structure_and_array_element_names (on my
in-progress branch that fixes a bunch of other stuff...YMMV).

Signed-off-by: Ian Romanick 
---
 src/mesa/main/uniform_query.cpp | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index ec08ed4..f0ab0f0 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -122,6 +122,16 @@ _mesa_GetActiveUniformsiv(GLuint program,
 
   case GL_UNIFORM_NAME_LENGTH:
 params[i] = strlen(uni->name) + 1;
+
+ /* Page 61 (page 73 of the PDF) in section 2.11 of the OpenGL ES 3.0
+  * spec says:
+  *
+  * "If the active uniform is an array, the uniform name returned
+  * in name will always be the name of the uniform array appended
+  * with "[0]"."
+  */
+ if (uni->array_elements != 0)
+params[i] += 3;
 break;
 
   case GL_UNIFORM_BLOCK_INDEX:
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 2/7] glsl/build: Remove dead LIBRARY_* variables

2013-01-16 Thread Matt Turner
---
 src/glsl/Makefile.am   |2 --
 src/glsl/glcpp/Makefile.am |2 --
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 0f545d5..1d93ac4 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -25,9 +25,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa/ \
-   $(LIBRARY_INCLUDES) \
$(DEFINES) \
-   $(LIBRARY_DEFINES) \
$(API_DEFINES)
 AM_CFLAGS = $(VISIBILITY_CFLAGS)
 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am
index 1efc9dc..d79f865 100644
--- a/src/glsl/glcpp/Makefile.am
+++ b/src/glsl/glcpp/Makefile.am
@@ -29,9 +29,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa/ \
$(VISIBILITY_CFLAGS) \
-   $(LIBRARY_INCLUDES) \
$(DEFINES) \
-   $(LIBRARY_DEFINES) \
$(API_DEFINES)
 
 AM_YFLAGS = -v -d -p "glcpp_parser_"
-- 
1.7.8.6

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


[Mesa-dev] [PATCH 3/7] glsl/build: Build glsl_test only on make check

2013-01-16 Thread Matt Turner
---
 src/glsl/Makefile.am |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 1d93ac4..36af90e 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -35,7 +35,8 @@ AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
 include Makefile.sources
 
 noinst_LTLIBRARIES = libglsl.la
-noinst_PROGRAMS = glsl_compiler glsl_test
+check_PROGRAMS = glsl_test
+noinst_PROGRAMS = glsl_compiler
 
 libglsl_la_SOURCES = \
glsl_lexer.ll \
-- 
1.7.8.6

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


[Mesa-dev] [PATCH 1/7] xmlpool/build: generate options.h via BUILT_SOURCES

2013-01-16 Thread Matt Turner
Fixes missing options.h when doing 'make check' in dri/common before
'make' has been run.
---
 src/mesa/drivers/dri/common/xmlpool/Makefile.am |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile.am 
b/src/mesa/drivers/dri/common/xmlpool/Makefile.am
index b99df40..b545f37 100644
--- a/src/mesa/drivers/dri/common/xmlpool/Makefile.am
+++ b/src/mesa/drivers/dri/common/xmlpool/Makefile.am
@@ -52,7 +52,7 @@ POT=xmlpool.pot
 
 .PHONY: all clean pot po mo
 
-all: options.h
+BUILT_SOURCES = options.h
 
 # All generated files are cleaned up.
 clean:
-- 
1.7.8.6

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


[Mesa-dev] [PATCH 4/7] glsl/build: Don't build glsl_compiler

2013-01-16 Thread Matt Turner
Use glslparsertest from piglit instead.
---
Alternatively, does automake offer any options for generating rules
to build a target without adding it to the default build? I'd be nice
to leave glsl_compiler out of the build but still be able to do
   make glsl_compiler

 src/glsl/Makefile.am |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 36af90e..fa09c5e 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -36,7 +36,6 @@ include Makefile.sources
 
 noinst_LTLIBRARIES = libglsl.la
 check_PROGRAMS = glsl_test
-noinst_PROGRAMS = glsl_compiler
 
 libglsl_la_SOURCES = \
glsl_lexer.ll \
@@ -47,14 +46,6 @@ libglsl_la_SOURCES = \
 libglsl_la_LIBADD = glcpp/libglcpp.la
 libglsl_la_LDFLAGS =
 
-glsl_compiler_SOURCES = \
-   $(top_srcdir)/src/mesa/main/hash_table.c \
-   $(top_srcdir)/src/mesa/program/prog_hash_table.c \
-   $(top_srcdir)/src/mesa/program/symbol_table.c \
-   $(GLSL_COMPILER_CXX_FILES)
-
-glsl_compiler_LDADD = libglsl.la
-
 glsl_test_SOURCES = \
$(top_srcdir)/src/mesa/main/hash_table.c \
$(top_srcdir)/src/mesa/program/prog_hash_table.c \
-- 
1.7.8.6

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


[Mesa-dev] [PATCH 5/7] glsl/build: Don't build builtin_compiler separately if not cross compiling

2013-01-16 Thread Matt Turner
Reduces the number of times that src/glsl/ is compiled when not cross
compiling.

Cc: Thierry Reding 
---
 configure.ac |2 ++
 src/glsl/.gitignore  |1 +
 src/glsl/Makefile.am |   29 +++--
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 99a08fd..5dd9a80 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1970,6 +1970,8 @@ AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 
'X86_ASM' >/dev/null 2>&1)
 AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 
2>&1)
 AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 
2>&1)
 
+AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
+
 AC_SUBST([VDPAU_MAJOR], 1)
 AC_SUBST([VDPAU_MINOR], 0)
 
diff --git a/src/glsl/.gitignore b/src/glsl/.gitignore
index 4eb4fef..a04df27 100644
--- a/src/glsl/.gitignore
+++ b/src/glsl/.gitignore
@@ -4,4 +4,5 @@ glsl_parser.cc
 glsl_parser.h
 glsl_parser.output
 builtin_function.cpp
+builtincompiler
 glsl_test
diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index fa09c5e..07fcf96 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -19,7 +19,11 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
+if CROSS_COMPILING
 SUBDIRS = builtin_compiler glcpp
+else
+SUBDIRS = glcpp
+endif
 
 AM_CPPFLAGS = \
-I$(top_srcdir)/include \
@@ -56,6 +60,27 @@ glsl_test_SOURCES = \
 
 glsl_test_LDADD = libglsl.la
 
+if CROSS_COMPILING
+BUILTIN_COMPILER = builtin_compiler/builtin_compiler$(BUILD_EXEEXT)
+else
+BUILTIN_COMPILER = builtincompiler$(BUILD_EXEEXT)
+
+noinst_PROGRAMS = builtincompiler
+noinst_LTLIBRARIES += libglslcore.la
+
+libglslcore_la_SOURCES =   \
+   glsl_lexer.ll   \
+   glsl_parser.cc  \
+   $(LIBGLSL_FILES)
+builtincompiler_SOURCES = \
+   $(top_srcdir)/src/mesa/main/hash_table.c\
+   $(top_srcdir)/src/mesa/program/prog_hash_table.c\
+   $(top_srcdir)/src/mesa/program/symbol_table.c   \
+   $(top_srcdir)/src/glsl/builtin_compiler/builtin_stubs.cpp \
+   $(GLSL_COMPILER_CXX_FILES)
+builtincompiler_LDADD = libglslcore.la glcpp/libglcpp.la
+endif
+
 # automake <=1.11 and automake >=1.12 have different conventions for naming 
C++ header files
 # made by yacc.  To work with both, we write our own rule rather than using 
automake's.
 # When (if) we require automake >=1.12 in configure.ac, this can be removed, 
and we can use
@@ -66,5 +91,5 @@ glsl_parser.cc glsl_parser.h: glsl_parser.yy
 BUILT_SOURCES = glsl_parser.h
 CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES) builtin_function.cpp
 
-builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* 
$(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py 
$(srcdir)/builtins/tools/texture_builtins.py 
builtin_compiler/builtin_compiler$(BUILD_EXEEXT)
-   $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) 
$(srcdir)/builtins/tools/generate_builtins.py 
builtin_compiler/builtin_compiler$(BUILD_EXEEXT) > builtin_function.cpp || rm 
-f builtin_function.cpp
+builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* 
$(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py 
$(srcdir)/builtins/tools/texture_builtins.py $(BUILTIN_COMPILER)
+   $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) 
$(srcdir)/builtins/tools/generate_builtins.py $(builddir)/$(BUILTIN_COMPILER) > 
builtin_function.cpp || rm -f builtin_function.cpp
-- 
1.7.8.6

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


[Mesa-dev] [PATCH 6/7] glsl/build: Build glcpp via the glsl Makefile

2013-01-16 Thread Matt Turner
Removing the subdirectory recursion provides a small speed up.
---
 configure.ac|1 -
 src/glsl/.gitignore |4 +-
 src/glsl/Makefile.am|  108 ++-
 src/glsl/Makefile.sources   |8 ++--
 src/glsl/glcpp/Makefile.am  |   54 ---
 src/glsl/glcpp/tests/glcpp-test |4 +-
 6 files changed, 91 insertions(+), 88 deletions(-)
 delete mode 100644 src/glsl/glcpp/Makefile.am

diff --git a/configure.ac b/configure.ac
index 5dd9a80..b08c1c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2085,7 +2085,6 @@ AC_CONFIG_FILES([Makefile
src/gbm/main/gbm.pc
src/glsl/Makefile
src/glsl/builtin_compiler/Makefile
-   src/glsl/glcpp/Makefile
src/glsl/tests/Makefile
src/glx/Makefile
src/glx/tests/Makefile
diff --git a/src/glsl/.gitignore b/src/glsl/.gitignore
index a04df27..2cf5b00 100644
--- a/src/glsl/.gitignore
+++ b/src/glsl/.gitignore
@@ -1,6 +1,6 @@
 glsl_compiler
-glsl_lexer.cc
-glsl_parser.cc
+glsl_lexer.cpp
+glsl_parser.cpp
 glsl_parser.h
 glsl_parser.output
 builtin_function.cpp
diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 07fcf96..1962d3b 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -20,35 +20,42 @@
 # IN THE SOFTWARE.
 
 if CROSS_COMPILING
-SUBDIRS = builtin_compiler glcpp
-else
-SUBDIRS = glcpp
+SUBDIRS = builtin_compiler
 endif
 
 AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa/ \
+   -I$(top_srcdir)/src/glsl/glcpp \
$(DEFINES) \
$(API_DEFINES)
 AM_CFLAGS = $(VISIBILITY_CFLAGS)
 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
 
-AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
-
 include Makefile.sources
 
-noinst_LTLIBRARIES = libglsl.la
-check_PROGRAMS = glsl_test
+TESTS = glcpp/tests/glcpp-test
 
-libglsl_la_SOURCES = \
-   glsl_lexer.ll \
-   glsl_parser.cc \
-   $(LIBGLSL_FILES) \
-   builtin_function.cpp
+noinst_LTLIBRARIES = libglcpp.la libglsl.la
+check_PROGRAMS = glcpp/glcpp glsl_test
 
-libglsl_la_LIBADD = glcpp/libglcpp.la
-libglsl_la_LDFLAGS =
+libglcpp_la_SOURCES =  \
+   glcpp/glcpp-lex.c   \
+   glcpp/glcpp-parse.c \
+   $(LIBGLCPP_FILES)
+
+glcpp_glcpp_SOURCES =  \
+   glcpp/glcpp.c   \
+   $(top_srcdir)/src/mesa/program/prog_hash_table.c
+glcpp_glcpp_LDADD = libglcpp.la
+
+libglsl_la_SOURCES =   \
+   glsl_lexer.cpp  \
+   glsl_parser.cpp \
+   $(LIBGLSL_FILES)\
+   builtin_function.cpp
+libglsl_la_LIBADD = libglcpp.la
 
 glsl_test_SOURCES = \
$(top_srcdir)/src/mesa/main/hash_table.c \
@@ -69,8 +76,8 @@ noinst_PROGRAMS = builtincompiler
 noinst_LTLIBRARIES += libglslcore.la
 
 libglslcore_la_SOURCES =   \
-   glsl_lexer.ll   \
-   glsl_parser.cc  \
+   glsl_lexer.cpp  \
+   glsl_parser.cpp \
$(LIBGLSL_FILES)
 builtincompiler_SOURCES = \
$(top_srcdir)/src/mesa/main/hash_table.c\
@@ -78,18 +85,69 @@ builtincompiler_SOURCES = \
$(top_srcdir)/src/mesa/program/symbol_table.c   \
$(top_srcdir)/src/glsl/builtin_compiler/builtin_stubs.cpp \
$(GLSL_COMPILER_CXX_FILES)
-builtincompiler_LDADD = libglslcore.la glcpp/libglcpp.la
+builtincompiler_LDADD = libglslcore.la libglcpp.la
 endif
 
-# automake <=1.11 and automake >=1.12 have different conventions for naming 
C++ header files
-# made by yacc.  To work with both, we write our own rule rather than using 
automake's.
-# When (if) we require automake >=1.12 in configure.ac, this can be removed, 
and we can use
-# the automake rule.
-glsl_parser.cc glsl_parser.h: glsl_parser.yy
-   $(AM_V_GEN) $(YACC) -v -o glsl_parser.cc -p "_mesa_glsl_" 
--defines=glsl_parser.h $<
+# We write our own rules for yacc and lex below. We'd rather use automake,
+# but automake makes it especially difficult for a number of reasons:
+#
+#  * < automake-1.12 generates .h files from .yy and .ypp files, but
+#>=automake-1.12 generates .hh and .hpp files respectively. There's no
+#good way of making a project that uses C++ yacc files compatible with
+#both versions of automake. Strong work automake developers.
+#
+#  * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
+#we'd like the resulting generated code to also go in glcpp/ for purposes
+#of distribution. Automake gives no way to do this.
+#
+#  * Since we're building multiple yacc parsers into one library (and v

[Mesa-dev] [PATCH 7/7] glsl/build: Build tests via the glsl Makefile

2013-01-16 Thread Matt Turner
---
 Makefile.am  |1 -
 configure.ac |1 -
 src/glsl/Makefile.am |   38 --
 src/glsl/tests/Makefile.am   |   35 ---
 src/glsl/tests/optimization-test |   10 --
 5 files changed, 44 insertions(+), 41 deletions(-)
 delete mode 100644 src/glsl/tests/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index ee7..74f43da 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -30,7 +30,6 @@ check-local:
$(MAKE) -C src/mapi/glapi/tests check
$(MAKE) -C src/mapi/shared-glapi/tests check
$(MAKE) -C src/mesa/main/tests check
-   $(MAKE) -C src/glsl/tests check
$(MAKE) -C src/glx/tests check
 
 .PHONY: doxygen
diff --git a/configure.ac b/configure.ac
index b08c1c8..40496e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2085,7 +2085,6 @@ AC_CONFIG_FILES([Makefile
src/gbm/main/gbm.pc
src/glsl/Makefile
src/glsl/builtin_compiler/Makefile
-   src/glsl/tests/Makefile
src/glx/Makefile
src/glx/tests/Makefile
src/gtest/Makefile
diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 1962d3b..175183a 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -28,6 +28,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa/ \
-I$(top_srcdir)/src/glsl/glcpp \
+   -I$(top_srcdir)/src/gtest/include \
$(DEFINES) \
$(API_DEFINES)
 AM_CFLAGS = $(VISIBILITY_CFLAGS)
@@ -35,10 +36,43 @@ AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
 
 include Makefile.sources
 
-TESTS = glcpp/tests/glcpp-test
+TESTS = glcpp/tests/glcpp-test \
+   tests/optimization-test \
+   tests/ralloc-test   \
+   tests/uniform-initializer-test
+
+TESTS_ENVIRONMENT= \
+   export PYTHON2=$(PYTHON2); \
+   export PYTHON_FLAGS=$(PYTHON_FLAGS);
 
 noinst_LTLIBRARIES = libglcpp.la libglsl.la
-check_PROGRAMS = glcpp/glcpp glsl_test
+check_PROGRAMS =   \
+   glcpp/glcpp \
+   glsl_test   \
+   tests/ralloc-test   \
+   tests/uniform-initializer-test
+
+tests_uniform_initializer_test_SOURCES =   \
+   $(top_srcdir)/src/mesa/main/hash_table.c\
+   $(top_srcdir)/src/mesa/program/prog_hash_table.c\
+   $(top_srcdir)/src/mesa/program/symbol_table.c   \
+   tests/copy_constant_to_storage_tests.cpp\
+   tests/set_uniform_initializer_tests.cpp \
+   tests/uniform_initializer_utils.cpp
+tests_uniform_initializer_test_CFLAGS =\
+   $(PTHREAD_CFLAGS)
+tests_uniform_initializer_test_LDADD = \
+   $(top_builddir)/src/gtest/libgtest.la   \
+   $(top_builddir)/src/glsl/libglsl.la \
+   $(PTHREAD_LIBS)
+
+tests_ralloc_test_SOURCES =\
+   tests/ralloc_test.cpp   \
+   $(top_builddir)/src/glsl/ralloc.c
+tests_ralloc_test_CFLAGS = $(PTHREAD_CFLAGS)
+tests_ralloc_test_LDADD =  \
+   $(top_builddir)/src/gtest/libgtest.la   \
+   $(PTHREAD_LIBS)
 
 libglcpp_la_SOURCES =  \
glcpp/glcpp-lex.c   \
diff --git a/src/glsl/tests/Makefile.am b/src/glsl/tests/Makefile.am
deleted file mode 100644
index eaf5a3c..000
--- a/src/glsl/tests/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-AM_CPPFLAGS = \
-   -I$(top_srcdir)/src/gtest/include \
-   -I$(top_srcdir)/src/mesa \
-   -I$(top_srcdir)/src/mapi \
-   -I$(top_srcdir)/src/glsl \
-   -I$(top_srcdir)/include
-
-TESTS_ENVIRONMENT= \
-   export PYTHON2=$(PYTHON2); \
-   export PYTHON_FLAGS=$(PYTHON_FLAGS);
-
-TESTS = \
-   optimization-test \
-   ralloc-test \
-   uniform-initializer-test
-
-check_PROGRAMS =   \
-   ralloc-test \
-   uniform-initializer-test
-
-uniform_initializer_test_SOURCES = \
-   copy_constant_to_storage_tests.cpp  \
-   set_uniform_initializer_tests.cpp   \
-   uniform_initializer_utils.cpp
-uniform_initializer_test_CFLAGS =  \
-   $(PTHREAD_CFLAGS)
-uniform_initializer_test_LDADD =   \
-   $(top_builddir)/src/gtest/libgtest.la   \
-   $(top_builddir)/src/glsl/libglsl.la \
-   $(top_builddir)/src/mesa/libmesa.la \
-   $(PTHREAD_LIBS)
-
-ralloc_test_SOURCES = ralloc_test.cpp $(top_builddir)/src/glsl/ralloc.c
-ralloc_test_CFLAGS = $(PTHREAD_CFLAGS)
-ralloc_test_LDADD = $(top_builddir)/src/gtest/libgtest.la $(PTHREAD_LIBS)
diff --git a/src/glsl/tests/optimization-test b/

Re: [Mesa-dev] [PATCH] mesa: Allow TexImage3D on depth/stencil textures in ES 3.0.

2013-01-16 Thread Matt Turner
On Wed, Jan 16, 2013 at 2:38 PM, Ian Romanick  wrote:
> These checks are suck. :(  Won't this let you specify depth component
> textures for GL_TEXTURE_3D textures too?

Looks like it, since packed_pixels_pixelstore is failing with this patch.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Allow TexImage3D on depth/stencil textures in ES 3.0.

2013-01-16 Thread Ian Romanick

On 01/16/2013 01:49 PM, Kenneth Graunke wrote:

ES 3.0 supports 2D array textures, which are populated via TexImage3D.

Fixes es3conform's shadow_execution_frag test.


Actually, this should be handled by other checks already in 
texture_error_check.  Search for "additional checks for depth textures". 
 GL_TEXTURE_3D depth component textures aren't allowed on desktop 
either, and 1D textures are never allowed in ES.



Signed-off-by: Kenneth Graunke 
---
  src/mesa/main/glformats.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 7969f77..9831ab4 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2068,7 +2068,7 @@ _mesa_es3_error_check_format_and_type(GLenum format, 
GLenum type,
break;

 case GL_DEPTH_COMPONENT:
-  if (dimensions != 2) {
+  if (dimensions == 1) {
   return GL_INVALID_OPERATION;
}
switch (type) {
@@ -2098,7 +2098,7 @@ _mesa_es3_error_check_format_and_type(GLenum format, 
GLenum type,
break;

 case GL_DEPTH_STENCIL:
-  if (dimensions != 2) {
+  if (dimensions == 1) {
   return GL_INVALID_OPERATION;
}
switch (type) {



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


[Mesa-dev] [PATCH 1/2] mesa: Don't allow DEPTH_STENCIL for 3D textures

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

Just like DEPTH_COMPONENT.

Signed-off-by: Ian Romanick 
---
 src/mesa/main/teximage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index eeb977e..7a15196 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2006,7 +2006,8 @@ texture_error_check( struct gl_context *ctx,
}
 
/* additional checks for depth textures */
-   if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
+   if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT
+   || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) {
   /* Only 1D, 2D, rect, array and cube textures supported, not 3D
* Cubemaps are only supported for GL version > 3.0 or with 
EXT_gpu_shader4 */
   if (target != GL_TEXTURE_1D &&
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 2/2] es3: Don't check dimensions in _mesa_es3_error_check_format_and_type

2013-01-16 Thread Ian Romanick
From: Ian Romanick 

Filtering of DEPTH_COMPONENT and DEPTH_STENCIL for TEXTURE_3D is already
done in texture_error_check because these combinations aren't allowed on
desktop GL either.

Signed-off-by: Ian Romanick 
---
 src/mesa/main/glformats.c | 9 +
 src/mesa/main/glformats.h | 3 +--
 src/mesa/main/teximage.c  | 3 +--
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 7969f77..3004c08 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1697,8 +1697,7 @@ _mesa_es_error_check_format_and_type(GLenum format, 
GLenum type,
  */
 GLenum
 _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
-  GLenum internalFormat,
-  unsigned dimensions)
+  GLenum internalFormat)
 {
GLboolean type_valid = GL_TRUE;
 
@@ -2068,9 +2067,6 @@ _mesa_es3_error_check_format_and_type(GLenum format, 
GLenum type,
   break;
 
case GL_DEPTH_COMPONENT:
-  if (dimensions != 2) {
- return GL_INVALID_OPERATION;
-  }
   switch (type) {
   case GL_UNSIGNED_SHORT:
  if (internalFormat != GL_DEPTH_COMPONENT16)
@@ -2098,9 +2094,6 @@ _mesa_es3_error_check_format_and_type(GLenum format, 
GLenum type,
   break;
 
case GL_DEPTH_STENCIL:
-  if (dimensions != 2) {
- return GL_INVALID_OPERATION;
-  }
   switch (type) {
   case GL_UNSIGNED_INT_24_8:
  if (internalFormat != GL_DEPTH24_STENCIL8)
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index 4cbc82f..cdd2b94 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -122,8 +122,7 @@ _mesa_es_error_check_format_and_type(GLenum format, GLenum 
type,
 
 extern GLenum
 _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
-  GLenum internalFormat,
-  unsigned dimensions);
+  GLenum internalFormat);
 
 
 #ifdef __cplusplus
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 7a15196..c44a4f5 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1896,8 +1896,7 @@ texture_error_check( struct gl_context *ctx,
if (_mesa_is_gles(ctx)) {
   if (_mesa_is_gles3(ctx)) {
  err = _mesa_es3_error_check_format_and_type(format, type,
- internalFormat,
- dimensions);
+ internalFormat);
   } else {
  if (format != internalFormat) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
-- 
1.7.11.7

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


Re: [Mesa-dev] [PATCH] mesa: add missing ASSERT_OUTSIDE_BEGIN_END() in _mesa_GetInternalformativ()

2013-01-16 Thread Ian Romanick

On 01/16/2013 07:19 AM, Brian Paul wrote:

Ah, yes.  I always forget about that.  I can't wait until Eric finishes 
separating the dispatch tables so that we never have to do this again.


Reviewed-by: Ian Romanick 


---
  src/mesa/main/formatquery.c |3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index f08ab66..bd895e8 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -22,6 +22,7 @@
   */

  #include "mtypes.h"
+#include "context.h"
  #include "glformats.h"
  #include "macros.h"
  #include "mfeatures.h"
@@ -37,6 +38,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum 
internalformat, GLenum pname,
 GLsizei count = 0;
 GET_CURRENT_CONTEXT(ctx);

+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
 if (!ctx->Extensions.ARB_internalformat_query) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetInternalformativ");
return;



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


[Mesa-dev] [Bug 59450] SIGSEGV src/mesa/state_tracker/st_cb_blit.c:216

2013-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59450

Brian Paul  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Brian Paul  ---
Fixed with commit 56c01d81094795286828ecb83713e043695e905a

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/10] Support UBOs with instance names pre-series

2013-01-16 Thread Kenneth Graunke

On 01/16/2013 03:03 PM, Ian Romanick wrote:

This is the "warm up" series before my series to make UBOs with
instances names (and arrays of UBOs) work.  These are both required
features of GLSL ES 3.00 that are not added to desktop GLSL until 1.50.
This series is just a bunch of minor fixes and small refactors.

This series fixes 4 gles3conform tests.  There are about a dozen more
patches coming in the next few day to fix the remaining 14 UBO tests.


This series is:
Reviewed-by: Kenneth Graunke 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] i965/vs: Create a 'lod_type' temporary for ir->lod_info.lod->type.

2013-01-16 Thread Kenneth Graunke
This is purely a refactor.  However, in a moment, we'll want to set
lod_type to float for ir_tex, where ir->lod_info.lod is NULL.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 02feff6..594f927 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1953,6 +1953,7 @@ vec4_visitor::visit(ir_texture *ir)
   shadow_comparitor = this->result;
}
 
+   const glsl_type *lod_type;
src_reg lod, dPdx, dPdy;
switch (ir->op) {
case ir_txf:
@@ -1960,6 +1961,7 @@ vec4_visitor::visit(ir_texture *ir)
case ir_txs:
   ir->lod_info.lod->accept(this);
   lod = this->result;
+  lod_type = ir->lod_info.lod->type;
   break;
case ir_txd:
   ir->lod_info.grad.dPdx->accept(this);
@@ -1967,6 +1969,8 @@ vec4_visitor::visit(ir_texture *ir)
 
   ir->lod_info.grad.dPdy->accept(this);
   dPdy = this->result;
+
+  lod_type = ir->lod_info.grad.dPdx->type;
   break;
case ir_tex:
case ir_txb:
@@ -2008,8 +2012,7 @@ vec4_visitor::visit(ir_texture *ir)
 
if (ir->op == ir_txs) {
   int writemask = intel->gen == 4 ? WRITEMASK_W : WRITEMASK_X;
-  emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type, writemask),
-  lod));
+  emit(MOV(dst_reg(MRF, param_base, lod_type, writemask), lod));
} else {
   int i, coord_mask = 0, zero_mask = 0;
   /* Load the coordinate */
@@ -2067,12 +2070,12 @@ vec4_visitor::visit(ir_texture *ir)
mrf = param_base;
writemask = WRITEMASK_Z;
 }
-emit(MOV(dst_reg(MRF, mrf, ir->lod_info.lod->type, writemask), lod));
+emit(MOV(dst_reg(MRF, mrf, lod_type, writemask), lod));
   } else if (ir->op == ir_txf) {
-emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type, WRITEMASK_W),
+emit(MOV(dst_reg(MRF, param_base, lod_type, WRITEMASK_W),
  lod));
   } else if (ir->op == ir_txd) {
-const glsl_type *type = ir->lod_info.grad.dPdx->type;
+const glsl_type *type = lod_type;
 
 if (intel->gen >= 5) {
dPdx.swizzle = 
BRW_SWIZZLE4(SWIZZLE_X,SWIZZLE_X,SWIZZLE_Y,SWIZZLE_Y);
-- 
1.8.1

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


[Mesa-dev] [PATCH 2/3] i965/vs: Set LOD to 0 for ordinary texture() calls.

2013-01-16 Thread Kenneth Graunke
Previously it was left undefined, causing us to select a random LOD.

NOTE: This is a candidate for stable branches (and requires the previous
commit as well).

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 594f927..3139245 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1956,6 +1956,10 @@ vec4_visitor::visit(ir_texture *ir)
const glsl_type *lod_type;
src_reg lod, dPdx, dPdy;
switch (ir->op) {
+   case ir_tex:
+  lod = src_reg(0.0f);
+  lod_type = glsl_type::float_type;
+  break;
case ir_txf:
case ir_txl:
case ir_txs:
@@ -1972,7 +1976,6 @@ vec4_visitor::visit(ir_texture *ir)
 
   lod_type = ir->lod_info.grad.dPdx->type;
   break;
-   case ir_tex:
case ir_txb:
   break;
}
@@ -2055,7 +2058,7 @@ vec4_visitor::visit(ir_texture *ir)
   }
 
   /* Load the LOD info */
-  if (ir->op == ir_txl) {
+  if (ir->op == ir_tex || ir->op == ir_txl) {
 int mrf, writemask;
 if (intel->gen >= 5) {
mrf = param_base + 1;
-- 
1.8.1

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


[Mesa-dev] [PATCH 3/3] i965/vs: Store texturing results into a vec4 temporary.

2013-01-16 Thread Kenneth Graunke
The sampler appears to ignore writemasks (even when correcting the
WRITEMASK_XYZW in brw_vec4_emit.cpp to the proper writemask) and just
always writes all four values.

To cope with this, just texture into a temporary, then MOV out into a
register that has the proper number of components.

NOTE: This is a candidate for stable branches.

Fixes es3conform's shadow_execution_vert.test.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

This series also fixes 18 oglconform subtests!  I didn't test on a per-patch
basis to figure out which patch fixes which tests, though.

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 3139245..ebf8990 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2005,6 +2005,7 @@ vec4_visitor::visit(ir_texture *ir)
inst->mlen = inst->header_present + 1; /* always at least one */
inst->sampler = sampler;
inst->dst = dst_reg(this, ir->type);
+   inst->dst.writemask = WRITEMASK_XYZW;
inst->shadow_compare = ir->shadow_comparitor != NULL;
 
if (ir->offset != NULL && ir->op != ir_txf)
@@ -2123,13 +2124,16 @@ vec4_visitor::visit(ir_texture *ir)
 void
 vec4_visitor::swizzle_result(ir_texture *ir, src_reg orig_val, int sampler)
 {
-   this->result = orig_val;
-
int s = c->key.tex.swizzles[sampler];
 
+   this->result = src_reg(this, ir->type);
+   dst_reg swizzled_result(this->result);
+
if (ir->op == ir_txs || ir->type == glsl_type::float_type
-   || s == SWIZZLE_NOOP)
+   || s == SWIZZLE_NOOP) {
+  emit(MOV(swizzled_result, orig_val));
   return;
+   }
 
int zero_mask = 0, one_mask = 0, copy_mask = 0;
int swizzle[4];
@@ -2149,9 +2153,6 @@ vec4_visitor::swizzle_result(ir_texture *ir, src_reg 
orig_val, int sampler)
   }
}
 
-   this->result = src_reg(this, ir->type);
-   dst_reg swizzled_result(this->result);
-
if (copy_mask) {
   orig_val.swizzle = BRW_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], 
swizzle[3]);
   swizzled_result.writemask = copy_mask;
-- 
1.8.1

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


Re: [Mesa-dev] [PATCH] radeon/r200: Fix FBO formats

2013-01-16 Thread Milan Kostić
 No, no regress in piglit i've seen at all, only better... i even
played whole Drawn 2 game:
 http://www.drawngame.com/games/dark-flight
under wine in OpenGL mode, it works perfectly now, needs culling under
fbo which is fixed now and this fix to display text and so works
exactly the same as with nvidia on Windows.

 It can further pass 2 more test in piglit if those are ported from intel:

 fbo-nodepth-test
 
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4d4f2daefabdc4ca1dd778a9265475c65ef52936

 i've tried that one and it pass and maybe this for fbo-cubemap - but
not tried:

 
http://cgit.freedesktop.org/mesa/mesa/commit/?id=80513ec8b4c812b9c6249cc5824337a5f04ab34c

 Now i checked supertuxkart game, it has some problems with alpha in
XRGB format. Under non-fbo mode kart model have black background,
and under fbo models are transparent. I fixed it for non fbo case with
R200_TXFORMAT_ALPHA_IN_MAP for XRGB also in r200_blit, but don't
know where is this format controled for fbos?  I mentoioned this
because text is slightly transparent also in that Drawn game, it only
works with with fbo extension in opengl mode, i guess that needs the
same fix for XRGB format to expect alpha under fbo, etc... But OK
that can be another bug :).

2013/1/16, Marek Olšák :
> On Tue, Jan 15, 2013 at 7:15 PM, Alex Deucher 
> wrote:
>> On Fri, Jan 11, 2013 at 6:37 AM, smoki  wrote:
>>> Piglit passes more fbo tests on rv280, 14/28 before and now 28/33.
>>> Also should fix bug:
>>> https://bugs.freedesktop.org/show_bug.cgi?id=27704
>>
>> Does this regress anything in piglit?  It's been a while since I
>> looked at this code, I think the issue may be that r1xx/r2xx asics
>> only support ARGB render buffers while the texture hardware supports
>> both ARGB and RGBA formats so you may run into cases where you can
>> texture from a buffer, but can't render to it, at least not without an
>> intermediate blit to convert the format first.
>
> In r300g, I decided to only support RGBA and BGRA formats and not ARGB
> and ABGR because of a lack of blending support. Maybe we should do the
> same for r1xx/r2xx to make things simpler.
>
> Marek
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 59499] New: SIGSEGV src/mesa/swrast/s_blit.c:546

2013-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59499

  Priority: medium
Bug ID: 59499
  Keywords: regression
CC: anuj.pho...@gmail.com
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: SIGSEGV src/mesa/swrast/s_blit.c:546
  Severity: critical
Classification: Unclassified
OS: Linux (All)
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Other
   Product: Mesa

mesa: 56c01d81094795286828ecb83713e043695e905a (master)

Run piglit fbo-srgb-blit on swrast.

$ ./bin/fbo-srgb-blit -auto
Mesa warning: failed to remap index 167
Mesa warning: failed to remap index 207
Mesa warning: failed to remap index 208
Mesa warning: failed to remap index 211
Mesa warning: failed to remap index 377
Segmentation fault (core dumped)

(gdb) bt
#0  0x7f9031b8738f in blit_linear (ctx=0xe0bed0, srcX0=7, srcY0=7, srcX1=9,
srcY1=9, dstX0=0, dstY0=0, dstX1=8, dstY1=16) at
../../../src/mesa/swrast/s_blit.c:546
#1  0x7f9031b87f20 in _swrast_BlitFramebuffer (ctx=0xe0bed0, srcX0=7,
srcY0=7, srcX1=9, srcY1=9, dstX0=0, dstY0=0, dstX1=8, dstY1=16, mask=16384,
filter=9729)
at ../../../src/mesa/swrast/s_blit.c:812
#2  0x7f9031a3123b in _mesa_BlitFramebuffer (srcX0=7, srcY0=7, srcX1=9,
srcY1=9, dstX0=0, dstY0=0, dstX1=8, dstY1=16, mask=16384, filter=9729) at
../../../src/mesa/main/fbobject.c:3057
#3  0x00401076 in blit_rect (src_format=35907, dst_format=32856, x=-1,
y=0, w=1, h=1, stretch=true) at piglit/tests/fbo/fbo-srgb-blit.c:66
#4  0x004012d6 in piglit_display () at
piglit/tests/fbo/fbo-srgb-blit.c:114
#5  0x7f9035517408 in display () at
piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:60
#6  0x7f9034ed1137 in fghRedrawWindow (window=0xe07e60) at
freeglut_main.c:210
#7  fghcbDisplayWindow (window=0xe07e60, enumerator=0x7fffab7497a0) at
freeglut_main.c:227
#8  0x7f9034ed4889 in fgEnumWindows (enumCallback=0x7f9034ed10d0
, enumerator=0x7fffab7497a0) at freeglut_structure.c:394
#9  0x7f9034ed15fa in fghDisplayAll () at freeglut_main.c:249
#10 glutMainLoopEvent () at freeglut_main.c:1450
#11 0x7f9034ed1f05 in glutMainLoop () at freeglut_main.c:1498
#12 0x7f90355175e0 in run_test (gl_fw=0x7f90357e17e0, argc=1,
argv=0x7fffab749b68) at
piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:127
#13 0x7f9035515726 in piglit_gl_test_run (argc=1, argv=0x7fffab749b68,
config=0x7fffab749a50) at piglit/tests/util/piglit-framework-gl.c:127
#14 0x00400e9e in main (argc=2, argv=0x7fffab749b68) at
piglit/tests/fbo/fbo-srgb-blit.c:41
(gdb) frame 0
#0  0x7f9031b8738f in blit_linear (ctx=0xe0bed0, srcX0=7, srcY0=7, srcX1=9,
srcY1=9, dstX0=0, dstY0=0, dstX1=8, dstY1=16) at
../../../src/mesa/swrast/s_blit.c:546
546   gl_format drawFormat = _mesa_get_srgb_format_linear(drawRb->Format);
(gdb) print drawRb
$1 = (struct gl_renderbuffer *) 0x0


bed997dabaada5e7c8081db08f93a6f1b5932e8b is the first bad commit
commit bed997dabaada5e7c8081db08f93a6f1b5932e8b
Author: Anuj Phogat 
Date:   Tue Dec 11 20:17:47 2012 -0800

mesa: Add support to allow blitting to multiple color draw buffers

This patch fixes a blitting case when drawAttachment->Texture ==
readAttachment->Texture. It was causing an assertion failure in
intel_miptree_attach_map() with gles3 conformance test case:
framebuffer_blit_functionality_minifying_blit

Number of changes in this file look scary. But most of them are caused
by introducing a big for loop to support rendering to multiple color
draw buffers.

V2: Fixed a case when number of draw buffer attachments are zero.
V3: Put a for loop in blit_nearest() and blit_linear() functions in to
support blitting to multiple color draw buffers.
V4: Remove variable declaration in for loop to avoid MSVC compilation
issues.

Signed-off-by: Anuj Phogat 
Reviewed-by: Kenneth Graunke 
Reviewed-by: Ian Romanick 

:04 04 98d5e6ea72f2fcf765cd8241682ab18c8081cc70
ee017ce78ded09098a4ded7a90e19130b53e4eea 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 59501] New: mesa/main/api_exec.c:286: undefined reference to `SET_GetInternalformativ'

2013-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59501

  Priority: medium
Bug ID: 59501
  Keywords: regression
CC: i...@freedesktop.org
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: mesa/main/api_exec.c:286: undefined reference to
`SET_GetInternalformativ'
  Severity: blocker
Classification: Unclassified
OS: Linux (All)
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Mesa core
   Product: Mesa

mesa: 56c01d81094795286828ecb83713e043695e905a (master)

$ scons platform=windows toolchain=crossmingw machine=x86_64
[...]
scons: Building targets ...
  Linking build/windows-x86_64-debug/gallium/targets/libgl-gdi/opengl32.dll ...
build/windows-x86_64-debug/mesa/libmesa.a(api_exec.o): In function
`_mesa_initialize_exec_table':
build/windows-x86_64-debug/mesa/main/api_exec.c:286: undefined reference to
`SET_GetInternalformativ'

bda540d2357f69a63dcf16550e178f803682d6ce is the first bad commit
commit bda540d2357f69a63dcf16550e178f803682d6ce
Author: Ian Romanick 
Date:   Fri Nov 30 12:43:58 2012 -0800

mesa: Add dispatch and extension XML for GL_ARB_internalformat_query

Signed-off-by: Ian Romanick 
Reviewed-by: Eric Anholt 
Reviewed-by: Jordan Justen 

:04 04 e38bd61c113bd0b4296bb47e22cd1f06d530ddd4
ecd74b726b9a188d64143c33f582cd3cd2eedfeb 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


Re: [Mesa-dev] [PATCH 5/7] glsl/build: Don't build builtin_compiler separately if not cross compiling

2013-01-16 Thread Thierry Reding
On Wed, Jan 16, 2013 at 03:14:14PM -0800, Matt Turner wrote:
[...]
> diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
> index fa09c5e..07fcf96 100644
> --- a/src/glsl/Makefile.am
> +++ b/src/glsl/Makefile.am
> @@ -19,7 +19,11 @@
>  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
>  # IN THE SOFTWARE.
>  
> +if CROSS_COMPILING
>  SUBDIRS = builtin_compiler glcpp
> +else
> +SUBDIRS = glcpp
> +endif
>  
>  AM_CPPFLAGS = \
>   -I$(top_srcdir)/include \
> @@ -56,6 +60,27 @@ glsl_test_SOURCES = \
>  
>  glsl_test_LDADD = libglsl.la
>  
> +if CROSS_COMPILING
> +BUILTIN_COMPILER = builtin_compiler/builtin_compiler$(BUILD_EXEEXT)
> +else
> +BUILTIN_COMPILER = builtincompiler$(BUILD_EXEEXT)
> +
> +noinst_PROGRAMS = builtincompiler
> +noinst_LTLIBRARIES += libglslcore.la
> +
> +libglslcore_la_SOURCES = \
> + glsl_lexer.ll   \
> + glsl_parser.cc  \
> + $(LIBGLSL_FILES)
> +builtincompiler_SOURCES = \
> + $(top_srcdir)/src/mesa/main/hash_table.c\
> + $(top_srcdir)/src/mesa/program/prog_hash_table.c\
> + $(top_srcdir)/src/mesa/program/symbol_table.c   \
> + $(top_srcdir)/src/glsl/builtin_compiler/builtin_stubs.cpp \
> + $(GLSL_COMPILER_CXX_FILES)
> +builtincompiler_LDADD = libglslcore.la glcpp/libglcpp.la
> +endif

Can this not be moved into the builtin_compiler subdirectory? You could
set the various *_FOR_BUILD variables only if CROSS_COMPILING and split
up the builtin_compiler_SOURCES variables such that a native version of
them is compiled if CROSS_COMPILING and make builtin_compiler link with
libglcpp.la and libglslcore.la otherwise.

That way there would be no duplication of these rules that need to be
kept in sync. Furthermore all the cross-compiling special cases would
be restricted to the builtin_compiler subdirectory.

Thierry


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


Re: [Mesa-dev] [PATCH 02/10] glsl: Track UBO block names in the symbol table.

2013-01-16 Thread Pohjolainen, Topi
On Wed, Jan 16, 2013 at 03:03:41PM -0800, Ian Romanick wrote:
> From: Kenneth Graunke 
> 
> The GLSL 1.40 spec says:
> 
> "Uniform block names and variable names declared within uniform
> blocks are scoped at the program level."
> 
> Track the block name in the symbol table and emit errors when conflicts
> exist.
> 
> Fixes es3conform's uniform_buffer_object_block_name_conflict test, and
> fixes the piglit block-name-clashes-with-{variable,function,struct}.vert
> tests.
> 
> NOTE: This is a candidate for the 9.0 branch.
> 
> Reviewed-by: Ian Romanick 
> ---
>  src/glsl/ast_to_hir.cpp|  6 ++
>  src/glsl/glsl_symbol_table.cpp | 14 +++---
>  src/glsl/glsl_symbol_table.h   |  1 +
>  3 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index ea5e3b7..31dd51a 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -4132,6 +4132,12 @@ ast_uniform_block::hir(exec_list *instructions,
> struct gl_uniform_block *ubo = get_next_uniform_block(state);
> ubo->Name = ralloc_strdup(state->uniform_blocks, this->block_name);
>  
> +   if (!state->symbols->add_uniform_block(ubo)) {
> +  YYLTYPE loc = this->get_location();
> +  _mesa_glsl_error(&loc, state, "Uniform block name `%s' already taken 
> in "
> +   "the current scope.\n", ubo->Name);
> +   }
> +
> unsigned int num_variables = 0;
> foreach_list_typed(ast_declarator_list, decl_list, link, &declarations) {
>foreach_list_const(node, &decl_list->declarations) {
> diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp
> index f934ea8..6171a27 100644
> --- a/src/glsl/glsl_symbol_table.cpp
> +++ b/src/glsl/glsl_symbol_table.cpp
> @@ -41,13 +41,15 @@ public:
>ralloc_free(entry);
> }
>  
> -   symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) 
> {}
> -   symbol_table_entry(ir_function *f) : v(0), f(f), t(0) 
> {}
> -   symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) 
> {}
> +   symbol_table_entry(ir_variable *v)   : v(v), f(0), t(0), u(0) 
> {}
> +   symbol_table_entry(ir_function *f)   : v(0), f(f), t(0), u(0) 
> {}
> +   symbol_table_entry(const glsl_type *t)   : v(0), f(0), t(t), u(0) 
> {}
> +   symbol_table_entry(struct gl_uniform_block *u)   : v(0), f(0), t(t), u(u) 
> {}

I guess you did not mean to initialize 't' on itself.
-
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

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