Re: [Mesa-dev] [PATCH 04/12] r600g: fix texture offset computation for mapped MSAA depth buffers

2013-07-01 Thread Christian König

Am 01.07.2013 03:53, schrieb Marek Olšák:

It was wrong, because the offset shouldn't be applied to MSAA depth buffers.
This small cleanup should prevent such issues in the future.

This fixes a lockup in "piglit/fbo-depthstencil default_fb -samples=n".

The lockup was special, because it was triggered by the CPU writing to memory
outside of the buffer range. I didn't know it was possible to hang a machine
with the CPU. This is nuts.


WTF? Well if my understanding of our memory controller is correct it is 
possible to hang it when the CPU tries to access some non existing 
memory, but to make this happen the kernel driver must program the PCI 
BAR somehow incorrectly.


Anyway it's good that this is fixed, but I'm pretty sure we should take 
a closer ĺook what's happening here.


Christian.


---
  src/gallium/drivers/r600/r600_pipe.h|  2 --
  src/gallium/drivers/r600/r600_texture.c | 28 ++--
  2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe.h 
b/src/gallium/drivers/r600/r600_pipe.h
index 8485cce..64a90c3 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -787,8 +787,6 @@ void r600_init_surface_functions(struct r600_context *r600);
  uint32_t r600_translate_texformat(struct pipe_screen *screen, enum 
pipe_format format,
  const unsigned char *swizzle_view,
  uint32_t *word4_p, uint32_t *yuv_format_p);
-unsigned r600_texture_get_offset(struct r600_texture *rtex,
-   unsigned level, unsigned layer);
  struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe,
struct pipe_resource *texture,
const struct pipe_surface 
*templ,
diff --git a/src/gallium/drivers/r600/r600_texture.c 
b/src/gallium/drivers/r600/r600_texture.c
index 60d8c36..c2feb52 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -116,11 +116,15 @@ static void r600_copy_from_staging_texture(struct 
pipe_context *ctx, struct r600
}
  }
  
-unsigned r600_texture_get_offset(struct r600_texture *rtex,

-   unsigned level, unsigned layer)
+static unsigned r600_texture_get_offset(struct r600_texture *rtex, unsigned 
level,
+   const struct pipe_box *box)
  {
+   enum pipe_format format = rtex->resource.b.b.format;
+
return rtex->surface.level[level].offset +
-  layer * rtex->surface.level[level].slice_size;
+  box->z * rtex->surface.level[level].slice_size +
+  box->y / util_format_get_blockheight(format) * 
rtex->surface.level[level].pitch_bytes +
+  box->x / util_format_get_blockwidth(format) * 
util_format_get_blocksize(format);
  }
  
  static int r600_init_surface(struct r600_screen *rscreen,

@@ -805,7 +809,6 @@ static void *r600_texture_transfer_map(struct pipe_context 
*ctx,
struct r600_texture *rtex = (struct r600_texture*)texture;
struct r600_transfer *trans;
boolean use_staging_texture = FALSE;
-   enum pipe_format format = texture->format;
struct r600_resource *buf;
unsigned offset = 0;
char *map;
@@ -849,8 +852,6 @@ static void *r600_texture_transfer_map(struct pipe_context 
*ctx,
trans->transfer.box = *box;
  
  	if (rtex->is_depth) {

-   /* XXX: only readback the rectangle which is being mapped? */
-   /* XXX: when discard is true, no need to read back from depth 
texture */
struct r600_texture *staging_depth;
  
  		if (rtex->resource.b.b.nr_samples > 1) {

@@ -861,6 +862,8 @@ static void *r600_texture_transfer_map(struct pipe_context 
*ctx,
 *
 * First downsample the depth buffer to a temporary 
texture,
 * then decompress the temporary one to staging.
+*
+* Only the region being mapped is transfered.
 */
struct pipe_resource *temp;
struct pipe_resource resource;
@@ -880,9 +883,10 @@ static void *r600_texture_transfer_map(struct pipe_context 
*ctx,
   0, 0, 0, box->depth, 0, 0);
  
  	pipe_resource_reference((struct pipe_resource**)&temp, NULL);

-   trans->offset = 0;
}
else {
+   /* XXX: only readback the rectangle which is being 
mapped? */
+   /* XXX: when discard is true, no need to read back from 
depth texture */
if (!r600_init_flushed_depth_texture(ctx, texture, 
&staging_depth)) {
R600_ERR("failed to create tempo

[Mesa-dev] [Bug 63404] [wayland egl] intel_do_flush_locked failed: invalid argument, crash

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

Ander Conselvan de Oliveira  changed:

   What|Removed |Added

 CC||m...@mail.mailinator.com

--- Comment #10 from Ander Conselvan de Oliveira  ---
*** Bug 66415 has been marked as a duplicate of this bug. ***

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


Re: [Mesa-dev] [PATCH] mesa: renumber shader indices according to their placement in pipeline

2013-07-01 Thread Jose Fonseca

- Original Message -
> See my explanation in mtypes.h.
> 
> v2: don't do this in gallium

Thanks for the update, Marek.

I think that the "These MUST have the same values as gallium's PIPE_SHADER_*" 
comment in gl_shader_type enum can be removed now.

Otherwise looks good AFAICT (but note I'm not very familiar with several of the 
components touched here.)

Jose


> ---
>  src/glsl/linker.cpp| 16 
>  src/mesa/drivers/dri/i965/brw_shader.cpp   |  8 ++--
>  src/mesa/main/mtypes.h |  8 ++--
>  src/mesa/main/shaderobj.h  |  4 ++--
>  src/mesa/program/ir_to_mesa.cpp| 10 +++---
>  src/mesa/program/program.h |  2 +-
>  src/mesa/state_tracker/st_context.c|  5 -
>  src/mesa/state_tracker/st_extensions.c | 12 +++-
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 10 +++---
>  9 files changed, 32 insertions(+), 43 deletions(-)
> 
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index c168e47..61405ea 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -1514,31 +1514,31 @@ static bool
>  check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
>  {
> static const char *const shader_names[MESA_SHADER_TYPES] = {
> -  "vertex", "fragment", "geometry"
> +  "vertex", "geometry", "fragment"
> };
>  
> const unsigned max_samplers[MESA_SHADER_TYPES] = {
>ctx->Const.VertexProgram.MaxTextureImageUnits,
> -  ctx->Const.FragmentProgram.MaxTextureImageUnits,
> -  ctx->Const.GeometryProgram.MaxTextureImageUnits
> +  ctx->Const.GeometryProgram.MaxTextureImageUnits,
> +  ctx->Const.FragmentProgram.MaxTextureImageUnits
> };
>  
> const unsigned max_default_uniform_components[MESA_SHADER_TYPES] = {
>ctx->Const.VertexProgram.MaxUniformComponents,
> -  ctx->Const.FragmentProgram.MaxUniformComponents,
> -  ctx->Const.GeometryProgram.MaxUniformComponents
> +  ctx->Const.GeometryProgram.MaxUniformComponents,
> +  ctx->Const.FragmentProgram.MaxUniformComponents
> };
>  
> const unsigned max_combined_uniform_components[MESA_SHADER_TYPES] = {
>ctx->Const.VertexProgram.MaxCombinedUniformComponents,
> -  ctx->Const.FragmentProgram.MaxCombinedUniformComponents,
> -  ctx->Const.GeometryProgram.MaxCombinedUniformComponents
> +  ctx->Const.GeometryProgram.MaxCombinedUniformComponents,
> +  ctx->Const.FragmentProgram.MaxCombinedUniformComponents
> };
>  
> const unsigned max_uniform_blocks[MESA_SHADER_TYPES] = {
>ctx->Const.VertexProgram.MaxUniformBlocks,
> -  ctx->Const.FragmentProgram.MaxUniformBlocks,
>ctx->Const.GeometryProgram.MaxUniformBlocks,
> +  ctx->Const.FragmentProgram.MaxUniformBlocks
> };
>  
> for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp
> b/src/mesa/drivers/dri/i965/brw_shader.cpp
> index 12986cc..584b4c2 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
> @@ -117,17 +117,13 @@ brw_link_shader(struct gl_context *ctx, struct
> gl_shader_program *shProg)
> for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
>struct brw_shader *shader =
>(struct brw_shader *)shProg->_LinkedShaders[stage];
> -  static const GLenum targets[] = {
> -  GL_VERTEX_PROGRAM_ARB,
> -  GL_FRAGMENT_PROGRAM_ARB,
> -  GL_GEOMETRY_PROGRAM_NV
> -  };
>  
>if (!shader)
>continue;
>  
>struct gl_program *prog =
> -  ctx->Driver.NewProgram(ctx, targets[stage], shader->base.Name);
> +  ctx->Driver.NewProgram(ctx, _mesa_program_index_to_target(stage),
> +shader->base.Name);
>if (!prog)
>   return false;
>prog->Parameters = _mesa_new_parameter_list();
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 1f62e2c..cab619b 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -2174,12 +2174,16 @@ struct gl_shader
>  /**
>   * Shader stages. Note that these will become 5 with tessellation.
>   * These MUST have the same values as gallium's PIPE_SHADER_*
> + *
> + * The order must match how shaders are ordered in the pipeline.
> + * The GLSL linker assumes that if i + * executed later than the i-th shader.
>   */
>  typedef enum
>  {
> MESA_SHADER_VERTEX = 0,
> -   MESA_SHADER_FRAGMENT = 1,
> -   MESA_SHADER_GEOMETRY = 2,
> +   MESA_SHADER_GEOMETRY = 1,
> +   MESA_SHADER_FRAGMENT = 2,
> MESA_SHADER_TYPES = 3
>  } gl_shader_type;
>  
> diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h
> index 5ce85cf..de1c9fc 100644
> --- a/src/mesa/main/shaderobj.h
> +++ b/src/mesa/main/shaderobj.h
> @@ -123,8 +123,8 @@ _mesa_shader_index_to_type(GLuint i)
>  {
> static const GLenum enums[MESA_SHADER_TYPES] = {
>GL_VERTEX_SHADER,
> - 

Re: [Mesa-dev] [PATCH 04/12] r600g: fix texture offset computation for mapped MSAA depth buffers

2013-07-01 Thread Marek Olšák
I only know that the offset was wrong and the state tracker was
writing outside of a mapped resource. The lockup disappeared by
commenting out the call to _mesa_pack_ubyte_stencil_row, which was
reading from and writing to the mapped resource.

Two possible explanations are:
- the memory controller hangs
- some other resource which happens to be mapped next to the
depth-stencil buffer is corrupted by the writes (e.g. shaders)

Marek

On Mon, Jul 1, 2013 at 9:47 AM, Christian König  wrote:
> Am 01.07.2013 03:53, schrieb Marek Olšák:
>
>> It was wrong, because the offset shouldn't be applied to MSAA depth
>> buffers.
>> This small cleanup should prevent such issues in the future.
>>
>> This fixes a lockup in "piglit/fbo-depthstencil default_fb -samples=n".
>>
>> The lockup was special, because it was triggered by the CPU writing to
>> memory
>> outside of the buffer range. I didn't know it was possible to hang a
>> machine
>> with the CPU. This is nuts.
>
>
> WTF? Well if my understanding of our memory controller is correct it is
> possible to hang it when the CPU tries to access some non existing memory,
> but to make this happen the kernel driver must program the PCI BAR somehow
> incorrectly.
>
> Anyway it's good that this is fixed, but I'm pretty sure we should take a
> closer ĺook what's happening here.
>
> Christian.
>
>
>> ---
>>   src/gallium/drivers/r600/r600_pipe.h|  2 --
>>   src/gallium/drivers/r600/r600_texture.c | 28
>> ++--
>>   2 files changed, 14 insertions(+), 16 deletions(-)
>>
>> diff --git a/src/gallium/drivers/r600/r600_pipe.h
>> b/src/gallium/drivers/r600/r600_pipe.h
>> index 8485cce..64a90c3 100644
>> --- a/src/gallium/drivers/r600/r600_pipe.h
>> +++ b/src/gallium/drivers/r600/r600_pipe.h
>> @@ -787,8 +787,6 @@ void r600_init_surface_functions(struct r600_context
>> *r600);
>>   uint32_t r600_translate_texformat(struct pipe_screen *screen, enum
>> pipe_format format,
>>   const unsigned char *swizzle_view,
>>   uint32_t *word4_p, uint32_t
>> *yuv_format_p);
>> -unsigned r600_texture_get_offset(struct r600_texture *rtex,
>> -   unsigned level, unsigned layer);
>>   struct pipe_surface *r600_create_surface_custom(struct pipe_context
>> *pipe,
>> struct pipe_resource
>> *texture,
>> const struct pipe_surface
>> *templ,
>> diff --git a/src/gallium/drivers/r600/r600_texture.c
>> b/src/gallium/drivers/r600/r600_texture.c
>> index 60d8c36..c2feb52 100644
>> --- a/src/gallium/drivers/r600/r600_texture.c
>> +++ b/src/gallium/drivers/r600/r600_texture.c
>> @@ -116,11 +116,15 @@ static void r600_copy_from_staging_texture(struct
>> pipe_context *ctx, struct r600
>> }
>>   }
>>   -unsigned r600_texture_get_offset(struct r600_texture *rtex,
>> -   unsigned level, unsigned layer)
>> +static unsigned r600_texture_get_offset(struct r600_texture *rtex,
>> unsigned level,
>> +   const struct pipe_box *box)
>>   {
>> +   enum pipe_format format = rtex->resource.b.b.format;
>> +
>> return rtex->surface.level[level].offset +
>> -  layer * rtex->surface.level[level].slice_size;
>> +  box->z * rtex->surface.level[level].slice_size +
>> +  box->y / util_format_get_blockheight(format) *
>> rtex->surface.level[level].pitch_bytes +
>> +  box->x / util_format_get_blockwidth(format) *
>> util_format_get_blocksize(format);
>>   }
>> static int r600_init_surface(struct r600_screen *rscreen,
>> @@ -805,7 +809,6 @@ static void *r600_texture_transfer_map(struct
>> pipe_context *ctx,
>> struct r600_texture *rtex = (struct r600_texture*)texture;
>> struct r600_transfer *trans;
>> boolean use_staging_texture = FALSE;
>> -   enum pipe_format format = texture->format;
>> struct r600_resource *buf;
>> unsigned offset = 0;
>> char *map;
>> @@ -849,8 +852,6 @@ static void *r600_texture_transfer_map(struct
>> pipe_context *ctx,
>> trans->transfer.box = *box;
>> if (rtex->is_depth) {
>> -   /* XXX: only readback the rectangle which is being mapped?
>> */
>> -   /* XXX: when discard is true, no need to read back from
>> depth texture */
>> struct r600_texture *staging_depth;
>> if (rtex->resource.b.b.nr_samples > 1) {
>> @@ -861,6 +862,8 @@ static void *r600_texture_transfer_map(struct
>> pipe_context *ctx,
>>  *
>>  * First downsample the depth buffer to a
>> temporary texture,
>>  * then decompress the temporary one to staging.
>> +*
>> +* Only the region being mapped is transfered.
>>  */
>>

[Mesa-dev] [PATCH] i965: fix alpha test for MRT

2013-07-01 Thread Chris Forbes
Include src0 alpha in the RT write message when using MRT, so it is used
for the alpha test instead of the normal per-RT alpha value.

Fixes broken rendering in Dota2 under Wine [FDO #62647] -- but not
tested against much else.

Signed-off-by: Chris Forbes 
---
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp| 2 +-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 2 +-
 src/mesa/drivers/dri/i965/brw_wm.c   | 4 
 src/mesa/drivers/dri/i965/brw_wm.h   | 1 +
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
index f390989..10f4c99 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
@@ -129,7 +129,7 @@ fs_generator::generate_fb_write(fs_inst *inst)
 
  if (inst->target > 0 &&
 c->key.nr_color_regions > 1 &&
-c->key.sample_alpha_to_coverage) {
+(c->key.sample_alpha_to_coverage || c->key.alpha_test)) {
 /* Set "Source0 Alpha Present to RenderTarget" bit in message
  * header.
  */
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index a67b6ed..0c8dc1b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2255,7 +2255,7 @@ fs_visitor::emit_fb_writes()
   src0_alpha_to_render_target = intel->gen >= 6 &&
!do_dual_src &&
c->key.nr_color_regions > 1 &&
-   c->key.sample_alpha_to_coverage;
+   (c->key.sample_alpha_to_coverage || 
c->key.alpha_test);
   /* m2, m3 header */
   nr += 2;
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c 
b/src/mesa/drivers/dri/i965/brw_wm.c
index 6eb4a1d..3265596 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -279,6 +279,8 @@ brw_wm_debug_recompile(struct brw_context *brw,
   old_key->nr_color_regions, key->nr_color_regions);
found |= key_debug(intel, "sample alpha to coverage",
   old_key->sample_alpha_to_coverage, 
key->sample_alpha_to_coverage);
+   found |= key_debug(intel, "MRT alpha test w/a",
+  old_key->alpha_test, key->alpha_test);
found |= key_debug(intel, "rendering to FBO",
   old_key->render_to_fbo, key->render_to_fbo);
found |= key_debug(intel, "fragment color clamping",
@@ -463,6 +465,8 @@ static void brw_wm_populate_key( struct brw_context *brw,
key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers;
   /* _NEW_MULTISAMPLE */
key->sample_alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage;
+   /* _NEW_COLOR */
+   key->alpha_test = ctx->Color.AlphaEnabled;
 
/* BRW_NEW_VUE_MAP_GEOM_OUT */
if (intel->gen < 6)
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h 
b/src/mesa/drivers/dri/i965/brw_wm.h
index 28e8734..13b17d0 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -63,6 +63,7 @@ struct brw_wm_prog_key {
GLuint flat_shade:1;
GLuint nr_color_regions:5;
GLuint sample_alpha_to_coverage:1;
+   GLuint alpha_test:1;
GLuint render_to_fbo:1;
GLuint clamp_fragment_color:1;
GLuint line_aa:2;
-- 
1.8.3.2

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


[Mesa-dev] [Bug 62647] Wrong rendering of Dota 2 on Wine (apitrace attached) - Intel IVB HD4000

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

--- Comment #24 from Chris Forbes  ---
I've just sent a (fairly dodgy) patch to the mesa list which fixes this.

-- 
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] [PATCH 04/12] r600g: fix texture offset computation for mapped MSAA depth buffers

2013-07-01 Thread Christian König
Ok, then I guess it is explanation number two. Your bug description just 
sounded like you steeped to that specific memory write with a debugger 
and executing this specific write was causing a lockup...


Then sorry for the noise,
Christian.

Am 01.07.2013 13:25, schrieb Marek Olšák:

I only know that the offset was wrong and the state tracker was
writing outside of a mapped resource. The lockup disappeared by
commenting out the call to _mesa_pack_ubyte_stencil_row, which was
reading from and writing to the mapped resource.

Two possible explanations are:
- the memory controller hangs
- some other resource which happens to be mapped next to the
depth-stencil buffer is corrupted by the writes (e.g. shaders)

Marek

On Mon, Jul 1, 2013 at 9:47 AM, Christian König  wrote:

Am 01.07.2013 03:53, schrieb Marek Olšák:


It was wrong, because the offset shouldn't be applied to MSAA depth
buffers.
This small cleanup should prevent such issues in the future.

This fixes a lockup in "piglit/fbo-depthstencil default_fb -samples=n".

The lockup was special, because it was triggered by the CPU writing to
memory
outside of the buffer range. I didn't know it was possible to hang a
machine
with the CPU. This is nuts.


WTF? Well if my understanding of our memory controller is correct it is
possible to hang it when the CPU tries to access some non existing memory,
but to make this happen the kernel driver must program the PCI BAR somehow
incorrectly.

Anyway it's good that this is fixed, but I'm pretty sure we should take a
closer ĺook what's happening here.

Christian.



---
   src/gallium/drivers/r600/r600_pipe.h|  2 --
   src/gallium/drivers/r600/r600_texture.c | 28
++--
   2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe.h
b/src/gallium/drivers/r600/r600_pipe.h
index 8485cce..64a90c3 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -787,8 +787,6 @@ void r600_init_surface_functions(struct r600_context
*r600);
   uint32_t r600_translate_texformat(struct pipe_screen *screen, enum
pipe_format format,
   const unsigned char *swizzle_view,
   uint32_t *word4_p, uint32_t
*yuv_format_p);
-unsigned r600_texture_get_offset(struct r600_texture *rtex,
-   unsigned level, unsigned layer);
   struct pipe_surface *r600_create_surface_custom(struct pipe_context
*pipe,
 struct pipe_resource
*texture,
 const struct pipe_surface
*templ,
diff --git a/src/gallium/drivers/r600/r600_texture.c
b/src/gallium/drivers/r600/r600_texture.c
index 60d8c36..c2feb52 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -116,11 +116,15 @@ static void r600_copy_from_staging_texture(struct
pipe_context *ctx, struct r600
 }
   }
   -unsigned r600_texture_get_offset(struct r600_texture *rtex,
-   unsigned level, unsigned layer)
+static unsigned r600_texture_get_offset(struct r600_texture *rtex,
unsigned level,
+   const struct pipe_box *box)
   {
+   enum pipe_format format = rtex->resource.b.b.format;
+
 return rtex->surface.level[level].offset +
-  layer * rtex->surface.level[level].slice_size;
+  box->z * rtex->surface.level[level].slice_size +
+  box->y / util_format_get_blockheight(format) *
rtex->surface.level[level].pitch_bytes +
+  box->x / util_format_get_blockwidth(format) *
util_format_get_blocksize(format);
   }
 static int r600_init_surface(struct r600_screen *rscreen,
@@ -805,7 +809,6 @@ static void *r600_texture_transfer_map(struct
pipe_context *ctx,
 struct r600_texture *rtex = (struct r600_texture*)texture;
 struct r600_transfer *trans;
 boolean use_staging_texture = FALSE;
-   enum pipe_format format = texture->format;
 struct r600_resource *buf;
 unsigned offset = 0;
 char *map;
@@ -849,8 +852,6 @@ static void *r600_texture_transfer_map(struct
pipe_context *ctx,
 trans->transfer.box = *box;
 if (rtex->is_depth) {
-   /* XXX: only readback the rectangle which is being mapped?
*/
-   /* XXX: when discard is true, no need to read back from
depth texture */
 struct r600_texture *staging_depth;
 if (rtex->resource.b.b.nr_samples > 1) {
@@ -861,6 +862,8 @@ static void *r600_texture_transfer_map(struct
pipe_context *ctx,
  *
  * First downsample the depth buffer to a
temporary texture,
  * then decompress the temporary one to staging.
+*
+* Only the region being mapped is transfered.

[Mesa-dev] [Bug 62647] Wrong rendering of Dota 2 on Wine (apitrace attached) - Intel IVB HD4000

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

--- Comment #25 from Vedran Rodic  ---
Confirmed fixed. Thanks Chris!

-- 
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


[Mesa-dev] [Bug 62647] Wrong rendering of Dota 2 on Wine (apitrace attached) - Intel IVB HD4000

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

--- Comment #26 from Alexandre Derumier  ---
Works fine here too ! Thanks Chris ! Thanks Vedran !

-- 
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] [Nouveau] [PATCH] nv50: H.264/MPEG2 decoding support via VP2, available on NV84-NV96, NVA0

2013-07-01 Thread Roland Scheidegger
Am 30.06.2013 03:02, schrieb Ilia Mirkin:
> Well, as luck would have it, I've redone it as SSE2 and it's faster
> (more instructions, but fewer cycles). So I'm just going to replace it
> with SSE2, which is on by default for x86_64. I didn't see any runtime
> feature detection logic in gallium, only compile-time (e.g. in
> pipe/p_config.h and util/u_sse.h) but I'm very new to the mesa
> codebase, so I could have missed it.

u_cpu_detect.c?

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


[Mesa-dev] [Bug 66236] glext.h:4609: error: redefinition of typedef 'GLclampf'

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

Brian Paul  changed:

   What|Removed |Added

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

--- Comment #13 from Brian Paul  ---
Fixed by Tom in commit bee49cb0ecbacb9fbc9dddc5e560874adacc518e

-- 
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 66346] shader_query.cpp:49: error: invalid conversion from 'void*' to 'GLuint'

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

--- Comment #1 from Brian Paul  ---
Created attachment 81814
  --> https://bugs.freedesktop.org/attachment.cgi?id=81814&action=edit
use a function to convert from GLhandleARB to GLuint

Vinson, can you try this patch?  There may be other files to fix similarly...

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


[Mesa-dev] [PATCH] mesa: simplify some _mesa_IsEnabled() queries

2013-07-01 Thread Brian Paul
No need to test array->Enabled != 0 since the Enabled field can
only be 0 or 1.
---
 src/mesa/main/enable.c |   21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 5c72b3c..21e5931 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1395,40 +1395,41 @@ _mesa_IsEnabled( GLenum cap )
   case GL_VERTEX_ARRAY:
  if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
 goto invalid_enum_error;
- return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled != 
0);
+ return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled;
   case GL_NORMAL_ARRAY:
  if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
 goto invalid_enum_error;
- return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled 
!= 0);
+ return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled;
   case GL_COLOR_ARRAY:
  if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
 goto invalid_enum_error;
- return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled 
!= 0);
+ return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled;
   case GL_INDEX_ARRAY:
  if (ctx->API != API_OPENGL_COMPAT)
 goto invalid_enum_error;
- return 
(ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled != 0);
+ return ctx->Array.ArrayObj->
+VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled;
   case GL_TEXTURE_COORD_ARRAY:
  if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
 goto invalid_enum_error;
- return 
(ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]
- .Enabled != 0);
+ return ctx->Array.ArrayObj->
+VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].Enabled;
   case GL_EDGE_FLAG_ARRAY:
  if (ctx->API != API_OPENGL_COMPAT)
 goto invalid_enum_error;
- return 
(ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled != 0);
+ return 
ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled;
   case GL_FOG_COORDINATE_ARRAY_EXT:
  if (ctx->API != API_OPENGL_COMPAT)
 goto invalid_enum_error;
- return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled != 
0);
+ return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled;
   case GL_SECONDARY_COLOR_ARRAY_EXT:
  if (ctx->API != API_OPENGL_COMPAT)
 goto invalid_enum_error;
- return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled 
!= 0);
+ return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled;
   case GL_POINT_SIZE_ARRAY_OES:
  if (ctx->API != API_OPENGLES)
 goto invalid_enum_error;
- return 
(ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled != 0);
+ return 
ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled;
 
   /* GL_ARB_texture_cube_map */
   case GL_TEXTURE_CUBE_MAP_ARB:
-- 
1.7.10.4

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


[Mesa-dev] [Bug 66213] Certain Mesa Demos Rendering Inverted (vertically)

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

Jesus Cortez  changed:

   What|Removed |Added

 Status|NEEDINFO|NEW

-- 
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 66213] Certain Mesa Demos Rendering Inverted (vertically)

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

Jesus Cortez  changed:

   What|Removed |Added

Version|9.0 |9.1

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


Re: [Mesa-dev] [PATCH] mesa: simplify some _mesa_IsEnabled() queries

2013-07-01 Thread Matt Turner
On Mon, Jul 1, 2013 at 7:58 AM, Brian Paul  wrote:
> No need to test array->Enabled != 0 since the Enabled field can
> only be 0 or 1.
> ---
>  src/mesa/main/enable.c |   21 +++--
>  1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
> index 5c72b3c..21e5931 100644
> --- a/src/mesa/main/enable.c
> +++ b/src/mesa/main/enable.c
> @@ -1395,40 +1395,41 @@ _mesa_IsEnabled( GLenum cap )
>case GL_VERTEX_ARRAY:
>   if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
>  goto invalid_enum_error;
> - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled 
> != 0);
> + return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled;
>case GL_NORMAL_ARRAY:
>   if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
>  goto invalid_enum_error;
> - return 
> (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled != 0);
> + return 
> ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled;
>case GL_COLOR_ARRAY:
>   if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
>  goto invalid_enum_error;
> - return 
> (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled != 0);
> + return 
> ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled;
>case GL_INDEX_ARRAY:
>   if (ctx->API != API_OPENGL_COMPAT)
>  goto invalid_enum_error;
> - return 
> (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled != 0);
> + return ctx->Array.ArrayObj->
> +VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled;
>case GL_TEXTURE_COORD_ARRAY:
>   if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
>  goto invalid_enum_error;
> - return 
> (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]
> - .Enabled != 0);
> + return ctx->Array.ArrayObj->
> +VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].Enabled;
>case GL_EDGE_FLAG_ARRAY:
>   if (ctx->API != API_OPENGL_COMPAT)
>  goto invalid_enum_error;
> - return 
> (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled != 0);
> + return 
> ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled;
>case GL_FOG_COORDINATE_ARRAY_EXT:
>   if (ctx->API != API_OPENGL_COMPAT)
>  goto invalid_enum_error;
> - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled 
> != 0);
> + return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled;
>case GL_SECONDARY_COLOR_ARRAY_EXT:
>   if (ctx->API != API_OPENGL_COMPAT)
>  goto invalid_enum_error;
> - return 
> (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled != 0);
> + return 
> ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled;
>case GL_POINT_SIZE_ARRAY_OES:
>   if (ctx->API != API_OPENGLES)
>  goto invalid_enum_error;
> - return 
> (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled != 0);
> + return 
> ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled;
>
>/* GL_ARB_texture_cube_map */
>case GL_TEXTURE_CUBE_MAP_ARB:
> --
> 1.7.10.4

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


Re: [Mesa-dev] [PATCH] i965: Initialize brw_blorp_const_color_program member variables.

2013-07-01 Thread Chad Versace

On 06/27/2013 10:40 PM, Vinson Lee wrote:

Fixes "Uninitialized scalar field" defect reported by Coverity.

Signed-off-by: Vinson Lee 
---
  src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)


Thanks, committed to master.

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


Re: [Mesa-dev] [PATCH 2/2] eglplatform: use unsigned long instead of 32-bit ints in generic platform

2013-07-01 Thread Chad Versace

On 06/27/2013 07:04 AM, Brian Paul wrote:

On 06/27/2013 05:35 AM, Ross Burton wrote:

In the generic Unix case use the "unsigned long" type instead of 32-bit
integers so that the type sizes are consistant on 64-bit machines between X11
and not-X11.

Signed-off-by: Ross Burton 
---
  include/EGL/eglplatform.h |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)



Ross, thanks. Both patches are committed to master. Please close
the bug report if this covers everything.

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


Re: [Mesa-dev] [PATCH] i965: fix alpha test for MRT

2013-07-01 Thread Paul Berry
On 1 July 2013 04:45, Chris Forbes  wrote:

> Include src0 alpha in the RT write message when using MRT, so it is used
> for the alpha test instead of the normal per-RT alpha value.
>
> Fixes broken rendering in Dota2 under Wine [FDO #62647] -- but not
> tested against much else.
>
> Signed-off-by: Chris Forbes 
>


Since there's no other user of key.sample_alpha_to_coverage, I guess I'd
prefer to see it renamed to something like key.replicate_alpha, and then in
brw_wm_populate_key(), set it to "ctx->DrawBuffer->_NumColorDrawBuffers > 1
&& (ctx->Multisample.SampleAlphaToCoverage || ctx->Color.AlphaEnabled)".
That will reduce unnecessary recompiles.

Also it would be nice to have a piglit test for this--it seems like the
sort of thing we could easily regress in the future if we're not careful.


> ---
>  src/mesa/drivers/dri/i965/brw_fs_emit.cpp| 2 +-
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 2 +-
>  src/mesa/drivers/dri/i965/brw_wm.c   | 4 
>  src/mesa/drivers/dri/i965/brw_wm.h   | 1 +
>  4 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
> b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
> index f390989..10f4c99 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
> @@ -129,7 +129,7 @@ fs_generator::generate_fb_write(fs_inst *inst)
>
>   if (inst->target > 0 &&
>  c->key.nr_color_regions > 1 &&
> -c->key.sample_alpha_to_coverage) {
> +(c->key.sample_alpha_to_coverage || c->key.alpha_test)) {
>  /* Set "Source0 Alpha Present to RenderTarget" bit in message
>   * header.
>   */
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index a67b6ed..0c8dc1b 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -2255,7 +2255,7 @@ fs_visitor::emit_fb_writes()
>src0_alpha_to_render_target = intel->gen >= 6 &&
> !do_dual_src &&
> c->key.nr_color_regions > 1 &&
> -   c->key.sample_alpha_to_coverage;
> +   (c->key.sample_alpha_to_coverage ||
> c->key.alpha_test);
>/* m2, m3 header */
>nr += 2;
> }
> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c
> b/src/mesa/drivers/dri/i965/brw_wm.c
> index 6eb4a1d..3265596 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm.c
> @@ -279,6 +279,8 @@ brw_wm_debug_recompile(struct brw_context *brw,
>old_key->nr_color_regions, key->nr_color_regions);
> found |= key_debug(intel, "sample alpha to coverage",
>old_key->sample_alpha_to_coverage,
> key->sample_alpha_to_coverage);
> +   found |= key_debug(intel, "MRT alpha test w/a",
> +  old_key->alpha_test, key->alpha_test);
> found |= key_debug(intel, "rendering to FBO",
>old_key->render_to_fbo, key->render_to_fbo);
> found |= key_debug(intel, "fragment color clamping",
> @@ -463,6 +465,8 @@ static void brw_wm_populate_key( struct brw_context
> *brw,
> key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers;
>/* _NEW_MULTISAMPLE */
> key->sample_alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage;
> +   /* _NEW_COLOR */
> +   key->alpha_test = ctx->Color.AlphaEnabled;
>
> /* BRW_NEW_VUE_MAP_GEOM_OUT */
> if (intel->gen < 6)
> diff --git a/src/mesa/drivers/dri/i965/brw_wm.h
> b/src/mesa/drivers/dri/i965/brw_wm.h
> index 28e8734..13b17d0 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm.h
> +++ b/src/mesa/drivers/dri/i965/brw_wm.h
> @@ -63,6 +63,7 @@ struct brw_wm_prog_key {
> GLuint flat_shade:1;
> GLuint nr_color_regions:5;
> GLuint sample_alpha_to_coverage:1;
> +   GLuint alpha_test:1;
> GLuint render_to_fbo:1;
> GLuint clamp_fragment_color:1;
> GLuint line_aa:2;
> --
> 1.8.3.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: simplify some _mesa_IsEnabled() queries

2013-07-01 Thread Chad Versace

On 07/01/2013 07:58 AM, Brian Paul wrote:

No need to test array->Enabled != 0 since the Enabled field can
only be 0 or 1.
---
  src/mesa/main/enable.c |   21 +++--
  1 file changed, 11 insertions(+), 10 deletions(-)


Reviewed-by: Chad Versace 

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


[Mesa-dev] [PATCH] fixup! glsl: Add support for C-style initializers.

2013-07-01 Thread Matt Turner
---
 src/glsl/glsl_parser_extras.cpp | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index f4b4924..2eb5fb7 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -674,15 +674,12 @@ static const char *
 _mesa_ast_get_matrix_column_type_name(const char *matrix_type_name)
 {
static const char *vec_name[] = { "vec2", "vec3", "vec4" };
-   long rows;
 
-   if (strlen(matrix_type_name) == strlen("mat4")) {
-  rows = strtol(matrix_type_name + 3, NULL, 10);
-   } else {
-  assert(strlen(matrix_type_name) == strlen("mat4x2"));
-
-  rows = strtol(matrix_type_name + 5, NULL, 10);
-   }
+   /* The number of elements in a row of a matrix is specified by the last
+* character of the matrix type name.
+*/
+   long rows = strtol(matrix_type_name + strlen(matrix_type_name) - 1,
+  NULL, 10);
return vec_name[rows - 2];
 }
 
-- 
1.8.1.5

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


Re: [Mesa-dev] [PATCH 03/14] glsl: Fix inverted conditional in error message.

2013-07-01 Thread Chad Versace

Patches 1-3 are
Reviewed-by: Chad Versace 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 04/14] glsl: Add a comment to note what an exec_list is a list of.

2013-07-01 Thread Chad Versace

On 06/29/2013 07:43 PM, Matt Turner wrote:

---
  src/glsl/ast.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index df2a21f..af7fcd9 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -526,6 +526,7 @@ public:
  struct _mesa_glsl_parse_state *state);

 ast_fully_specified_type *type;
+   /* List of ast_declaration * */

 

This start-start confused me. I was lucky and untangled the
meaning, the next person might not have luck untangling.

Please quote the type to distinguish between star1 and star2,
like /* List of 'ast_declaration*' */

With such a clarification,
Reviewed-by: Chad Versace 


 exec_list declarations;

 /**



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


Re: [Mesa-dev] [PATCH V5 1/2] i965/blorp: Add bilinear filtering of samples for multisample scaled blits

2013-07-01 Thread Paul Berry
On 28 June 2013 16:59, Anuj Phogat  wrote:

> Current implementation of ext_framebuffer_multisample_blit_scaled in
> i965/blorp uses nearest filtering for multisample scaled blits. Using
> nearest filtering produces blocky artifacts and negates the benefits
> of MSAA. That is the reason why extension was not enabled on i965.
>
> This patch implements the bilinear filtering of samples in blorp engine.
> Images generated with this patch are free from blocky artifacts and show
> big improvement in visual quality.
>
> Observed no piglit and gles3 regressions.
>
> V3:
> - Algorithm used for filtering assumes a rectangular grid of samples
>   roughly corresponding to sample locations.
> - Test the boundary conditions on the edges of texture.
>
> V4:
> - Clip texcoords and use conditional MOVs.
> - Send texture dimensions as push constants.
> - Remove the optimization in case of scaled multisample blits.
>
> V5:
> - Move mcs_fetch() inside the 'for' loop after computing pixel coordinates.
>
> Signed-off-by: Anuj Phogat 
> ---
>
>  src/mesa/drivers/dri/i965/brw_blorp.h|  16 ++
>  src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 278
> +--
>  2 files changed, 273 insertions(+), 21 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h
> b/src/mesa/drivers/dri/i965/brw_blorp.h
> index ffc27cc..9277d09 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp.h
> +++ b/src/mesa/drivers/dri/i965/brw_blorp.h
> @@ -178,8 +178,15 @@ struct brw_blorp_wm_push_constants
> uint32_t dst_x1;
> uint32_t dst_y0;
> uint32_t dst_y1;
> +   /* Top right coordinates of the rectangular sample grid used for
> +* multisample scaled blitting.
> +*/
> +   float sample_grid_x1;
> +   float sample_grid_y1;
> brw_blorp_coord_transform_params x_transform;
> brw_blorp_coord_transform_params y_transform;
> +   /* Pad out to an integral number of registers */
> +   uint32_t pad[6];
>  };
>
>  /* Every 32 bytes of push constant data constitutes one GEN register. */
> @@ -319,6 +326,15 @@ struct brw_blorp_blit_prog_key
>  * than one sample per pixel.
>  */
> bool persample_msaa_dispatch;
> +
> +   /* True for scaled blitting. */
> +   bool blit_scaled;
> +
> +   /* Scale factors between the pixel grid and the grid of samples. We're
> +* using grid of samples for bilinear filetring in multisample scaled
> blits.
> +*/
> +   float x_scale;
> +   float y_scale;
>  };
>
>  class brw_blorp_blit_params : public brw_blorp_params
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
> b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
> index 8694128..d39bae1 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
> @@ -622,7 +622,8 @@ private:
> void kill_if_outside_dst_rect();
> void translate_dst_to_src();
> void single_to_blend();
> -   void manual_blend(unsigned num_samples);
> +   void manual_blend_average(unsigned num_samples);
> +   void manual_blend_bilinear(unsigned num_samples);
> void sample(struct brw_reg dst);
> void texel_fetch(struct brw_reg dst);
> void mcs_fetch();
> @@ -651,6 +652,11 @@ private:
> struct brw_reg dst_x1;
> struct brw_reg dst_y0;
> struct brw_reg dst_y1;
> +   /* Top right coordinates of the rectangular sample grid used for
> +* multisample scaled blitting.
> +*/
> +   struct brw_reg sample_grid_x1;
> +   struct brw_reg sample_grid_y1;
> struct {
>struct brw_reg multiplier;
>struct brw_reg offset;
> @@ -676,6 +682,16 @@ private:
>  */
> struct brw_reg y_coords[2];
>
> +   /* X, Y coordinates of the pixel from which we need to fetch the
> specific
> +*  sample. These are used for multisample scaled blitting.
> +*/
> +   struct brw_reg x_sample_coords;
> +   struct brw_reg y_sample_coords;
> +
> +   /* Fractional parts of the x and y coordinates, used as bilinear
> interpolation coefficients */
> +   struct brw_reg x_frac;
> +   struct brw_reg y_frac;
> +
> /* Which element of x_coords and y_coords is currently in use.
>  */
> int xy_coord_index;
> @@ -814,15 +830,17 @@ brw_blorp_blit_program::compile(struct brw_context
> *brw,
>  * that we want to texture from.  Exception: if we are blending, then
> S is
>  * irrelevant, because we are going to fetch all samples.
>  */
> -   if (key->blend) {
> +   if (key->blend && !key->blit_scaled) {
>if (brw->intel.gen == 6) {
>   /* Gen6 hardware an automatically blend using the SAMPLE message
> */
>   single_to_blend();
>   sample(texture_data[0]);
>} else {
>   /* Gen7+ hardware doesn't automaticaly blend. */
> - manual_blend(key->src_samples);
> + manual_blend_average(key->src_samples);
>}
> +   } else if(key->blend && key->blit_scaled) {
> +  manual_blend_bilinear(key->src_samples);
> } else {
>/* We aren't blending, which means we just want to fetch a 

[Mesa-dev] [PATCH 4/6] glsl/linker: eliminate unused and set-but-unused built-in varyings

2013-07-01 Thread Marek Olšák
This eliminates built-in varyings such as gl_Color, gl_SecondaryColor,
gl_TexCoord, and gl_FogFragCoord if they are unused by the next stage or
not written at all (e.g. gl_TexCoord elements). The gl_TexCoord array is
broken down into separate vec4s if needed.

v2: - use a switch statement in varying_info_visitor::visit(ir_variable*)
- use snprintf
- disable the optimization for GLES2
---
 src/glsl/Makefile.sources  |   1 +
 src/glsl/ir_optimization.h |   4 +
 src/glsl/link_varyings.h   |   4 +
 src/glsl/linker.cpp|  13 +-
 src/glsl/opt_dead_builtin_varyings.cpp | 476 +
 5 files changed, 496 insertions(+), 2 deletions(-)
 create mode 100644 src/glsl/opt_dead_builtin_varyings.cpp

diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index acd19d1..979c416 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -82,6 +82,7 @@ LIBGLSL_FILES = \
$(GLSL_SRCDIR)/opt_constant_variable.cpp \
$(GLSL_SRCDIR)/opt_copy_propagation.cpp \
$(GLSL_SRCDIR)/opt_copy_propagation_elements.cpp \
+   $(GLSL_SRCDIR)/opt_dead_builtin_varyings.cpp \
$(GLSL_SRCDIR)/opt_dead_code.cpp \
$(GLSL_SRCDIR)/opt_dead_code_local.cpp \
$(GLSL_SRCDIR)/opt_dead_functions.cpp \
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index d38d5e3..fad6f1b 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -76,6 +76,10 @@ bool do_constant_variable_unlinked(exec_list *instructions);
 bool do_copy_propagation(exec_list *instructions);
 bool do_copy_propagation_elements(exec_list *instructions);
 bool do_constant_propagation(exec_list *instructions);
+void do_dead_builtin_varyings(struct gl_context *ctx,
+  exec_list *producer, exec_list *consumer,
+  unsigned num_tfeedback_decls,
+  class tfeedback_decl *tfeedback_decls);
 bool do_dead_code(exec_list *instructions, bool uniform_locations_assigned);
 bool do_dead_code_local(exec_list *instructions);
 bool do_dead_code_unlinked(exec_list *instructions);
diff --git a/src/glsl/link_varyings.h b/src/glsl/link_varyings.h
index daa9d79..7f7be35 100644
--- a/src/glsl/link_varyings.h
+++ b/src/glsl/link_varyings.h
@@ -125,6 +125,10 @@ public:
  return this->vector_elements * this->matrix_columns * this->size;
}
 
+   unsigned get_location() const {
+  return this->location;
+   }
+
 private:
/**
 * The name that was supplied to glTransformFeedbackVaryings.  Used for
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 6d73578..ba97ade 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1887,6 +1887,9 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
 goto done;
   }
 
+  do_dead_builtin_varyings(ctx, sh->ir, NULL,
+   num_tfeedback_decls, tfeedback_decls);
+
   demote_shader_inputs_and_outputs(sh, ir_var_shader_out);
 
   /* Eliminate code that is now dead due to unused outputs being demoted.
@@ -1895,11 +1898,13 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
  ;
}
else if (first == MESA_SHADER_FRAGMENT) {
-  /* If the program only contains a fragment shader, just demote
-   * user-defined varyings.
+  /* If the program only contains a fragment shader...
*/
   gl_shader *const sh = prog->_LinkedShaders[first];
 
+  do_dead_builtin_varyings(ctx, NULL, sh->ir,
+   num_tfeedback_decls, tfeedback_decls);
+
   demote_shader_inputs_and_outputs(sh, ir_var_shader_in);
 
   while (do_dead_code(sh->ir, false))
@@ -1919,6 +1924,10 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
 tfeedback_decls))
  goto done;
 
+  do_dead_builtin_varyings(ctx, sh_i->ir, sh_next->ir,
+next == MESA_SHADER_FRAGMENT ? num_tfeedback_decls : 0,
+tfeedback_decls);
+
   demote_shader_inputs_and_outputs(sh_i, ir_var_shader_out);
   demote_shader_inputs_and_outputs(sh_next, ir_var_shader_in);
 
diff --git a/src/glsl/opt_dead_builtin_varyings.cpp 
b/src/glsl/opt_dead_builtin_varyings.cpp
new file mode 100644
index 000..71bb7c4
--- /dev/null
+++ b/src/glsl/opt_dead_builtin_varyings.cpp
@@ -0,0 +1,476 @@
+/*
+ * Copyright © 2013 Marek Olšák 
+ *
+ * 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 t

Re: [Mesa-dev] [PATCH] draw/translate: fix instancing

2013-07-01 Thread Jose Fonseca


- Original Message -
> We were incorrectly computing the buffer offset when using the
> instances. The buffer offset is always equal to:
> start_instance * stride + (instance_num / instance_divisor) *
> stride
> We were completely ignoring the start instance quite
> often producing instances that completely wrong, e.g. if
> start instance = 5, instance divisor = 2, then on the first
> iteration it should be:
> 5 * stride, not (5/2) * stride as we'd have currently, and if
> start instance = 1, instance divisor = 3, then on the first
> iteration it should be:
> 1 * stride, not 0 as we'd have.
> This fixes it and adjusts all the code to the changes.
> 
> Signed-off-by: Zack Rusin 
> ---
>  src/gallium/auxiliary/draw/draw_llvm.c |   15 ++---
>  src/gallium/auxiliary/draw/draw_pipe_vbuf.c|2 +-
>  src/gallium/auxiliary/draw/draw_private.h  |1 +
>  src/gallium/auxiliary/draw/draw_pt.c   |1 +
>  src/gallium/auxiliary/draw/draw_pt_emit.c  |2 ++
>  src/gallium/auxiliary/draw/draw_pt_fetch.c |2 ++
>  src/gallium/auxiliary/draw/draw_pt_fetch_emit.c|3 ++
>  src/gallium/auxiliary/draw/draw_pt_so_emit.c   |   23 --
>  src/gallium/auxiliary/draw/draw_vs_variant.c   |4 +++
>  src/gallium/auxiliary/translate/translate.h|4 +++
>  .../auxiliary/translate/translate_generic.c|   17 ---
>  src/gallium/auxiliary/translate/translate_sse.c|   32
>  
>  src/gallium/auxiliary/util/u_vbuf.c|8 ++---
>  src/gallium/drivers/nv30/nv30_push.c   |8 ++---
>  src/gallium/drivers/nv50/nv50_push.c   |8 ++---
>  src/gallium/drivers/nvc0/nvc0_push.c   |8 ++---
>  src/gallium/drivers/nvc0/nvc0_vbo_translate.c  |8 ++---
>  17 files changed, 106 insertions(+), 40 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_llvm.c
> b/src/gallium/auxiliary/draw/draw_llvm.c
> index 97b463f..9eb5a93 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_llvm.c
> @@ -674,6 +674,7 @@ generate_vs(struct draw_llvm_variant *variant,
>  
>  static void
>  generate_fetch(struct gallivm_state *gallivm,
> +   struct draw_context *draw,
> LLVMValueRef vbuffers_ptr,
> LLVMValueRef *res,
> struct pipe_vertex_element *velem,
> @@ -704,10 +705,14 @@ generate_fetch(struct gallivm_state *gallivm,
> struct lp_build_if_state if_ctx;
>  
> if (velem->instance_divisor) {
> -  /* array index = instance_id / instance_divisor */
> -  index = LLVMBuildUDiv(builder, instance_id,
> -lp_build_const_int32(gallivm,
> velem->instance_divisor),
> -"instance_divisor");
> +  LLVMValueRef current_instance;
> +  /* array index = start_instance + (instance_num / instance_divisor) */
> +  index = lp_build_const_int32(gallivm, draw->start_instance);
> +  current_instance = LLVMBuildSub(builder, instance_id, index, "");
> +  current_instance = LLVMBuildUDiv(builder, current_instance,
> +   lp_build_const_int32(gallivm,
> velem->instance_divisor),
> +   "instance_divisor");
> +  index = LLVMBuildAdd(builder, index, current_instance, "instance");
> }
>  
> stride = lp_build_umul_overflow(gallivm, vb_stride, index, &ofbit);
> @@ -1697,7 +1702,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct
> draw_llvm_variant *variant,
>  LLVMValueRef vb_index =
> lp_build_const_int32(gallivm, velem->vertex_buffer_index);
>  LLVMValueRef vb = LLVMBuildGEP(builder, vb_ptr, &vb_index, 1,
>  "");
> -generate_fetch(gallivm, vbuffers_ptr,
> +generate_fetch(gallivm, draw, vbuffers_ptr,
> &aos_attribs[j][i], velem, vb, true_index,
> system_values.instance_id);
>   }
> diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
> b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
> index 578433c..d3b38eb 100644
> --- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
> +++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
> @@ -138,7 +138,7 @@ emit_vertex( struct vbuf_stage *vbuf,
>/* Note: we really do want data[0] here, not data[pos]:
> */
>vbuf->translate->set_buffer(vbuf->translate, 0, vertex->data[0], 0,
>~0);
> -  vbuf->translate->run(vbuf->translate, 0, 1, 0, vbuf->vertex_ptr);
> +  vbuf->translate->run(vbuf->translate, 0, 1, 0, 0, vbuf->vertex_ptr);
>  
>if (0) draw_dump_emitted_vertex(vbuf->vinfo, (uint8_t
>*)vbuf->vertex_ptr);
>
> diff --git a/src/gallium/auxiliary/draw/draw_private.h
> b/src/gallium/auxiliary/draw/draw_private.h
> index fd52c2d..f42cded 100644
> --- a/src/gallium/auxiliary/draw/draw_

[Mesa-dev] [Bug 66357] pipe_loader_sw fails to build without libx11 headers

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

--- Comment #1 from Martin Jansa  ---
Created attachment 81827
  --> https://bugs.freedesktop.org/attachment.cgi?id=81827&action=edit
0002-pipe_loader_sw-include-xlib_sw_winsys.h-only-when-HA.patch

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


Re: [Mesa-dev] [PATCH] i965: fix alpha test for MRT

2013-07-01 Thread Chris Forbes
Paul,

That's much nicer -- I noticed the new flag was pretty much redundant
with the alpha-to-coverage flag as soon as I'd sent out the patch.

Will fix that up, and cook up a piglit test for this tonight.

-- Chris

On Tue, Jul 2, 2013 at 5:28 AM, Paul Berry  wrote:
> On 1 July 2013 04:45, Chris Forbes  wrote:
>>
>> Include src0 alpha in the RT write message when using MRT, so it is used
>> for the alpha test instead of the normal per-RT alpha value.
>>
>> Fixes broken rendering in Dota2 under Wine [FDO #62647] -- but not
>> tested against much else.
>>
>> Signed-off-by: Chris Forbes 
>
>
>
> Since there's no other user of key.sample_alpha_to_coverage, I guess I'd
> prefer to see it renamed to something like key.replicate_alpha, and then in
> brw_wm_populate_key(), set it to "ctx->DrawBuffer->_NumColorDrawBuffers > 1
> && (ctx->Multisample.SampleAlphaToCoverage || ctx->Color.AlphaEnabled)".
> That will reduce unnecessary recompiles.
>
> Also it would be nice to have a piglit test for this--it seems like the sort
> of thing we could easily regress in the future if we're not careful.
>
>>
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs_emit.cpp| 2 +-
>>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 2 +-
>>  src/mesa/drivers/dri/i965/brw_wm.c   | 4 
>>  src/mesa/drivers/dri/i965/brw_wm.h   | 1 +
>>  4 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
>> b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
>> index f390989..10f4c99 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
>> @@ -129,7 +129,7 @@ fs_generator::generate_fb_write(fs_inst *inst)
>>
>>   if (inst->target > 0 &&
>>  c->key.nr_color_regions > 1 &&
>> -c->key.sample_alpha_to_coverage) {
>> +(c->key.sample_alpha_to_coverage || c->key.alpha_test)) {
>>  /* Set "Source0 Alpha Present to RenderTarget" bit in message
>>   * header.
>>   */
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>> b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>> index a67b6ed..0c8dc1b 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>> @@ -2255,7 +2255,7 @@ fs_visitor::emit_fb_writes()
>>src0_alpha_to_render_target = intel->gen >= 6 &&
>> !do_dual_src &&
>> c->key.nr_color_regions > 1 &&
>> -   c->key.sample_alpha_to_coverage;
>> +   (c->key.sample_alpha_to_coverage ||
>> c->key.alpha_test);
>>/* m2, m3 header */
>>nr += 2;
>> }
>> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c
>> b/src/mesa/drivers/dri/i965/brw_wm.c
>> index 6eb4a1d..3265596 100644
>> --- a/src/mesa/drivers/dri/i965/brw_wm.c
>> +++ b/src/mesa/drivers/dri/i965/brw_wm.c
>> @@ -279,6 +279,8 @@ brw_wm_debug_recompile(struct brw_context *brw,
>>old_key->nr_color_regions, key->nr_color_regions);
>> found |= key_debug(intel, "sample alpha to coverage",
>>old_key->sample_alpha_to_coverage,
>> key->sample_alpha_to_coverage);
>> +   found |= key_debug(intel, "MRT alpha test w/a",
>> +  old_key->alpha_test, key->alpha_test);
>> found |= key_debug(intel, "rendering to FBO",
>>old_key->render_to_fbo, key->render_to_fbo);
>> found |= key_debug(intel, "fragment color clamping",
>> @@ -463,6 +465,8 @@ static void brw_wm_populate_key( struct brw_context
>> *brw,
>> key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers;
>>/* _NEW_MULTISAMPLE */
>> key->sample_alpha_to_coverage =
>> ctx->Multisample.SampleAlphaToCoverage;
>> +   /* _NEW_COLOR */
>> +   key->alpha_test = ctx->Color.AlphaEnabled;
>>
>> /* BRW_NEW_VUE_MAP_GEOM_OUT */
>> if (intel->gen < 6)
>> diff --git a/src/mesa/drivers/dri/i965/brw_wm.h
>> b/src/mesa/drivers/dri/i965/brw_wm.h
>> index 28e8734..13b17d0 100644
>> --- a/src/mesa/drivers/dri/i965/brw_wm.h
>> +++ b/src/mesa/drivers/dri/i965/brw_wm.h
>> @@ -63,6 +63,7 @@ struct brw_wm_prog_key {
>> GLuint flat_shade:1;
>> GLuint nr_color_regions:5;
>> GLuint sample_alpha_to_coverage:1;
>> +   GLuint alpha_test:1;
>> GLuint render_to_fbo:1;
>> GLuint clamp_fragment_color:1;
>> GLuint line_aa:2;
>> --
>> 1.8.3.2
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 66357] pipe_loader_sw fails to build without libx11 headers

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

--- Comment #2 from Martin Jansa  ---
To fix build with xlib enabled:
 #ifdef HAVE_PIPE_LOADER_XLIB
-   x11_sw_create,
+   xlib_create_sw_winsys
 #endif

But HAVE_PIPE_LOADER_XLIB was removed recently:

commit 657cfe62521f05dab744824e9d72e0a753fd9096
Author: Matt Turner 
Date:   Mon Apr 22 11:41:26 2013 -0700
configure.ac: Remove unused HAVE_PIPE_LOADER_XLIB macro.

and then
commit 1b6281443d9cf4e85988724bbf8f54ae5d3a92d0
Author: Matt Turner 
Date:   Mon Apr 22 14:28:50 2013 -0700
build: Remove libws_xlib.la from GALLIUM_PIPE_LOADER_LIBS.

So maybe the easiest way to resolve this is to remove xlib support from
pipe_loader_sw?

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


[Mesa-dev] [PATCH] gallivm: Fix indirect immediate registers.

2013-07-01 Thread jfonseca
From: José Fonseca 

If reg->Register.Indirect then the immediate is not truly a constant
expression.

There is no performance regression -- LLVMBuildBitCast will fallback to
LLVMConstBitCast internally when the argument is a constant.
---
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 0bbc408..f641859 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -1026,9 +1026,9 @@ emit_fetch_immediate(
}
 
if (stype == TGSI_TYPE_UNSIGNED) {
-  res = LLVMConstBitCast(res, bld_base->uint_bld.vec_type);
+  res = LLVMBuildBitCast(builder, res, bld_base->uint_bld.vec_type, "");
} else if (stype == TGSI_TYPE_SIGNED) {
-  res = LLVMConstBitCast(res, bld_base->int_bld.vec_type);
+  res = LLVMBuildBitCast(builder, res, bld_base->int_bld.vec_type, "");
}
return res;
 }
-- 
1.8.1.2

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


[Mesa-dev] [Bug 66466] Account request for Mesa related development

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

Matthew McClure  changed:

   What|Removed |Added

   Assignee|sitewranglers@lists.freedes |mesa-dev@lists.freedesktop.
   |ktop.org|org
Product|freedesktop.org |Mesa
  Component|New Accounts|Other

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


Re: [Mesa-dev] [PATCH 08/14] glsl: Add copy-constructor for ast_struct_specifier.

2013-07-01 Thread Chad Versace

On 06/29/2013 07:43 PM, Matt Turner wrote:

---
  src/glsl/ast.h | 7 +++
  1 file changed, 7 insertions(+)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index 13c5e6b..0b70bb7 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -453,6 +453,13 @@ class ast_declarator_list;

  class ast_struct_specifier : public ast_node {
  public:
+   ast_struct_specifier(const ast_struct_specifier *structure):
+  is_declaration(structure->is_declaration), name(structure->name),
+  declarations(structure->declarations)
+   {
+  /* empty */
+   }
+
 ast_struct_specifier(const char *identifier,
ast_declarator_list *declarator_list);
 virtual void print(void) const;


We discussed in person, so this is for the list.

The copy constructors in patches 7 and 8 make a deep-copy the class's
value members up the inheritance hierarchy. This causes the unexpected
side effect that the copy of ast_struct_specifier
will inhabit the same position in the exec_list as the original 
ast_struct_specifier.

Also, please use 'that' as the param name. It makes the code extra easy read,
especially when writing code like this:
   this->foo = that->foo;

I'm done today for reviews because I need to move on to hw bring-up. But
I'll try to continue reviewing the series tomorrow morning.





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


Re: [Mesa-dev] [PATCH] prog_parameter.c ASAN Patch

2013-07-01 Thread Brian Paul

I took a closer look at your patch and I think it's incorrect.

Note that the 'values' pointer is incremented by 4 in each loop 
iteration and size is decremented by 4.  So accessing values[i*4+j] will 
eventually go out of bounds.


I think something like this would work.

diff --git a/src/mesa/program/prog_parameter.c 
b/src/mesa/program/prog_parameter.c

index 95b153e..1b16feb 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -155,7 +155,17 @@ _mesa_add_parameter(struct 
gl_program_parameter_list *paramList,

  p->Size = size;
  p->DataType = datatype;
  if (values) {
-COPY_4V(paramList->ParameterValues[oldNum + i], values);
+if (size >= 4) {
+   COPY_4V(paramList->ParameterValues[oldNum + i], values);
+}
+else {
+   for (j = 0; j < size; j++) {
+  paramList->ParameterValues[oldNum + i][j] = values[j];
+   }
+   for (; j < 4; j++) {
+  paramList->ParameterValues[oldNum + i][j] = 0.0f;
+   }
+}
 values += 4;
 p->Initialized = GL_TRUE;
  }

-Brian


On 06/19/2013 01:47 AM, Myles C. Maxfield wrote:

Any word on this?

Thanks,
Myles


On Mon, Jun 17, 2013 at 12:09 PM, Myles C. Maxfield
mailto:myles.maxfi...@gmail.com>> wrote:

Sure. I was under the impression that |size| couldn't be both
greater than 4 and a non-multiple of 4, but I've reworked the patch
to incorporate this and to be a little more straightforward.

Is the only way to replace "ASAN" with "Address Sanitizer" to change
the subject of this email thread?

Anyway, here's a similar but modified patch:

From: Myles C. Maxfield mailto:my...@amazon.com>>
Date: Mon, 17 Jun 2013 11:50:05 -0700
Subject: [PATCH] Appeasing Address Sanitizer

---
  src/mesa/program/prog_parameter.c | 13 -
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/mesa/program/prog_parameter.c
b/src/mesa/program/prog_parameter.c
index 95b153e..1d46476 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -155,7 +155,18 @@ _mesa_add_parameter(struct
gl_program_parameter_list *paramList,
   p->Size = size;
   p->DataType = datatype;
   if (values) {
-COPY_4V(paramList->ParameterValues[oldNum + i], values);
+if (size >= (i+1)*4) {
+COPY_4V(paramList->ParameterValues[oldNum + i],
values);
+} else {
+/* silence asan */
+for (j = 0; j < 4; j++) {
+if (i*4+j < size) {
+paramList->ParameterValues[oldNum + i][j] =
values[i*4+j];
+} else {
+paramList->ParameterValues[oldNum + i][j].f
= 0.0f;
+}
+}
+}
  values += 4;
  p->Initialized = GL_TRUE;
   }
--
1.7.12.4 (Apple Git-37)


On Mon, Jun 17, 2013 at 8:13 AM, Brian Paul mailto:bri...@vmware.com>> wrote:

On 06/14/2013 05:12 PM, Myles C. Maxfield wrote:

Sorry for the triple post; I received a bounce email the
first time and got sent to the spam folder the second time,
so I'm trying a third time.

Hello, all. I was running Mesa with Address Sanitizer [1]
turned on, and found one place where ASAN pointed out a
read-before-initialized problem. In particular, in
_mesa_add_parameter, in prog_parameter.c, |values|
represents an array holding a variable number of values.
These values get copied out of the array 4 at a time with
the COPY_4V macro, however, the array might only contain a
single element. In this case, ASAN reports a
read-before-initialize because the last 3 of the 4 elements
haven't been written to yet. I was hoping to contribute a
patch that will silence this problem that ASAN reports. I'm
happy to incorporate any feedback anyone has into this patch.

Thanks,
Myles C. Maxfield

[1]https://code.google.com/p/__address-sanitizer/


diff --git a/src/mesa/program/prog___parameter.c
b/src/mesa/program/prog___parameter.c
index 2018fa5..63915fb 100644
--- a/src/mesa/program/prog___parameter.c
+++ b/src/mesa/program/prog___parameter.c
@@ -158,7 +158,17 @@ _mesa_add_parameter(struct
gl_program_parameter_list *paramList,
p->DataType = datatype;
p->Flags = flags;
if

[Mesa-dev] [Bug 66423] [bisected] postprocess/pp_run.c :56:pp_run: Assertion ppq->tmp[1] failed

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

Matthew McClure  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|mesa-dev@lists.freedesktop. |mcclu...@vmware.com
   |org |

--- Comment #1 from Matthew McClure  ---
Created attachment 81829
  --> https://bugs.freedesktop.org/attachment.cgi?id=81829&action=edit
Patch to address assertion with 1 or 2 filters enabled.

I have a patch ready locally. Until I can update fdo, here is a patch to help.

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


Re: [Mesa-dev] [PATCH] gallivm: Fix indirect immediate registers.

2013-07-01 Thread Roland Scheidegger
Am 01.07.2013 21:54, schrieb jfons...@vmware.com:
> From: José Fonseca 
> 
> If reg->Register.Indirect then the immediate is not truly a constant
> expression.
> 
> There is no performance regression -- LLVMBuildBitCast will fallback to
> LLVMConstBitCast internally when the argument is a constant.
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
> b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> index 0bbc408..f641859 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> @@ -1026,9 +1026,9 @@ emit_fetch_immediate(
> }
>  
> if (stype == TGSI_TYPE_UNSIGNED) {
> -  res = LLVMConstBitCast(res, bld_base->uint_bld.vec_type);
> +  res = LLVMBuildBitCast(builder, res, bld_base->uint_bld.vec_type, "");
> } else if (stype == TGSI_TYPE_SIGNED) {
> -  res = LLVMConstBitCast(res, bld_base->int_bld.vec_type);
> +  res = LLVMBuildBitCast(builder, res, bld_base->int_bld.vec_type, "");
> }
> return res;
>  }
> 

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


Re: [Mesa-dev] [PATCH] gallivm: Fix indirect immediate registers.

2013-07-01 Thread Zack Rusin
> Am 01.07.2013 21:54, schrieb jfons...@vmware.com:
> > From: José Fonseca 
> > 
> > If reg->Register.Indirect then the immediate is not truly a constant
> > expression.
> > 
> > There is no performance regression -- LLVMBuildBitCast will fallback to
> > LLVMConstBitCast internally when the argument is a constant.
> > ---
> >  src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> > b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> > index 0bbc408..f641859 100644
> > --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> > +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> > @@ -1026,9 +1026,9 @@ emit_fetch_immediate(
> > }
> >  
> > if (stype == TGSI_TYPE_UNSIGNED) {
> > -  res = LLVMConstBitCast(res, bld_base->uint_bld.vec_type);
> > +  res = LLVMBuildBitCast(builder, res, bld_base->uint_bld.vec_type,
> > "");
> > } else if (stype == TGSI_TYPE_SIGNED) {
> > -  res = LLVMConstBitCast(res, bld_base->int_bld.vec_type);
> > +  res = LLVMBuildBitCast(builder, res, bld_base->int_bld.vec_type,
> > "");
> > }
> > return res;
> >  }
> > 
> 
> Reviewed-by: Roland Scheidegger 

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


[Mesa-dev] Mesa 9.1.4

2013-07-01 Thread Ian Romanick

Mesa 9.1.4 has been released.  Mesa 9.1.4 is a bug fix release which
fixes bugs fixed since the 9.1.3 release.

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

Mesa 9.1.4 is available for download at
ftp://freedesktop.org/pub/mesa/9.1.4/

md5sums:

a2c4e25d0e27918bc67f61bae04d0cb8  MesaLib-9.1.4.tar.bz2
8c7e9ce5b05cb2223f0587396dd9dc08  MesaLib-9.1.4.tar.gz
020459c5793d4279bdcb2daa1f7dd9f6  MesaLib-9.1.4.zip

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

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

I have also verified that I pushed the tag.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 66466] Account request for Mesa related development

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

Brian Paul  changed:

   What|Removed |Added

   Assignee|mesa-dev@lists.freedesktop. |sitewranglers@lists.freedes
   |org |ktop.org
Product|Mesa|freedesktop.org
  Component|Other   |New Accounts

--- Comment #2 from Brian Paul  ---
Approved.  Reassigning to admins.

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


Re: [Mesa-dev] [PATCH] prog_parameter.c ASAN Patch

2013-07-01 Thread Myles C. Maxfield
Looks good to me. Thanks for fixing it up. Do the prospects look good for
getting this committed?

It would be cool if my name was attached to the patch, but since you really
ended up writing it, its fine with me if you're marked as the author.

Thanks,
Myles


On Mon, Jul 1, 2013 at 2:08 PM, Brian Paul  wrote:

> I took a closer look at your patch and I think it's incorrect.
>
> Note that the 'values' pointer is incremented by 4 in each loop iteration
> and size is decremented by 4.  So accessing values[i*4+j] will eventually
> go out of bounds.
>
> I think something like this would work.
>
> diff --git a/src/mesa/program/prog_**parameter.c b/src/mesa/program/prog_*
> *parameter.c
> index 95b153e..1b16feb 100644
> --- a/src/mesa/program/prog_**parameter.c
> +++ b/src/mesa/program/prog_**parameter.c
> @@ -155,7 +155,17 @@ _mesa_add_parameter(struct gl_program_parameter_list
> *paramList,
>
>   p->Size = size;
>   p->DataType = datatype;
>   if (values) {
> -COPY_4V(paramList->**ParameterValues[oldNum + i], values);
> +if (size >= 4) {
>
> +   COPY_4V(paramList->**ParameterValues[oldNum + i], values);
> +}
> +else {
>
> +   for (j = 0; j < size; j++) {
> +  paramList->ParameterValues[**oldNum + i][j] =
> values[j];
> +   }
> +   for (; j < 4; j++) {
> +  paramList->ParameterValues[**oldNum + i][j] = 0.0f;
>
> +   }
> +}
>  values += 4;
>  p->Initialized = GL_TRUE;
>   }
>
> -Brian
>
>
>
> On 06/19/2013 01:47 AM, Myles C. Maxfield wrote:
>
>> Any word on this?
>>
>> Thanks,
>> Myles
>>
>>
>> On Mon, Jun 17, 2013 at 12:09 PM, Myles C. Maxfield
>> > >
>> wrote:
>>
>> Sure. I was under the impression that |size| couldn't be both
>> greater than 4 and a non-multiple of 4, but I've reworked the patch
>> to incorporate this and to be a little more straightforward.
>>
>> Is the only way to replace "ASAN" with "Address Sanitizer" to change
>> the subject of this email thread?
>>
>> Anyway, here's a similar but modified patch:
>>
>> From: Myles C. Maxfield mailto:my...@amazon.com>>
>>
>> Date: Mon, 17 Jun 2013 11:50:05 -0700
>> Subject: [PATCH] Appeasing Address Sanitizer
>>
>> ---
>>   src/mesa/program/prog_**parameter.c | 13 -
>>   1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/program/prog_**parameter.c
>> b/src/mesa/program/prog_**parameter.c
>> index 95b153e..1d46476 100644
>> --- a/src/mesa/program/prog_**parameter.c
>> +++ b/src/mesa/program/prog_**parameter.c
>> @@ -155,7 +155,18 @@ _mesa_add_parameter(struct
>> gl_program_parameter_list *paramList,
>>p->Size = size;
>>p->DataType = datatype;
>>if (values) {
>> -COPY_4V(paramList->**ParameterValues[oldNum + i],
>> values);
>> +if (size >= (i+1)*4) {
>> +COPY_4V(paramList->**ParameterValues[oldNum + i],
>> values);
>> +} else {
>> +/* silence asan */
>> +for (j = 0; j < 4; j++) {
>> +if (i*4+j < size) {
>> +paramList->ParameterValues[**oldNum + i][j]
>> =
>> values[i*4+j];
>> +} else {
>> +paramList->ParameterValues[**oldNum +
>> i][j].f
>> = 0.0f;
>> +}
>> +}
>> +}
>>   values += 4;
>>   p->Initialized = GL_TRUE;
>>}
>> --
>> 1.7.12.4 (Apple Git-37)
>>
>>
>> On Mon, Jun 17, 2013 at 8:13 AM, Brian Paul > > wrote:
>>
>> On 06/14/2013 05:12 PM, Myles C. Maxfield wrote:
>>
>> Sorry for the triple post; I received a bounce email the
>> first time and got sent to the spam folder the second time,
>> so I'm trying a third time.
>>
>> Hello, all. I was running Mesa with Address Sanitizer [1]
>> turned on, and found one place where ASAN pointed out a
>> read-before-initialized problem. In particular, in
>> _mesa_add_parameter, in prog_parameter.c, |values|
>> represents an array holding a variable number of values.
>> These values get copied out of the array 4 at a time with
>> the COPY_4V macro, however, the array might only contain a
>> single element. In this case, ASAN reports a
>> read-before-initialize because the last 3 of the 4 elements
>> haven't been written to yet. I was hoping to contribute a
>> patch that will silence this problem that ASAN reports. I'm
>> happy to incorporate any feedback anyone has into

[Mesa-dev] [Bug 66476] New: translate_test.c:263:10: error: too few arguments to function ‘translate?=[0]->=?UTF-8?Q?run_elts’

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

  Priority: medium
Bug ID: 66476
  Keywords: regression
CC: za...@vmware.com
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: translate_test.c:263:10: error: too few arguments to
function ‘translate[0]->run_elts’
  Severity: blocker
Classification: Unclassified
OS: All
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Other
   Product: Mesa

mesa: 27f2df2507a591eaf8ff6c2953fd39e60ad85482 (master)

$ scons
[...]
  Compiling src/gallium/tests/unit/translate_test.c ...
src/gallium/tests/unit/translate_test.c: In function ‘main’:
src/gallium/tests/unit/translate_test.c:263:10: warning: passing argument 5 of
‘translate[0]->run_elts’ makes integer from pointer without a cast [enabled by
default]
src/gallium/tests/unit/translate_test.c:263:10: note: expected ‘unsigned int’
but argument is of type ‘unsigned char *’
src/gallium/tests/unit/translate_test.c:263:10: error: too few arguments to
function ‘translate[0]->run_elts’
src/gallium/tests/unit/translate_test.c:265:10: warning: passing argument 5 of
‘translate[1]->run_elts’ makes integer from pointer without a cast [enabled by
default]
src/gallium/tests/unit/translate_test.c:265:10: note: expected ‘unsigned int’
but argument is of type ‘unsigned char *’
src/gallium/tests/unit/translate_test.c:265:10: error: too few arguments to
function ‘translate[1]->run_elts’
src/gallium/tests/unit/translate_test.c:267:10: warning: passing argument 5 of
‘translate[0]->run_elts’ makes integer from pointer without a cast [enabled by
default]
src/gallium/tests/unit/translate_test.c:267:10: note: expected ‘unsigned int’
but argument is of type ‘unsigned char *’
src/gallium/tests/unit/translate_test.c:267:10: error: too few arguments to
function ‘translate[0]->run_elts’
src/gallium/tests/unit/translate_test.c:269:10: warning: passing argument 5 of
‘translate[1]->run_elts’ makes integer from pointer without a cast [enabled by
default]
src/gallium/tests/unit/translate_test.c:269:10: note: expected ‘unsigned int’
but argument is of type ‘unsigned char *’
src/gallium/tests/unit/translate_test.c:269:10: error: too few arguments to
function ‘translate[1]->run_elts’


1c2e5c223da28cdffe156b6b430fcdf638909021 is the first bad commit
commit 1c2e5c223da28cdffe156b6b430fcdf638909021
Author: Zack Rusin 
Date:   Thu Jun 27 20:40:10 2013 -0400

draw/translate: fix instancing

We were incorrectly computing the buffer offset when using the
instances. The buffer offset is always equal to:
start_instance * stride + (instance_num / instance_divisor) *
stride
We were completely ignoring the start instance quite
often producing instances that completely wrong, e.g. if
start instance = 5, instance divisor = 2, then on the first
iteration it should be:
5 * stride, not (5/2) * stride as we'd have currently, and if
start instance = 1, instance divisor = 3, then on the first
iteration it should be:
1 * stride, not 0 as we'd have.
This fixes it and adjusts all the code to the changes.

Signed-off-by: Zack Rusin 

:04 04 cbd8d10d710bd44b366c7341c77d8a18dcd40bda
76b1ca3ea48bdb3cd7320e5a674979d77d28ab2d Msrc
bisect run success

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


Re: [Mesa-dev] [PATCH 0/6] Eliminating unused built-in varyings

2013-07-01 Thread Ian Romanick

The series is

Reviewed-by: Ian Romanick 

On 06/13/2013 05:25 AM, Marek Olšák wrote:

Hi everyone,

this series adds a new GLSL compiler optimization pass which eliminates unused 
and set-but-unused built-in varyings and adds a few improvements to the GLSL 
linker in the process.

Before I show you how it works, I wanna say that there are patches which are 
related to and will most probably conflict with the geometry shader work, but 
they are necessary because the linkage of varyings is largely suboptimal.

Also, the GL_EXT_separate_shader_objects extension must be disabled for this optimization 
to be enabled. The reason is a program object with both a VS and FS can be bound 
partially, e.g. by glUseShaderProgramEXT(GL_VERTEX_SHADER, prog), so the extension makes 
every program object be just a set of "separate shaders". The extension is not 
important anyway.

Now, to illustrate how the optimization works, consider these 2 shader IR dumps:


Vertex shader (8 varyings):
...
(declare (shader_out ) vec4 gl_FrontColor)
(declare (shader_out ) vec4 gl_FrontSecondaryColor)
(declare (shader_out ) (array vec4 6) gl_TexCoord)
(function main
   (signature void
 (parameters
 )
 (
   ...
   (assign  (xyzw) (var_ref gl_FrontColor)  (var_ref gl_Color) )
   (assign  (xyzw) (var_ref gl_FrontSecondaryColor)  (var_ref 
gl_SecondaryColor) )
   (assign  (xyzw) (array_ref (var_ref gl_TexCoord) (constant int (1)) )  
(var_ref gl_MultiTexCoord1) )
   (assign  (xyzw) (array_ref (var_ref gl_TexCoord) (constant int (4)) )  
(var_ref gl_MultiTexCoord4) )
   (assign  (xyzw) (array_ref (var_ref gl_TexCoord) (constant int (5)) )  
(var_ref gl_MultiTexCoord5) )
 ))
)

Fragment shader (6 varyings):
...
(declare (shader_in ) vec4 gl_SecondaryColor)
(declare (shader_in ) (array vec4 5) gl_TexCoord)
(function main
   (signature void
 (parameters
 )
 (
   (declare () vec4 r)
   (assign  (xyzw) (var_ref r)  ... (var_ref gl_SecondaryColor) ) )
   (assign  (xyzw) (var_ref r)  ... (array_ref (var_ref gl_TexCoord) 
(constant int (1)) ) ) ) )
   (assign  (xyzw) (var_ref r)  ... (array_ref (var_ref gl_TexCoord) 
(constant int (2)) ) ) ) )
   (assign  (xyzw) (var_ref r)  ... (array_ref (var_ref gl_TexCoord) 
(constant int (3)) ) ) ) )
   (declare (temporary ) vec4 assignment_tmp)
   (assign  (xyzw) (var_ref assignment_tmp)  ... (array_ref (var_ref 
gl_TexCoord) (constant int (4)) ) ) ) )
   ...
 ))
)


Note that only gl_TexCoord[1], gl_TexCoord[4], and gl_SecondaryColor are used 
by both shaders. The optimization replaces all occurences of varyings which are 
unused by the other stage by temporary variables. It also breaks down the 
gl_TexCoord array into separate vec4 variables if needed. Here's the result:


Vertex shader (3 varyings instead of 8):
...
(declare (shader_out ) vec4 gl_out_TexCoord1)
(declare (shader_out ) vec4 gl_out_TexCoord4)
(declare (temporary ) vec4 gl_out_TexCoord5_dummy)
(declare (temporary ) vec4 gl_out_FrontColor0_dummy)
(declare (shader_out ) vec4 gl_FrontSecondaryColor)
(function main
   (signature void
 (parameters
 )
 (
   ...
   (assign  (xyzw) (var_ref gl_out_FrontColor0_dummy)  (var_ref gl_Color) )
   (assign  (xyzw) (var_ref gl_FrontSecondaryColor)  (var_ref 
gl_SecondaryColor) )
   (assign  (xyzw) (var_ref gl_out_TexCoord1)  (var_ref gl_MultiTexCoord1) )
   (assign  (xyzw) (var_ref gl_out_TexCoord4)  (var_ref gl_MultiTexCoord4) )
   (assign  (xyzw) (var_ref gl_out_TexCoord5_dummy)  (var_ref 
gl_MultiTexCoord5) )
 ))
)

Fragment shader (3 varyings instead of 6):
...
(declare (shader_in ) vec4 gl_in_TexCoord1)
(declare (temporary ) vec4 gl_in_TexCoord2_dummy)
(declare (temporary ) vec4 gl_in_TexCoord3_dummy)
(declare (shader_in ) vec4 gl_in_TexCoord4)
(declare (shader_in ) vec4 gl_SecondaryColor)
(function main
   (signature void
 (parameters
 )
 (
   (declare () vec4 r)
   (assign  (xyzw) (var_ref r)  ... (var_ref gl_SecondaryColor) ) )
   (assign  (xyzw) (var_ref r)  ... (var_ref gl_in_TexCoord1) ) ) )
   (assign  (xyzw) (var_ref r)  ... (var_ref gl_in_TexCoord2_dummy) ) ) )
   (assign  (xyzw) (var_ref r)  ... (var_ref gl_in_TexCoord3_dummy) ) ) )
   (declare (temporary ) vec4 assignment_tmp)
   (assign  (xyzw) (var_ref assignment_tmp)  ... (var_ref gl_in_TexCoord4) 
) ) )
   ...
 ))
)

The locations of varyings remain the same. That's all. Please review.

Marek
___
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


[Mesa-dev] [Bug 66346] shader_query.cpp:49: error: invalid conversion from 'void*' to 'GLuint'

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

--- Comment #2 from Vinson Lee  ---
(In reply to comment #1)
> Created attachment 81814 [details] [review]
> use a function to convert from GLhandleARB to GLuint
> 
> Vinson, can you try this patch?  There may be other files to fix similarly...

  Compiling src/mesa/main/uniform_query.cpp ...
src/mesa/main/uniform_query.cpp: In function ‘void
_mesa_GetActiveUniform(void*, GLuint, GLsizei, GLsizei*, GLint*, GLenum*,
GLcharARB*)’:
src/mesa/main/uniform_query.cpp:49: error: invalid conversion from ‘void*’ to
‘GLuint’
src/mesa/main/uniform_query.cpp:49: error:   initializing argument 2 of
‘gl_shader_program* _mesa_lookup_shader_program_err(gl_context*, GLuint, const
char*)’

-- 
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