[Mesa-dev] Redefinition error in glapitmp.h

2013-03-18 Thread Ritvik Sharma
Hi, 
While compiling mesa, I am getting redefinition errors for the file glapitemp.h 
(already defined in gl.h ). Also in the file mapi_tmp.h I am getting  #include 
error for  MAPI_ABI_HEADER.

Thanks and Regards-
Ritvik Sharma
Department of Computer Science  Engineering
National Institute Of Technology, Hamirpur.
Himachal Pradesh, India - 177005
Phone -  +91-9829404511, +91- 9817169471
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Redefinition error in glapitmp.h

2013-03-18 Thread Michel Dänzer
On Son, 2013-03-17 at 15:57 +0800, Ritvik Sharma wrote:
 While compiling mesa,

Which version?


 I am getting redefinition errors for the file glapitemp.h (already
 defined in gl.h ).  Also in the file mapi_tmp.h I am getting  #include
 error for  MAPI_ABI_HEADER.

Please post the actual error output.


-- 
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] Fwd: [PATCH 5/6] st/mesa: implement blit-based ReadPixels

2013-03-18 Thread Michel Dänzer
On Mon, 2013-03-18 at 01:06 +0100, Marek Olšák wrote: 
 
 ([rant]We should really have an unmappable portion of VRAM as a
 feature, because unmappable memory is cool: the memory can be
 reclaimed immediately after texture deletion even if the texture is
 busy, because the CPU can't access it, and thanks to that, ttm_bo_wait
 could be a no-op for all unmappable resources[/rant]).

FWIW, that doesn't require a separate unmappable domain but 'just' that
TTM allows more asynchronous GPU operations. Thomas had plans for that a
long time ago, don't know what happened to them.


-- 
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 9/9] tgsi: add ArrayID documentation

2013-03-18 Thread Christian König

Am 17.03.2013 20:59, schrieb Christoph Bumiller:

On 17.03.2013 18:04, Christoph Bumiller wrote:

On 17.03.2013 16:30, Christian König wrote:

Am 15.03.2013 18:58, schrieb Christoph Bumiller:

On 15.03.2013 13:08, Christian König wrote:

Am 14.03.2013 15:53, schrieb Christoph Bumiller:

On 14.03.2013 15:20, Christian König wrote:

From: Christian König christian.koe...@amd.com

Signed-off-by: Christian König christian.koe...@amd.com
---
src/gallium/docs/source/tgsi.rst |   16 
1 file changed, 16 insertions(+)

diff --git a/src/gallium/docs/source/tgsi.rst
b/src/gallium/docs/source/tgsi.rst
index d9a7fe9..27fe039 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -1833,6 +1833,22 @@ If Interpolate flag is set to 1, a
Declaration Interpolate token follows.
  If file is TGSI_FILE_RESOURCE, a Declaration Resource token
follows.
+If Array flag is set to 1, a Declaration Array token follows.
+
+Array Declaration
+
+
+Declarations can optional have an ArrayID attribute which can be
referred by
+indirect addressing operands. An ArrayID of zero is reserved and
treaded as
+if no ArrayID is specified.
+
+If an indirect addressing operand refers to an specific declaration
by using

s/an/a

Thx, fixed.


+an ArrayID only the registers in this declaration are guaranteed
to be
+accessed, accessing any register outside this declaration results
in undefined
+behavior.

+ Note that the effective index is zero-based and not relative to the
specified declaration. XXX: Is it ? Should it be ?

Yes for compatibility reasons, otherwise we would need to change all
drivers at once.


+
+If no ArrayID is specified with an indirect addressing operand the
whole
+register file might be accessed by this operand.


+ A practice which is strongly discouraged. Don't do this if you have
more than 1 declaration for the file in question ! It will prevent
packing of scalar/vec2 arrays and effective memory alias analysis.

A bit shortened, but in general added the remark.


Packing ? Yes !
We can pack arrays if they're declared as e.g.
TEMP[0-3].xyzw
TEMP[4-31].x

And the caches will be very very thankful that we don't just access
every 4th element of our 4 times larger than it needs to be buffer !!!

And if your card can't do that, pleeease be nice and still make it
possible for other drivers. :o3

It is probably possible with the new information to do so, but not
priority for me cause I primary need it for our LLVM backend.


At some point you'll be able to make use of the info in your backend,
too, and then you'll regret having to refamiliarize with this code just
because you didn't add the extra (estimated) 2 lines to set the
UsageMask.

I think you misunderstood me here, you don't need the UsageMask to
generate those informations. It is possible by just scanning the
shader to figure out which channels are used and which aren't.


For temporaries that may be true ... and inputs/outputs are always vec4
sized to guarantee linkage, packing for GENERIC ones is handled at the
mesa level.


Additional to that I'm not convinced that using the UsageMask for this
is 100% correct, to me it looks more like UsageMask is something we
need for outputs to distinct between not writing to an output channel
(and so still having the default) and not having an output channel at
all.


Actually, for gl_ClipDistance[] we use the UsageMask to specify if the
clip distance was declared in the source (and thus should be enabled)
instead of whether it's been written or not.

I wanted to be able to distinguish between
float gl_ClipDistance[8] or
vec4 mesa_ClipDistance[2] with the UsageMask but I guess

OUT[0..1].x, CLIPDIST might just as well mean that gl_ClipDistance[0 and
4] are being used ...

Hm, we'll need a cap for that anway to tell st if it should lower
ClipDistance to vec4s or not, and just assume that TGSI corresponds to
what the cap says.
And since this is the only case for IN/OUT where the driver's backend
has to decide whether to pack or not ... ok, I'll just infer array width
myself, too, and you can ignore the UsageMask.


Also, NAK from me until array access/declarations for the other files
follows suit.
Sorry for being so ... pesky, but I'd really like this change to be 100%
complete. Come on, doesn't it nag on your conscience if this is left to
remain only a few smalls steps from perfection ?

Declaring and accessing arrays for inputs/outputs are not so much of a
problem, figuring out how to get this information to glsl_to_tgsi is
the real problem. For temporaries changing the glsl_to_tgsi pass is
pretty much sufficient, but for inputs and outputs you need to dig
into the mesa state tracker, and I definitely don't intend to do so.


Fine, then I'll have a look at that myself. * flaming eyes *

Ok, had a look, had enough. It hurts. At least if you have never touched
glsl-to-tgsi and go about it expecting it to be easy and straightforward.
HURTS!


Yes, 

Re: [Mesa-dev] [PATCH 4/4] st/dri: don't create 24-bit depth, non-stencil visuals

2013-03-18 Thread Marek Olšák
On Thu, Mar 14, 2013 at 3:23 PM, Brian Paul bri...@vmware.com wrote:
 On 03/14/2013 08:18 AM, Marek Olšák wrote:

 Z24X8 actually does save memory, because Radeon HD 5000 and later
 cards don't support combined depth stencil formats, therefore Z24S8 is
 allocated internally as two separate buffers Z24X8 and S8.


 Ah, OK.  I'll drop this patch then.  Thanks.

 However, I think we have some redundant visual/FBconfigs.  I'm still
 interested in trying to prune them down...

Some configs might seem redundant, but glxinfo doesn't print all
config properties. One such property is back_buffer_modes defined in
dri_screen.c:99.

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


[Mesa-dev] [PATCH 1/9] tgsi/ureg: cleanup local temporary emission v2

2013-03-18 Thread Christian König
From: Christian König christian.koe...@amd.com

Instead of emitting each temporary separately, emit them in a chunk.

v2: keep separate function for emitting temps

Signed-off-by: Christian König christian.koe...@amd.com
---
 src/gallium/auxiliary/tgsi/tgsi_ureg.c |   30 +-
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 3c2a923..72657ae 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -1260,24 +1260,23 @@ emit_decl_fs(struct ureg_program *ureg,
out[3].decl_semantic.Index = semantic_index;
 }
 
-
-static void emit_decl( struct ureg_program *ureg,
-   unsigned file,
-   unsigned index,
-   boolean local )
+static void
+emit_decl_temps( struct ureg_program *ureg,
+ unsigned first, unsigned last,
+ boolean local )
 {
union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 2 );
 
out[0].value = 0;
out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
out[0].decl.NrTokens = 2;
-   out[0].decl.File = file;
+   out[0].decl.File = TGSI_FILE_TEMPORARY;
out[0].decl.UsageMask = TGSI_WRITEMASK_XYZW;
out[0].decl.Local = local;
 
out[1].value = 0;
-   out[1].decl_range.First = index;
-   out[1].decl_range.Last = index;
+   out[1].decl_range.First = first;
+   out[1].decl_range.Last = last;
 }
 
 static void emit_decl_range( struct ureg_program *ureg,
@@ -1535,16 +1534,13 @@ static void emit_decls( struct ureg_program *ureg )
}
 
if (ureg-nr_temps) {
-  if (util_bitmask_get_first_index(ureg-local_temps) ==  
UTIL_BITMASK_INVALID_INDEX) {
- emit_decl_range( ureg,
-  TGSI_FILE_TEMPORARY,
-  0, ureg-nr_temps );
+  for (i = 0; i  ureg-nr_temps;) {
+ boolean local = util_bitmask_get(ureg-local_temps, i);
+ unsigned first = i++;
+ while (i  ureg-nr_temps  local == 
util_bitmask_get(ureg-local_temps, i))
+++i;
 
-  } else {
- for (i = 0; i  ureg-nr_temps; i++) {
-emit_decl( ureg, TGSI_FILE_TEMPORARY, i,
-   util_bitmask_get(ureg-local_temps, i) );
- }
+ emit_decl_temps( ureg, first, i - 1, local );
   }
}
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 2/9] tgsi/ureg: implement support for array temporaries

2013-03-18 Thread Christian König
From: Christian König christian.koe...@amd.com

Don't bother with free temporaries, just allocate them at
the end and also emit them in their own declaration.

Signed-off-by: Christian König christian.koe...@amd.com
---
 src/gallium/auxiliary/tgsi/tgsi_ureg.c |   55 
 src/gallium/auxiliary/tgsi/tgsi_ureg.h |   38 +++---
 2 files changed, 69 insertions(+), 24 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 72657ae..88acdcb 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -153,6 +153,7 @@ struct ureg_program
 
struct util_bitmask *free_temps;
struct util_bitmask *local_temps;
+   struct util_bitmask *decl_temps;
unsigned nr_temps;
 
struct const_decl const_decls;
@@ -547,13 +548,18 @@ static struct ureg_dst alloc_temporary( struct 
ureg_program *ureg,
 
/* Or allocate a new one.
 */
-   if (i == UTIL_BITMASK_INVALID_INDEX)
+   if (i == UTIL_BITMASK_INVALID_INDEX) {
   i = ureg-nr_temps++;
 
-   util_bitmask_clear(ureg-free_temps, i);
+  if (local)
+ util_bitmask_set(ureg-local_temps, i);
 
-   if (local)
-  util_bitmask_set(ureg-local_temps, i);
+  /* Start a new declaration when the local flag changes */
+  if (!i || util_bitmask_get(ureg-local_temps, i - 1) != local)
+ util_bitmask_set(ureg-decl_temps, i);
+   }
+
+   util_bitmask_clear(ureg-free_temps, i);
 
return ureg_dst_register( TGSI_FILE_TEMPORARY, i );
 }
@@ -568,6 +574,24 @@ struct ureg_dst ureg_DECL_local_temporary( struct 
ureg_program *ureg )
return alloc_temporary(ureg, TRUE);
 }
 
+struct ureg_dst ureg_DECL_array_temporary( struct ureg_program *ureg,
+   unsigned size,
+   boolean local )
+{
+   unsigned i = ureg-nr_temps;
+   struct ureg_dst dst = ureg_dst_register( TGSI_FILE_TEMPORARY, i );
+
+   if (local)
+  util_bitmask_set(ureg-local_temps, i);
+
+   util_bitmask_set(ureg-decl_temps, i);
+
+   ureg-nr_temps += size;
+   util_bitmask_set(ureg-decl_temps, ureg-nr_temps);
+
+   return dst;
+}
+
 void ureg_release_temporary( struct ureg_program *ureg,
  struct ureg_dst tmp )
 {
@@ -856,11 +880,11 @@ ureg_emit_src( struct ureg_program *ureg,
}
 
if (src.Dimension) {
+  out[0].src.Dimension = 1;
+  out[n].dim.Dimension = 0;
+  out[n].dim.Padding = 0;
   if (src.DimIndirect) {
- out[0].src.Dimension = 1;
  out[n].dim.Indirect = 1;
- out[n].dim.Dimension = 0;
- out[n].dim.Padding = 0;
  out[n].dim.Index = src.DimensionIndex;
  n++;
  out[n].value = 0;
@@ -871,10 +895,7 @@ ureg_emit_src( struct ureg_program *ureg,
  out[n].src.SwizzleW = src.DimIndSwizzle;
  out[n].src.Index = src.DimIndIndex;
   } else {
- out[0].src.Dimension = 1;
  out[n].dim.Indirect = 0;
- out[n].dim.Dimension = 0;
- out[n].dim.Padding = 0;
  out[n].dim.Index = src.DimensionIndex;
   }
   n++;
@@ -1536,9 +1557,10 @@ static void emit_decls( struct ureg_program *ureg )
if (ureg-nr_temps) {
   for (i = 0; i  ureg-nr_temps;) {
  boolean local = util_bitmask_get(ureg-local_temps, i);
- unsigned first = i++;
- while (i  ureg-nr_temps  local == 
util_bitmask_get(ureg-local_temps, i))
-++i;
+ unsigned first = i;
+ i = util_bitmask_get_next_index(ureg-decl_temps, i + 1);
+ if (i == UTIL_BITMASK_INVALID_INDEX)
+i = ureg-nr_temps;
 
  emit_decl_temps( ureg, first, i - 1, local );
   }
@@ -1707,8 +1729,14 @@ struct ureg_program *ureg_create( unsigned processor )
if (ureg-local_temps == NULL)
   goto no_local_temps;
 
+   ureg-decl_temps = util_bitmask_create();
+   if (ureg-decl_temps == NULL)
+  goto no_decl_temps;
+
return ureg;
 
+no_decl_temps:
+   util_bitmask_destroy(ureg-local_temps);
 no_local_temps:
util_bitmask_destroy(ureg-free_temps);
 no_free_temps:
@@ -1730,6 +1758,7 @@ void ureg_destroy( struct ureg_program *ureg )
 
util_bitmask_destroy(ureg-free_temps);
util_bitmask_destroy(ureg-local_temps);
+   util_bitmask_destroy(ureg-decl_temps);
 
FREE(ureg);
 }
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index fb663e9..cd140de 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -71,17 +71,17 @@ struct ureg_src
  */
 struct ureg_dst
 {
-   unsigned File: 4;  /* TGSI_FILE_ */
-   unsigned WriteMask   : 4;  /* TGSI_WRITEMASK_ */
-   unsigned Indirect: 1;  /* BOOL */
-   unsigned Saturate: 1;  /* BOOL */
-   unsigned Predicate   : 1;
-   unsigned PredNegate  : 1;  /* BOOL */
-   unsigned PredSwizzleX: 2;  /* TGSI_SWIZZLE_ */
-   unsigned PredSwizzleY: 2;  /* 

[Mesa-dev] [PATCH 3/9] glsl_to_tgsi: use get_temp for all allocations

2013-03-18 Thread Christian König
From: Christian König christian.koe...@amd.com

Signed-off-by: Christian König christian.koe...@amd.com
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 0cef092..7562d11 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1078,13 +1078,11 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
   */
  assert((int) ir-num_state_slots == type_size(ir-type));
 
- storage = new(mem_ctx) variable_storage(ir, PROGRAM_TEMPORARY,
-this-next_temp);
- this-variables.push_tail(storage);
- this-next_temp += type_size(ir-type);
+ dst = st_dst_reg(get_temp(ir-type));
+
+ storage = new(mem_ctx) variable_storage(ir, dst.file, dst.index);
 
- dst = st_dst_reg(st_src_reg(PROGRAM_TEMPORARY, storage-index,
-   native_integers ? ir-type-base_type : GLSL_TYPE_FLOAT));
+ this-variables.push_tail(storage);
   }
 
 
@@ -2052,11 +2050,11 @@ glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir)
  break;
   case ir_var_auto:
   case ir_var_temporary:
- entry = new(mem_ctx) variable_storage(var, PROGRAM_TEMPORARY,
-  this-next_temp);
+ st_src_reg src = get_temp(var-type);
+
+ entry = new(mem_ctx) variable_storage(var, src.file, src.index);
  this-variables.push_tail(entry);
 
- next_temp += type_size(var-type);
  break;
   }
 
@@ -2574,11 +2572,10 @@ 
glsl_to_tgsi_visitor::get_function_signature(ir_function_signature *sig)
   storage = find_variable_storage(param);
   assert(!storage);
 
-  storage = new(mem_ctx) variable_storage(param, PROGRAM_TEMPORARY,
- this-next_temp);
-  this-variables.push_tail(storage);
+  st_src_reg src = get_temp(param-type);
 
-  this-next_temp += type_size(param-type);
+  storage = new(mem_ctx) variable_storage(param, src.file, src.index);
+  this-variables.push_tail(storage);
}
 
if (!sig-return_type-is_void()) {
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 6/9] tgsi: remove TGSI_FILE_(IMMEDIATE|TEMP)_ARRAY

2013-03-18 Thread Christian König
From: Christian König christian.koe...@amd.com

Nobody seems to be using it, and only nv50 had a partial implementation.

Signed-off-by: Christian König christian.koe...@amd.com
---
 src/gallium/auxiliary/tgsi/tgsi_build.c|   19 -
 src/gallium/auxiliary/tgsi/tgsi_dump.c |   38 --
 src/gallium/auxiliary/tgsi/tgsi_exec.c |   41 --
 src/gallium/auxiliary/tgsi/tgsi_exec.h |2 -
 src/gallium/auxiliary/tgsi/tgsi_parse.c|   11 ---
 src/gallium/auxiliary/tgsi/tgsi_parse.h|6 --
 src/gallium/auxiliary/tgsi/tgsi_sanity.c   |2 -
 src/gallium/auxiliary/tgsi/tgsi_strings.c  |2 -
 src/gallium/auxiliary/tgsi/tgsi_text.c |   43 ---
 .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp |   80 
 src/gallium/include/pipe/p_shader_tokens.h |6 +-
 11 files changed, 2 insertions(+), 248 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c 
b/src/gallium/auxiliary/tgsi/tgsi_build.c
index cb7b9b2..33cbbd8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -336,7 +336,6 @@ tgsi_default_full_declaration( void )
full_declaration.Range = tgsi_default_declaration_range();
full_declaration.Semantic = tgsi_default_declaration_semantic();
full_declaration.Interp = tgsi_default_declaration_interp();
-   full_declaration.ImmediateData.u = NULL;
full_declaration.Resource = tgsi_default_declaration_resource();
full_declaration.SamplerView = tgsi_default_declaration_sampler_view();
 
@@ -425,24 +424,6 @@ tgsi_build_full_declaration(
  header );
}
 
-   if (full_decl-Declaration.File == TGSI_FILE_IMMEDIATE_ARRAY) {
-  unsigned i, j;
-  union tgsi_immediate_data *data;
-
-  for (i = 0; i = dr-Last; ++i) {
- for (j = 0; j  4; ++j) {
-unsigned idx = i*4 + j;
-if (maxsize = size)
-   return 0;
-data = (union tgsi_immediate_data *) tokens[size];
-++size;
-
-*data = full_decl-ImmediateData.u[idx];
-declaration_grow( declaration, header );
- }
-  }
-   }
-
if (full_decl-Declaration.File == TGSI_FILE_RESOURCE) {
   struct tgsi_declaration_resource *dr;
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c 
b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 3e6f76a..177be0f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -347,44 +347,6 @@ iter_declaration(
   TXT( , INVARIANT );
}
 
-
-   if (decl-Declaration.File == TGSI_FILE_IMMEDIATE_ARRAY) {
-  unsigned i;
-  char range_indent[4];
-
-  TXT( {);
-
-  if (decl-Range.Last  10)
- range_indent[0] = '\0';
-  else if (decl-Range.Last  100) {
- range_indent[0] = ' ';
- range_indent[1] = '\0';
-  } else if (decl-Range.Last  1000) {
- range_indent[0] = ' ';
- range_indent[1] = ' ';
- range_indent[2] = '\0';
-  } else {
- range_indent[0] = ' ';
- range_indent[1] = ' ';
- range_indent[2] = ' ';
- range_indent[3] = '\0';
-  }
-
-  dump_imm_data(iter, decl-ImmediateData.u,
-4, TGSI_IMM_FLOAT32);
-  for(i = 1; i = decl-Range.Last; ++i) {
- /* indent by strlen of:
-  *   DCL IMMX[0..1] { */
- CHR('\n');
- TXT(  );
- TXT( range_indent );
- dump_imm_data(iter, decl-ImmediateData.u + i,
-   4, TGSI_IMM_FLOAT32);
-  }
-
-  TXT( });
-   }
-
EOL();
 
return TRUE;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 3df3ac3..1af2395 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -749,19 +749,6 @@ tgsi_exec_machine_bind_shader(
++mach-NumOutputs;
 }
  }
- if (parse.FullToken.FullDeclaration.Declaration.File ==
- TGSI_FILE_IMMEDIATE_ARRAY) {
-unsigned reg;
-struct tgsi_full_declaration *decl =
-   parse.FullToken.FullDeclaration;
-debug_assert(decl-Range.Last  TGSI_EXEC_NUM_IMMEDIATES);
-for (reg = decl-Range.First; reg = decl-Range.Last; ++reg) {
-   for( i = 0; i  4; i++ ) {
-  int idx = reg * 4 + i;
-  mach-ImmArray[reg][i] = decl-ImmediateData.u[idx].Float;
-   }
-}
- }
  memcpy(declarations + numDeclarations,
 parse.FullToken.FullDeclaration,
 sizeof(declarations[0]));
@@ -1116,16 +1103,6 @@ fetch_src_file_channel(const struct tgsi_exec_machine 
*mach,
   }
   break;
 
-   case TGSI_FILE_TEMPORARY_ARRAY:
-  for (i = 0; i  TGSI_QUAD_SIZE; i++) {
- assert(index-i[i]  TGSI_EXEC_NUM_TEMPS);
- 

[Mesa-dev] [PATCH 7/9] tgsi: add ArrayID to declarations

2013-03-18 Thread Christian König
From: Christian König christian.koe...@amd.com

Remember which declarations are declared as arrays and so
can be indirectly addressed. ArrayIDs start at 1, cause for
compatibility reasons zero is treaded as no array present.

Signed-off-by: Christian König christian.koe...@amd.com
---
 src/gallium/auxiliary/tgsi/tgsi_dump.c |6 ++
 src/gallium/auxiliary/tgsi/tgsi_parse.c|4 
 src/gallium/auxiliary/tgsi/tgsi_parse.h|1 +
 src/gallium/auxiliary/tgsi/tgsi_text.c |   22 +
 src/gallium/auxiliary/tgsi/tgsi_ureg.c |   29 +---
 src/gallium/include/pipe/p_shader_tokens.h |8 +++-
 6 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c 
b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 177be0f..adca6af 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -272,6 +272,12 @@ iter_declaration(
   ctx,
   decl-Declaration.UsageMask );
 
+   if (decl-Declaration.Array) {
+  TXT( , ARRAY( );
+  SID(decl-Array.ArrayID);
+  CHR(')');
+   }
+
if (decl-Declaration.Local)
   TXT( , LOCAL );
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c 
b/src/gallium/auxiliary/tgsi/tgsi_parse.c
index 720d68d..29079ef 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c
@@ -129,6 +129,10 @@ tgsi_parse_token(
  next_token(ctx, decl-SamplerView);
   }
 
+  if( decl-Declaration.Array ) {
+ next_token(ctx, decl-Array);
+  }
+
   break;
}
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h 
b/src/gallium/auxiliary/tgsi/tgsi_parse.h
index 78210ed..ae40f13 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h
@@ -66,6 +66,7 @@ struct tgsi_full_declaration
struct tgsi_declaration_semantic Semantic;
struct tgsi_declaration_resource Resource;
struct tgsi_declaration_sampler_view SamplerView;
+   struct tgsi_declaration_array Array;
 };
 
 struct tgsi_full_immediate
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 7d580e6..8a2a760 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -1114,6 +1114,28 @@ static boolean parse_declaration( struct translate_ctx 
*ctx )
 
cur = ctx-cur;
eat_opt_white( cur );
+   if (*cur == ',') {
+  cur2 = cur;
+  cur2++;
+  eat_opt_white( cur2 );
+  if (str_match_nocase_whole( cur2, ARRAY( )) {
+ int arrayid;
+ eat_opt_white( cur2 );
+ if (!parse_int( cur2, arrayid )) {
+report_error( ctx, Expected `,' );
+return FALSE;
+ }
+ eat_opt_white( cur2 );
+ if (*cur2 != ')') {
+report_error( ctx, Expected `,' );
+return FALSE;
+ }
+ decl.Declaration.Array = 1;
+ decl.Array.ArrayID = arrayid;
+ cur = cur2;
+  }
+   }
+
if (*cur == ','  !is_vs_input) {
   uint i, j;
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 88acdcb..1e862cb 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -50,6 +50,7 @@ union tgsi_any_token {
struct tgsi_declaration_interp decl_interp;
struct tgsi_declaration_semantic decl_semantic;
struct tgsi_declaration_sampler_view decl_sampler_view;
+   struct tgsi_declaration_array array;
struct tgsi_immediate imm;
union  tgsi_immediate_data imm_data;
struct tgsi_instruction insn;
@@ -78,6 +79,7 @@ struct ureg_tokens {
 #define UREG_MAX_IMMEDIATE 256
 #define UREG_MAX_ADDR 2
 #define UREG_MAX_PRED 1
+#define UREG_MAX_ARRAY_TEMPS 256
 
 struct const_decl {
struct {
@@ -156,6 +158,9 @@ struct ureg_program
struct util_bitmask *decl_temps;
unsigned nr_temps;
 
+   unsigned array_temps[UREG_MAX_ARRAY_TEMPS];
+   unsigned nr_array_temps;
+
struct const_decl const_decls;
struct const_decl const_decls2D[PIPE_MAX_CONSTANT_BUFFERS];
 
@@ -584,11 +589,17 @@ struct ureg_dst ureg_DECL_array_temporary( struct 
ureg_program *ureg,
if (local)
   util_bitmask_set(ureg-local_temps, i);
 
+   /* Always start a new declaration at the start */
util_bitmask_set(ureg-decl_temps, i);
 
ureg-nr_temps += size;
+
+   /* and also at the end of the array */
util_bitmask_set(ureg-decl_temps, ureg-nr_temps);
 
+   if (ureg-nr_array_temps  UREG_MAX_ARRAY_TEMPS)
+  ureg-array_temps[ureg-nr_array_temps++] = i;
+
return dst;
 }
 
@@ -1284,9 +1295,11 @@ emit_decl_fs(struct ureg_program *ureg,
 static void
 emit_decl_temps( struct ureg_program *ureg,
  unsigned first, unsigned last,
- boolean local )
+ boolean local,
+ unsigned arrayid )
 {
-   union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 2 );
+   

[Mesa-dev] [PATCH 8/9] tgsi: use separate structure for indirect address v2

2013-03-18 Thread Christian König
From: Christian König christian.koe...@amd.com

To further improve the optimization of source and destination
indirect addressing we need the ability to store a reference
to the declaration of the addressed operands.

Since most of the fields in tgsi_src_register doesn't apply for
an indirect addressing operand replace it with a separate
tgsi_ind_register structure and so make room for extra information.

v2: rename Declaration to ArrayID, put the ArrayID into () instead of []

Signed-off-by: Christian König christian.koe...@amd.com
---
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c|4 +-
 src/gallium/auxiliary/tgsi/tgsi_build.c|  109 +++-
 src/gallium/auxiliary/tgsi/tgsi_dump.c |   28 -
 src/gallium/auxiliary/tgsi/tgsi_exec.c |8 +-
 src/gallium/auxiliary/tgsi/tgsi_parse.c|   35 +--
 src/gallium/auxiliary/tgsi/tgsi_parse.h|8 +-
 src/gallium/auxiliary/tgsi/tgsi_text.c |   27 +++--
 src/gallium/auxiliary/tgsi/tgsi_ureg.c |   36 +++
 src/gallium/auxiliary/tgsi/tgsi_ureg.h |7 ++
 src/gallium/auxiliary/tgsi/tgsi_util.c |   18 
 src/gallium/auxiliary/tgsi/tgsi_util.h |3 +
 src/gallium/drivers/i915/i915_fpc.h|8 +-
 src/gallium/drivers/nv30/nvfx_vertprog.c   |2 +-
 .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp |6 ++
 src/gallium/drivers/r600/r600_llvm.c   |2 +-
 src/gallium/include/pipe/p_shader_tokens.h |   24 +++--
 16 files changed, 193 insertions(+), 132 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 9fe87c4..f157dc1 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -517,12 +517,12 @@ emit_mask_scatter(struct lp_build_tgsi_soa_context *bld,
 static LLVMValueRef
 get_indirect_index(struct lp_build_tgsi_soa_context *bld,
unsigned reg_file, unsigned reg_index,
-   const struct tgsi_src_register *indirect_reg)
+   const struct tgsi_ind_register *indirect_reg)
 {
LLVMBuilderRef builder = bld-bld_base.base.gallivm-builder;
struct lp_build_context *uint_bld = bld-bld_base.uint_bld;
/* always use X component of address register */
-   unsigned swizzle = indirect_reg-SwizzleX;
+   unsigned swizzle = indirect_reg-Swizzle;
LLVMValueRef base;
LLVMValueRef rel;
LLVMValueRef max_index;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c 
b/src/gallium/auxiliary/tgsi/tgsi_build.c
index 33cbbd8..435d94a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -816,6 +816,43 @@ tgsi_build_src_register(
return src_register;
 }
 
+static struct tgsi_ind_register
+tgsi_default_ind_register( void )
+{
+   struct tgsi_ind_register ind_register;
+
+   ind_register.File = TGSI_FILE_NULL;
+   ind_register.Swizzle = TGSI_SWIZZLE_X;
+   ind_register.ArrayID = 0;
+
+   return ind_register;
+}
+
+static struct tgsi_ind_register
+tgsi_build_ind_register(
+   unsigned file,
+   unsigned swizzle,
+   unsigned arrayid,
+   int index,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_ind_register   ind_register;
+
+   assert( file  TGSI_FILE_COUNT );
+   assert( swizzle = TGSI_SWIZZLE_W );
+   assert( index = -0x8000  index = 0x7FFF );
+
+   ind_register.File = file;
+   ind_register.Swizzle = swizzle;
+   ind_register.Index = index;
+   ind_register.ArrayID = arrayid;
+
+   instruction_grow( instruction, header );
+
+   return ind_register;
+}
+
 static struct tgsi_dimension
 tgsi_default_dimension( void )
 {
@@ -835,9 +872,9 @@ tgsi_default_full_src_register( void )
struct tgsi_full_src_register full_src_register;
 
full_src_register.Register = tgsi_default_src_register();
-   full_src_register.Indirect = tgsi_default_src_register();
+   full_src_register.Indirect = tgsi_default_ind_register();
full_src_register.Dimension = tgsi_default_dimension();
-   full_src_register.DimIndirect = tgsi_default_src_register();
+   full_src_register.DimIndirect = tgsi_default_ind_register();
 
return full_src_register;
 }
@@ -910,9 +947,9 @@ tgsi_default_full_dst_register( void )
struct tgsi_full_dst_register full_dst_register;
 
full_dst_register.Register = tgsi_default_dst_register();
-   full_dst_register.Indirect = tgsi_default_src_register();
+   full_dst_register.Indirect = tgsi_default_ind_register();
full_dst_register.Dimension = tgsi_default_dimension();
-   full_dst_register.DimIndirect = tgsi_default_src_register();
+   full_dst_register.DimIndirect = tgsi_default_ind_register();
 
return full_dst_register;
 }
@@ -1057,24 +1094,18 @@ tgsi_build_full_instruction(
  header );
 
   if( reg-Register.Indirect ) {
- struct tgsi_src_register 

[Mesa-dev] [PATCH 9/9] tgsi: add ArrayID documentation v2

2013-03-18 Thread Christian König
From: Christian König christian.koe...@amd.com

v2: further improve the text with comments from Christoph Bumiller.

Signed-off-by: Christian König christian.koe...@amd.com
---
 src/gallium/docs/source/tgsi.rst |   18 ++
 1 file changed, 18 insertions(+)

diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index d9a7fe9..4c55e60 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -1833,6 +1833,24 @@ If Interpolate flag is set to 1, a Declaration 
Interpolate token follows.
 
 If file is TGSI_FILE_RESOURCE, a Declaration Resource token follows.
 
+If Array flag is set to 1, a Declaration Array token follows.
+
+Array Declaration
+
+
+Declarations can optional have an ArrayID attribute which can be referred by
+indirect addressing operands. An ArrayID of zero is reserved and treaded as
+if no ArrayID is specified.
+
+If an indirect addressing operand refers to a specific declaration by using
+an ArrayID only the registers in this declaration are guaranteed to be
+accessed, accessing any register outside this declaration results in undefined
+behavior. Note that for compatibility the effective index is zero-based and
+not relative to the specified declaration
+
+If no ArrayID is specified with an indirect addressing operand the whole
+register file might be accessed by this operand. This is strongly discouraged
+and will prevent packing of scalar/vec2 arrays and effective alias analysis.
 
 Declaration Semantic
 
-- 
1.7.9.5

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


[Mesa-dev] Error while compiling the MAPI directory

2013-03-18 Thread Ritvik_Sharma
Hi,

I am receiving the following error  while compiling the code in the mapi 
directory.  I am using mesa 7.5.

(On compiling glapi_dispatch.c)
OpenGL\mapi/glapi/glapitemp.h(86) : error C2375: 'glNewList' : redefinition; 
different linkage
c:\poc\edk2\AppPkg\Include\GL/gl.h(944) : see declaration of 'glNewList'
OpenGL\mapi/glapi/glapitemp.h(92) : error C2375: 'glEndList' : redefinition; 
different linkage
c:\poc\edk2\AppPkg\Inclu
de\GL/gl.h(946) : see declaration of 'glEndList'
and so on

(On compiling files inside mapi/mapi directory)
mapi_tmp.h(48) : error C2006: '#include' : expected a filename, found 'constant'
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 8/9] tgsi: use separate structure for indirect address v2

2013-03-18 Thread Roland Scheidegger
Am 18.03.2013 14:36, schrieb Christian König:
 From: Christian König christian.koe...@amd.com
 
 To further improve the optimization of source and destination
 indirect addressing we need the ability to store a reference
 to the declaration of the addressed operands.
 
 Since most of the fields in tgsi_src_register doesn't apply for
 an indirect addressing operand replace it with a separate
 tgsi_ind_register structure and so make room for extra information.
 
 v2: rename Declaration to ArrayID, put the ArrayID into () instead of []
 
 Signed-off-by: Christian König christian.koe...@amd.com
 ---
 diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h 
 b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
 index cd140de..be99ae0 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
 +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
 @@ -62,6 +62,7 @@ struct ureg_src
 int  IndirectIndex: 16; /* SINT */
 int  DimensionIndex   : 16; /* SINT */
 int  DimIndIndex  : 16; /* SINT */
 +   unsigned ArrayID  : 10; /* UINT */
  };
  
  /* Very similar to a tgsi_dst_register, removing unsupported fields
 @@ -84,6 +85,7 @@ struct ureg_dst
 int  Index   : 16; /* SINT */
 int  IndirectIndex   : 16; /* SINT */
 int  IndirectSwizzle : 2;  /* TGSI_SWIZZLE_ */
 +   unsigned ArrayID : 10; /* UINT */
  };
  

Not sure I like the ordering of these fields...
In any case it would be difficult (but possible) to make ureg_dst fit
into a 64bit struct.
FWIW (but that's not your fault) IndirectSwizzle really ought to be a
unsigned too, looks to me like this misdeclaration really could cause
bugs somewhere.

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


[Mesa-dev] [PATCH 1/2] build libgallium shared by default.

2013-03-18 Thread Maarten Lankhorst
This is one of the 2 patches used in ubuntu for decreasing size of mesa build.

The other one is more hacky, and links libmesagallium into libgallium,
and then links libgallium against libdricore too for minimal duplication.

This might mess up with static llvm, iirc static llvm is built wrong and
linking libgallium against it will cause it to export all llvm symbols too.
I believe that this is a bug in llvm though, not in mesa. The static libraries
should not export all llvm symbols.

I should probably change the default to not building shared gallium for the
same reason. :-)

Meant mostly for discussion purposes, although if there is no objection I'll
change the default to disabling shared gallium, and just let every distro enable
shared llvm and libgallium for themselves.

8---
Signed-off-by: Maarten Lankhorst maarten.lankho...@canonical.com

--- a/configure.ac
+++ b/configure.ac
@@ -733,6 +733,19 @@
 fi
 AM_CONDITIONAL(HAVE_SHARED_GLAPI, test x$enable_shared_glapi = xyes)
 
+AC_ARG_ENABLE([shared-gallium],
+[AS_HELP_STRING([--enable-shared-gallium],
+[Enable shared gallium core @:@default=yes@:@])],
+[enable_shared_gallium=$enableval],
+[enable_shared_gallium=yes])
+
+SHARED_GALLIUM=0
+if test x$enable_shared_gallium = xyes; then
+SHARED_GALLIUM=1
+fi
+AC_SUBST([SHARED_GALLIUM])
+AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test $SHARED_GALLIUM = 1)
+
 dnl
 dnl Driver specific build directories
 dnl
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -3,13 +3,19 @@
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libgallium.la
-
 AM_CFLAGS = \
-I$(top_srcdir)/src/gallium/auxiliary/util \
-   $(GALLIUM_CFLAGS) $(VISIBILITY_CFLAGS)
+   $(GALLIUM_CFLAGS)
+
+AM_CXXFLAGS =
 
-AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
+if HAVE_SHARED_GALLIUM
+lib_LTLIBRARIES = libgallium.la
+else
+noinst_LTLIBRARIES = libgallium.la
+AM_CFLAGS += $(VISIBILITY_CFLAGS)
+AM_CXXFLAGS += $(VISIBILITY_CXXFLAGS)
+endif
 
 libgallium_la_SOURCES = \
$(C_SOURCES) \
@@ -28,6 +34,8 @@
 
 AM_CXXFLAGS += -fno-rtti
 
+libgallium_la_LIBADD = $(LLVM_LIBS)
+
 endif
 
 libgallium_la_SOURCES += \

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


Re: [Mesa-dev] [PATCH 8/9] tgsi: use separate structure for indirect address v2

2013-03-18 Thread Christian König

Am 18.03.2013 15:12, schrieb Roland Scheidegger:

Am 18.03.2013 14:36, schrieb Christian König:

From: Christian König christian.koe...@amd.com

To further improve the optimization of source and destination
indirect addressing we need the ability to store a reference
to the declaration of the addressed operands.

Since most of the fields in tgsi_src_register doesn't apply for
an indirect addressing operand replace it with a separate
tgsi_ind_register structure and so make room for extra information.

v2: rename Declaration to ArrayID, put the ArrayID into () instead of []

Signed-off-by: Christian König christian.koe...@amd.com
---
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index cd140de..be99ae0 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -62,6 +62,7 @@ struct ureg_src
 int  IndirectIndex: 16; /* SINT */
 int  DimensionIndex   : 16; /* SINT */
 int  DimIndIndex  : 16; /* SINT */
+   unsigned ArrayID  : 10; /* UINT */
  };
  
  /* Very similar to a tgsi_dst_register, removing unsupported fields

@@ -84,6 +85,7 @@ struct ureg_dst
 int  Index   : 16; /* SINT */
 int  IndirectIndex   : 16; /* SINT */
 int  IndirectSwizzle : 2;  /* TGSI_SWIZZLE_ */
+   unsigned ArrayID : 10; /* UINT */
  };
  

Not sure I like the ordering of these fields...
In any case it would be difficult (but possible) to make ureg_dst fit
into a 64bit struct.
FWIW (but that's not your fault) IndirectSwizzle really ought to be a
unsigned too, looks to me like this misdeclaration really could cause
bugs somewhere.


Noticed the strange declaration of IndirectSwizzle also, and I have it 
on my todo list (as very low priority) to figure out if this causes any 
problems or not, but as far as I have seen we currently only use 
indirect addressing with swizzle X, and then it probably won't hurt.


Regarding putting everything into a 64bit struct, well I'm pretty sure 
that I don't like that idea. Bitfields might make sense for TGSI tokens, 
but for ureg_src/ureg_dst saving some bytes of memory probably doesn't 
judge the extra overhead related to them.


Christian.



Roland
___
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 1/2] build libgallium shared by default.

2013-03-18 Thread Andreas Boll
2013/3/18 Maarten Lankhorst maarten.lankho...@canonical.com:
 This is one of the 2 patches used in ubuntu for decreasing size of mesa build.

 The other one is more hacky, and links libmesagallium into libgallium,
 and then links libgallium against libdricore too for minimal duplication.

 This might mess up with static llvm, iirc static llvm is built wrong and
 linking libgallium against it will cause it to export all llvm symbols too.
 I believe that this is a bug in llvm though, not in mesa. The static libraries
 should not export all llvm symbols.

 I should probably change the default to not building shared gallium for the
 same reason. :-)

 Meant mostly for discussion purposes, although if there is no objection I'll
 change the default to disabling shared gallium, and just let every distro 
 enable
 shared llvm and libgallium for themselves.

8---
 Signed-off-by: Maarten Lankhorst maarten.lankho...@canonical.com

 --- a/configure.ac
 +++ b/configure.ac
 @@ -733,6 +733,19 @@
  fi
  AM_CONDITIONAL(HAVE_SHARED_GLAPI, test x$enable_shared_glapi = xyes)

 +AC_ARG_ENABLE([shared-gallium],
 +[AS_HELP_STRING([--enable-shared-gallium],
 +[Enable shared gallium core @:@default=yes@:@])],
 +[enable_shared_gallium=$enableval],
 +[enable_shared_gallium=yes])
 +

The following code could be simplified...

 +SHARED_GALLIUM=0
 +if test x$enable_shared_gallium = xyes; then
 +SHARED_GALLIUM=1
 +fi
 +AC_SUBST([SHARED_GALLIUM])
 +AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test $SHARED_GALLIUM = 1)
 +

... to:

AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test x$enable_shared_gallium = xyes)


  dnl
  dnl Driver specific build directories
  dnl
 --- a/src/gallium/auxiliary/Makefile.am
 +++ b/src/gallium/auxiliary/Makefile.am
 @@ -3,13 +3,19 @@
  include Makefile.sources
  include $(top_srcdir)/src/gallium/Automake.inc

 -noinst_LTLIBRARIES = libgallium.la
 -
  AM_CFLAGS = \
 -I$(top_srcdir)/src/gallium/auxiliary/util \
 -   $(GALLIUM_CFLAGS) $(VISIBILITY_CFLAGS)
 +   $(GALLIUM_CFLAGS)
 +
 +AM_CXXFLAGS =

 -AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
 +if HAVE_SHARED_GALLIUM
 +lib_LTLIBRARIES = libgallium.la
 +else
 +noinst_LTLIBRARIES = libgallium.la
 +AM_CFLAGS += $(VISIBILITY_CFLAGS)
 +AM_CXXFLAGS += $(VISIBILITY_CXXFLAGS)
 +endif

  libgallium_la_SOURCES = \
 $(C_SOURCES) \
 @@ -28,6 +34,8 @@

  AM_CXXFLAGS += -fno-rtti

 +libgallium_la_LIBADD = $(LLVM_LIBS)
 +
  endif

  libgallium_la_SOURCES += \

 ___
 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] gallivm: fix return opcode handling in main function of a shader

2013-03-18 Thread Jose Fonseca
Looks good to me.  Please add all necessary test cases to cover all these code 
paths.

Good stuff guys. Very subtle code indeed.

Jose

- Original Message -
 From: Roland Scheidegger srol...@vmware.com
 
 If we're in some conditional or loop we must not return, or the code
 after the condition is never executed.
 (v2): And, we also can't just continue as nothing happened, since the
 mask update code would later check if we actually have a mask, so we
 need to remember that there was a return in main where we didn't exit
 (to illustrate this, a ret in a if clause would cause a mask update
 which is still ok as we're in a conditional, but after the endif the
 mask update code would drop the mask hence bringing execution back to
 pixels which should have their execution mask set to zero by the ret).
 Thanks to Christoph Bumiller for figuring this out.
 
 This fixes https://bugs.freedesktop.org/show_bug.cgi?id=62357.
 
 Note: This is a candidate for the stable branches.
 ---
  src/gallium/auxiliary/gallivm/lp_bld_tgsi.h     |    1 +
  src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |   20 +---
  2 files changed, 18 insertions(+), 3 deletions(-)
 
 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
 b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
 index dac97c3..6e65e12 100644
 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
 +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
 @@ -243,6 +243,7 @@ struct lp_exec_mask {
     struct lp_build_context *bld;
  
     boolean has_mask;
 +   boolean ret_in_main;
  
     LLVMTypeRef int_vec_type;
  
 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
 b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
 index 0dc26b5..965255a 100644
 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
 +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
 @@ -73,6 +73,7 @@ static void lp_exec_mask_init(struct lp_exec_mask *mask,
 struct lp_build_context
  
     mask-bld = bld;
     mask-has_mask = FALSE;
 +   mask-ret_in_main = FALSE;
     mask-cond_stack_size = 0;
     mask-loop_stack_size = 0;
     mask-call_stack_size = 0;
 @@ -108,7 +109,7 @@ static void lp_exec_mask_update(struct lp_exec_mask
 *mask)
     } else
        mask-exec_mask = mask-cond_mask;
  
 -   if (mask-call_stack_size) {
 +   if (mask-call_stack_size || mask-ret_in_main) {
        mask-exec_mask = LLVMBuildAnd(builder,
                                       mask-exec_mask,
                                       mask-ret_mask,
 @@ -117,7 +118,8 @@ static void lp_exec_mask_update(struct lp_exec_mask
 *mask)
  
     mask-has_mask = (mask-cond_stack_size  0 ||
                       mask-loop_stack_size  0 ||
 -                     mask-call_stack_size  0);
 +                     mask-call_stack_size  0 ||
 +                     mask-ret_in_main);
  }
  
  static void lp_exec_mask_cond_push(struct lp_exec_mask *mask,
 @@ -348,11 +350,23 @@ static void lp_exec_mask_ret(struct lp_exec_mask *mask,
 int *pc)
     LLVMBuilderRef builder = mask-bld-gallivm-builder;
     LLVMValueRef exec_mask;
  
 -   if (mask-call_stack_size == 0) {
 +   if (mask-cond_stack_size == 0 
 +       mask-loop_stack_size == 0 
 +       mask-call_stack_size == 0) {
        /* returning from main() */
        *pc = -1;
        return;
     }
 +
 +   if (mask-call_stack_size == 0) {
 +      /*
 +       * This requires special handling since we need to ensure
 +       * we don't drop the mask even if we have no call stack
 +       * (e.g. after a ret in a if clause after the endif)
 +       */
 +      mask-ret_in_main = TRUE;
 +   }
 +
     exec_mask = LLVMBuildNot(builder,
                              mask-exec_mask,
                              ret);
 --
 1.7.9.5

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


Re: [Mesa-dev] glxgears is faster but 3D render is so slow

2013-03-18 Thread Brian Paul

On 03/15/2013 05:33 PM, jupiter wrote:

Hi Brian,

On 3/15/13, Brian Paulbri...@vmware.com  wrote:

On 03/15/2013 05:39 AM, jupiter wrote:

Thanks Brian and Matt.

On 3/15/13, Matt Turnermatts...@gmail.com   wrote:

On Thu, Mar 14, 2013 at 6:29 AM, Brian Paulbri...@vmware.com   wrote:

Hmm, I guess autoconf still has some unneeded dependencies on DRI when
it's
not needed.  You might try adding --with-gallium-drivers=swrast so that
no
DRI drivers are selected.


Don't think so. He's just not setting --with-gallium-drivers= so he
gets a radeon driver by default.


I did try to setup --with-gallium-drivers=llvm, it was an error, the
gallium drivers does not have llvm. I now changed to
--with-gallium-drivers=swrast. Matt is right, I don't need libdrm
anymore.

What is the correct llvm for --with-gallium-drivers? I also seen that
dri-core were also built, that could cause the problems.

The package built on CentOS 6.2 32-bit machine now included
lib/gallium, but the libGL.so and libGL.so.1 did not link to
lib/gallium/libGL.so.1.5.0. After manually linking the lib/libGL.so
and libGL.so.1 to lib/gallium/libGL.so.1.5.0, although the glxinfo
OpenGL rendering string is now pointing to the  llvmpipe, but it seems
broken the xlib driver. It stopped running my 3D application via VNC
connection. Does the LLVMPIPE use any DRI?


No.


Or is it still xlib driver?


llvmpipe uses Xlib only.



As the VNC can only use xlib, anything bypass the xlib will break the
VNC connection.


Do other OpenGL apps run OK with llvmpipe or is it just Chimera that's
not working?  How exactly is Chimera failing/broken?


Please see following benchmark for using both xlib and llvm:

(1) xlib driver

$ glxinfo | grep OpenGL renderer string
OpenGL renderer string: Mesa X11

glxgears 1500 FPS

glxspheres
15 frames/sec - 15 Mpixels/sec

(2) llvm driver

$ glxinfo | grep OpenGL renderer string
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.2, 128 bits)

glxgears: 600 FPS

glxspheres: 1 frames/sec - 1 Mpixels/sec


I'm not familiar with glxspheres.  But the xlib/swrast driver was 
optimized for simple things like glxgears.  llvm might be slower on 
that kind of thing, but it should be much, much faster with modern 
apps that uses shaders and texturing.





It is fair to say, if running llvm driver in my local machine (a
32-bit CentOS 6.2 without VNC connection), it was indeed faster than
the xlib driver.

Seems to me that the llvm driver broken the xlib VNC connection which
could be caused by either I haven't configure the llvm correctly, or
mesa llvm compile process may have bugs.


I don't understand what you mean by llvm driver broken the xlib VNC 
connection.





For your further examination, please see following configurations for
building each drivers:

(1) Compile xlib driver

${SOURCE}/${CONFIGURE} --prefix=${INSTALL} --enable-xlib-glx
--disable-dri --with-gallium-drivers=swrast


(2) Compile llvm driver

LLVM=/usr/local/libllvm/3.2

${SOURCE}/${CONFIGURE} --prefix=${INSTALL} --enable-xlib-glx
--disable-dri --enable-gallium-llvm --with-gallium-drivers=swrast
--with-llvm-shared-libs=${LLVM}/lib --with-llvm-prefix=${LLVM}

Manually change libGL.so and libGL.so.1 to link lib/gallium/libGL.so.1.5.0.


Looks OK to me.

-Brian

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


[Mesa-dev] [Bug 61827] [softpipe] piglit fbo-clear-formats GL_ARB_depth_buffer_float stencil regression

2013-03-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=61827

Anuj Phogat anuj.pho...@gmail.com changed:

   What|Removed |Added

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

--- Comment #1 from Anuj Phogat anuj.pho...@gmail.com ---
This bug is duplicate of bug 59498.

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

-- 
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 62482] New: [softpipe] piglit amd_seamless_cubemap_per_texture regression

2013-03-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=62482

  Priority: medium
Bug ID: 62482
  Keywords: regression
CC: jfons...@vmware.com
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: [softpipe] piglit amd_seamless_cubemap_per_texture
regression
  Severity: normal
Classification: Unclassified
OS: Linux (All)
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Other
   Product: Mesa

mesa: 5a13e051d9043c2b95333cf778b242ce94be70d5 (master)

$ ./bin/amd_seamless_cubemap_per_texture -auto
Mesa warning: failed to remap glClampColorARB
Mesa warning: failed to remap glTexBufferARB
Mesa warning: failed to remap glFramebufferTextureARB
Mesa warning: failed to remap glVertexAttribDivisorARB
Mesa warning: failed to remap glProgramParameteriARB
Probe at (80,20)
  Expected: 0.50 0.00 0.50
  Observed: 1.00 0.00 0.00
Probe at (170,20)
  Expected: 0.50 0.00 0.50
  Observed: 0.00 0.00 1.00
Probe at (200,20)
  Expected: 0.50 0.00 0.50
  Observed: 1.00 0.00 0.00
Probe at (230,20)
  Expected: 0.50 0.00 0.50
  Observed: 0.00 0.00 1.00
Probe at (20,50)
  Expected: 0.50 0.00 0.50
  Observed: 1.00 0.00 0.00
Probe at (50,50)
  Expected: 0.50 0.00 0.50
  Observed: 0.00 0.00 1.00
Probe at (80,50)
  Expected: 0.50 0.00 0.50
  Observed: 1.00 0.00 0.00
Probe at (110,50)
  Expected: 0.50 0.00 0.50
  Observed: 0.00 0.00 1.00
Probe at (140,50)
  Expected: 0.50 0.00 0.50
  Observed: 1.00 0.00 0.00
Probe at (170,50)
  Expected: 0.50 0.00 0.50
  Observed: 0.00 0.00 1.00
Probe at (200,50)
  Expected: 0.50 0.00 0.50
  Observed: 1.00 0.00 0.00
Probe at (230,50)
  Expected: 0.50 0.00 0.50
  Observed: 0.00 0.00 1.00
PIGLIT: {'result': 'fail' }

6a3d77e13dbae17000e35ce16023532200e68d09 is the first bad commit
commit 6a3d77e13dbae17000e35ce16023532200e68d09
Author: José Fonseca jfons...@vmware.com
Date:   Thu Mar 14 11:44:21 2013 +

softpipe: Shrink context size.

- each softpipe_tex_tile_cache 50*64*64*4*4 = 3,276,800 bytes
- each softpipe_context has 3*32 softpipe_tex_tile_cache, i.e, each
softpipe
  context is 314,572,800 bytes, i.e, 300MB

That is, in a 32bits process (around 3GB virtual memory max), we can
only fit 10 contexts.

This change is a short-term hack to shrink the context size.  Longer
term we'll need to change how the texture cache works.

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

:04 04 64ff15d9847673c6545754f29cba7bcbdd4be457
727f8e3f8b282c58978ca3c4a9d637ebc4f7f21e 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] Error while compiling the MAPI directory

2013-03-18 Thread Jose Fonseca
- Original Message -
 
 
 Hi,
 
 I am receiving the following error while compiling the code in the mapi
 directory. I am using mesa 7.5.

If you're compiling with MSVC I'd recommend using a recent Mesa release and 
save your self a world of trouble. It's known to build well there.

If you must use this old release, then you'll likely need to search the MSVC 
build fixes and crossport them.

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


Re: [Mesa-dev] [PATCH 5/7] mesa: allow multisample texture targets in [Get]TexParameter*

2013-03-18 Thread Eric Anholt
Chris Forbes chr...@ijw.co.nz writes:

 ARB_texture_storage_multisample allows texture parameters to be
 queried for TEXTURE_2D_MULTISAMPLE and TEXTURE_2D_MULTISAMPLE_ARRAY
 targets.

 Some parameters may also be set, with the following exceptions:

 - TEXTURE_BASE_LEVEL may not be set to a nonzero value; generates
INVALID_OPERATION

 - any state which appears in the `per-sampler` state table may not
   be set; generates INVALID_OPERATION


 @@ -348,6 +392,11 @@ set_tex_parameteri(struct gl_context *ctx,
 case GL_TEXTURE_MAX_LEVEL:
if (texObj-MaxLevel == params[0])
   return GL_FALSE;
 +
 +  if ((texObj-Target == GL_TEXTURE_2D_MULTISAMPLE ||
 +   texObj-Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)  params[0] 
 != 0)
 + goto invalid_operation;

I don't see anything banning MAX_LEVEL != 0 -- it's not sampler state,
and it's not otherwise called out.  On the other hand, there's no
useful thing you could do with MAX_LEVEL != 0, since it's a single-level
texture type.

I don't have an opinion either way, really.


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


[Mesa-dev] [PATCH] mesa: Disable validate_ir_tree() on release builds.

2013-03-18 Thread Eric Anholt
Since half of ir_validate uses asserts() (the other using printf() then
abort()), there's not much use to calling it in a release build.  Cuts
6.3% of the startup time of TF2.

NOTE: This is a candidate for the stable branches.
---
 src/glsl/ir_validate.cpp |6 ++
 src/glsl/linker.cpp  |2 --
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 24ea506..699c192 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -701,6 +701,11 @@ check_node_type(ir_instruction *ir, void *data)
 void
 validate_ir_tree(exec_list *instructions)
 {
+   /* We shouldn't have any reason to validate IR in a release build,
+* and it's half composed of assert()s anyway which wouldn't do
+* anything.
+*/
+#ifdef DEBUG
ir_validate v;
 
v.run(instructions);
@@ -710,4 +715,5 @@ validate_ir_tree(exec_list *instructions)
 
   visit_tree(ir, check_node_type, NULL);
}
+#endif
 }
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 29856b0..2b30d2b 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1067,13 +1067,11 @@ link_intrastage_shaders(void *mem_ctx,
 
free(linking_shaders);
 
-#ifdef DEBUG
/* At this point linked should contain all of the linked IR, so
 * validate it to make sure nothing went wrong.
 */
if (linked)
   validate_ir_tree(linked-ir);
-#endif
 
/* Make a pass over all variable declarations to ensure that arrays with
 * unspecified sizes have a size specified.  The size is inferred from the
-- 
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 v3] i965: Avoid unnecessary copy when depthstencil workaround invoked by clear.

2013-03-18 Thread Eric Anholt
Paul Berry stereotype...@gmail.com writes:

 Since apps typically begin rendering with a call to glClear(), it is
 likely that when brw_workaround_depthstencil_alignment() moves a
 miplevel to a temporary buffer, it can avoid doing a blit, since the
 contents of the miplevel are about to be erased.

 This patch adds the necessary plumbing to determine when
 brw_workaround_depthstencil_alignment() is being called as a
 consequence of glClear(), and avoids the unnecessary blit when it is
 safe to do so.

 Reviewed-by: Chad Versace chad.vers...@linux.intel.com
 Reviewed-by: Kenneth Graunke kenn...@whitecape.org

 v2: Eliminate unnecessary call to _mesa_is_depthstencil_format().  Fix
 handling of depth buffer in depth/stencil format.

 v3: Use correct bitfields for clear_mask.  Fix handling of depth
 buffer in depth/stencil format when hardware uses separate stencil.
 When invalidating, make sure we still reassociate the image to the new
 miptree.

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


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


Re: [Mesa-dev] [PATCH 1/7] mesa: add support for immutable textures to teximagemultisample()

2013-03-18 Thread Eric Anholt
Chris Forbes chr...@ijw.co.nz writes:

 The new entrypoints will come later, but this adds the actual logic for
 supporting immutable multisample textures:

 - The immutability flag is set as desired.
 - Attempting to modify an immutable multisample texture produces
   INVALID_OPERATION.

 Note: The extension spec does not mention adding this behavior to
 TexImage*Multisample, but it seems like the reasonable thing to do.

 Signed-off-by: Chris Forbes chr...@ijw.co.nz

You should also be calling tex_storage_error_check() in the immutable
case, which covers a bunch of cases from p258 of the 4.2 core spec.

Other than that, this series is:

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


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


Re: [Mesa-dev] [PATCH 1/7] mesa: add support for immutable textures to teximagemultisample()

2013-03-18 Thread Eric Anholt
Chris Forbes chr...@ijw.co.nz writes:

 The new entrypoints will come later, but this adds the actual logic for
 supporting immutable multisample textures:

 - The immutability flag is set as desired.
 - Attempting to modify an immutable multisample texture produces
   INVALID_OPERATION.

 Note: The extension spec does not mention adding this behavior to
 TexImage*Multisample, but it seems like the reasonable thing to do.

I think that's because it's just inheriting the text on p261 about what
you can't do to immutable textures.


pgpMYWGjYJ2Nk.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] R600: Use CONSTANT_BUFFER_0 address space for Implicit Parameters

2013-03-18 Thread Chad Rosier
Test case?

 Chad

On Mar 16, 2013, at 9:45 AM, Vincent Lejeune v...@ovi.com wrote:

 It allows the backend to generate reads to constant cache which
 are faster that VTX_READ.
 ---
 lib/Target/R600/R600ISelLowering.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/lib/Target/R600/R600ISelLowering.cpp 
 b/lib/Target/R600/R600ISelLowering.cpp
 index a0e27ea..caa1899 100644
 --- a/lib/Target/R600/R600ISelLowering.cpp
 +++ b/lib/Target/R600/R600ISelLowering.cpp
 @@ -522,7 +522,7 @@ SDValue 
 R600TargetLowering::LowerImplicitParameter(SelectionDAG DAG, EVT VT,
unsigned DwordOffset) 
 const {
   unsigned ByteOffset = DwordOffset * 4;
   PointerType * PtrType = 
 PointerType::get(VT.getTypeForEVT(*DAG.getContext()),
 -  AMDGPUAS::PARAM_I_ADDRESS);
 +  AMDGPUAS::CONSTANT_BUFFER_0);
 
   // We shouldn't be using an offset wider than 16-bits for implicit 
 parameters.
   assert(isInt16(ByteOffset));
 -- 
 1.8.1.4
 
 ___
 llvm-commits mailing list
 llvm-comm...@cs.uiuc.edu
 http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


[Mesa-dev] [Bug 61821] src/mesa/drivers/dri/common/xmlpool.h:96:29: fatal error: xmlpool/options.h

2013-03-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=61821

--- Comment #7 from Mike Stroyan m...@lunarg.com ---
Created attachment 76708
  -- https://bugs.freedesktop.org/attachment.cgi?id=76708action=edit
configure.ac: Build dricommon for gallium swrast

The 07f2dee7 commit added setting HAVE_COMMON_DRI in gallium_check_st().
But the dri-swrast case didn't use gallium_check_st().
I can get dri/common built when needed by using gallium_check_st
instead of directly setting GALLIUM_TARGET_DIRS to add dri-swrast.

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


Re: [Mesa-dev] Google Summer of Code ideas needed

2013-03-18 Thread Ian Romanick

On 03/13/2013 10:11 AM, Tom Stellard wrote:

Hi,

It's time again for Google Summer of Code, so we need to start updating
the X.Org ideas page (http://www.x.org/wiki/SummerOfCodeIdeas) with new
ideas.  Since there have been a few issues with the wikis lately, if you
have any ideas please respond to this thread, and I will make sure they
get onto the official ideas page (but still feel free to update the wiki
page yourself if you can).  A good project description should contain:


I've been trying to update the wiki... I don't seem to have an account 
(seems unpossible), and the account creation page is broken.


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

In the mean time, I have a couple ideas that someone could add.

#1. Find common patterns in real GLSL shaders.

Difficulty: Medium
Skills Required: C, C++
Helpful, but optional skills: GLSL, compilers
Possible Mentor: IanRomanick (idr on IRC)
Where to ask questions: mesa-dev@lists.freedesktop.org, #dri-devel on 
irc.freedesktop.org

Descrition:

Using Mesa's stand-along GLSL compiler as a basis, generate a database 
of IR from a large number of existing shaders (e.g., from shaderdb). 
Write a piece of software that will mine this database for large 
patterns that commonly occur in shaders.  This information will be used 
by people working on the GLSL compiler to improve code generation for 
these sequences.


#2. Improved application of GLSL complier optimizations

Difficulty: Easy
Skills Required: C, C++
Helpful, but optional skills: GLSL, compilers
Possible Mentor: IanRomanick (idr on IRC)
Where to ask questions: mesa-dev@lists.freedesktop.org, #dri-devel on 
irc.freedesktop.org

Descrition:

Mesa's GLSL compiler contains a large number of optimization passes. 
Each pass may change the code of a shader, and this may result in 
opportunities for other passes to make more changes.  As a result, we 
run all of our optimization passes in a loop until the shader code 
stabilizes.  This is expensive, and, though we have never observed this 
in the wild, it is possible that a shader may never stabilize.


Find a static ordering, with possible repeats, of optimization passes 
that does not compromise the quality of the generated code.  Measure the 
before and after speed of compiling a large set of real-world shaders.



- A brief description of the project
- A difficulty rating (e.g. easy, medium, hard)
- The skills / programming languages required

Also, I am going to purge all the old ideas from the ideas page in the
next week, so if there are any of the old ideas that you think are
still relevant, let me know and I will keep it.

The ideas page is used as one of the criteria by Google for selecting
mentoring organizations and part of the reason X.Org was not selected
last year was that the ideas page was not up to par, so if we want to
participate in Google Summer of Code this year, it is important we
have a good ideas page with lots of ideas.

Thanks,
Tom Stellard
___
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] i965: Don't use texture swizzling to force alpha to 1.0 if unnecessary.

2013-03-18 Thread Carl Worth
Kenneth Graunke kenn...@whitecape.org writes:
 This partially fixes a performance regression since commit 33599433c7.
 More work is required to fully fix it in all cases.  This at least helps
 Warsow.

Thanks, Ken.

Reviewed-by: Carl Worth cwo...@cworth.org

-Carl


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


Re: [Mesa-dev] Google Summer of Code ideas needed

2013-03-18 Thread Jordan Justen
On Wed, Mar 13, 2013 at 10:11 AM, Tom Stellard t...@stellard.net wrote:
 - A brief description of the project
 - A difficulty rating (e.g. easy, medium, hard)
 - The skills / programming languages required

GL/GLSL tests for GL 3.2, 3.3 in the piglit test suite
Difficulty: Easy-Medium
Skills Required: C
Useful skills: OpenGL, GLSL programming
Hardware/Software required: driver supporting = OpenGL 3.2
Possible Mentor: JordanJusten (jljusten on IRC)
Where to ask questions: mesa-dev@lists.freedesktop.org, #dri-devel on
irc.freedesktop.org
Description:

Write tests for OpenGL 3.2 / GLSL 1.50 and newer for the piglit test suite.

Proposal should identify:
* GL/GLSL version/features you plan to focus on
* Number of tests you estimate completing
* Hardware/driver you have access to

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


[Mesa-dev] [PATCH] i965: Align all depth miplevels to 8 in the X direction.

2013-03-18 Thread Eric Anholt
On an INTEL_DEBUG=perf piglit run on IVB, reduces the instances of HW
workaround: blit (the printouts from the misaligned-depth workaround
blits) from 725 to 684

It doesn't totally eliminate the workaround blit, because we still have
problems with Y offsets that we can't fix (since texturing can only align
miplevels up to 2 or 4, not 8).

No regressions on piglit/es3conform on IVB.
---
 src/mesa/drivers/dri/intel/intel_tex_layout.c |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c 
b/src/mesa/drivers/dri/intel/intel_tex_layout.c
index 35030df..95242f8 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_layout.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c
@@ -77,7 +77,15 @@ intel_horizontal_texture_alignment_unit(struct intel_context 
*intel,
if (format == MESA_FORMAT_S8)
   return 8;
 
-   if (intel-gen = 7  format == MESA_FORMAT_Z16)
+   /* The depth alignment requirements in the table above are for rendering to
+* depth miplevels using the LOD control fields.  We don't use LOD control
+* fields, and instead use page offsets plus intra-tile x/y offsets, which
+* require that the low 3 bits are zero.  To reduce the number of x/y
+* offset workaround blits we do, align the X to 8, which depth texturing
+* can handle (sadly, it can't handle 8 in the Y direction).
+*/
+   if (intel-gen = 4 
+   _mesa_get_format_base_format(format) == GL_DEPTH_COMPONENT)
   return 8;
 
return 4;
-- 
1.7.10.4

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


Re: [Mesa-dev] Redefinition error in glapitmp.h

2013-03-18 Thread Matt Turner
On Sun, Mar 17, 2013 at 12:57 AM, Ritvik Sharma
ritviksharma.n...@yahoo.in wrote:
 Also in the file mapi_tmp.h I am getting  #include error for  MAPI_ABI_HEADER.

Look at how the Makefiles define MAPI_ABI_HEADER (e.g., in
src/mapi/es2api/Makefile.am).
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 00/15] GLSL 1.50 interface blocks support

2013-03-18 Thread Jordan Justen
git://people.freedesktop.org/~jljusten/mesa interface-blocks-v2

v2:
 * 3 new patches added to series
 * Add support for interface block instance arrays
 * Add support for rejecting unmatched interface blocks
   during the linking phase.
 * Known issue: fails new piglit glsl-1.50 test:
   execution/interface-blocks-same-uniform-varying-name.shader_test

v1:
 * Initial support for GLSL 1.50 interface block support
 * Known issue: interface block arrays are not working
 * Known issue: rejection of unmatched interface blocks
is not working
 * Piglit tests for known issues have been sent to piglit list

Jordan Justen (15):
  glsl: rename ast_uniform_block to ast_interface_block
  glsl parser: rename uniform block to interface block
  glsl: parse in/out types for interface blocks
  glsl parser: reject VS+in  FS+out interface blocks
  glsl parser: on desktop GL require GLSL 150 for instance names
  glsl parser: allow in  out for interface block members
  glsl parser: handle interface block member qualifier
  glsl ast_to_hir: support in/out for interface blocks
  glsl ir: add as_dereference_record
  glsl linker: cross validate interface block types between stages
  glsl linker: remove interface block instance names
  glsl link_varyings: link interface blocks using the block name
  glsl linker: support arrays of interface block instances
  glsl linker: compare interface blocks during intrastage linking
  glsl linker: compare interface blocks during interstage linking

 src/glsl/Makefile.sources |2 +
 src/glsl/ast.h|4 +-
 src/glsl/ast_to_hir.cpp   |   23 ++-
 src/glsl/glsl_parser.yy   |  189 ---
 src/glsl/interface_blocks.cpp |  104 +
 src/glsl/interface_blocks.h   |   35 +
 src/glsl/ir.h |6 +
 src/glsl/ir_optimization.h|1 +
 src/glsl/link_varyings.cpp|   33 +++-
 src/glsl/linker.cpp   |   28 
 src/glsl/lower_named_interface_blocks.cpp |  237 +
 11 files changed, 599 insertions(+), 63 deletions(-)
 create mode 100644 src/glsl/interface_blocks.cpp
 create mode 100644 src/glsl/interface_blocks.h
 create mode 100644 src/glsl/lower_named_interface_blocks.cpp

-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 01/15] glsl: rename ast_uniform_block to ast_interface_block

2013-03-18 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/ast.h  |4 ++--
 src/glsl/ast_to_hir.cpp |6 +++---
 src/glsl/glsl_parser.yy |   14 +++---
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index fcc6b45..49c3939 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -805,9 +805,9 @@ public:
ast_compound_statement *body;
 };
 
-class ast_uniform_block : public ast_node {
+class ast_interface_block : public ast_node {
 public:
-   ast_uniform_block(ast_type_qualifier layout,
+   ast_interface_block(ast_type_qualifier layout,
  const char *instance_name,
 ast_expression *array_size)
: layout(layout), block_name(NULL), instance_name(instance_name),
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 92065f5..40f3188 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4244,12 +4244,12 @@ ast_struct_specifier::hir(exec_list *instructions,
 }
 
 ir_rvalue *
-ast_uniform_block::hir(exec_list *instructions,
-  struct _mesa_glsl_parse_state *state)
+ast_interface_block::hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
 {
YYLTYPE loc = this-get_location();
 
-   /* The ast_uniform_block has a list of ast_declarator_lists.  We
+   /* The ast_interface_block has a list of ast_declarator_lists.  We
 * need to turn those into ir_variables with an association
 * with this uniform block.
 */
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index f52ed9b..cd33078 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -79,7 +79,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, 
const char *msg)
ast_case_label_list *case_label_list;
ast_case_statement *case_statement;
ast_case_statement_list *case_statement_list;
-   ast_uniform_block *uniform_block;
+   ast_interface_block *interface_block;
 
struct {
   ast_node *cond;
@@ -1900,7 +1900,7 @@ uniform_block:
}
| layout_qualifier basic_uniform_block
{
-  ast_uniform_block *block = $2;
+  ast_interface_block *block = $2;
   if (!block-layout.merge_qualifier( @1, state, $1)) {
  YYERROR;
   }
@@ -1911,7 +1911,7 @@ uniform_block:
 basic_uniform_block:
UNIFORM NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';'
{
-  ast_uniform_block *const block = $6;
+  ast_interface_block *const block = $6;
 
   block-block_name = $2;
   block-declarations.push_degenerate_list_at_head( $4-link);
@@ -1944,19 +1944,19 @@ basic_uniform_block:
 instance_name_opt:
/* empty */
{
-  $$ = new(state) ast_uniform_block(*state-default_uniform_qualifier,
+  $$ = new(state) 
ast_interface_block(*state-default_uniform_qualifier,
 NULL,
 NULL);
}
| NEW_IDENTIFIER
{
-  $$ = new(state) ast_uniform_block(*state-default_uniform_qualifier,
+  $$ = new(state) 
ast_interface_block(*state-default_uniform_qualifier,
 $1,
 NULL);
}
| NEW_IDENTIFIER '[' constant_expression ']'
{
-  $$ = new(state) ast_uniform_block(*state-default_uniform_qualifier,
+  $$ = new(state) 
ast_interface_block(*state-default_uniform_qualifier,
 $1,
 $3);
}
@@ -1965,7 +1965,7 @@ instance_name_opt:
   _mesa_glsl_error( @1, state,
instance block arrays must be explicitly sized\n);
 
-  $$ = new(state) ast_uniform_block(*state-default_uniform_qualifier,
+  $$ = new(state) 
ast_interface_block(*state-default_uniform_qualifier,
 $1,
 NULL);
}
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 02/15] glsl parser: rename uniform block to interface block

2013-03-18 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/glsl_parser.yy |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index cd33078..33b74ea 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -115,7 +115,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state 
*st, const char *msg)
 %token STRUCT VOID_TOK WHILE
 %token identifier IDENTIFIER TYPE_IDENTIFIER NEW_IDENTIFIER
 %type identifier any_identifier
-%type uniform_block instance_name_opt
+%type interface_block instance_name_opt
 %token real FLOATCONSTANT
 %token n INTCONSTANT UINTCONSTANT BOOLCONSTANT
 %token identifier FIELD_SELECTION
@@ -164,7 +164,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state 
*st, const char *msg)
 %type type_qualifier interpolation_qualifier
 %type type_qualifier layout_qualifier
 %type type_qualifier layout_qualifier_id_list layout_qualifier_id
-%type type_qualifier uniform_block_layout_qualifier
+%type type_qualifier interface_block_layout_qualifier
 %type type_specifier type_specifier
 %type type_specifier type_specifier_no_prec
 %type type_specifier type_specifier_nonarray
@@ -223,8 +223,8 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state 
*st, const char *msg)
 %type node declaration
 %type node declaration_statement
 %type node jump_statement
-%type node uniform_block
-%type uniform_block basic_uniform_block
+%type node interface_block
+%type interface_block basic_interface_block
 %type struct_specifier struct_specifier
 %type declarator_list struct_declaration_list
 %type declarator_list struct_declaration
@@ -784,7 +784,7 @@ declaration:
   $3-is_precision_statement = true;
   $$ = $3;
}
-   | uniform_block
+   | interface_block
{
   $$ = $1;
}
@@ -1140,7 +1140,7 @@ layout_qualifier_id:
  }
   }
 
-  /* See also uniform_block_layout_qualifier. */
+  /* See also interface_block_layout_qualifier. */
   if (!$$.flags.i  state-ARB_uniform_buffer_object_enable) {
  if (strcmp($1, std140) == 0) {
 $$.flags.q.std140 = 1;
@@ -1211,7 +1211,7 @@ layout_qualifier_id:
 identifier `%s' used\n, $1);
   }
}
-   | uniform_block_layout_qualifier
+   | interface_block_layout_qualifier
{
   $$ = $1;
   /* Layout qualifiers for ARB_uniform_buffer_object. */
@@ -1232,7 +1232,7 @@ layout_qualifier_id:
  * most qualifiers.  See the any_identifier path of
  * layout_qualifier_id for the others.
  */
-uniform_block_layout_qualifier:
+interface_block_layout_qualifier:
ROW_MAJOR
{
   memset( $$, 0, sizeof($$));
@@ -1893,12 +1893,12 @@ function_definition:
;
 
 /* layout_qualifieropt is packed into this rule */
-uniform_block:
-   basic_uniform_block
+interface_block:
+   basic_interface_block
{
   $$ = $1;
}
-   | layout_qualifier basic_uniform_block
+   | layout_qualifier basic_interface_block
{
   ast_interface_block *block = $2;
   if (!block-layout.merge_qualifier( @1, state, $1)) {
@@ -1908,7 +1908,7 @@ uniform_block:
}
;
 
-basic_uniform_block:
+basic_interface_block:
UNIFORM NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';'
{
   ast_interface_block *const block = $6;
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 03/15] glsl: parse in/out types for interface blocks

2013-03-18 Thread Jordan Justen
Previously only 'uniform' was allowed for uniform blocks.

Now, in/out can be parsed, but it will only be allowed for
GLSL = 150.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/glsl_parser.yy |   60 ++-
 1 file changed, 49 insertions(+), 11 deletions(-)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 33b74ea..7adc06d 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -165,6 +165,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state 
*st, const char *msg)
 %type type_qualifier layout_qualifier
 %type type_qualifier layout_qualifier_id_list layout_qualifier_id
 %type type_qualifier interface_block_layout_qualifier
+%type type_qualifier interface_qualifier
 %type type_specifier type_specifier
 %type type_specifier type_specifier_no_prec
 %type type_specifier type_specifier_nonarray
@@ -1215,11 +1216,11 @@ layout_qualifier_id:
{
   $$ = $1;
   /* Layout qualifiers for ARB_uniform_buffer_object. */
-  if (!state-ARB_uniform_buffer_object_enable) {
+  if ($$.flags.q.uniform  !state-ARB_uniform_buffer_object_enable) {
  _mesa_glsl_error( @1, state,
   #version 140 / GL_ARB_uniform_buffer_object 
   layout qualifier `%s' is used\n, $1);
-  } else if (state-ARB_uniform_buffer_object_warn) {
+  } else if ($$.flags.q.uniform  
state-ARB_uniform_buffer_object_warn) {
  _mesa_glsl_warning( @1, state,
 #version 140 / GL_ARB_uniform_buffer_object 
 layout qualifier `%s' is used\n, $1);
@@ -1909,21 +1910,29 @@ interface_block:
;
 
 basic_interface_block:
-   UNIFORM NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';'
+   interface_qualifier NEW_IDENTIFIER '{' member_list '}' 
instance_name_opt ';'
{
   ast_interface_block *const block = $6;
 
   block-block_name = $2;
   block-declarations.push_degenerate_list_at_head( $4-link);
 
-  if (!state-ARB_uniform_buffer_object_enable) {
- _mesa_glsl_error( @1, state,
-  #version 140 / GL_ARB_uniform_buffer_object 
-  required for defining uniform blocks\n);
-  } else if (state-ARB_uniform_buffer_object_warn) {
- _mesa_glsl_warning( @1, state,
-#version 140 / GL_ARB_uniform_buffer_object 
-required for defining uniform blocks\n);
+  if ($1.flags.q.uniform) {
+ if (!state-ARB_uniform_buffer_object_enable) {
+_mesa_glsl_error( @1, state,
+ #version 140 / GL_ARB_uniform_buffer_object 
+ required for defining uniform blocks\n);
+ } else if (state-ARB_uniform_buffer_object_warn) {
+_mesa_glsl_warning( @1, state,
+   #version 140 / 
GL_ARB_uniform_buffer_object 
+   required for defining uniform blocks\n);
+ }
+  } else {
+ if (state-es_shader || state-language_version  150) {
+_mesa_glsl_error( @1, state,
+#version 150 required for using 
+interface blocks.\n);
+ }
   }
 
   /* Since block arrays require names, and both features are added in
@@ -1937,10 +1946,39 @@ basic_interface_block:
   blocks with an instance name\n);
   }
 
+  unsigned interface_type_mask, interface_type_flags;
+  struct ast_type_qualifier temp_type_qualifier;
+
+  temp_type_qualifier.flags.i = 0;
+  temp_type_qualifier.flags.q.uniform = true;
+  temp_type_qualifier.flags.q.in = true;
+  temp_type_qualifier.flags.q.out = true;
+  interface_type_mask = temp_type_qualifier.flags.i;
+  interface_type_flags = $1.flags.i  interface_type_mask;
+  block-layout.flags.i |= interface_type_flags;
+
   $$ = block;
}
;
 
+interface_qualifier:
+   IN_TOK
+   {
+  memset( $$, 0, sizeof($$));
+  $$.flags.q.in = 1;
+   }
+   | OUT_TOK
+   {
+  memset( $$, 0, sizeof($$));
+  $$.flags.q.out = 1;
+   }
+   | UNIFORM
+   {
+  memset( $$, 0, sizeof($$));
+  $$.flags.q.uniform = 1;
+   }
+   ;
+
 instance_name_opt:
/* empty */
{
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 04/15] glsl parser: reject VS+in FS+out interface blocks

2013-03-18 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/glsl_parser.yy |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 7adc06d..8e6b04d 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1935,6 +1935,20 @@ basic_interface_block:
  }
   }
 
+  /* GLSLangSpec.1.50.11, 4.3.7 Interface Blocks:
+   * It is illegal to have an input block in a vertex shader
+   *  or an output block in a fragment shader
+   */
+  if ((state-target == vertex_shader)  $1.flags.q.in) {
+ _mesa_glsl_error( @1, state,
+  in interface block is not allowed for 
+  a vertex shader\n);
+  } else if ((state-target == fragment_shader)  $1.flags.q.out) {
+ _mesa_glsl_error( @1, state,
+  out interface block is not allowed for 
+  a fragment shader\n);
+  }
+
   /* Since block arrays require names, and both features are added in
* the same language versions, we don't have to explicitly
* version-check both things.
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 05/15] glsl parser: on desktop GL require GLSL 150 for instance names

2013-03-18 Thread Jordan Justen
Interface blocks in GLSL 150 allow an instance name to be used.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/glsl_parser.yy |   15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 8e6b04d..1fd8cc2 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1953,11 +1953,16 @@ basic_interface_block:
* the same language versions, we don't have to explicitly
* version-check both things.
*/
-  if (block-instance_name != NULL
-   !(state-language_version == 300  state-es_shader)) {
- _mesa_glsl_error( @1, state,
-  #version 300 es required for using uniform 
-  blocks with an instance name\n);
+  if (block-instance_name != NULL) {
+ if(state-es_shader  state-language_version  300) {
+_mesa_glsl_error( @1, state,
+#version 300 es required for using uniform 
+blocks with an instance name\n);
+ } else if (!state-es_shader  state-language_version  150) {
+_mesa_glsl_error( @1, state,
+#version 150 required for using uniform 
+blocks with an instance name\n);
+ }
   }
 
   unsigned interface_type_mask, interface_type_flags;
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 07/15] glsl parser: handle interface block member qualifier

2013-03-18 Thread Jordan Justen
An interface block member may specify the type:
in {
in vec4 in_var_with_qualifier;
};

In this case it must match the interface block type.

It can also omit the qualifier:
uniform {
vec4 uniform_var_without_qualifier;
};

In this case, it should use the same type as the interface block.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/glsl_parser.yy |   17 +
 1 file changed, 17 insertions(+)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index d21ca2d..ac1d8ed 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1976,6 +1976,23 @@ basic_interface_block:
   interface_type_flags = $1.flags.i  interface_type_mask;
   block-layout.flags.i |= interface_type_flags;
 
+  foreach_list_typed (ast_declarator_list, member, link, 
block-declarations) {
+ ast_type_qualifier qualifier = member-type-qualifier;
+ if ((qualifier.flags.i  interface_type_mask) == 0) {
+qualifier.flags.i |= interface_type_flags;
+ } else if ((qualifier.flags.i  interface_type_mask) !=
+interface_type_flags) {
+/* GLSLangSpec.1.50.11, 4.3.7 Interface Blocks:
+ * Input variables, output variables, and uniform variables 
can only
+ *  be in in blocks, out blocks, and uniform blocks, 
respectively.
+ */
+_mesa_glsl_error( @1, state,
+ uniform/in/out qualifier on 
+ interface block member does not match 
+ the interface block\n);
+ }
+  }
+
   $$ = block;
}
;
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 06/15] glsl parser: allow in out for interface block members

2013-03-18 Thread Jordan Justen
Previously uniform blocks allowed for the 'uniform' keyword
to be used with members of a uniform blocks. With interface
blocks 'in' can be used on 'in' interface block members and
'out' can be used on 'out' interface block members.

The basic_interface_block rule will verify that the same
qualifier type is used with the block and each member.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/glsl_parser.yy |   47 ++-
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 1fd8cc2..d21ca2d 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -2041,41 +2041,54 @@ member_list:
}
;
 
-/* Specifying uniform inside of a uniform block is redundant. */
-uniformopt:
-   /* nothing */
-   | UNIFORM
-   ;
-
 member_declaration:
-   layout_qualifier uniformopt type_specifier struct_declarator_list ';'
+   layout_qualifier fully_specified_type struct_declarator_list ';'
{
   void *ctx = state;
-  ast_fully_specified_type *type = new(ctx) ast_fully_specified_type();
+  ast_fully_specified_type *type = $2;
   type-set_location(yylloc);
 
-  type-qualifier = $1;
-  type-qualifier.flags.q.uniform = true;
-  type-specifier = $3;
+  if (!type-qualifier.merge_qualifier( @1, state, $1)) {
+ YYERROR;
+  }
+
+  if (type-qualifier.flags.q.attribute) {
+ _mesa_glsl_error( @1, state,
+ keyword 'attribute' cannot be used with 
+ interface block member\n);
+  } else if (type-qualifier.flags.q.varying) {
+ _mesa_glsl_error( @1, state,
+ keyword 'varying' cannot be used with 
+ interface block member\n);
+  }
+
   $$ = new(ctx) ast_declarator_list(type);
   $$-set_location(yylloc);
   $$-ubo_qualifiers_valid = true;
 
-  $$-declarations.push_degenerate_list_at_head( $4-link);
+  $$-declarations.push_degenerate_list_at_head( $3-link);
}
-   | uniformopt type_specifier struct_declarator_list ';'
+   | fully_specified_type struct_declarator_list ';'
{
   void *ctx = state;
-  ast_fully_specified_type *type = new(ctx) ast_fully_specified_type();
+  ast_fully_specified_type *type = $1;
   type-set_location(yylloc);
 
-  type-qualifier.flags.q.uniform = true;
-  type-specifier = $2;
+  if (type-qualifier.flags.q.attribute) {
+ _mesa_glsl_error( @1, state,
+ keyword 'attribute' cannot be used in 
+ interface block\n);
+  } else if (type-qualifier.flags.q.varying) {
+ _mesa_glsl_error( @1, state,
+ keyword 'varying' cannot be used in 
+ interface block\n);
+  }
+
   $$ = new(ctx) ast_declarator_list(type);
   $$-set_location(yylloc);
   $$-ubo_qualifiers_valid = true;
 
-  $$-declarations.push_degenerate_list_at_head( $3-link);
+  $$-declarations.push_degenerate_list_at_head( $2-link);
}
;
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 08/15] glsl ast_to_hir: support in/out for interface blocks

2013-03-18 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/ast_to_hir.cpp |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 40f3188..ee54c70 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4293,6 +4293,17 @@ ast_interface_block::hir(exec_list *instructions,
 */
assert(declared_variables.is_empty());
 
+   ir_variable_mode var_mode;
+   if (this-layout.flags.q.in) {
+  var_mode = ir_var_shader_in;
+   } else if (this-layout.flags.q.out) {
+  var_mode = ir_var_shader_out;
+   } else if (this-layout.flags.q.uniform) {
+  var_mode = ir_var_uniform;
+   } else {
+  assert(!interface block layout qualifier not found!);
+   }
+
/* Page 39 (page 45 of the PDF) of section 4.3.7 in the GLSL ES 3.00 spec
 * says:
 *
@@ -4309,11 +4320,11 @@ ast_interface_block::hir(exec_list *instructions,
 
  var = new(state) ir_variable(block_array_type,
   this-instance_name,
-  ir_var_uniform);
+  var_mode);
   } else {
  var = new(state) ir_variable(block_type,
   this-instance_name,
-  ir_var_uniform);
+  var_mode);
   }
 
   var-interface_type = block_type;
@@ -4329,7 +4340,7 @@ ast_interface_block::hir(exec_list *instructions,
  ir_variable *var =
 new(state) ir_variable(fields[i].type,
ralloc_strdup(state, fields[i].name),
-   ir_var_uniform);
+   var_mode);
  var-interface_type = block_type;
 
  state-symbols-add_variable(var);
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 09/15] glsl ir: add as_dereference_record

2013-03-18 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/ir.h |6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index bbfec69..ee27dea 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -120,6 +120,7 @@ public:
virtual class ir_dereference *   as_dereference()  { return NULL; }
virtual class ir_dereference_array *as_dereference_array() { return 
NULL; }
virtual class ir_dereference_variable *as_dereference_variable() { return 
NULL; }
+   virtual class ir_dereference_record *as_dereference_record() { return NULL; 
}
virtual class ir_expression *as_expression()   { return NULL; }
virtual class ir_rvalue *as_rvalue()   { return NULL; }
virtual class ir_loop *  as_loop() { return NULL; }
@@ -1738,6 +1739,11 @@ public:
 
virtual ir_constant *constant_expression_value(struct hash_table 
*variable_context = NULL);
 
+   virtual ir_dereference_record *as_dereference_record()
+   {
+  return this;
+   }
+
/**
 * Get the variable that is ultimately referenced by an r-value
 */
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 11/15] glsl linker: remove interface block instance names

2013-03-18 Thread Jordan Justen
Convert interface blocks with instance names into flat
interface blocks without an instance name.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/Makefile.sources |1 +
 src/glsl/ir_optimization.h|1 +
 src/glsl/linker.cpp   |6 +
 src/glsl/lower_named_interface_blocks.cpp |  202 +
 4 files changed, 210 insertions(+)
 create mode 100644 src/glsl/lower_named_interface_blocks.cpp

diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index c294aa4..86ae43e 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -62,6 +62,7 @@ LIBGLSL_FILES = \
$(GLSL_SRCDIR)/lower_mat_op_to_vec.cpp \
$(GLSL_SRCDIR)/lower_noise.cpp \
$(GLSL_SRCDIR)/lower_packed_varyings.cpp \
+   $(GLSL_SRCDIR)/lower_named_interface_blocks.cpp \
$(GLSL_SRCDIR)/lower_packing_builtins.cpp \
$(GLSL_SRCDIR)/lower_texture_projection.cpp \
$(GLSL_SRCDIR)/lower_variable_index_to_cond_assign.cpp \
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 2454bbe..c0850ce 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -105,6 +105,7 @@ void lower_ubo_reference(struct gl_shader *shader, 
exec_list *instructions);
 void lower_packed_varyings(void *mem_ctx, unsigned location_base,
unsigned locations_used, ir_variable_mode mode,
gl_shader *shader);
+void lower_named_interface_blocks(void *mem_ctx, gl_shader *shader);
 bool optimize_redundant_jumps(exec_list *instructions);
 bool optimize_split_arrays(exec_list *instructions, bool linked);
 
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index acbdd2f..003a331 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1748,6 +1748,12 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
   prog-LinkStatus = true;
}
 
+
+   for (unsigned int i = 0; i  MESA_SHADER_TYPES; i++) {
+  if (prog-_LinkedShaders[i] != NULL)
+ lower_named_interface_blocks(mem_ctx, prog-_LinkedShaders[i]);
+   }
+
/* Implement the GLSL 1.30+ rule for discard vs infinite loops Do
 * it before optimization because we want most of the checks to get
 * dropped thanks to constant propagation.
diff --git a/src/glsl/lower_named_interface_blocks.cpp 
b/src/glsl/lower_named_interface_blocks.cpp
new file mode 100644
index 000..2e0c322
--- /dev/null
+++ b/src/glsl/lower_named_interface_blocks.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file lower_named_interface_blocks.cpp
+ *
+ * This lowering pass converts all interface blocks with instance names
+ * into interface blocks without an interface name.
+ *
+ * For example, the following shader:
+ *
+ *   out block {
+ * float block_var;
+ *   } inst_name;
+ *
+ *   main()
+ *   {
+ * inst_name.block_var = 0.0;
+ *   }
+ *
+ * Is rewritten to:
+ *
+ *   out block {
+ * float block_var;
+ *   };
+ *
+ *   main()
+ *   {
+ * block_var = 0.0;
+ *   }
+ *
+ * This takes place after the shader code has already been verified with
+ * the interface name in place.
+ *
+ * The linking phase will use the interface name rather than the
+ * interface's instance name.
+ *
+ * This modification to the ir allows our currently existing dead code
+ * elimination to work with interface blocks without changes.
+ */
+
+#include glsl_symbol_table.h
+#include ir.h
+#include ir_optimization.h
+#include ir_rvalue_visitor.h
+#include program/hash_table.h
+
+class flatten_named_interface_blocks_declarations : public ir_rvalue_visitor
+{
+public:
+   void * const mem_ctx;
+   hash_table *interface_namespace;
+
+   flatten_named_interface_blocks_declarations(void *mem_ctx)
+  : mem_ctx(mem_ctx)
+   {
+   }
+

[Mesa-dev] [PATCH v2 10/15] glsl linker: cross validate interface block types between stages

2013-03-18 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/linker.cpp |   13 +
 1 file changed, 13 insertions(+)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 29856b0..acbdd2f 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -478,6 +478,7 @@ cross_validate_globals(struct gl_shader_program *prog,
 * them.
 */
glsl_symbol_table variables;
+   glsl_symbol_table interfaces;
for (unsigned i = 0; i  num_shaders; i++) {
   if (shader_list[i] == NULL)
 continue;
@@ -488,6 +489,18 @@ cross_validate_globals(struct gl_shader_program *prog,
 if (var == NULL)
continue;
 
+ if (var-is_in_uniform_block()) {
+const glsl_type *type = 
interfaces.get_type(var-interface_type-name);
+if (type == NULL) {
+   interfaces.add_type(var-interface_type-name, 
var-interface_type);
+} else if (type != var-interface_type) {
+   linker_error(prog, interface block `%s' is inconsistent 
+between shader stages\n,
+type-name);
+   return false;
+}
+ }
+
 if (uniforms_only  (var-mode != ir_var_uniform))
continue;
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 12/15] glsl link_varyings: link interface blocks using the block name

2013-03-18 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/link_varyings.cpp |   33 +
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 04c9fdd..b374049 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -965,6 +965,8 @@ assign_varying_locations(struct gl_context *ctx,
   = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
hash_table *consumer_inputs
   = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
+   hash_table *consumer_interface_inputs
+  = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
 
/* Operate in a total of three passes.
 *
@@ -983,8 +985,17 @@ assign_varying_locations(struct gl_context *ctx,
 ((ir_instruction *) node)-as_variable();
 
  if ((input_var != NULL)  (input_var-mode == ir_var_shader_in)) {
-hash_table_insert(consumer_inputs, input_var,
-  ralloc_strdup(mem_ctx, input_var-name));
+if (input_var-interface_type != NULL) {
+   char *const iface_field_name =
+  ralloc_asprintf(mem_ctx, %s.%s,
+  input_var-interface_type-name,
+  input_var-name);
+   hash_table_insert(consumer_interface_inputs, input_var,
+ iface_field_name);
+} else {
+   hash_table_insert(consumer_inputs, input_var,
+ ralloc_strdup(mem_ctx, input_var-name));
+}
  }
   }
}
@@ -998,8 +1009,19 @@ assign_varying_locations(struct gl_context *ctx,
   tfeedback_candidate_generator g(mem_ctx, tfeedback_candidates);
   g.process(output_var);
 
-  ir_variable *input_var =
- (ir_variable *) hash_table_find(consumer_inputs, output_var-name);
+  ir_variable *input_var;
+  if (output_var-interface_type != NULL) {
+ char *const iface_field_name =
+ralloc_asprintf(mem_ctx, %s.%s,
+output_var-interface_type-name,
+output_var-name);
+ input_var =
+(ir_variable *) hash_table_find(consumer_interface_inputs,
+iface_field_name);
+  } else {
+ input_var =
+(ir_variable *) hash_table_find(consumer_inputs, output_var-name);
+  }
 
   if (input_var  input_var-mode != ir_var_shader_in)
  input_var = NULL;
@@ -1019,6 +1041,7 @@ assign_varying_locations(struct gl_context *ctx,
   if (matched_candidate == NULL) {
  hash_table_dtor(tfeedback_candidates);
  hash_table_dtor(consumer_inputs);
+ hash_table_dtor(consumer_interface_inputs);
  return false;
   }
 
@@ -1036,12 +1059,14 @@ assign_varying_locations(struct gl_context *ctx,
   if (!tfeedback_decls[i].assign_location(ctx, prog)) {
  hash_table_dtor(tfeedback_candidates);
  hash_table_dtor(consumer_inputs);
+ hash_table_dtor(consumer_interface_inputs);
  return false;
   }
}
 
hash_table_dtor(tfeedback_candidates);
hash_table_dtor(consumer_inputs);
+   hash_table_dtor(consumer_interface_inputs);
 
if (ctx-Const.DisableVaryingPacking) {
   /* Transform feedback code assumes varyings are packed, so if the driver
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 13/15] glsl linker: support arrays of interface block instances

2013-03-18 Thread Jordan Justen
With this change we now support interface block arrays.
For example, cases like this:

out block_name {
float f;
} block_instance[2];

This allows Mesa to pass the piglit glsl-1.50 test:
* execution/interface-blocks-complex-vs-fs.shader_test

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/lower_named_interface_blocks.cpp |   53 -
 1 file changed, 44 insertions(+), 9 deletions(-)

diff --git a/src/glsl/lower_named_interface_blocks.cpp 
b/src/glsl/lower_named_interface_blocks.cpp
index 2e0c322..405e7a9 100644
--- a/src/glsl/lower_named_interface_blocks.cpp
+++ b/src/glsl/lower_named_interface_blocks.cpp
@@ -107,22 +107,47 @@ 
flatten_named_interface_blocks_declarations::run(exec_list *instructions)
  if (var-mode == ir_var_uniform)
 continue;
 
- const glsl_type *const t = var-type;
+ const glsl_type * iface_t = var-type;
+ const glsl_type * array_t = NULL;
  exec_node *insert_pos = var;
- char *iface_field_name;
- for (unsigned i = 0; i  t-length; i++) {
-iface_field_name = ralloc_asprintf(mem_ctx, %s.%s, t-name,
-   t-fields.structure[i].name);
+
+ if (iface_t-is_array()) {
+array_t = iface_t;
+iface_t = array_t-fields.array;
+ }
+
+ assert (iface_t-is_interface());
+
+ for (unsigned i = 0; i  iface_t-length; i++) {
+const char * field_name = iface_t-fields.structure[i].name;
+char *iface_field_name =
+   ralloc_asprintf(mem_ctx, %s.%s,
+   iface_t-name, field_name);
 
 ir_variable *found_var =
(ir_variable *) hash_table_find(interface_namespace,
iface_field_name);
 if (!found_var) {
ir_variable *new_var =
-  new(mem_ctx) ir_variable(t-fields.structure[i].type,
-   ralloc_strdup(mem_ctx, 
t-fields.structure[i].name),
+  new(mem_ctx) ir_variable(iface_t-fields.structure[i].type,
+   ralloc_strdup(mem_ctx, 
iface_t-fields.structure[i].name),
(ir_variable_mode) var-mode);
-   new_var-interface_type = t;
+   if (array_t != NULL) {
+  const glsl_type *new_array_type =
+ glsl_type::get_array_instance(
+iface_t-fields.structure[i].type,
+array_t-length);
+  char *array_var_name =
+ ralloc_asprintf(mem_ctx, %s[%d],
+ new_var-name, array_t-length);
+  ir_variable *new_array_var =
+ new(mem_ctx) ir_variable(new_array_type,
+  array_var_name,
+  (ir_variable_mode) var-mode);
+  new_var = new_array_var;
+   }
+
+   new_var-interface_type = iface_t;
hash_table_insert(interface_namespace, new_var,
  iface_field_name);
insert_pos-insert_after(new_var);
@@ -187,9 +212,19 @@ 
flatten_named_interface_blocks_declarations::handle_rvalue(ir_rvalue **rvalue)
  (ir_variable *) hash_table_find(interface_namespace,
  iface_field_name);
   assert(found_var);
+
   ir_dereference_variable *deref_var =
  new(mem_ctx) ir_dereference_variable(found_var);
-  *rvalue = deref_var;
+
+  ir_dereference_array *deref_array =
+ ir-record-as_dereference_array();
+  if (deref_array != NULL) {
+ *rvalue =
+new(mem_ctx) ir_dereference_array(deref_var,
+  deref_array-array_index);
+  } else {
+ *rvalue = deref_var;
+  }
}
 }
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 14/15] glsl linker: compare interface blocks during intrastage linking

2013-03-18 Thread Jordan Justen
Verify that interface blocks match when combining compilation
units at the same stage. (For example, when merging all vertex
shaders.)

Fixes piglit glsl-1.50 test:
* linker/interface-blocks-multiple-vs-member-count-mismatch.shader_test

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/Makefile.sources |1 +
 src/glsl/interface_blocks.cpp |   90 +
 src/glsl/interface_blocks.h   |   32 +++
 src/glsl/linker.cpp   |6 +++
 4 files changed, 129 insertions(+)
 create mode 100644 src/glsl/interface_blocks.cpp
 create mode 100644 src/glsl/interface_blocks.h

diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index 86ae43e..ba37ad2 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -25,6 +25,7 @@ LIBGLSL_FILES = \
$(GLSL_SRCDIR)/glsl_types.cpp \
$(GLSL_SRCDIR)/glsl_symbol_table.cpp \
$(GLSL_SRCDIR)/hir_field_selection.cpp \
+   $(GLSL_SRCDIR)/interface_blocks.cpp \
$(GLSL_SRCDIR)/ir_basic_block.cpp \
$(GLSL_SRCDIR)/ir_builder.cpp \
$(GLSL_SRCDIR)/ir_clone.cpp \
diff --git a/src/glsl/interface_blocks.cpp b/src/glsl/interface_blocks.cpp
new file mode 100644
index 000..f3daccf
--- /dev/null
+++ b/src/glsl/interface_blocks.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file interface_blocks.cpp
+ * GLSL interface blocks support
+ */
+
+#include ir.h
+#include program/hash_table.h
+
+bool
+cross_validate_interface_blocks(struct gl_shader **shader_list,
+unsigned num_shaders)
+{
+   bool ok = true;
+
+   assert(num_shaders = 1);
+
+   hash_table *ifaces
+  = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
+   const char *iface_name = NULL;
+
+   for (unsigned int i = 0; ok  i  num_shaders; i++) {
+  if (shader_list[i] == NULL)
+ continue;
+
+  foreach_list(node, shader_list[i]-ir) {
+ ir_variable *var = ((ir_instruction *) node)-as_variable();
+ if (!var)
+continue;
+
+ const glsl_type *iface_type = var-interface_type;
+
+ if (iface_type == NULL)
+continue;
+
+ /* We've already looked at this interface within this shader
+  * compilation unit, so there is no need to check it again.
+  */
+ if (iface_name != NULL 
+ strcmp(iface_name, iface_type-name) == 0)
+continue;
+
+ iface_name = iface_type-name;
+
+ const glsl_type *old_iface_type =
+(glsl_type *) hash_table_find(ifaces, iface_name);
+
+ /* This is the first time we've seen the interface, so save
+  * it into our hash table.
+  */
+ if (old_iface_type == NULL) {
+hash_table_insert(ifaces, (void*) iface_type, iface_name);
+continue;
+ }
+
+ ok = old_iface_type == iface_type;
+ if (!ok)
+break;
+  }
+
+  iface_name = NULL;
+   }
+
+   hash_table_dtor(ifaces);
+
+   return ok;
+}
+
diff --git a/src/glsl/interface_blocks.h b/src/glsl/interface_blocks.h
new file mode 100644
index 000..76ab725
--- /dev/null
+++ b/src/glsl/interface_blocks.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * 

[Mesa-dev] [PATCH v2 15/15] glsl linker: compare interface blocks during interstage linking

2013-03-18 Thread Jordan Justen
Verify that interface blocks match when linking separate shader
stages into a program.

Fixes piglit glsl-1.50 tests:
* linker/interface-blocks-vs-fs-member-count-mismatch.shader_test
* linker/interface-blocks-vs-fs-member-order-mismatch.shader_test

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/glsl/interface_blocks.cpp |   14 ++
 src/glsl/interface_blocks.h   |3 +++
 src/glsl/linker.cpp   |3 +++
 3 files changed, 20 insertions(+)

diff --git a/src/glsl/interface_blocks.cpp b/src/glsl/interface_blocks.cpp
index f3daccf..4da40b0 100644
--- a/src/glsl/interface_blocks.cpp
+++ b/src/glsl/interface_blocks.cpp
@@ -88,3 +88,17 @@ cross_validate_interface_blocks(struct gl_shader 
**shader_list,
return ok;
 }
 
+bool
+validate_program_interface_blocks(const struct gl_shader_program *prog)
+{
+   bool ok = true;
+   struct gl_shader *shader_list[2];
+
+   shader_list[0] = prog-_LinkedShaders[MESA_SHADER_VERTEX];
+   shader_list[1] = prog-_LinkedShaders[MESA_SHADER_FRAGMENT];
+
+   ok = cross_validate_interface_blocks((struct gl_shader **) shader_list, 2);
+
+   return ok;
+}
+
diff --git a/src/glsl/interface_blocks.h b/src/glsl/interface_blocks.h
index 76ab725..fa4f873 100644
--- a/src/glsl/interface_blocks.h
+++ b/src/glsl/interface_blocks.h
@@ -29,4 +29,7 @@ bool
 cross_validate_interface_blocks(struct gl_shader **shader_list,
 unsigned num_shaders);
 
+bool
+validate_program_interface_blocks(const struct gl_shader_program *prog);
+
 #endif /* GLSL_INTERFACE_BLOCKS_H */
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 5bc5132..45c60f6 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1724,6 +1724,9 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
 sh);
}
 
+   if (!validate_program_interface_blocks(prog))
+  goto done;
+
/* Here begins the inter-stage linking phase.  Some initial validation is
 * performed, then locations are assigned for uniforms, attributes, and
 * varyings.
-- 
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] i965: Align all depth miplevels to 8 in the X direction.

2013-03-18 Thread Kenneth Graunke

On 03/18/2013 03:56 PM, Eric Anholt wrote:

On an INTEL_DEBUG=perf piglit run on IVB, reduces the instances of HW
workaround: blit (the printouts from the misaligned-depth workaround
blits) from 725 to 684

It doesn't totally eliminate the workaround blit, because we still have
problems with Y offsets that we can't fix (since texturing can only align
miplevels up to 2 or 4, not 8).

No regressions on piglit/es3conform on IVB.
---
  src/mesa/drivers/dri/intel/intel_tex_layout.c |   10 +-
  1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c 
b/src/mesa/drivers/dri/intel/intel_tex_layout.c
index 35030df..95242f8 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_layout.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c
@@ -77,7 +77,15 @@ intel_horizontal_texture_alignment_unit(struct intel_context 
*intel,
 if (format == MESA_FORMAT_S8)
return 8;

-   if (intel-gen = 7  format == MESA_FORMAT_Z16)
+   /* The depth alignment requirements in the table above are for rendering to
+* depth miplevels using the LOD control fields.  We don't use LOD control
+* fields, and instead use page offsets plus intra-tile x/y offsets, which
+* require that the low 3 bits are zero.  To reduce the number of x/y
+* offset workaround blits we do, align the X to 8, which depth texturing
+* can handle (sadly, it can't handle 8 in the Y direction).
+*/
+   if (intel-gen = 4 
+   _mesa_get_format_base_format(format) == GL_DEPTH_COMPONENT)
return 8;

 return 4;


I'm really excited to see this happen on Ivybridge.

However, the HALIGN_8 surface state bit doesn't exist on Gen4-6, so this 
will break there.


This patch but with intel-gen = 7 instead of 4 would get a R-b.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] Add dri image entry point for creating image from fd

2013-03-18 Thread Kristian Høgsberg
On Fri, Mar 01, 2013 at 02:03:20PM +0200, Ander Conselvan de Oliveira wrote:
 On 02/28/2013 03:52 AM, Kristian Høgsberg wrote:
 ---
   include/GL/internal/dri_interface.h| 14 +++-
   src/mesa/drivers/dri/intel/intel_regions.c | 33 +++
   src/mesa/drivers/dri/intel/intel_regions.h |  6 
   src/mesa/drivers/dri/intel/intel_screen.c  | 53 
  --
   4 files changed, 102 insertions(+), 4 deletions(-)
 
 
 [...]
 
 diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
 b/src/mesa/drivers/dri/intel/intel_screen.c
 index 277b133..3ee0d69 100644
 --- a/src/mesa/drivers/dri/intel/intel_screen.c
 +++ b/src/mesa/drivers/dri/intel/intel_screen.c
 @@ -546,6 +546,9 @@ intel_query_image(__DRIimage *image, int attrib, int 
 *value)
return false;
 *value = image-planar_format-components;
 return true;
 +   case __DRI_IMAGE_ATTRIB_FD:
 +  drm_intel_bo_gem_export_to_prime(image-region-bo, value);
 +  return true;
 
 Need to check the return value of drm_intel_bo_gem_export_to_prime().

Right, thanks.

 [...]
 
   .createImageFromRenderbuffer= 
  intel_create_image_from_renderbuffer,
 @@ -705,6 +751,7 @@ static struct __DRIimageExtensionRec intelImageExtension 
 = {
   .createImageFromNames   = intel_create_image_from_names,
   .fromPlanar = intel_from_planar,
   .createImageFromTexture = intel_create_image_from_texture
 +.createImageFromFd  = intel_create_image_from_fd
 
 There's missing comma above, as you pointed out in IRC.

Yeah, that was a little odd, I think I had the compile fix in an uncommitted
patch.
 
 Other than this, the patch seems fine to me.

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


Re: [Mesa-dev] [PATCH 3/3] wayland: Add prime fd passing as a buffer sharing mechanism

2013-03-18 Thread Kristian Høgsberg
On Fri, Mar 01, 2013 at 02:06:03PM +0200, Ander Conselvan de Oliveira wrote:
 On 02/28/2013 03:52 AM, Kristian Høgsberg wrote:
 diff --git a/src/egl/drivers/dri2/platform_wayland.c 
 b/src/egl/drivers/dri2/platform_wayland.c
 index b5cd04a..1b42a98 100644
 --- a/src/egl/drivers/dri2/platform_wayland.c
 +++ b/src/egl/drivers/dri2/platform_wayland.c
 @@ -451,6 +451,46 @@ static const struct wl_callback_listener frame_listener 
 = {
  wayland_frame_callback
   };
 
 +static void
 +create_wl_buffer(struct dri2_egl_surface *dri2_surf)
 +{
 +   struct dri2_egl_display *dri2_dpy =
 +  dri2_egl_display(dri2_surf-base.Resource.Display);
 +   int fd;
 +
 +   if (dri2_surf-current-wl_buffer != NULL)
 +  return;
 +
 +   if (dri2_dpy-capabilities  WL_DRM_CAPABILITY_PRIME) {
 [...]
 +  } else {
 
 There's an indentation error here.
 
 There's also lines replacing tabs with spaces, but I don't know what
 is supposed to be the coding style of those files. Indent is done
 both ways in them.

Uhm, yeah... fixed.  The mesa policy is to use spaces, but it's not
strictly enforced, but moving towards spaces can't be bad.  It comes from
the .dir-locals.el in the mesa top-level directory which makes my emacs
do it.

 Anyway, the series looks good to me, feel free to add my R-b,
 although you might want someone else to review the intel_screen.c
 changes too. I'm not that familiar with that code.

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


[Mesa-dev] Basic GLSL 1.50 support: new types built-in functions

2013-03-18 Thread Kenneth Graunke
This series improves our basic GLSL 1.50 support.  First, it makes 1.50
shaders using built-in functions work.  Secondly, it adds the new types
and built-ins from the ARB_texture_multisample extension (which are now
part of core).

It also makes it possible to run Unigine Valley and Heaven 4.0 with
MESA_GL_VERSION_OVERRIDE=3.2 and MESA_GLSL_VERSION_OVERRIDE=150; i965
also needs shader_precompile=false to avoid an assertion failure which
I haven't tracked down yet.

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


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

2013-03-18 Thread Kenneth Graunke
The version bumps are necessary in order to compile built-ins for 1.50.

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

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

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


[Mesa-dev] [PATCH 2/3] glsl: Add sampler2DMS/sampler2DMSArray types to GLSL 1.50.

2013-03-18 Thread Kenneth Graunke
GLSL 1.50 includes support for the new sampler types introduced by
the ARB_texture_multisample extension.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/glsl/glsl_types.cpp | 12 +++-
 src/glsl/glsl_types.h   |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index a783dcc..8b0a248 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -292,6 +292,14 @@ glsl_type::generate_140_types(glsl_symbol_table *symtab)
 
 
 void
+glsl_type::generate_150_types(glsl_symbol_table *symtab)
+{
+   generate_140_types(symtab);
+   generate_ARB_texture_multisample_types(symtab, false);
+}
+
+
+void
 glsl_type::generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab,
bool warn)
 {
@@ -385,9 +393,11 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state 
*state)
  glsl_type::generate_130_types(state-symbols, true, skip_1d);
  break;
   case 140:
-  case 150:
  glsl_type::generate_140_types(state-symbols);
  break;
+  case 150:
+ glsl_type::generate_150_types(state-symbols);
+ break;
   default:
  assert(!Unexpected language version);
  break;
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 7930426..2f3b19f 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -583,6 +583,7 @@ private:
static void generate_130_types(glsl_symbol_table *, bool add_deprecated,
   bool skip_1d);
static void generate_140_types(glsl_symbol_table *);
+   static void generate_150_types(glsl_symbol_table *);
static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool);
static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
static void generate_OES_texture_3D_types(glsl_symbol_table *, bool);
-- 
1.8.2

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


[Mesa-dev] [PATCH 3/3] glsl: Add built-in functions for GLSL 1.50.

2013-03-18 Thread Kenneth Graunke
This makes basic built-in functions work in GLSL 1.50.  It supports
everything except the new Geometry Shader functions.

The new 150.glsl file is 140.glsl plus ARB_texture_multisample.glsl;
150.frag is identical to 140.frag except for the #version bump.

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

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