Re: [Mesa-dev] [PATCH 07/43] st/nine: Fix use of D3DSP_NOSWIZZLE

2015-01-31 Thread Henri Verbeet
On 30 January 2015 at 21:34, Axel Davy  wrote:
> @@ -2778,7 +2778,7 @@ sm1_parse_get_param(struct shader_translator *tx, DWORD 
> *reg, DWORD *rel)
>  *rel = (1 << 31) |
>  ((D3DSPR_ADDR << D3DSP_REGTYPE_SHIFT2) & 
> D3DSP_REGTYPE_MASK2) |
>  ((D3DSPR_ADDR << D3DSP_REGTYPE_SHIFT)  & D3DSP_REGTYPE_MASK) 
> |
> -(D3DSP_NOSWIZZLE << D3DSP_SWIZZLE_SHIFT);
> +D3DSP_NOSWIZZLE;
>  else
>  *rel = TOKEN_NEXT(tx);
>  }

I can't help but notice a certain amount of similarity between the
naming and structuring of the SM1 parser here and the one in Wine. I
assume that's because it's the one and only logical way to write such
a parser. Just in case though, I'd like to explicitly state that we'd
welcome anyone reusing Wine's code, provided the terms of the LGPL are
respected.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965/pixel_read: Don't try to do a tiled_memcpy from a multisampled buffer

2015-01-31 Thread Kenneth Graunke
On Friday, January 30, 2015 06:56:22 PM Jason Ekstrand wrote:
> The GL spec guarantees that glGetTexImage will never get a multisampled
> texture, but this is not true for glReadPixels.  If we get a multisampled
> buffer, we have to do a multisample resolve on it before we can pull the
> data down for the user.  Since this isn't practical to handle in
> tiled_memcpy, we just fall back to the other paths that can handle this.
> ---
>  src/mesa/drivers/dri/i965/intel_pixel_read.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c 
> b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> index 15f9e38..f3ab05c 100644
> --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
> +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> @@ -125,6 +125,13 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
>yoffset += irb->mt->level[level].level_y;
> }
>  
> +   /* It is possible that the renderbuffer (or underlying texture) is
> +* multisampled.  Since ReadPixels from a multisampled buffer requires a
> +* multisample resolve, we can't handle this here
> +*/
> +   if (rb->NumSamples > 1)
> +  return false;
> +
> if (!intel_get_memcpy(rb->Format, format, type, &mem_copy, &cpp))
>return false;
>  
> 

Reviewed-by: Kenneth Graunke 

signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] nir: Add an ALU op builder kind of like ir_builder.h

2015-01-31 Thread Kenneth Graunke
On Friday, January 30, 2015 07:27:50 PM Connor Abbott wrote:
> I mentioned this on IRC, but it would be good to add the ability to
> append the sequence of instructions before/after an instruction as
> well as at the beginning or end of a basic block. We would need to
> store the current basic block, the current instruction, and an enum
> consisting of "insert before instruction," "insert after instruction,"
> insert at beginning of block," and "insert at end of block." Doing
> this would make the builder more useful for other places we currently
> create and insert ALU instruction manually -- just grep for
> nir_alu_instr_create(). Also, why isn't there a function for
> initializing the builder structure?
> 
> On Fri, Jan 30, 2015 at 4:07 PM, Eric Anholt  wrote:
> > v2: Rebase on the nir_opcodes.h python code generation support.
> > v3: Use SSA values, and set an appropriate writemask on dot products.
> > v4: Make the arguments be SSA references as well.  This lets you stack up
> > expressions in the arguments of other expressions, at the cost of
> > having to insert a fmov/imov if you want to swizzle.  Also, add
> > the generated file to NIR_GENERATED_FILES.
> > ---
> >  src/glsl/Makefile.am  |  5 ++
> >  src/glsl/Makefile.sources |  1 +
> >  src/glsl/nir/.gitignore   |  1 +
> >  src/glsl/nir/nir_builder.h| 95 
> > +++
> >  src/glsl/nir/nir_builder_opcodes_h.py | 38 ++
> >  5 files changed, 140 insertions(+)
> >  create mode 100644 src/glsl/nir/nir_builder.h
> >  create mode 100644 src/glsl/nir/nir_builder_opcodes_h.py
> >
> > diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
> > index e89a9ad..42c77ae 100644
> > --- a/src/glsl/Makefile.am
> > +++ b/src/glsl/Makefile.am
> > @@ -216,6 +216,7 @@ BUILT_SOURCES = 
> > \
> > glsl_lexer.cpp  \
> > glcpp/glcpp-parse.c \
> > glcpp/glcpp-lex.c   \
> > +   nir/nir_builder_opcodes.h   \
> > nir/nir_constant_expressions.c  \
> > nir/nir_opcodes.c   \
> > nir/nir_opcodes.h   \
> > @@ -232,6 +233,10 @@ dist-hook:
> > $(RM) glcpp/tests/*.out
> > $(RM) glcpp/tests/subtest*/*.out
> >
> > +nir/nir_builder_opcodes.h: nir/nir_opcodes.py nir/nir_builder_opcodes_h.py
> > +   $(MKDIR_P) nir; \
> > +   $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_builder_opcodes_h.py > 
> > $@
> > +
> >  nir/nir_constant_expressions.c: nir/nir_opcodes.py 
> > nir/nir_constant_expressions.py nir/nir_constant_expressions.h
> > $(MKDIR_P) nir; \
> > $(PYTHON2) $(PYTHON_FLAGS) 
> > $(srcdir)/nir/nir_constant_expressions.py > $@
> > diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
> > index face22e..903f733 100644
> > --- a/src/glsl/Makefile.sources
> > +++ b/src/glsl/Makefile.sources
> > @@ -11,6 +11,7 @@ LIBGLCPP_GENERATED_FILES = \
> > glcpp/glcpp-parse.c
> >
> >  NIR_GENERATED_FILES = \
> > +   nir/nir_builder_opcodes.h \
> > nir/nir_constant_expressions.c \
> > nir/nir_opcodes.c \
> > nir/nir_opcodes.h \
> > diff --git a/src/glsl/nir/.gitignore b/src/glsl/nir/.gitignore
> > index 261f64f..64828eb 100644
> > --- a/src/glsl/nir/.gitignore
> > +++ b/src/glsl/nir/.gitignore
> > @@ -1,3 +1,4 @@
> > +nir_builder_opcodes.h
> >  nir_opt_algebraic.c
> >  nir_opcodes.c
> >  nir_opcodes.h
> > diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h
> > new file mode 100644
> > index 000..50e8a20
> > --- /dev/null
> > +++ b/src/glsl/nir/nir_builder.h
> > @@ -0,0 +1,95 @@
> > +/*
> > + * Copyright © 2014-2015 Broadcom
> > + *
> > + * 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

[Mesa-dev] [Bug 88536] AMD graphics hardware hangs with an homogeneous coloured screen or blank screen, and with chirp coming from the graphics card

2015-01-31 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=88536

Alberto Salvia Novella  changed:

   What|Removed |Added

 Status|NEEDINFO|NEW

--- Comment #19 from Alberto Salvia Novella  ---
I can still hang graphics by doing this:

1. Let the computer cool down for several hours.
2. Preferably in the morning, when ambiance is cool, switch on the computer.
3. Using the HTML5 YouTube player, play a video.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
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 88536] AMD graphics hardware hangs with an homogeneous coloured screen or blank screen, and with chirp coming from the graphics card

2015-01-31 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=88536

--- Comment #20 from Alberto Salvia Novella  ---
It looks like if the computer has been on for a while, is harder to make it to
hang.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
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 v2] dir-locals.el: Don't set variables for non-programming modes

2015-01-31 Thread Neil Roberts
This limits the style changes to modes inherited from prog-mode. The
main reason to do this is to avoid setting fill-column for people
using Emacs to edit commit messages because 78 characters is too many
to make it wrap properly in git log. Note that makefile-mode also
inherits from prog-mode so the fill column should continue to apply
there.

v2: Apply to all the .dir-locals.el files, not just the one in the
root directory.
---
 .dir-locals.el| 2 +-
 src/gallium/drivers/freedreno/.dir-locals.el  | 2 +-
 src/gallium/drivers/r600/.dir-locals.el   | 2 +-
 src/gallium/drivers/radeon/.dir-locals.el | 2 +-
 src/gallium/drivers/radeonsi/.dir-locals.el   | 2 +-
 src/gallium/drivers/vc4/.dir-locals.el| 2 +-
 src/gallium/drivers/vc4/kernel/.dir-locals.el | 2 +-
 src/gallium/winsys/radeon/.dir-locals.el  | 2 +-
 src/mesa/drivers/dri/nouveau/.dir-locals.el   | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index 04a1a2c..d95eb48 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,4 +1,4 @@
-((nil
+((prog-mode
   (indent-tabs-mode . nil)
   (tab-width . 8)
   (c-basic-offset . 3)
diff --git a/src/gallium/drivers/freedreno/.dir-locals.el 
b/src/gallium/drivers/freedreno/.dir-locals.el
index c26578b..aa20d49 100644
--- a/src/gallium/drivers/freedreno/.dir-locals.el
+++ b/src/gallium/drivers/freedreno/.dir-locals.el
@@ -1,4 +1,4 @@
-((nil
+((prog-mode
   (indent-tabs-mode . true)
   (tab-width . 4)
   (c-basic-offset . 4)
diff --git a/src/gallium/drivers/r600/.dir-locals.el 
b/src/gallium/drivers/r600/.dir-locals.el
index 8be6a30..4e35c12 100644
--- a/src/gallium/drivers/r600/.dir-locals.el
+++ b/src/gallium/drivers/r600/.dir-locals.el
@@ -1,4 +1,4 @@
-((nil
+((prog-mode
   (indent-tabs-mode . true)
   (tab-width . 8)
   (c-basic-offset . 8)
diff --git a/src/gallium/drivers/radeon/.dir-locals.el 
b/src/gallium/drivers/radeon/.dir-locals.el
index 8be6a30..4e35c12 100644
--- a/src/gallium/drivers/radeon/.dir-locals.el
+++ b/src/gallium/drivers/radeon/.dir-locals.el
@@ -1,4 +1,4 @@
-((nil
+((prog-mode
   (indent-tabs-mode . true)
   (tab-width . 8)
   (c-basic-offset . 8)
diff --git a/src/gallium/drivers/radeonsi/.dir-locals.el 
b/src/gallium/drivers/radeonsi/.dir-locals.el
index 8be6a30..4e35c12 100644
--- a/src/gallium/drivers/radeonsi/.dir-locals.el
+++ b/src/gallium/drivers/radeonsi/.dir-locals.el
@@ -1,4 +1,4 @@
-((nil
+((prog-mode
   (indent-tabs-mode . true)
   (tab-width . 8)
   (c-basic-offset . 8)
diff --git a/src/gallium/drivers/vc4/.dir-locals.el 
b/src/gallium/drivers/vc4/.dir-locals.el
index ed10dc2..ac94242 100644
--- a/src/gallium/drivers/vc4/.dir-locals.el
+++ b/src/gallium/drivers/vc4/.dir-locals.el
@@ -1,4 +1,4 @@
-((nil
+((prog-mode
   (indent-tabs-mode . nil)
   (tab-width . 8)
   (c-basic-offset . 8)
diff --git a/src/gallium/drivers/vc4/kernel/.dir-locals.el 
b/src/gallium/drivers/vc4/kernel/.dir-locals.el
index 2e58e90..49403de 100644
--- a/src/gallium/drivers/vc4/kernel/.dir-locals.el
+++ b/src/gallium/drivers/vc4/kernel/.dir-locals.el
@@ -1,4 +1,4 @@
-((nil
+((prog-mode
   (indent-tabs-mode . t)
   (tab-width . 8)
   (c-basic-offset . 8)
diff --git a/src/gallium/winsys/radeon/.dir-locals.el 
b/src/gallium/winsys/radeon/.dir-locals.el
index 0e937bb..d5f0f04 100644
--- a/src/gallium/winsys/radeon/.dir-locals.el
+++ b/src/gallium/winsys/radeon/.dir-locals.el
@@ -1,4 +1,4 @@
-((nil
+((prog-mode
   (indent-tabs-mode . nil)
   (tab-width . 8)
   (c-basic-offset . 4)
diff --git a/src/mesa/drivers/dri/nouveau/.dir-locals.el 
b/src/mesa/drivers/dri/nouveau/.dir-locals.el
index 29735e8..774f023 100644
--- a/src/mesa/drivers/dri/nouveau/.dir-locals.el
+++ b/src/mesa/drivers/dri/nouveau/.dir-locals.el
@@ -1,4 +1,4 @@
-((nil
+((prog-mode
   (indent-tabs-mode . true)
   (tab-width . 8)
   (c-basic-offset . 8)
-- 
1.9.3

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


Re: [Mesa-dev] [PATCH 01/43] st/nine: Explicit nine requirements

2015-01-31 Thread Ilia Mirkin
On Fri, Jan 30, 2015 at 3:34 PM, Axel Davy  wrote:
> This patch raises nine requirements and disables nine for old
> hw that don't match them.
>
> Currently for these cards only games that don't have tight requirements
> would work well with nine. However nine is missing several checks
> regarding these limitations.
> To make code and future patches less heavy, dropping support for these old
> card seems a good solution.
>
> That makes r500 the only dx9 generation cards supported by nine. It seems the 
> one
> with the less limitations for nine. Still not everything is ok, and we'll have
> for example to implement shader recompilation for these cards to include
> integer and boolean constants in the shader.
> Eventually when this is done, we can reintroduce support for older cards.
>
> Signed-off-by: Axel Davy 
> ---
>  src/gallium/state_trackers/nine/adapter9.c | 106 
> +
>  src/gallium/state_trackers/nine/device9.c  |   9 +--
>  2 files changed, 66 insertions(+), 49 deletions(-)
>
> diff --git a/src/gallium/state_trackers/nine/adapter9.c 
> b/src/gallium/state_trackers/nine/adapter9.c
> index 481f863..bdf547e 100644
> --- a/src/gallium/state_trackers/nine/adapter9.c
> +++ b/src/gallium/state_trackers/nine/adapter9.c
> @@ -39,6 +39,7 @@ NineAdapter9_ctor( struct NineAdapter9 *This,
> struct NineUnknownParams *pParams,
> struct d3dadapter9_context *pCTX )
>  {
> +struct pipe_screen *hal = pCTX->hal;
>  HRESULT hr = NineUnknown_ctor(&This->base, pParams);
>  if (FAILED(hr)) { return hr; }
>
> @@ -46,7 +47,7 @@ NineAdapter9_ctor( struct NineAdapter9 *This,
>  nine_dump_D3DADAPTER_IDENTIFIER9(DBG_CHANNEL, &pCTX->identifier);
>
>  This->ctx = pCTX;
> -if (!This->ctx->hal->get_param(This->ctx->hal, PIPE_CAP_CLIP_HALFZ)) {
> +if (!hal->get_param(hal, PIPE_CAP_CLIP_HALFZ)) {
>  ERR("Driver doesn't support d3d9 coordinates\n");
>  return D3DERR_DRIVERINTERNALERROR;
>  }
> @@ -54,7 +55,44 @@ NineAdapter9_ctor( struct NineAdapter9 *This,
>  !This->ctx->ref->get_param(This->ctx->ref, PIPE_CAP_CLIP_HALFZ)) {
>  ERR("Warning: Sotware rendering driver doesn't support d3d9 
> coordinates\n");
>  }
> -
> +/* Old cards had tricks to bypass some restrictions to implement
> + * everything and fit tight the requirements: number of constants,
> + * number of temp registers, special behaviours, etc. Since we don't
> + * have access to all this, we need a bit more than what dx9 required.
> + * For example we have to use more than 32 temp registers to emulate
> + * behaviours, while some dx9 hw don't have more. As for sm2 hardware,
> + * we could support vs2 / ps2 for them but it needs some more care, and
> + * as these are very old, we choose to drop support for them */
> +
> +/* checks minimum requirements, most are vs3/ps3 strict requirements */
> +if (!hal->get_param(hal, PIPE_CAP_SM3) ||
> +hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
> +  PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE) < 256 * 
> sizeof(float[4]) ||
> +hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
> +  PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE) < 244 * 
> sizeof(float[4]) ||
> +hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
> +  PIPE_SHADER_CAP_MAX_TEMPS) < 32 ||
> +hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
> +  PIPE_SHADER_CAP_MAX_TEMPS) < 32 ||
> +hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
> +  PIPE_SHADER_CAP_MAX_INPUTS) < 16 ||
> +hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
> +  PIPE_SHADER_CAP_MAX_INPUTS) < 10) {
> +ERR("Your card is not supported by Gallium Nine. Minimum requirement 
> "
> +"is >= r500, >= nv50, >= i965\n");

">= i965 gen6" i assume? alternatively ">= snb"?

Up to you...


> +return D3DERR_DRIVERINTERNALERROR;
> +}
> +/* for r500 */
> +if (hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
> +  PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE) < 276 * 
> sizeof(float[4]) || /* we put bool and int constants with float constants */
> +hal->get_shader_param(hal, PIPE_SHADER_VERTEX,
> +  PIPE_SHADER_CAP_MAX_TEMPS) < 40 || /* we use 
> some more temp registers */
> +hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
> +  PIPE_SHADER_CAP_MAX_TEMPS) < 40 ||
> +hal->get_shader_param(hal, PIPE_SHADER_FRAGMENT,
> +  PIPE_SHADER_CAP_MAX_INPUTS) < 20) /* we don't 
> pack inputs as much as we could */
> +ERR("Your card is at the limit of Gallium Nine requirements. Some 
> games "
> +"may run into issues because requirements are too tight\n");

Can't say this sentence makes much s

Re: [Mesa-dev] [PATCH 02/43] st/nine: Refactor how user constbufs sizes are calculated

2015-01-31 Thread Ilia Mirkin
On Fri, Jan 30, 2015 at 3:34 PM, Axel Davy  wrote:
> Count explicitly the slots for float, int and bool constants,
> and deduce the constbuf size in nine_shader.
>
> Signed-off-by: Axel Davy 
> ---
>  src/gallium/state_trackers/nine/nine_shader.c   | 17 ++---
>  src/gallium/state_trackers/nine/nine_shader.h   | 22 ++
>  src/gallium/state_trackers/nine/nine_state.h|  5 -
>  src/gallium/state_trackers/nine/pixelshader9.c  |  1 -
>  src/gallium/state_trackers/nine/vertexshader9.c |  2 --
>  5 files changed, 24 insertions(+), 23 deletions(-)
>
> diff --git a/src/gallium/state_trackers/nine/nine_shader.c 
> b/src/gallium/state_trackers/nine/nine_shader.c
> index 944b646..1984087 100644
> --- a/src/gallium/state_trackers/nine/nine_shader.c
> +++ b/src/gallium/state_trackers/nine/nine_shader.c
> @@ -2995,7 +2995,9 @@ tx_ctor(struct shader_translator *tx, struct 
> nine_shader_info *info)
>  info->position_t = FALSE;
>  info->point_size = FALSE;
>
> -tx->info->const_used_size = 0;
> +tx->info->num_float_consts_slots = 0;
> +tx->info->num_int_consts_slots = 0;
> +tx->info->num_bool_consts_slots = 0;
>
>  info->sampler_mask = 0x0;
>  info->rt_mask = 0x0;
> @@ -3065,6 +3067,7 @@ nine_translate_shader(struct NineDevice9 *device, 
> struct nine_shader_info *info)
>  struct shader_translator *tx;
>  HRESULT hr = D3D_OK;
>  const unsigned processor = tgsi_processor_from_type(info->type);
> +unsigned slot_max;
>
>  user_assert(processor != ~0, D3DERR_INVALIDCALL);
>
> @@ -3196,8 +3199,16 @@ nine_translate_shader(struct NineDevice9 *device, 
> struct nine_shader_info *info)
>  hr = D3D_OK;
>  }
>
> -if (tx->indirect_const_access)
> -info->const_used_size = ~0;
> +if (tx->indirect_const_access) /* vs only */
> +info->num_float_consts_slots = device->max_vs_const_f;
> +
> +slot_max = info->num_bool_consts_slots > 0 ?
> +   device->max_vs_const_f + NINE_MAX_CONST_I
> +   + info->num_bool_consts_slots :
> +   info->num_int_consts_slots > 0 ?
> +   device->max_vs_const_f + info->num_int_consts_slots :
> +   info->num_float_consts_slots;

Please use an if ladder, no reason to make it so difficult to read.

> +info->const_used_size = sizeof(float[4]) * slot_max; /* slots start from 
> 1 */
>
>  info->cso = ureg_create_shader_and_destroy(tx->ureg, device->pipe);
>  if (!info->cso) {
> diff --git a/src/gallium/state_trackers/nine/nine_shader.h 
> b/src/gallium/state_trackers/nine/nine_shader.h
> index ddee372..027f765 100644
> --- a/src/gallium/state_trackers/nine/nine_shader.h
> +++ b/src/gallium/state_trackers/nine/nine_shader.h
> @@ -63,32 +63,30 @@ struct nine_shader_info
>  unsigned const_b_base; /* in vec4 (16 byte) units */
>  unsigned const_used_size;
>
> +unsigned num_float_consts_slots;
> +unsigned num_int_consts_slots;
> +unsigned num_bool_consts_slots;

You're more familiar with this code, but these names seem jarring
relative to the other stuff... why not

const_float_slots
const_int_slots

etc

Actually these are regarding the *used* slots right? So then it should be

const_float_used
const_int_used

etc?

> +
>  struct nine_lconstf lconstf; /* out, NOTE: members to be free'd by user 
> */
>  };
>
>  static INLINE void
>  nine_info_mark_const_f_used(struct nine_shader_info *info, int idx)
>  {
> -unsigned size = (idx + 1) * 16;
> -
> -if (info->const_used_size < size)
> -info->const_used_size = size;
> +if (info->num_float_consts_slots < (idx + 1))
> +info->num_float_consts_slots = idx + 1;
>  }
>  static INLINE void
>  nine_info_mark_const_i_used(struct nine_shader_info *info, int idx)
>  {
> -unsigned size = (info->const_i_base + (idx + 1)) * 16;
> -
> -if (info->const_used_size < size)
> -info->const_used_size = size;
> +if (info->num_int_consts_slots < (idx + 1))
> +info->num_int_consts_slots = idx + 1;
>  }
>  static INLINE void
>  nine_info_mark_const_b_used(struct nine_shader_info *info, int idx)
>  {
> -unsigned size = (info->const_b_base + ((idx + 4) / 4)) * 16;
> -
> -if (info->const_used_size < size)
> -info->const_used_size = size;
> +if (info->num_bool_consts_slots < (idx + 1))
> +info->num_bool_consts_slots = idx + 1;
>  }
>
>  HRESULT
> diff --git a/src/gallium/state_trackers/nine/nine_state.h 
> b/src/gallium/state_trackers/nine/nine_state.h
> index 58ca8c9..927bfe1 100644
> --- a/src/gallium/state_trackers/nine/nine_state.h
> +++ b/src/gallium/state_trackers/nine/nine_state.h
> @@ -91,11 +91,6 @@
>  ((nconstf)* 4 * sizeof(float) + \
>   NINE_MAX_CONST_I * 4 * sizeof(int))
>
> -#define NINE_CONSTBUF_SIZE(nconstf) \
> -((nconstf)* 4 * sizeof(float) + \
> - NINE_MAX_CONST_I * 4 * sizeof(int) + \
> - NINE_MAX_CONST_B * 1 * sizeof(float))
> -
>

Re: [Mesa-dev] [PATCH 20/43] st/nine: Implement AMD alpha to coverage

2015-01-31 Thread Ilia Mirkin
On Fri, Jan 30, 2015 at 3:34 PM, Axel Davy  wrote:
> This D3D hack is supposed to be supported
> by all AMD SM2+ cards. Apps use it without
> checking if they are on AMD.
>
> Signed-off-by: Axel Davy 
> ---
>  src/gallium/state_trackers/nine/device9.c| 17 +++--
>  src/gallium/state_trackers/nine/nine_pipe.c  |  2 +-
>  src/gallium/state_trackers/nine/nine_state.c |  3 ++-
>  src/gallium/state_trackers/nine/nine_state.h |  3 ++-
>  4 files changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/state_trackers/nine/device9.c 
> b/src/gallium/state_trackers/nine/device9.c
> index a446c8f..63f9f16 100644
> --- a/src/gallium/state_trackers/nine/device9.c
> +++ b/src/gallium/state_trackers/nine/device9.c
> @@ -2049,6 +2049,9 @@ NineDevice9_ResolveZ( struct NineDevice9 *This )
>  return D3D_OK;
>  }
>
> +#define ALPHA_TO_COVERAGE_ENABLE   MAKEFOURCC('A', '2', 'M', '1')
> +#define ALPHA_TO_COVERAGE_DISABLE  MAKEFOURCC('A', '2', 'M', '0')
> +
>  HRESULT WINAPI
>  NineDevice9_SetRenderState( struct NineDevice9 *This,
>  D3DRENDERSTATETYPE State,
> @@ -2059,8 +2062,18 @@ NineDevice9_SetRenderState( struct NineDevice9 *This,
>  DBG("This=%p State=%u(%s) Value=%08x\n", This,
>  State, nine_d3drs_to_string(State), Value);
>
> -if (State == D3DRS_POINTSIZE && Value == RESZ_CODE)
> -return NineDevice9_ResolveZ(This);
> +/* Amd hacks (equivalent to GL extensions) */
> +if (State == D3DRS_POINTSIZE) {
> +if (Value == RESZ_CODE)
> +return NineDevice9_ResolveZ(This);
> +
> +if (Value == ALPHA_TO_COVERAGE_ENABLE ||
> +Value == ALPHA_TO_COVERAGE_DISABLE) {
> +state->rs[NINED3DRS_ALPHACOVERAGE] = (Value == 
> ALPHA_TO_COVERAGE_ENABLE);
> +state->changed.group |= NINE_STATE_BLEND;

Only if it actually changed, no?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 5/8] mesa: Validate original image internal format rather than derived mesa format.

2015-01-31 Thread Francisco Jerez
This matches what _mesa_BindImageTextures() does.  The derived image format
(gl_texture_image::TexFormat) isn't necessarily equivalent to the internal
format of the texture image.  If a forbidden internal format has been
specified we need to mark the image unit as invalid as required by the spec,
regardless of the derived format.  Fixes the "invalid"
ARB_shader_image_load_store piglit test.
---
 src/mesa/main/shaderimage.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index cb88d9c..8caff2f 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -353,7 +353,7 @@ validate_image_unit(struct gl_context *ctx, struct 
gl_image_unit *u)
   return GL_FALSE;
 
if (t->Target == GL_TEXTURE_BUFFER) {
-  tex_format = t->_BufferObjectFormat;
+  tex_format = _mesa_get_shader_image_format(t->BufferObjectFormat);
 
} else {
   struct gl_texture_image *img = (t->Target == GL_TEXTURE_CUBE_MAP ?
@@ -363,10 +363,10 @@ validate_image_unit(struct gl_context *ctx, struct 
gl_image_unit *u)
   if (!img || img->Border || img->NumSamples > ctx->Const.MaxImageSamples)
  return GL_FALSE;
 
-  tex_format = img->TexFormat;
+  tex_format = _mesa_get_shader_image_format(img->InternalFormat);
}
 
-   if (get_image_format_class(tex_format) == IMAGE_FORMAT_CLASS_NONE)
+   if (!tex_format)
   return GL_FALSE;
 
switch (t->ImageFormatCompatibilityType) {
-- 
2.1.3

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


[Mesa-dev] [PATCH 6/8] mesa: Implement image uniform queries.

2015-01-31 Thread Francisco Jerez
---
 src/mesa/main/uniform_query.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 32870d0..82e5e38 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -362,7 +362,8 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, 
GLint location,
  &&
  (uni->type->base_type == GLSL_TYPE_INT
   || uni->type->base_type == GLSL_TYPE_UINT
-  || uni->type->base_type == GLSL_TYPE_SAMPLER))) {
+  || uni->type->base_type == GLSL_TYPE_SAMPLER
+   || uni->type->base_type == GLSL_TYPE_IMAGE))) {
 memcpy(paramsOut, src, bytes);
   } else {
 union gl_constant_value *const dst =
@@ -381,6 +382,7 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, 
GLint location,
  break;
   case GLSL_TYPE_INT:
   case GLSL_TYPE_SAMPLER:
+  case GLSL_TYPE_IMAGE:
  dst[i].f = (float) src[i].i;
  break;
   case GLSL_TYPE_BOOL:
-- 
2.1.3

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


[Mesa-dev] [PATCH 1/8] mesa: Export shader image format to mesa format conversion function.

2015-01-31 Thread Francisco Jerez
This function will be useful for back-ends to translate an image internal
format as specified in GLSL code into a mesa format.
---
 src/mesa/main/shaderimage.c | 10 +-
 src/mesa/main/shaderimage.h |  7 +++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index dcbcca6..f812073 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -58,8 +58,8 @@
 # define MESA_FORMAT_SIGNED_RG_8 MESA_FORMAT_R8G8_SNORM
 #endif
 
-static mesa_format
-get_image_format(GLenum format)
+mesa_format
+_mesa_get_shader_image_format(GLenum format)
 {
switch (format) {
case GL_RGBA32F:
@@ -421,7 +421,7 @@ validate_bind_image_texture(struct gl_context *ctx, GLuint 
unit,
   return GL_FALSE;
}
 
-   if (!get_image_format(format)) {
+   if (!_mesa_get_shader_image_format(format)) {
   _mesa_error(ctx, GL_INVALID_VALUE, "glBindImageTexture(format)");
   return GL_FALSE;
}
@@ -458,7 +458,7 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint 
level,
   u->Level = level;
   u->Access = access;
   u->Format = format;
-  u->_ActualFormat = get_image_format(format);
+  u->_ActualFormat = _mesa_get_shader_image_format(format);
 
   if (_mesa_tex_target_is_layered(t->Target)) {
  u->Layered = layered;
@@ -573,7 +573,7 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const 
GLuint *textures)
 continue;
  }
 
- actualFormat = get_image_format(image->InternalFormat);
+ actualFormat = _mesa_get_shader_image_format(image->InternalFormat);
 
  if (actualFormat == MESA_FORMAT_NONE) {
 /* The ARB_multi_bind spec says:
diff --git a/src/mesa/main/shaderimage.h b/src/mesa/main/shaderimage.h
index 733ac77..4aa859c 100644
--- a/src/mesa/main/shaderimage.h
+++ b/src/mesa/main/shaderimage.h
@@ -28,10 +28,17 @@
 #define SHADERIMAGE_H
 
 #include "glheader.h"
+#include "formats.h"
 
 struct gl_context;
 
 /**
+ * Get the matching mesa_format for a shader image format GL enum.
+ */
+mesa_format
+_mesa_get_shader_image_format(GLenum format);
+
+/**
  * Recalculate the \c _Valid flag of a context's shader image units.
  *
  * To be called when the state of any texture bound to an image unit
-- 
2.1.3

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


[Mesa-dev] [PATCH 4/8] mesa: Call _mesa_test_texobj_completeness() before using _MaxLevel in image validation.

2015-01-31 Thread Francisco Jerez
gl_texture_object::_MaxLevel doesn't have any meaningful value until
_mesa_test_texobj_completeness() has been run.  Fixes the "level"
ARB_shader_image_load_store piglit test.
---
 src/mesa/main/shaderimage.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index 005698c..cb88d9c 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -337,13 +337,14 @@ validate_image_unit(struct gl_context *ctx, struct 
gl_image_unit *u)
struct gl_texture_object *t = u->TexObj;
mesa_format tex_format;
 
-   if (!t || u->Level < t->BaseLevel ||
-   u->Level > t->_MaxLevel)
+   if (!t)
   return GL_FALSE;
 
_mesa_test_texobj_completeness(ctx, t);
 
-   if ((u->Level == t->BaseLevel && !t->_BaseComplete) ||
+   if (u->Level < t->BaseLevel ||
+   u->Level > t->_MaxLevel ||
+   (u->Level == t->BaseLevel && !t->_BaseComplete) ||
(u->Level != t->BaseLevel && !t->_MipmapComplete))
   return GL_FALSE;
 
-- 
2.1.3

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


[Mesa-dev] [PATCH 3/8] mesa: Add support for binding a buffer texture to a shader image unit.

2015-01-31 Thread Francisco Jerez
---
 src/mesa/main/shaderimage.c | 73 ++---
 1 file changed, 42 insertions(+), 31 deletions(-)

diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index f812073..005698c 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -335,7 +335,7 @@ static GLboolean
 validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
 {
struct gl_texture_object *t = u->TexObj;
-   struct gl_texture_image *img;
+   mesa_format tex_format;
 
if (!t || u->Level < t->BaseLevel ||
u->Level > t->_MaxLevel)
@@ -351,25 +351,32 @@ validate_image_unit(struct gl_context *ctx, struct 
gl_image_unit *u)
u->Layer >= _mesa_get_texture_layers(t, u->Level))
   return GL_FALSE;
 
-   if (t->Target == GL_TEXTURE_CUBE_MAP)
-  img = t->Image[u->Layer][u->Level];
-   else
-  img = t->Image[0][u->Level];
+   if (t->Target == GL_TEXTURE_BUFFER) {
+  tex_format = t->_BufferObjectFormat;
 
-   if (!img || img->Border ||
-   get_image_format_class(img->TexFormat) == IMAGE_FORMAT_CLASS_NONE ||
-   img->NumSamples > ctx->Const.MaxImageSamples)
+   } else {
+  struct gl_texture_image *img = (t->Target == GL_TEXTURE_CUBE_MAP ?
+  t->Image[u->Layer][u->Level] :
+  t->Image[0][u->Level]);
+
+  if (!img || img->Border || img->NumSamples > ctx->Const.MaxImageSamples)
+ return GL_FALSE;
+
+  tex_format = img->TexFormat;
+   }
+
+   if (get_image_format_class(tex_format) == IMAGE_FORMAT_CLASS_NONE)
   return GL_FALSE;
 
switch (t->ImageFormatCompatibilityType) {
case GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE:
-  if (_mesa_get_format_bytes(img->TexFormat) !=
+  if (_mesa_get_format_bytes(tex_format) !=
   _mesa_get_format_bytes(u->_ActualFormat))
  return GL_FALSE;
   break;
 
case GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS:
-  if (get_image_format_class(img->TexFormat) !=
+  if (get_image_format_class(tex_format) !=
   get_image_format_class(u->_ActualFormat))
  return GL_FALSE;
   break;
@@ -535,8 +542,7 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const 
GLuint *textures)
 
   if (texture != 0) {
  struct gl_texture_object *texObj;
- struct gl_texture_image *image;
- mesa_format actualFormat;
+ GLenum tex_format;
 
  if (!u->TexObj || u->TexObj->Name != texture) {
 texObj = _mesa_lookup_texture_locked(ctx, texture);
@@ -557,25 +563,30 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, 
const GLuint *textures)
 texObj = u->TexObj;
  }
 
- image = texObj->Image[0][0];
+ if (texObj->Target == GL_TEXTURE_BUFFER) {
+tex_format = texObj->BufferObjectFormat;
+ } else {
+struct gl_texture_image *image = texObj->Image[0][0];
 
- if (!image || image->Width == 0 || image->Height == 0 || image->Depth 
== 0) {
-/* The ARB_multi_bind spec says:
- *
- *"An INVALID_OPERATION error is generated if the width,
- * height, or depth of the level zero texture image of
- * any texture in  is zero (per binding)."
- */
-_mesa_error(ctx, GL_INVALID_OPERATION,
-"glBindImageTextures(the width, height or depth "
-"of the level zero texture image of "
-"textures[%d]=%u is zero)", i, texture);
-continue;
- }
+if (!image || image->Width == 0 || image->Height == 0 ||
+image->Depth == 0) {
+   /* The ARB_multi_bind spec says:
+*
+*"An INVALID_OPERATION error is generated if the width,
+* height, or depth of the level zero texture image of
+* any texture in  is zero (per binding)."
+*/
+   _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glBindImageTextures(the width, height or depth "
+   "of the level zero texture image of "
+   "textures[%d]=%u is zero)", i, texture);
+   continue;
+}
 
- actualFormat = _mesa_get_shader_image_format(image->InternalFormat);
+tex_format = image->InternalFormat;
+ }
 
- if (actualFormat == MESA_FORMAT_NONE) {
+ if (_mesa_get_shader_image_format(tex_format) == MESA_FORMAT_NONE) {
 /* The ARB_multi_bind spec says:
  *
  *   "An INVALID_OPERATION error is generated if the internal
@@ -586,7 +597,7 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const 
GLuint *textures)
 "glBindImageTextures(the internal format %s of "
 "the level zero texture image of textures[%d]=%u "
   

[Mesa-dev] [PATCH 2/8] mesa: Add extern "C" guards to shaderimage.h to allow inclusion from C++ code.

2015-01-31 Thread Francisco Jerez
---
 src/mesa/main/shaderimage.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/main/shaderimage.h b/src/mesa/main/shaderimage.h
index 4aa859c..1c7d1e0 100644
--- a/src/mesa/main/shaderimage.h
+++ b/src/mesa/main/shaderimage.h
@@ -30,6 +30,10 @@
 #include "glheader.h"
 #include "formats.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct gl_context;
 
 /**
@@ -58,4 +62,8 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const 
GLuint *textures);
 void GLAPIENTRY
 _mesa_MemoryBarrier(GLbitfield barriers);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
-- 
2.1.3

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


[Mesa-dev] [PATCH 7/8] mesa: Initialize image units to default state on context creation.

2015-01-31 Thread Francisco Jerez
This is the required initial image unit state according to "Table 23.45. Image
State (state per image unit)" of the OpenGL 4.3 specification.
---
 src/mesa/main/context.c |  2 ++
 src/mesa/main/shaderimage.c | 13 +
 src/mesa/main/shaderimage.h |  6 ++
 3 files changed, 21 insertions(+)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 63d30a2..11f3c13 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -118,6 +118,7 @@
 #include "scissor.h"
 #include "shared.h"
 #include "shaderobj.h"
+#include "shaderimage.h"
 #include "util/simple_list.h"
 #include "state.h"
 #include "stencil.h"
@@ -820,6 +821,7 @@ init_attrib_groups(struct gl_context *ctx)
_mesa_init_feedback( ctx );
_mesa_init_fog( ctx );
_mesa_init_hint( ctx );
+   _mesa_init_image_units( ctx );
_mesa_init_line( ctx );
_mesa_init_lighting( ctx );
_mesa_init_matrix( ctx );
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index 8caff2f..3189500 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -331,6 +331,19 @@ get_image_format_class(mesa_format format)
}
 }
 
+void
+_mesa_init_image_units(struct gl_context *ctx)
+{
+   unsigned i;
+
+   for (i = 0; i < Elements(ctx->ImageUnits); ++i) {
+  struct gl_image_unit *u = &ctx->ImageUnits[i];
+  u->Access = GL_READ_ONLY;
+  u->Format = GL_R8;
+  u->_ActualFormat = _mesa_get_shader_image_format(u->Format);
+   }
+}
+
 static GLboolean
 validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
 {
diff --git a/src/mesa/main/shaderimage.h b/src/mesa/main/shaderimage.h
index 1c7d1e0..33d8a1e 100644
--- a/src/mesa/main/shaderimage.h
+++ b/src/mesa/main/shaderimage.h
@@ -43,6 +43,12 @@ mesa_format
 _mesa_get_shader_image_format(GLenum format);
 
 /**
+ * Initialize a context's shader image units to the default state.
+ */
+void
+_mesa_init_image_units(struct gl_context *ctx);
+
+/**
  * Recalculate the \c _Valid flag of a context's shader image units.
  *
  * To be called when the state of any texture bound to an image unit
-- 
2.1.3

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


[Mesa-dev] [PATCH 8/8] mesa: Update image unit state when glBindImageTexture is called with texture=0.

2015-01-31 Thread Francisco Jerez
There's no indication in the spec that the image unit state other than the
bound texture object shouldn't be updated when glBindImageTexture() is called
passing the zero texture as argument.  It's very unlikely that any application
would ever have relied on this, but it's easy to get right, and it fixes the
"state" ARB_shader_image_load_store piglit test.
---
 src/mesa/main/shaderimage.c | 31 +++
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index 3189500..86aa709 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -456,7 +456,6 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint 
level,
GLenum format)
 {
GET_CURRENT_CONTEXT(ctx);
-   struct gl_texture_object *t = NULL;
struct gl_image_unit *u;
 
if (!validate_bind_image_texture(ctx, unit, texture, level,
@@ -469,34 +468,34 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint 
level,
ctx->NewDriverState |= ctx->DriverFlags.NewImageUnits;
 
if (texture) {
-  t = _mesa_lookup_texture(ctx, texture);
+  struct gl_texture_object *t = _mesa_lookup_texture(ctx, texture);
+
   if (!t) {
  _mesa_error(ctx, GL_INVALID_VALUE, "glBindImageTexture(texture)");
  return;
   }
 
   _mesa_reference_texobj(&u->TexObj, t);
-  u->Level = level;
-  u->Access = access;
-  u->Format = format;
-  u->_ActualFormat = _mesa_get_shader_image_format(format);
-
-  if (_mesa_tex_target_is_layered(t->Target)) {
- u->Layered = layered;
- u->Layer = (layered ? 0 : layer);
-  } else {
- u->Layered = GL_FALSE;
- u->Layer = 0;
-  }
-
} else {
   _mesa_reference_texobj(&u->TexObj, NULL);
}
 
+   u->Level = level;
+   u->Access = access;
+   u->Format = format;
+   u->_ActualFormat = _mesa_get_shader_image_format(format);
u->_Valid = validate_image_unit(ctx, u);
 
+   if (u->TexObj && _mesa_tex_target_is_layered(u->TexObj->Target)) {
+  u->Layered = layered;
+  u->Layer = (layered ? 0 : layer);
+   } else {
+  u->Layered = GL_FALSE;
+  u->Layer = 0;
+   }
+
if (ctx->Driver.BindImageTexture)
-  ctx->Driver.BindImageTexture(ctx, u, t, level, layered,
+  ctx->Driver.BindImageTexture(ctx, u, u->TexObj, level, layered,
layer, access, format);
 }
 
-- 
2.1.3

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


[Mesa-dev] [Bug 88534] include/c11/threads_posix.h PTHREAD_MUTEX_RECURSIVE_NP not defined

2015-01-31 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=88534

--- Comment #1 from felix.ja...@posteo.de ---
Patch now sent instead to mesa-dev.

-- 
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 88534] include/c11/threads_posix.h PTHREAD_MUTEX_RECURSIVE_NP not defined

2015-01-31 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=88534

felix.ja...@posteo.de changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |MOVED

-- 
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 4/4] i965: Allow Y-tiled allocations for large surfaces

2015-01-31 Thread Jordan Justen
I agree with Jason's comments on 3 & 4. I think I asked something
similar previously regarding patch 3. (Ie, why not just do the
adjustments all the time?)

With Jason's comments fixed, series
Reviewed-by: Jordan Justen 

On 2015-01-14 10:34:52, Jason Ekstrand wrote:
> 
> 
> On Tue, Jan 13, 2015 at 11:37 PM, Ben Widawsky 
> wrote:
> 
> This patch will use a new calculation to determine if a surface can be
> blitted
> from or to. Previously, the "total_height" member was used. Total_height 
> in
> the
> case of 2d, 3d, and cube map arrays is the height of each 
> slice/layer/face.
> Since the GL map APIS only ever deal with a slice at a time however, the
> determining factor is really the height of one slice.
> 
> This patch also has a side effect of not needing to set potentially large
> texture objects to the CPU domain, which implies we do not need to clflush
> the
> entire objects. (See references below for a kernel patch to achieve the
> same
> thing)
> 
> With both the Y-tiled surfaces, and the removal of excessive clflushes,
> this
> improves the terrain benchmark on Cherryview (data collected by Jordan)
> 
> Difference at 95.0% confidence
> 17.9236 +/- 0.252116 153.005% +/- 2.1522% (Student's t, pooled s =
> 0.205889)
> 
> With the performance governor, and HI-Z raw stall optimization, the
> improvement
> is even more stark on Braswell.
> 
> Jordan was extremely helpful in creating this patch. Consider him
> co-author.
> 
> References: http://patchwork.freedesktop.org/patch/38909/
> Cc: Jordan Justen 
> Signed-off-by: Ben Widawsky 
> ---
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 71
> +--
>  1 file changed, 56 insertions(+), 15 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/
> drivers/dri/i965/intel_mipmap_tree.c
> index 639309b..1319f1e 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -86,6 +86,27 @@ compute_msaa_layout(struct brw_context *brw, 
> mesa_format
> format, GLenum target)
> }
>  }
> 
> +static uint32_t
> +compute_real_blit_height(struct intel_mipmap_tree *mt)
> +{
> +   switch (mt->target) {
> +   case GL_TEXTURE_CUBE_MAP:
> +   case GL_TEXTURE_1D_ARRAY:
> +   case GL_TEXTURE_2D_ARRAY:
> +   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> +   case GL_TEXTURE_CUBE_MAP_ARRAY:
> +  assert(mt->logical_depth0);
> +  return mt->qpitch;
> +   case GL_TEXTURE_3D:
> +  /* FIXME 3d textures don't have a qpitch. I think it's simply the
> tiled
> +   * aligned mt->physical_height0. Since 3D textures aren't used
> often, just
> +   * print the perf debug from the caller and bail
> +   */
> +   /* fallthrough */
> +   default:
> +  return mt->total_height;
> +   }
> +}
> 
>  /**
>   * For single-sampled render targets ("non-MSRT"), the MCS buffer is a
> @@ -416,6 +437,17 @@ intel_miptree_create_layout(struct brw_context *brw,
> return mt;
>  }
> 
> +static bool
> +miptree_exceeds_blit_height(struct intel_mipmap_tree *mt)
> +{
> +   /* FIXME: Add 3d texture support */
> +   if (mt->target == GL_TEXTURE_3D && mt->total_height >= 32768) {
> +  return true;
> +   }
> +
> +   return compute_real_blit_height(mt) >= 32768;
> 
> 
> I don't think this is quite correct.  Let's say we have 2D array texture with 
> a
> qpitch of 32767.  Then slice 1 (the second slice) will start at 32767.  Since
> we have to align to a tile, the vertical offset we use for the blit will be
> 32768 - tile_height.  Then the Y2 coordinat will be (2 * 32767) - (32768 -
> tile_height) which is greater than 32767.  If we just give ourselves an extra
> tile_height of padding here, it should solve this problem.  Probably want to
> throw the above in as a comment as well.
>  
> 
> +}
> +
>  /**
>   * \brief Helper function for intel_miptree_create().
>   */
> @@ -473,10 +505,22 @@ intel_miptree_choose_tiling(struct brw_context *brw,
> if (minimum_pitch < 64)
>return I915_TILING_NONE;
> 
> -   if (ALIGN(minimum_pitch, 512) >= 32768 ||
> -   mt->total_width >= 32768 || mt->total_height >= 32768) {
> -  perf_debug("%dx%d miptree too large to blit, falling back to
> untiled",
> - mt->total_width, mt->total_height);
> +   if (ALIGN(minimum_pitch, 512) >= 32768 || miptree_exceeds_blit_height
> (mt)) {
> +  if (mt->format == GL_TEXTURE_3D) {
> + perf_debug("Unsupported large 3D texture blit. "
> +"Falling back to untiled.\n");
> +  } else {
> + /* qpitch should always be greater than or equal to the tile
>

Re: [Mesa-dev] [PATCH 03/43] st/nine: Declare constants only up to the maximum needed.

2015-01-31 Thread Ilia Mirkin
On Fri, Jan 30, 2015 at 3:34 PM, Axel Davy  wrote:
> Previously 276 constants were declared everytime.
>
> This patch makes shaders declare constants up to the maximum
> constant needed and moves the moment we print the TGSI
> shader after the moment we declare the constants.
>
> This is needed for r500, since when indirect addressing is used,
> it cannot reduce the amount of constants needed, and that it is
> restricted to 256 constant slots.
>
> Signed-off-by: Axel Davy 
> ---
>  src/gallium/state_trackers/nine/nine_shader.c | 38 
> ---
>  1 file changed, 11 insertions(+), 27 deletions(-)
>
> diff --git a/src/gallium/state_trackers/nine/nine_shader.c 
> b/src/gallium/state_trackers/nine/nine_shader.c
> index 1984087..8a8695a 100644
> --- a/src/gallium/state_trackers/nine/nine_shader.c
> +++ b/src/gallium/state_trackers/nine/nine_shader.c
> @@ -620,24 +620,6 @@ tx_src_scalar(struct ureg_dst dst)
>  return src;
>  }
>
> -/* Need to declare all constants if indirect addressing is used,
> - * otherwise we could scan the shader to determine the maximum.
> - * TODO: It doesn't really matter for nv50 so I won't do the scan,
> - * but radeon drivers might care, if they don't infer it from TGSI.
> - */
> -static void
> -tx_decl_constants(struct shader_translator *tx)
> -{
> -unsigned i, n = 0;
> -
> -for (i = 0; i < NINE_MAX_CONST_F; ++i)
> -ureg_DECL_constant(tx->ureg, n++);
> -for (i = 0; i < NINE_MAX_CONST_I; ++i)
> -ureg_DECL_constant(tx->ureg, n++);
> -for (i = 0; i < (NINE_MAX_CONST_B / 4); ++i)
> -ureg_DECL_constant(tx->ureg, n++);
> -}
> -
>  static INLINE void
>  tx_temp_alloc(struct shader_translator *tx, INT idx)
>  {
> @@ -3067,7 +3049,7 @@ nine_translate_shader(struct NineDevice9 *device, 
> struct nine_shader_info *info)
>  struct shader_translator *tx;
>  HRESULT hr = D3D_OK;
>  const unsigned processor = tgsi_processor_from_type(info->type);
> -unsigned slot_max;
> +unsigned s, slot_max;
>
>  user_assert(processor != ~0, D3DERR_INVALIDCALL);
>
> @@ -3095,7 +3077,6 @@ nine_translate_shader(struct NineDevice9 *device, 
> struct nine_shader_info *info)
>  hr = E_OUTOFMEMORY;
>  goto out;
>  }
> -tx_decl_constants(tx);
>
>  tx->native_integers = GET_SHADER_CAP(INTEGERS);
>  tx->inline_subroutines = !GET_SHADER_CAP(SUBROUTINES);
> @@ -3134,13 +3115,6 @@ nine_translate_shader(struct NineDevice9 *device, 
> struct nine_shader_info *info)
>  if (IS_VS && !ureg_dst_is_undef(tx->regs.oPts))
>  info->point_size = TRUE;
>
> -if (debug_get_bool_option("NINE_TGSI_DUMP", FALSE)) {
> -unsigned count;
> -const struct tgsi_token *toks = ureg_get_tokens(tx->ureg, &count);
> -tgsi_dump(toks, 0);
> -ureg_free_tokens(toks);
> -}
> -
>  /* record local constants */
>  if (tx->num_lconstf && tx->indirect_const_access) {
>  struct nine_range *ranges;
> @@ -3210,6 +3184,16 @@ nine_translate_shader(struct NineDevice9 *device, 
> struct nine_shader_info *info)
> info->num_float_consts_slots;
>  info->const_used_size = sizeof(float[4]) * slot_max; /* slots start from 
> 1 */
>
> +for(s = 0; s < slot_max; s++)

for (

With that fixed, Reviewed-by: Ilia Mirkin 

> +ureg_DECL_constant(tx->ureg, s);
> +
> +if (debug_get_bool_option("NINE_TGSI_DUMP", FALSE)) {
> +unsigned count;
> +const struct tgsi_token *toks = ureg_get_tokens(tx->ureg, &count);
> +tgsi_dump(toks, 0);
> +ureg_free_tokens(toks);
> +}
> +
>  info->cso = ureg_create_shader_and_destroy(tx->ureg, device->pipe);
>  if (!info->cso) {
>  hr = D3DERR_DRIVERINTERNALERROR;
> --
> 2.1.0
>
> ___
> 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] [PATCH 4/7] glsl: Split off memory qualifiers from storage qualifiers.

2015-01-31 Thread Francisco Jerez
Image memory qualifiers (coherent, volatile, restrict, readonly and writeonly)
follow slightly different rules from storage qualifiers, e.g. the uniqueness
rule doesn't apply.  Make them a separate non-terminal.
---
 src/glsl/glsl_parser.yy | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 7fb8c38..d67e9bf 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -205,6 +205,7 @@ static bool match_layout_qualifier(const char *s1, const 
char *s2,
 %type  layout_qualifier
 %type  layout_qualifier_id_list layout_qualifier_id
 %type  interface_block_layout_qualifier
+%type  memory_qualifier
 %type  interface_qualifier
 %type  type_specifier
 %type  type_specifier_nonarray
@@ -984,6 +985,11 @@ parameter_qualifier:
   $$ = $2;
   $$.precision = $1;
}
+   | memory_qualifier parameter_qualifier
+   {
+  $$ = $1;
+  $$.merge_qualifier(&@1, state, $2);
+   }
 
 parameter_direction_qualifier:
IN_TOK
@@ -1565,6 +1571,7 @@ type_qualifier:
| storage_qualifier
| interpolation_qualifier
| layout_qualifier
+   | memory_qualifier
| precision_qualifier
{
   memset(&$$, 0, sizeof($$));
@@ -1702,6 +1709,11 @@ type_qualifier:
   $$ = $2;
   $$.precision = $1;
}
+   | memory_qualifier type_qualifier
+   {
+  $$ = $1;
+  $$.merge_qualifier(&@1, state, $2);
+   }
;
 
 auxiliary_storage_qualifier:
@@ -1762,7 +1774,10 @@ storage_qualifier:
   memset(& $$, 0, sizeof($$));
   $$.flags.q.uniform = 1;
}
-   | COHERENT
+   ;
+
+memory_qualifier:
+   COHERENT
{
   memset(& $$, 0, sizeof($$));
   $$.flags.q.coherent = 1;
-- 
2.1.3

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


[Mesa-dev] [PATCH 3/7] glsl: Forbid opaque variables as operands of the ternary operator.

2015-01-31 Thread Francisco Jerez
---
 src/glsl/ast_to_hir.cpp | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 1ba29f7..783384e 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1596,6 +1596,18 @@ ast_expression::do_hir(exec_list *instructions,
  error_emitted = true;
   }
 
+  /* From section 4.1.7 of the GLSL 4.50 spec (Opaque Types):
+   *
+   *  "Except for array indexing, structure member selection, and
+   *   parentheses, opaque variables are not allowed to be operands in
+   *   expressions; such use results in a compile-time error."
+   */
+  if (type->contains_opaque()) {
+ _mesa_glsl_error(&loc, state, "opaque variables cannot be operands "
+  "of the ?: operator");
+ error_emitted = true;
+  }
+
   ir_constant *cond_val = op[0]->constant_expression_value();
   ir_constant *then_val = op[1]->constant_expression_value();
   ir_constant *else_val = op[2]->constant_expression_value();
-- 
2.1.3

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


[Mesa-dev] [PATCH 7/7] glsl: Keep track of the early_fragment_tests flag in gl_shader.

2015-01-31 Thread Francisco Jerez
And rename _mesa_glsl_parse_state::early_fragment_tests to
fs_early_fragment_tests for consistency with other FS-specific flags in the
same struct.
---
 src/glsl/ast_type.cpp   | 2 +-
 src/glsl/glsl_parser_extras.cpp | 4 +++-
 src/glsl/glsl_parser_extras.h   | 2 +-
 src/glsl/linker.cpp | 2 ++
 src/mesa/main/mtypes.h  | 6 ++
 5 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index 34c2b73..1bcf6a2 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -342,7 +342,7 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
}
 
if (q.flags.q.early_fragment_tests) {
-  state->early_fragment_tests = true;
+  state->fs_early_fragment_tests = true;
}
 
if (create_gs_ast) {
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index ccdf031..7526c20 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -212,7 +212,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct 
gl_context *_ctx,
this->gs_input_size = 0;
this->in_qualifier = new(this) ast_type_qualifier();
this->out_qualifier = new(this) ast_type_qualifier();
-   this->early_fragment_tests = false;
+   this->fs_early_fragment_tests = false;
memset(this->atomic_counter_offsets, 0,
   sizeof(this->atomic_counter_offsets));
this->allow_extension_directive_midshader =
@@ -1393,6 +1393,7 @@ set_shader_inout_layout(struct gl_shader *shader,
   assert(!state->fs_redeclares_gl_fragcoord);
   assert(!state->fs_pixel_center_integer);
   assert(!state->fs_origin_upper_left);
+  assert(!state->fs_early_fragment_tests);
}
 
switch (shader->Stage) {
@@ -1435,6 +1436,7 @@ set_shader_inout_layout(struct gl_shader *shader,
   shader->origin_upper_left = state->fs_origin_upper_left;
   shader->ARB_fragment_coord_conventions_enable =
  state->ARB_fragment_coord_conventions_enable;
+  shader->EarlyFragmentTests = state->fs_early_fragment_tests;
   break;
 
default:
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 843fdae..7d6638e 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -500,7 +500,7 @@ struct _mesa_glsl_parse_state {
 */
unsigned gs_input_size;
 
-   bool early_fragment_tests;
+   bool fs_early_fragment_tests;
 
/** Atomic counter offsets by binding */
unsigned atomic_counter_offsets[MAX_COMBINED_ATOMIC_BUFFERS];
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 3f5eac1..079f6ce 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1411,6 +1411,8 @@ link_fs_input_layout_qualifiers(struct gl_shader_program 
*prog,
  linked_shader->origin_upper_left = shader->origin_upper_left;
  linked_shader->pixel_center_integer = shader->pixel_center_integer;
   }
+
+  linked_shader->EarlyFragmentTests |= shader->EarlyFragmentTests;
}
 }
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 81a7c0e..9e19390 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2653,6 +2653,12 @@ struct gl_shader
GLuint NumImages;
 
/**
+* Whether early fragment tests are enabled as defined by
+* ARB_shader_image_load_store.
+*/
+   bool EarlyFragmentTests;
+
+   /**
 * Compute shader state from ARB_compute_shader layout qualifiers.
 */
struct {
-- 
2.1.3

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


[Mesa-dev] [PATCH 5/7] glsl: Forbid use of image qualifiers in declarations of type other than image.

2015-01-31 Thread Francisco Jerez
---
 src/glsl/ast_to_hir.cpp | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 783384e..1cfba39 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2399,6 +2399,14 @@ apply_image_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
 
  var->data.image_format = GL_NONE;
   }
+   } else if (qual->flags.q.read_only ||
+  qual->flags.q.write_only ||
+  qual->flags.q.coherent ||
+  qual->flags.q._volatile ||
+  qual->flags.q.restrict_flag ||
+  qual->flags.q.explicit_image_format) {
+  _mesa_glsl_error(loc, state, "memory qualifiers may only be applied to "
+   "images");
}
 }
 
@@ -2821,8 +2829,7 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
   validate_matrix_layout_for_type(state, loc, var->type, var);
}
 
-   if (var->type->contains_image())
-  apply_image_qualifier_to_variable(qual, var, state, loc);
+   apply_image_qualifier_to_variable(qual, var, state, loc);
 }
 
 /**
-- 
2.1.3

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


[Mesa-dev] [PATCH 2/7] glsl: Forbid calling the constructor of any opaque type.

2015-01-31 Thread Francisco Jerez
The spec doesn't define any opaque type constructors.
---
 src/glsl/ast_function.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index cbff9d8..151b082 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -1524,10 +1524,10 @@ ast_function_expression::hir(exec_list *instructions,
   }
 
 
-  /* Constructors for samplers are illegal.
+  /* Constructors for opaque types are illegal.
*/
-  if (constructor_type->is_sampler()) {
-_mesa_glsl_error(& loc, state, "cannot construct sampler type `%s'",
+  if (constructor_type->contains_opaque()) {
+_mesa_glsl_error(& loc, state, "cannot construct opaque type `%s'",
  constructor_type->name);
 return ir_rvalue::error_value(ctx);
   }
-- 
2.1.3

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


[Mesa-dev] [PATCH 6/7] glsl: Error out on invalid uses of the early_fragment_tests layout qualifier.

2015-01-31 Thread Francisco Jerez
---
 src/glsl/ast_to_hir.cpp | 14 ++
 src/glsl/ast_type.cpp   | 10 +-
 src/glsl/glsl_parser.yy | 15 +++
 3 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 1cfba39..6db9365 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2830,6 +2830,20 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
}
 
apply_image_qualifier_to_variable(qual, var, state, loc);
+
+   /* From section 4.4.1.3 of the GLSL 4.50 specification (Fragment Shader
+* Inputs):
+*
+*  "Fragment shaders also allow the following layout qualifier on in only
+*   (not with variable declarations)
+* layout-qualifier-id
+*early_fragment_tests
+*   [...]"
+*/
+   if (qual->flags.q.early_fragment_tests) {
+  _mesa_glsl_error(loc, state, "early_fragment_tests layout qualifier only 
"
+   "valid in fragment shader input layout declaration.");
+   }
 }
 
 /**
diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index b596cd5..34c2b73 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -293,11 +293,7 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
   valid_in_mask.flags.q.invocations = 1;
   break;
case MESA_SHADER_FRAGMENT:
-  if (q.flags.q.early_fragment_tests) {
- state->early_fragment_tests = true;
-  } else {
- _mesa_glsl_error(loc, state, "invalid input layout qualifier");
-  }
+  valid_in_mask.flags.q.early_fragment_tests = 1;
   break;
case MESA_SHADER_COMPUTE:
   create_cs_ast |=
@@ -345,6 +341,10 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
   this->invocations = q.invocations;
}
 
+   if (q.flags.q.early_fragment_tests) {
+  state->early_fragment_tests = true;
+   }
+
if (create_gs_ast) {
   node = new(mem_ctx) ast_gs_input_layout(*loc, q.prim_type);
} else if (create_cs_ast) {
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index d67e9bf..39845f3 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1350,6 +1350,21 @@ layout_qualifier_id:
 
  if (!$$.flags.i &&
  match_layout_qualifier($1, "early_fragment_tests", state) == 0) {
+/* From section 4.4.1.3 of the GLSL 4.50 specification
+ * (Fragment Shader Inputs):
+ *
+ *  "Fragment shaders also allow the following layout
+ *   qualifier on in only (not with variable declarations)
+ * layout-qualifier-id
+ *early_fragment_tests
+ *   [...]"
+ */
+if (state->stage != MESA_SHADER_FRAGMENT) {
+   _mesa_glsl_error(& @1, state,
+"early_fragment_tests layout qualifier only "
+"valid in fragment shaders");
+}
+
 $$.flags.q.early_fragment_tests = 1;
  }
   }
-- 
2.1.3

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


[Mesa-dev] [PATCH 1/7] glsl: Return correct number of coordinate components for cubemap array images.

2015-01-31 Thread Francisco Jerez
Cubemap array images are unlike cubemap array samplers in that they don't need
an additional coordinate to index individual cubemaps in the array, instead
they behave like a 2D array of 6n layers, with n the number of cubemaps in the
array.  Take this exception into account.
---
 src/glsl/glsl_types.cpp | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index b4223f4..61d785a 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -1225,8 +1225,13 @@ glsl_type::coordinate_components() const
   break;
}
 
-   /* Array textures need an additional component for the array index. */
-   if (sampler_array)
+   /* Array textures need an additional component for the array index, */
+   if (sampler_array &&
+   /* except for cubemap array images that behave like a 2D array of
+* interleaved cubemap faces.
+*/
+   !(base_type == GLSL_TYPE_IMAGE &&
+ sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE))
   size += 1;
 
return size;
-- 
2.1.3

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


[Mesa-dev] [Bug 86701] [regression] weston-simple-egl not running anymore inside qemu

2015-01-31 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=86701

--- Comment #6 from nerdopol...@verizon.net ---
Any updates on this one?

-- 
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] GL: Update glext.h to fix ARB_dsa function prototypes.

2015-01-31 Thread Ian Romanick
On 01/31/2015 04:58 AM, Chris Forbes wrote:
> With the new commit message,
> 
> Reviewed-by: Chris Forbes 

Me too.

Reviewed-by: Ian Romanick 

> On Sat, Jan 31, 2015 at 2:08 PM, Laura Ekstrand  wrote:
>> It's updated to:
>>
>> GL: Update glext.h to Khronos Revision 29537.
>>
>> Khronos Revision 29537 fixes ARB_direct_state_access function prototypes
>> that
>> had GLsizei where they should have had GLsizeiptr. The mainly affects
>> functions related to buffer objects.

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


Re: [Mesa-dev] [PATCH 06/21] main: Add entry point for NamedBufferData.

2015-01-31 Thread Ian Romanick
On 02/01/2015 08:25 AM, Ian Romanick wrote:
> Did you intend to reply off-list?  All discussions about code changes
> should be on the public list.

Never mind.  I just saw the extra fwd...

> On 01/31/2015 12:42 AM, Laura Ekstrand wrote:
>>
>>
>> On Wed, Jan 21, 2015 at 6:28 PM, Ian Romanick > > wrote:
>>
>> On 01/21/2015 05:40 PM, Laura Ekstrand wrote:
>> > ---
>> >  src/mapi/glapi/gen/ARB_direct_state_access.xml |  9 ++-
>> >  src/mesa/main/bufferobj.c  | 77 
>> --
>> >  src/mesa/main/bufferobj.h  | 13 -
>> >  src/mesa/main/tests/dispatch_sanity.cpp|  1 +
>> >  4 files changed, 69 insertions(+), 31 deletions(-)
>> >
>> > diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml 
>> b/src/mapi/glapi/gen/ARB_direct_state_access.xml
>> > index ff81c21..4b1ef6f 100644
>> > --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
>> > +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
>> > @@ -21,7 +21,14 @@
>> >
>> > 
>> >
>> > -   
>> > +   
>> > +  
>> > +  
>> > +  
>> > +  
>> > +   
>> > +
>> > +  
>>
>> I think you accidentally deleted a space before this comment.
>>
>> >
>> > 
>> >
>> > diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
>> > index 0977459..c77029f 100644
>> > --- a/src/mesa/main/bufferobj.c
>> > +++ b/src/mesa/main/bufferobj.c
>> > @@ -556,9 +556,9 @@ _mesa_total_buffer_object_memory(struct gl_context 
>> *ctx)
>> >   * \sa glBufferDataARB, dd_function_table::BufferData.
>> >   */
>> >  static GLboolean
>> > -_mesa_buffer_data( struct gl_context *ctx, GLenum target, 
>> GLsizeiptrARB size,
>> > -const GLvoid * data, GLenum usage, GLenum 
>> storageFlags,
>> > -struct gl_buffer_object * bufObj )
>> > +_mesa_BufferData_sw(struct gl_context *ctx, GLenum target, GLsizeiptr 
>> size,
>> > +const GLvoid *data, GLenum usage, GLenum 
>> storageFlags,
>> > +struct gl_buffer_object *bufObj)
>>
>> You are confused here.  This function has nothing to do with swrast.  It
>> is a fallback for a DD-table entry.
> 
> I am not confused.  I know what it is.  The name you picked does not
> follow Mesa coding standards.
> 
>> We should pick a different name for this.  Names with this pattern are
>> (almost exclusively) direct API entry points.  Maybe
>> _swrast_buffer_data?
>>
>> Alternately, if the "new" _mesa_buffer_data will only ever be called
>> from the same file, we could just call that buffer_data and make it
>> static.
>>
>> >  {
>> > void * new_data;
>> >
>> > @@ -1112,7 +1112,7 @@ _mesa_init_buffer_object_functions(struct
>> dd_function_table *driver)
>> > /* GL_ARB_vertex/pixel_buffer_object */
>> > driver->NewBufferObject = _mesa_new_buffer_object;
>> > driver->DeleteBuffer = _mesa_delete_buffer_object;
>> > -   driver->BufferData = _mesa_buffer_data;
>> > +   driver->BufferData = _mesa_BufferData_sw;
>> > driver->BufferSubData = _mesa_buffer_subdata;
>> > driver->GetBufferSubData = _mesa_buffer_get_subdata;
>> > driver->UnmapBuffer = _mesa_buffer_unmap;
>> > @@ -1474,23 +1474,22 @@ _mesa_NamedBufferStorage(GLuint buffer,
>> GLsizeiptr size, const GLvoid *data,
>> >  }
>> >
>> >
>> > -
>> > -void GLAPIENTRY
>> > -_mesa_BufferData(GLenum target, GLsizeiptrARB size,
>> > -const GLvoid * data, GLenum usage)
>> > +void
>> > +_mesa_buffer_data(struct gl_context *ctx, struct gl_buffer_object
>> *bufObj,
>> > +  GLenum target, GLsizeiptr size, const GLvoid *data,
>> > +  GLenum usage, const char *func)
>> >  {
>> > -   GET_CURRENT_CONTEXT(ctx);
>> > -   struct gl_buffer_object *bufObj;
>> > bool valid_usage;
>> >
>> > if (MESA_VERBOSE & VERBOSE_API)
>> > -  _mesa_debug(ctx, "glBufferData(%s, %ld, %p, %s)\n",
>> > +  _mesa_debug(ctx, "%s(%s, %ld, %p, %s)\n",
>> > +  func,
>> >_mesa_lookup_enum_by_nr(target),
>> >(long int) size, data,
>> >_mesa_lookup_enum_by_nr(usage));
>> >
>> > if (size < 0) {
>> > -  _mesa_error(ctx, GL_INVALID_VALUE, "glBufferDataARB(size <
>> 0)");
>> > +  _mesa_error(ctx, GL_INVALID_VALUE, "%s(size < 0)", func);
>> >return;
>> > }
>> >
>> > @@ -1519,16 +1518,13 @@ _mesa_BufferData(GLenum target,
>> GLsizeiptrARB size,
>> > }
>> >
>> > if (!valid_usage) {
>> > -  _mesa_error(ctx, GL_INVALID_ENUM, "glBufferData(usage)");
>> > +  _mesa_e

Re: [Mesa-dev] [PATCH 08/21] main: Add entry point for NamedBufferSubData.

2015-01-31 Thread Ian Romanick
On 01/31/2015 02:21 AM, Laura Ekstrand wrote:
> 
> 
> On Wed, Jan 21, 2015 at 6:42 PM, Ian Romanick  > wrote:
> 
> On 01/21/2015 05:40 PM, Laura Ekstrand wrote:
> > ---
> >  src/mapi/glapi/gen/ARB_direct_state_access.xml |   7 ++
> >  src/mesa/main/bufferobj.c  | 150
> -
> >  src/mesa/main/bufferobj.h  |  13 ++-
> >  src/mesa/main/tests/dispatch_sanity.cpp|   1 +
> >  4 files changed, 113 insertions(+), 58 deletions(-)
> >
> > diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml
> b/src/mapi/glapi/gen/ARB_direct_state_access.xml
> > index 4b1ef6f..8a5cebb 100644
> > --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
> > +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
> > @@ -28,6 +28,13 @@
> >
> > 
> >
> > +   
> > +  
> > +  
> > +  
> > +  
> > +   
> > +
> >
> >
> > 
> > diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> > index c77029f..20c2cdc 100644
> > --- a/src/mesa/main/bufferobj.c
> > +++ b/src/mesa/main/bufferobj.c
> > @@ -227,67 +227,62 @@ bufferobj_range_mapped(const struct
> gl_buffer_object *obj,
> >   * \c glClearBufferSubData.
> >   *
> >   * \param ctx GL context.
> > - * \param target  Buffer object target on which to operate.
> > + * \param bufObj  The buffer object.
> >   * \param offset  Offset of the first byte of the subdata range.
> >   * \param sizeSize, in bytes, of the subdata range.
> >   * \param mappedRange  If true, checks if an overlapping range is
> mapped.
> >   * If false, checks if buffer is mapped.
> > - * \param errorNoBuffer  Error code if no buffer is bound to target.
> > - * \param caller  Name of calling function for recording errors.
> > - * \return   A pointer to the buffer object bound to \c target in the
> > - *   specified context or \c NULL if any of the parameter
> or state
> > - *   conditions are invalid.
> > + * \param func  Name of calling function for recording errors.
> > + * \return   false if error, true otherwise
> >   *
> >   * \sa glBufferSubDataARB, glGetBufferSubDataARB,
> glClearBufferSubData
> >   */
> > -static struct gl_buffer_object *
> > -buffer_object_subdata_range_good(struct gl_context * ctx, GLenum
> target,
> > - GLintptrARB offset,
> GLsizeiptrARB size,
> > - bool mappedRange, GLenum
> errorNoBuffer,
> > - const char *caller)
> > +static bool
> > +buffer_object_subdata_range_good(struct gl_context *ctx,
> > + struct gl_buffer_object *bufObj,
> > + GLintptr offset, GLsizeiptr size,
> > + bool mappedRange, const char *func)
> 
> Many places in Mesa use 'caller'.  This feels like a spurious change in
> this patch.  If we want to unify on a single name, there should be a
> patch that changes all the occurrences of 'func', 'caller', and
> 'function' to that single name.
> 
> >  {
> > -   struct gl_buffer_object *bufObj;
> > -
> > if (size < 0) {
> > -  _mesa_error(ctx, GL_INVALID_VALUE, "%s(size < 0)", caller);
> > -  return NULL;
> > +  _mesa_error(ctx, GL_INVALID_VALUE, "%s(size < 0)", func);
> > +  return false;
> > }
> >
> > if (offset < 0) {
> > -  _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset < 0)", caller);
> > -  return NULL;
> > +  _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset < 0)", func);
> > +  return false;
> > }
> >
> > -   bufObj = get_buffer(ctx, caller, target, errorNoBuffer);
> > -   if (!bufObj)
> > -  return NULL;
> > -
> > if (offset + size > bufObj->Size) {
> >_mesa_error(ctx, GL_INVALID_VALUE,
> > -  "%s(offset %lu + size %lu > buffer size %lu)",
> caller,
> > +  "%s(offset %lu + size %lu > buffer size %lu)",
> func,
> >(unsigned long) offset,
> >(unsigned long) size,
> >(unsigned long) bufObj->Size);
> > -  return NULL;
> > +  return false;
> > }
> >
> > if (bufObj->Mappings[MAP_USER].AccessFlags &
> GL_MAP_PERSISTENT_BIT)
> > -  return bufObj;
> > +  return true;
> >
> > if (mappedRange) {
> >if (bufferobj_range_mapped(bufObj, offset, size)) {
> > - _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
> > - return NULL;
> > + _mesa_error(ctx, G