Re: [Mesa-dev] [PATCH] i965: compute DDX in a subspan based only on top row

2013-10-02 Thread Chia-I Wu
On Wed, Oct 2, 2013 at 2:14 AM, Chris Forbes chr...@ijw.co.nz wrote:
 With those fixes:

 Reviewed-by: Chris Forbes chr...@ijw.co.nz
Thanks, I will push it shortly.

With this change landed, the slowness of sample_d is no longer the
bottleneck.  Instead, the lack of native SIMD16 sample_d becomes the
problem.  I have posted my other series that emulates SIMD16 sample_d
with dual SIMD8 sample_d for review.


 On Wed, Oct 2, 2013 at 6:38 AM, Ian Romanick i...@freedesktop.org wrote:
 On 09/30/2013 10:54 PM, Chia-I Wu wrote:
 From: Chia-I Wu o...@lunarg.com

 I agree with both of Ken's comments.  With those fixed, this patch is

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

 Consider only the top-left and top-right pixels to approximate DDX in a 2x2
 subspan, unless the application requests a more accurate approximation via
 GL_FRAGMENT_SHADER_DERIVATIVE_HINT or this optimization is disabled from the
 new driconf option disable_derivative_optimization.

 This results in a less accurate approximation.  However, it improves the
 performance of Xonotic with Ultra settings by 24.3879% +/- 0.832202% (at 
 95.0%
 confidence) on Haswell.  No noticeable image quality difference observed.

 The improvement comes from faster sample_d.  It seems, on Haswell, some
 optimizations are introduced to allow faster sample_d when all pixels in a
 subspan have the same derivative.  I considered SAMPLE_STATE too, which 
 allows
 one to control the quality of sample_d on Haswell.  But it gave much worse
 image quality without giving better performance comparing to this change.

 No piglit quick.tests regression on Haswell, except with in-parameter-struct
 and normal-parameter-struct tests which appear to be noises.

 Signed-off-by: Chia-I Wu o...@lunarg.com
 ---
  src/mesa/drivers/dri/i965/brw_context.c|  2 ++
  src/mesa/drivers/dri/i965/brw_context.h|  1 +
  src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 33 
 +++---
  src/mesa/drivers/dri/i965/brw_wm.c | 11 +
  src/mesa/drivers/dri/i965/brw_wm.h |  1 +
  src/mesa/drivers/dri/i965/intel_screen.c   |  4 
  6 files changed, 44 insertions(+), 8 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
 b/src/mesa/drivers/dri/i965/brw_context.c
 index 5f58a29..18b8e57 100644
 --- a/src/mesa/drivers/dri/i965/brw_context.c
 +++ b/src/mesa/drivers/dri/i965/brw_context.c
 @@ -478,6 +478,8 @@ brwCreateContext(int api,
 brw_draw_init( brw );

 brw-precompile = driQueryOptionb(brw-optionCache, 
 shader_precompile);
 +   brw-disable_derivative_optimization =
 +  driQueryOptionb(brw-optionCache, 
 disable_derivative_optimization);

 ctx-Const.ContextFlags = 0;
 if ((flags  __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
 diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
 b/src/mesa/drivers/dri/i965/brw_context.h
 index 0f88bad..0ec1218 100644
 --- a/src/mesa/drivers/dri/i965/brw_context.h
 +++ b/src/mesa/drivers/dri/i965/brw_context.h
 @@ -1005,6 +1005,7 @@ struct brw_context
 bool always_flush_cache;
 bool disable_throttling;
 bool precompile;
 +   bool disable_derivative_optimization;

 driOptionCache optionCache;
 /** @} */
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
 index 7ce42c4..9eb5e17 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
 @@ -540,7 +540,7 @@ fs_generator::generate_tex(fs_inst *inst, struct 
 brw_reg dst, struct brw_reg src
   *
   * arg0: ss0.tl ss0.tr ss0.bl ss0.br ss1.tl ss1.tr ss1.bl ss1.br
   *
 - * and we're trying to produce:
 + * Ideally, we want to produce:
   *
   *   DDX DDY
   * dst: (ss0.tr - ss0.tl) (ss0.tl - ss0.bl)
 @@ -556,24 +556,41 @@ fs_generator::generate_tex(fs_inst *inst, struct 
 brw_reg dst, struct brw_reg src
   *
   * For DDX, it ends up being easy: width = 2, horiz=0 gets us the same 
 result
   * for each pair, and vertstride = 2 jumps us 2 elements after processing a
 - * pair. But for DDY, it's harder, as we want to produce the pairs swizzled
 - * between each other.  We could probably do it like ddx and swizzle the 
 right
 - * order later, but bail for now and just produce
 + * pair.  But the ideal approximation may impose a huge performance cost on
 + * sample_d.  On at least Haswell, sample_d instruction does some
 + * optimizations if the same LOD is used for all pixels in the subspan.
 + *
 + * For DDY, it's harder, as we want to produce the pairs swizzled between 
 each
 + * other.  We could probably do it like ddx and swizzle the right order 
 later,
 + * but bail for now and just produce
   * ((ss0.tl - ss0.bl)x4 (ss1.tl - ss1.bl)x4)
   */
  void
  fs_generator::generate_ddx(fs_inst *inst, struct brw_reg dst, struct 
 brw_reg src)
  {
 +   unsigned vstride, width;
 +
 +   if (c-key.high_quality_derivatives) {
 +  /* produce accurate 

Re: [Mesa-dev] [PATCH v2 01/14] glsl: Add new atomic_uint built-in GLSL type.

2013-10-02 Thread Kenneth Graunke
On 10/01/2013 07:15 PM, Francisco Jerez wrote:
 v2: Fix GLSL version in which the type became available.  Add
 contains_atomic() convenience method.  Split off atomic counter
 comparison error checking to a separate patch that will handle all
 opaque types.  Include new ir_variable fields for atomic types.
 ---
  src/glsl/ast_to_hir.cpp  |  1 +
  src/glsl/builtin_type_macros.h   |  2 ++
  src/glsl/builtin_types.cpp   |  6 ++
  src/glsl/glsl_types.cpp  |  2 ++
  src/glsl/glsl_types.h| 22 ++
  src/glsl/ir.cpp  |  2 +-
  src/glsl/ir.h|  8 
  src/glsl/ir_clone.cpp|  3 +++
  src/glsl/link_uniform_initializers.cpp   |  1 +
  src/glsl/tests/uniform_initializer_utils.cpp |  3 +++
  src/mesa/program/ir_to_mesa.cpp  |  2 ++
  src/mesa/state_tracker/st_glsl_to_tgsi.cpp   |  1 +
  12 files changed, 52 insertions(+), 1 deletion(-)
 
 diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
 index 0859d9e..99159dc 100644
 --- a/src/glsl/ast_to_hir.cpp
 +++ b/src/glsl/ast_to_hir.cpp
 @@ -902,6 +902,7 @@ do_comparison(void *mem_ctx, int operation, ir_rvalue 
 *op0, ir_rvalue *op1)
 case GLSL_TYPE_VOID:
 case GLSL_TYPE_SAMPLER:
 case GLSL_TYPE_INTERFACE:
 +   case GLSL_TYPE_ATOMIC_UINT:
/* I assume a comparison of a struct containing a sampler just
 * ignores the sampler present in the type.
 */
 diff --git a/src/glsl/builtin_type_macros.h b/src/glsl/builtin_type_macros.h
 index fec38da..263fd83 100644
 --- a/src/glsl/builtin_type_macros.h
 +++ b/src/glsl/builtin_type_macros.h
 @@ -110,6 +110,8 @@ DECL_TYPE(sampler2DRectShadow,
 GL_SAMPLER_2D_RECT_SHADOW,GLSL_SAMPLER
  
  DECL_TYPE(samplerExternalOES, GL_SAMPLER_EXTERNAL_OES,  
 GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT)
  
 +DECL_TYPE(atomic_uint, GL_UNSIGNED_INT_ATOMIC_COUNTER, 
 GLSL_TYPE_ATOMIC_UINT, 1, 1)
 +
  STRUCT_TYPE(gl_DepthRangeParameters)
  STRUCT_TYPE(gl_PointParameters)
  STRUCT_TYPE(gl_MaterialParameters)
 diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp
 index 722eda2..98f608b 100644
 --- a/src/glsl/builtin_types.cpp
 +++ b/src/glsl/builtin_types.cpp
 @@ -203,6 +203,8 @@ const static struct builtin_type_versions {
 T(sampler2DRectShadow, 140, 999)
  
 T(struct_gl_DepthRangeParameters,  110, 100)
 +
 +   T(atomic_uint, 420, 999)
  };
  
  const glsl_type *const deprecated_types[] = {
 @@ -284,5 +286,9 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state 
 *state)
 if (state-OES_texture_3D_enable) {
add_type(symbols, glsl_type::sampler3D_type);
 }
 +
 +   if (state-ARB_shader_atomic_counters_enable) {
 +  add_type(symbols, glsl_type::atomic_uint_type);
 +   }
  }
  /** @} */
 diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
 index 3c396dd..e1fe153 100644
 --- a/src/glsl/glsl_types.cpp
 +++ b/src/glsl/glsl_types.cpp
 @@ -586,6 +586,7 @@ glsl_type::component_slots() const
return this-length * this-fields.array-component_slots();
  
 case GLSL_TYPE_SAMPLER:
 +   case GLSL_TYPE_ATOMIC_UINT:
 case GLSL_TYPE_VOID:
 case GLSL_TYPE_ERROR:
break;
 @@ -874,6 +875,7 @@ glsl_type::count_attribute_slots() const
return this-length * this-fields.array-count_attribute_slots();
  
 case GLSL_TYPE_SAMPLER:
 +   case GLSL_TYPE_ATOMIC_UINT:
 case GLSL_TYPE_VOID:
 case GLSL_TYPE_ERROR:
break;
 diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
 index 9f61eee..d00b9e7 100644
 --- a/src/glsl/glsl_types.h
 +++ b/src/glsl/glsl_types.h
 @@ -53,6 +53,7 @@ enum glsl_base_type {
 GLSL_TYPE_FLOAT,
 GLSL_TYPE_BOOL,
 GLSL_TYPE_SAMPLER,
 +   GLSL_TYPE_ATOMIC_UINT,
 GLSL_TYPE_STRUCT,
 GLSL_TYPE_INTERFACE,
 GLSL_TYPE_ARRAY,
 @@ -441,6 +442,27 @@ struct glsl_type {
 }
  
 /**
 +* Return the amount of atomic counter storage required for a type.
 +*/
 +   unsigned atomic_size() const
 +   {
 +  if (base_type == GLSL_TYPE_ATOMIC_UINT)
 + return ATOMIC_COUNTER_SIZE;

This doesn't compile, since ATOMIC_COUNTER_SIZE is not defined.

 +  else if (is_array())
 + return length * element_type()-atomic_size();
 +  else
 + return 0;
 +   }

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


Re: [Mesa-dev] [PATCH V4 01/13] mesa: add texture gather changes

2013-10-02 Thread Kenneth Graunke
On 09/30/2013 03:08 AM, Chris Forbes wrote:
 From: Maxence Le Dore maxence.led...@gmail.com
 
 Reviewed-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/mapi/glapi/gen/ARB_texture_gather.xml | 14 ++
  src/mapi/glapi/gen/gl_API.xml |  2 +-
  src/mesa/main/context.c   |  4 
  src/mesa/main/extensions.c|  1 +
  src/mesa/main/get.c   |  1 +
  src/mesa/main/get_hash_params.py  |  6 ++
  src/mesa/main/mtypes.h|  6 ++
  src/mesa/main/tests/enum_strings.cpp  |  3 +++
  8 files changed, 36 insertions(+), 1 deletion(-)
  create mode 100644 src/mapi/glapi/gen/ARB_texture_gather.xml

Series is:
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

I'm fine with this landing.  I think the next step is to enable the
ARB_gpu_shader5 variants.  The workarounds are gross, but it's inherent
in the problem, and I don't think we're going to find much better.

Eventually I hope to shrink the binding tables, but I'm not too worried
for now...it at least gets the new feature working without adding cost
to existing programs that don't use it.  We can always optimize and tidy
things up once it's all in place.

Thanks for your work on this, Chris.

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


Re: [Mesa-dev] [PATCH V4 01/13] mesa: add texture gather changes

2013-10-02 Thread Kenneth Graunke
On 10/02/2013 02:39 AM, Kenneth Graunke wrote:
 On 09/30/2013 03:08 AM, Chris Forbes wrote:
 From: Maxence Le Dore maxence.led...@gmail.com

 Reviewed-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/mapi/glapi/gen/ARB_texture_gather.xml | 14 ++
  src/mapi/glapi/gen/gl_API.xml |  2 +-
  src/mesa/main/context.c   |  4 
  src/mesa/main/extensions.c|  1 +
  src/mesa/main/get.c   |  1 +
  src/mesa/main/get_hash_params.py  |  6 ++
  src/mesa/main/mtypes.h|  6 ++
  src/mesa/main/tests/enum_strings.cpp  |  3 +++
  8 files changed, 36 insertions(+), 1 deletion(-)
  create mode 100644 src/mapi/glapi/gen/ARB_texture_gather.xml
 
 Series is:
 Reviewed-by: Kenneth Graunke kenn...@whitecape.org
 
 I'm fine with this landing.  I think the next step is to enable the
 ARB_gpu_shader5 variants.  The workarounds are gross, but it's inherent
 in the problem, and I don't think we're going to find much better.
 
 Eventually I hope to shrink the binding tables, but I'm not too worried
 for now...it at least gets the new feature working without adding cost
 to existing programs that don't use it.  We can always optimize and tidy
 things up once it's all in place.
 
 Thanks for your work on this, Chris.
 
 --Ken

Oh, and the last patch can be:
Reviewed-and-tested-by: Kenneth Graunke kenn...@whitecape.org

since I tested this on Haswell.  All 1600+ textureGather piglit cases pass.

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


[Mesa-dev] [Bug 70009] [r300g, bisected] some wine apps renders black

2013-10-02 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=70009

Pavel Ondračka pavel.ondra...@email.cz changed:

   What|Removed |Added

   Assignee|mesa-dev@lists.freedesktop. |dri-devel@lists.freedesktop
   |org |.org
Summary|[bisected] some wine apps   |[r300g, bisected] some wine
   |renders black   |apps renders black
  Component|Mesa core   |Drivers/Gallium/r300

--- Comment #2 from Pavel Ondračka pavel.ondra...@email.cz ---
So is seems, that when I record a trace using r300g driver (RV530) and replay
it using either llvmpipe or i965, it works fine. Probably this is just some
issue in the r300g driver, uncovered by core mesa changes...
EVE online apitrace uploaded here: http://pavel.ondracka.cz/EVE.trace

-- 
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] wayland: Don't race when releasing named buffers

2013-10-02 Thread Jonas Ådahl
This patch fixes a race when a client releases a named buffer before the
server had the time to handle 'wl_drm_create_buffer'. When triggered,
the server would fail to create the buffer since the client already
having destroyed it, throwing out the client in the process with a
protocol error.

To solve this, use a lazy non-blocking roundtrip when creating the
buffer that will only potentially block when releasing if the roundtrip
callback was not already invoked.

Signed-off-by: Jonas Ådahl jad...@gmail.com
---
 src/egl/drivers/dri2/egl_dri2.h |  1 +
 src/egl/drivers/dri2/platform_wayland.c | 74 -
 2 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index fba5f81..6508612 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -189,6 +189,7 @@ struct dri2_egl_surface
   struct wl_buffer   *wl_buffer;
   __DRIimage *dri_image;
   int pitch, name;
+  struct wl_callback *created_callback;
 #endif
 #ifdef HAVE_DRM_PLATFORM
   struct gbm_bo   *bo;
diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index 1d417bb..3a873f7 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -184,6 +184,55 @@ dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay 
*disp,
  window, attrib_list);
 }
 
+static void
+buffer_create_sync_callback(void *data,
+struct wl_callback *callback,
+uint32_t serial)
+{
+   struct wl_callback **created_callback = data;
+
+   *created_callback = NULL;
+   wl_callback_destroy(callback);
+}
+
+static const struct wl_callback_listener buffer_create_sync_listener = {
+   buffer_create_sync_callback
+};
+
+static void
+lazy_create_buffer_roundtrip(struct dri2_egl_display *dri2_dpy,
+ struct dri2_egl_surface *dri2_surf)
+{
+   struct wl_callback *callback;
+
+   callback = wl_display_sync(dri2_dpy-wl_dpy);
+   dri2_surf-current-created_callback = callback;
+
+   wl_callback_add_listener(callback,
+buffer_create_sync_listener,
+dri2_surf-current-created_callback);
+   wl_proxy_set_queue((struct wl_proxy *) callback, dri2_dpy-wl_queue);
+}
+
+static int
+synchronize_create_buffer(struct dri2_egl_display *dri2_dpy,
+  struct dri2_egl_surface *dri2_surf,
+  int i)
+{
+   int ret = 0;
+
+   while (ret != -1  dri2_surf-color_buffers[i].created_callback)
+  ret = wl_display_dispatch_queue(dri2_dpy-wl_dpy, dri2_dpy-wl_queue);
+
+   if (dri2_surf-color_buffers[i].created_callback) {
+  wl_callback_destroy(dri2_surf-color_buffers[i].created_callback);
+  dri2_surf-color_buffers[i].created_callback = NULL;
+  return -1;
+   }
+
+   return 0;
+}
+
 /**
  * Called via eglDestroySurface(), drv-API.DestroySurface().
  */
@@ -206,6 +255,8 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *surf)
  wl_buffer_destroy(dri2_surf-color_buffers[i].wl_buffer);
   if (dri2_surf-color_buffers[i].dri_image)
  dri2_dpy-image-destroyImage(dri2_surf-color_buffers[i].dri_image);
+  if (dri2_surf-color_buffers[i].created_callback)
+ wl_callback_destroy(dri2_surf-color_buffers[i].created_callback);
}
 
for (i = 0; i  __DRI_BUFFER_COUNT; i++)
@@ -227,7 +278,7 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *surf)
return EGL_TRUE;
 }
 
-static void
+static int
 dri2_release_buffers(struct dri2_egl_surface *dri2_surf)
 {
struct dri2_egl_display *dri2_dpy =
@@ -235,6 +286,11 @@ dri2_release_buffers(struct dri2_egl_surface *dri2_surf)
int i;
 
for (i = 0; i  ARRAY_SIZE(dri2_surf-color_buffers); i++) {
+  if (dri2_surf-color_buffers[i].created_callback) {
+ if (synchronize_create_buffer(dri2_dpy, dri2_surf, i) != 0)
+return -1;
+  }
+
   if (dri2_surf-color_buffers[i].wl_buffer 
   !dri2_surf-color_buffers[i].locked)
  wl_buffer_destroy(dri2_surf-color_buffers[i].wl_buffer);
@@ -251,6 +307,8 @@ dri2_release_buffers(struct dri2_egl_surface *dri2_surf)
   dri2_surf-dri_buffers[i]-attachment != __DRI_BUFFER_BACK_LEFT)
  dri2_dpy-dri2-releaseBuffer(dri2_dpy-dri_screen,
dri2_surf-dri_buffers[i]);
+
+   return 0;
 }
 
 static int
@@ -349,7 +407,10 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
(dri2_surf-base.Width != dri2_surf-wl_win-width || 
 dri2_surf-base.Height != dri2_surf-wl_win-height)) {
 
-  dri2_release_buffers(dri2_surf);
+  if (dri2_release_buffers(dri2_surf) != 0) {
+ _eglError(EGL_BAD_DISPLAY, failed to release color buffers);
+ return NULL;
+  }
 
   

Re: [Mesa-dev] [PATCH v2 01/14] glsl: Add new atomic_uint built-in GLSL type.

2013-10-02 Thread Francisco Jerez
Kenneth Graunke kenn...@whitecape.org writes:

 On 10/01/2013 07:15 PM, Francisco Jerez wrote:
[...]
 @@ -441,6 +442,27 @@ struct glsl_type {
 }
  
 /**
 +* Return the amount of atomic counter storage required for a type.
 +*/
 +   unsigned atomic_size() const
 +   {
 +  if (base_type == GLSL_TYPE_ATOMIC_UINT)
 + return ATOMIC_COUNTER_SIZE;

 This doesn't compile, since ATOMIC_COUNTER_SIZE is not defined.

Ken, this patch is not expected to compile alone without a bunch of
patches from my previous series that I didn't resend to avoid flooding
the list.  You can find a working branch with all the necessary
dependencies here:

http://cgit.freedesktop.org/~currojerez/mesa/log/?h=atomic-counters

Thanks.

 +  else if (is_array())
 + return length * element_type()-atomic_size();
 +  else
 + return 0;
 +   }


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


Re: [Mesa-dev] [PATCH] gen7: Use logical, not physical, dims in 3DSTATE_DEPTH_BUFFER

2013-10-02 Thread Eric Anholt
Chad Versace chad.vers...@linux.intel.com writes:

 In 3DSTATE_DEPTH_BUFFER, we set Width and Height to the miptree slice's
 physical dimensions. (Logical and physical dimensions may differ for
 multisample surfaces).

 However, in SURFACE_STATE, we always set Width and Height to the slice's
 logical dimensions. We should do the same for 3DSTATE_DEPTH_BUFFER,
 because the hw docs say so.

 No Piglit regressions (-x glx) on Ivybridge with Wayland.

 CC: Paul Berry stereotype...@gmail.com
 CC: Jordan Justen jordan.l.jus...@intel.com
 CC: Ben Widawsky b...@bwidawsk.net
 Signed-off-by: Chad Versace chad.vers...@linux.intel.com
 ---
  src/mesa/drivers/dri/i965/gen7_blorp.cpp| 3 ---
  src/mesa/drivers/dri/i965/gen7_misc_state.c | 5 -
  2 files changed, 8 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
 b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
 index 9df3d92..158f801 100644
 --- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
 +++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
 @@ -705,9 +705,6 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context 
 *brw,
 */
surfwidth = params-depth.width;
surfheight = params-depth.height;
 -   } else {
 -  surfwidth = params-depth.mt-physical_width0;
 -  surfheight = params-depth.mt-physical_height0;
 }

It looks like surfwidth/height doesn't get initialized in this case any
more.  logical_width0 wouldn't be right either, since you actually want
the logical of the particular slice.

The gen7_misc_state.c hunk is good, though.


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


Re: [Mesa-dev] Janitorial work: no more intel_context.[ch]; tidying

2013-10-02 Thread Ian Romanick
(Adding Alan to the CC list.)

On 10/01/2013 10:51 PM, Vinson Lee wrote:
 On Mon, Sep 30, 2013 at 10:21 PM, Kenneth Graunke kenn...@whitecape.org 
 wrote:
 On 09/27/2013 06:24 PM, Emil Velikov wrote:
 * With the recent split of the intel driver codebase, the new i965
 headers has been getting a bunch of #pragma once over the standard
 #ifndef _HEADER_H_... Are those intentional ?

 Yup, that's intentional.  #pragma once doesn't require inventing a
 unique #define name, is less typing, and is faster on some compilers.

 I actually forgot that it wasn't standard.  It's supported basically
 everywhere, though, so I'd be really shocked if it caused problems.
 
 Oracle Solaris Studio does not support #pragma once.

Is there *any* reason to use that compiler over GCC?  This isn't the
first time that we've discovered it to be lacking some feature that GCC,
clang, and Visual Studio all support. :(

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


[Mesa-dev] [PATCH] i965: Implement ABO surface state emission.

2013-10-02 Thread Francisco Jerez
The maximum number of atomic buffer objects is somewhat arbitrary, we
can change it in the future easily if it turns out it's not enough...

v2: Add comments with the relevant mesa dirty bits.  Fix usage of
BRW_NEW_UNIFORM_BUFFER in the GS ABO state atom.
v3: Update binding table layout diagrams.

Reviewed-by: Paul Berry stereotype...@gmail.com
---
 src/mesa/drivers/dri/i965/brw_context.h  | 27 --
 src/mesa/drivers/dri/i965/brw_gs_surface_state.c | 21 +++
 src/mesa/drivers/dri/i965/brw_state.h|  3 ++
 src/mesa/drivers/dri/i965/brw_state_upload.c |  4 +++
 src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 21 +++
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 45 
 6 files changed, 119 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 3922705..1407f20 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -158,6 +158,7 @@ enum brw_state_id {
BRW_STATE_RASTERIZER_DISCARD,
BRW_STATE_STATS_WM,
BRW_STATE_UNIFORM_BUFFER,
+   BRW_STATE_ATOMIC_BUFFER,
BRW_STATE_META_IN_PROGRESS,
BRW_STATE_INTERPOLATION_MAP,
BRW_STATE_PUSH_CONSTANT_ALLOCATION,
@@ -196,6 +197,7 @@ enum brw_state_id {
 #define BRW_NEW_RASTERIZER_DISCARD (1  BRW_STATE_RASTERIZER_DISCARD)
 #define BRW_NEW_STATS_WM   (1  BRW_STATE_STATS_WM)
 #define BRW_NEW_UNIFORM_BUFFER  (1  BRW_STATE_UNIFORM_BUFFER)
+#define BRW_NEW_ATOMIC_BUFFER   (1  BRW_STATE_ATOMIC_BUFFER)
 #define BRW_NEW_META_IN_PROGRESS(1  BRW_STATE_META_IN_PROGRESS)
 #define BRW_NEW_INTERPOLATION_MAP   (1  BRW_STATE_INTERPOLATION_MAP)
 #define BRW_NEW_PUSH_CONSTANT_ALLOCATION (1  
BRW_STATE_PUSH_CONSTANT_ALLOCATION)
@@ -599,6 +601,12 @@ struct brw_gs_prog_data
 /** Max number of render targets in a shader */
 #define BRW_MAX_DRAW_BUFFERS 8
 
+/** Max number of uniform buffer objects in a shader */
+#define BRW_MAX_UBO 12
+
+/** Max number of atomic counter buffer objects in a shader */
+#define BRW_MAX_ABO 4
+
 /**
  * Max number of binding table entries used for stream output.
  *
@@ -661,6 +669,11 @@ struct brw_gs_prog_data
  *|   : | :   |
  *|  36 | UBO 11  |
  *+---+
+ *|  37 | ABO 0   |
+ *|   . | .   |
+ *|   : | :   |
+ *|  40 | ABO 3   |
+ *+---+
  *
  * Our VS (and Gen7 GS) binding tables are programmed as follows:
  *
@@ -677,6 +690,11 @@ struct brw_gs_prog_data
  *|   : | :   |
  *|  28 | UBO 11  |
  *+---+
+ *|  29 | ABO 0   |
+ *|   . | .   |
+ *|   : | :   |
+ *|  32 | ABO 3   |
+ *+---+
  *
  * Our (gen6) GS binding tables are programmed as follows:
  *
@@ -691,14 +709,16 @@ struct brw_gs_prog_data
 #define SURF_INDEX_FRAG_CONST_BUFFER (BRW_MAX_DRAW_BUFFERS + 1)
 #define SURF_INDEX_TEXTURE(t)(BRW_MAX_DRAW_BUFFERS + 2 + (t))
 #define SURF_INDEX_WM_UBO(u) (SURF_INDEX_TEXTURE(BRW_MAX_TEX_UNIT) + u)
-#define SURF_INDEX_WM_SHADER_TIME(SURF_INDEX_WM_UBO(12))
+#define SURF_INDEX_WM_ABO(a) (SURF_INDEX_WM_UBO(BRW_MAX_UBO) + a)
+#define SURF_INDEX_WM_SHADER_TIME(SURF_INDEX_WM_ABO(BRW_MAX_ABO))
 /** Maximum size of the binding table. */
 #define BRW_MAX_WM_SURFACES  (SURF_INDEX_WM_SHADER_TIME + 1)
 
 #define SURF_INDEX_VEC4_CONST_BUFFER (0)
 #define SURF_INDEX_VEC4_TEXTURE(t)   (SURF_INDEX_VEC4_CONST_BUFFER + 1 + (t))
 #define SURF_INDEX_VEC4_UBO(u)   
(SURF_INDEX_VEC4_TEXTURE(BRW_MAX_TEX_UNIT) + u)
-#define SURF_INDEX_VEC4_SHADER_TIME  (SURF_INDEX_VEC4_UBO(12))
+#define SURF_INDEX_VEC4_ABO(a)   (SURF_INDEX_VEC4_UBO(BRW_MAX_UBO) + a)
+#define SURF_INDEX_VEC4_SHADER_TIME  (SURF_INDEX_VEC4_ABO(BRW_MAX_ABO))
 #define BRW_MAX_VEC4_SURFACES(SURF_INDEX_VEC4_SHADER_TIME + 1)
 
 #define SURF_INDEX_GEN6_SOL_BINDING(t) (t)
@@ -1498,6 +1518,9 @@ brw_update_sol_surface(struct brw_context *brw,
 void brw_upload_ubo_surfaces(struct brw_context *brw,
 struct gl_shader *shader,
 uint32_t *surf_offsets);
+void brw_upload_abo_surfaces(struct brw_context *brw,
+ struct gl_shader_program *prog,
+ uint32_t *surf_offsets);
 
 /* brw_surface_formats.c */
 bool brw_is_hiz_depth_format(struct brw_context *ctx, gl_format format);
diff --git a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
index d0ce412..05f9efa 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
@@ 

[Mesa-dev] [PATCH 2/2] i965: Remove gap after the last draw buffer in the WM surface binding table.

2013-10-02 Thread Francisco Jerez
---
 src/mesa/drivers/dri/i965/brw_context.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 4423862..420e630 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -710,8 +710,8 @@ struct brw_gs_prog_data
  *+-+-+
  */
 #define SURF_INDEX_DRAW(d)   (d)
-#define SURF_INDEX_FRAG_CONST_BUFFER (BRW_MAX_DRAW_BUFFERS + 1)
-#define SURF_INDEX_TEXTURE(t)(BRW_MAX_DRAW_BUFFERS + 2 + (t))
+#define SURF_INDEX_FRAG_CONST_BUFFER (BRW_MAX_DRAW_BUFFERS)
+#define SURF_INDEX_TEXTURE(t)(BRW_MAX_DRAW_BUFFERS + 1 + (t))
 #define SURF_INDEX_WM_UBO(u) (SURF_INDEX_TEXTURE(BRW_MAX_TEX_UNIT) + u)
 #define SURF_INDEX_WM_ABO(a) (SURF_INDEX_WM_UBO(BRW_MAX_UBO) + a)
 #define SURF_INDEX_WM_SHADER_TIME(SURF_INDEX_WM_ABO(BRW_MAX_ABO))
-- 
1.8.3.4

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


[Mesa-dev] [PATCH 1/2] i965: Add shader time surface to the binding table layout diagrams.

2013-10-02 Thread Francisco Jerez
---
 src/mesa/drivers/dri/i965/brw_context.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 1407f20..4423862 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -674,6 +674,8 @@ struct brw_gs_prog_data
  *|   : | :   |
  *|  40 | ABO 3   |
  *+---+
+ *|  41 | Shader time |
+ *+---+
  *
  * Our VS (and Gen7 GS) binding tables are programmed as follows:
  *
@@ -695,6 +697,8 @@ struct brw_gs_prog_data
  *|   : | :   |
  *|  32 | ABO 3   |
  *+---+
+ *|  33 | Shader time |
+ *+---+
  *
  * Our (gen6) GS binding tables are programmed as follows:
  *
-- 
1.8.3.4

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


Re: [Mesa-dev] [PATCH] i965: Implement ABO surface state emission.

2013-10-02 Thread Adrian M Negreanu
On Oct 2, 2013 9:29 PM, Francisco Jerez curroje...@riseup.net wrote:

 The maximum number of atomic buffer objects is somewhat arbitrary, we
 can change it in the future easily if it turns out it's not enough...

 v2: Add comments with the relevant mesa dirty bits.  Fix usage of
 BRW_NEW_UNIFORM_BUFFER in the GS ABO state atom.
 v3: Update binding table layout diagrams.

 Reviewed-by: Paul Berry stereotype...@gmail.com
Hi,
I guess this patch also depends on pending patches, right?
Aiaiai-mesa fails to built it:

On Oct 2, 2013 9:39 PM, Aiaiai aia...@aiaiai.ku wrote:
Hi,

I have tested your changes:

[Mesa-dev] [PATCH] i965: Implement ABO surface state emission.

Project: mesa (Mesa build tests)

Configurations: android linux


Tested the patch(es) on top of the following commits:
4e4c32b r600/llvm: Adds support for MSAA
8edbd76 r600g/llvm: Undef z and w component of 2D TXP inst
9f183eb r600g/llvm: fix txq for texture buffer
848c0e7 i965: compute DDX in a subspan based only on top row
72edba1 i965/blorp: Use passed in framebuffer rather than ctx-DrawBuffer
ef8cc3e ralloc: Remove the rzalloc-based new/delete operator definition
macro.
fcbbecb st/mesa: Switch glsl_to_tgsi_instruction to the non-zeroing
allocator.


Failed to build for android

4e4c32b r600/llvm: Adds support for MSAA
8edbd76 r600g/llvm: Undef z and w component of 2D TXP inst
9f183eb r600g/llvm: fix txq for texture buffer
848c0e7 i965: compute DDX in a subspan based only on top row
72edba1 i965/blorp: Use passed in framebuffer rather than ctx-DrawBuffer
ef8cc3e ralloc: Remove the rzalloc-based new/delete operator definition
macro.
fcbbecb st/mesa: Switch glsl_to_tgsi_instruction to the non-zeroing
allocator.
src/mesa/drivers/dri/i965/brw_state_dump.c:423:63: warning: pointer of type
'void *' used in arithmetic [-Wpointer-arith]
src/mesa/drivers/dri/i965/brw_state_dump.c: In function 'dump_vs_constants':
src/mesa/drivers/dri/i965/brw_state_dump.c:435:47: warning: pointer of type
'void *' used in arithmetic [-Wpointer-arith]
src/mesa/drivers/dri/i965/brw_state_dump.c:436:45: warning: pointer of type
'void *' used in arithmetic [-Wpointer-arith]
src/mesa/drivers/dri/i965/brw_state_dump.c: In function 'dump_wm_constants':
src/mesa/drivers/dri/i965/brw_state_dump.c:451:47: warning: pointer of type
'void *' used in arithmetic [-Wpointer-arith]
src/mesa/drivers/dri/i965/brw_state_dump.c:452:45: warning: pointer of type
'void *' used in arithmetic [-Wpointer-arith]
src/mesa/drivers/dri/i965/brw_state_dump.c: In function
'dump_binding_table':
src/mesa/drivers/dri/i965/brw_state_dump.c:468:44: warning: pointer of type
'void *' used in arithmetic [-Wpointer-arith]
src/mesa/drivers/dri/i965/brw_state_dump.c: In function 'dump_prog_cache':
src/mesa/drivers/dri/i965/brw_state_dump.c:495:33: warning: pointer of type
'void *' used in arithmetic [-Wpointer-arith]
src/mesa/drivers/dri/i965/brw_vs_surface_state.c: In function
'brw_upload_vec4_pull_constants':
src/mesa/drivers/dri/i965/brw_vs_surface_state.c:72:45: warning: pointer of
type 'void *' used in arithmetic [-Wpointer-arith]
src/mesa/drivers/dri/i965/brw_wm_surface_state.c: In function
'brw_upload_abo_surfaces':
src/mesa/drivers/dri/i965/brw_wm_surface_state.c:842:28: error: 'struct
gl_shader_program' has no member named 'NumAtomicBuffers'
src/mesa/drivers/dri/i965/brw_wm_surface_state.c:844:14: error: 'struct
gl_context' has no member named 'AtomicBufferBindings'
src/mesa/drivers/dri/i965/brw_wm_surface_state.c:844:41: error: 'struct
gl_shader_program' has no member named 'AtomicBuffers'
src/mesa/drivers/dri/i965/brw_wm_surface_state.c:846:37: error:
dereferencing pointer to incomplete type
src/mesa/drivers/dri/i965/brw_wm_surface_state.c:850:16: error: 'struct
anonymous' has no member named 'create_raw_surface'
src/mesa/drivers/dri/i965/brw_wm_surface_state.c:850:52: error:
dereferencing pointer to incomplete type
src/mesa/drivers/dri/i965/brw_wm_surface_state.c:851:54: error:
dereferencing pointer to incomplete type
src/mesa/drivers/dri/i965/brw_wm_surface_state.c:855:12: error: 'struct
gl_shader_program' has no member named 'NumAtomicBuffers'
make: ***
[out/target/product/samsungxe700t/obj/SHARED_LIBRARIES/i965_dri_intermediates/brw_wm_surface_state.o]
Error 1
FAILURE



 ---
  src/mesa/drivers/dri/i965/brw_context.h  | 27 --
  src/mesa/drivers/dri/i965/brw_gs_surface_state.c | 21 +++
  src/mesa/drivers/dri/i965/brw_state.h|  3 ++
  src/mesa/drivers/dri/i965/brw_state_upload.c |  4 +++
  src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 21 +++
  src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 45

  6 files changed, 119 insertions(+), 2 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_context.h

Re: [Mesa-dev] [PATCH] i965/fs: Improve accuracy of dFdy() to match dFdx().

2013-10-02 Thread Eric Anholt
Paul Berry stereotype...@gmail.com writes:

 Previously, we computed dFdy() using the following instruction:

   add(8) dst1F src4,4,0)F -src.24,4,0F { align1 1Q }

 That had the disadvantage that it computed the same value for all 4
 pixels of a 2x2 subspan, which meant that it was less accurate than
 dFdx().  This patch changes it to the following instruction when
 c-key.high_quality_derivatives is set:

   add(8) dst1F src4,4,1.xyxyF -src4,4,1.zwzwF { align16 1Q }

 This gives it comparable accuracy to dFdx().

 Unfortunately, for some reason the SIMD16 version of this instruction:

   add(16) dst1F src4,4,1.xyxyF -src4,4,1.zwzwF { align16 1H }

 Doesn't seem to work reliably (presumably the hardware designers never
 validated the combination of align16 mode with compressed
 instructions), so we unroll it to:

From the gen4 PRM vol4, page 340:

A compressed instruction must be in Align1 access mode. Align16
 mode instructions cannot be compressed.

Other than updating the comment about compressed due to the PRM cite,
this is:

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

Thanks for figuring this out.


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


Re: [Mesa-dev] [PATCH] gen7: Use logical, not physical, dims in 3DSTATE_DEPTH_BUFFER

2013-10-02 Thread Jordan Justen
On Wed, Oct 2, 2013 at 10:48 AM, Eric Anholt e...@anholt.net wrote:
 Chad Versace chad.vers...@linux.intel.com writes:

 In 3DSTATE_DEPTH_BUFFER, we set Width and Height to the miptree slice's
 physical dimensions. (Logical and physical dimensions may differ for
 multisample surfaces).

 However, in SURFACE_STATE, we always set Width and Height to the slice's
 logical dimensions. We should do the same for 3DSTATE_DEPTH_BUFFER,
 because the hw docs say so.

 No Piglit regressions (-x glx) on Ivybridge with Wayland.

HSW too?

 CC: Paul Berry stereotype...@gmail.com
 CC: Jordan Justen jordan.l.jus...@intel.com
 CC: Ben Widawsky b...@bwidawsk.net
 Signed-off-by: Chad Versace chad.vers...@linux.intel.com
 ---
  src/mesa/drivers/dri/i965/gen7_blorp.cpp| 3 ---
  src/mesa/drivers/dri/i965/gen7_misc_state.c | 5 -
  2 files changed, 8 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
 b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
 index 9df3d92..158f801 100644
 --- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
 +++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
 @@ -705,9 +705,6 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context 
 *brw,
 */
surfwidth = params-depth.width;
surfheight = params-depth.height;
 -   } else {
 -  surfwidth = params-depth.mt-physical_width0;
 -  surfheight = params-depth.mt-physical_height0;
 }

 It looks like surfwidth/height doesn't get initialized in this case any
 more.  logical_width0 wouldn't be right either, since you actually want
 the logical of the particular slice.

This didn't cause an issue for depthstencil-render-miplevel for levels  0?

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


Re: [Mesa-dev] [PATCH] gen7: Use logical, not physical, dims in 3DSTATE_DEPTH_BUFFER

2013-10-02 Thread Ben Widawsky
On Wed, Oct 02, 2013 at 12:41:16PM -0700, Jordan Justen wrote:
 On Wed, Oct 2, 2013 at 10:48 AM, Eric Anholt e...@anholt.net wrote:
  Chad Versace chad.vers...@linux.intel.com writes:
 
  In 3DSTATE_DEPTH_BUFFER, we set Width and Height to the miptree slice's
  physical dimensions. (Logical and physical dimensions may differ for
  multisample surfaces).
 
  However, in SURFACE_STATE, we always set Width and Height to the slice's
  logical dimensions. We should do the same for 3DSTATE_DEPTH_BUFFER,
  because the hw docs say so.
 
  No Piglit regressions (-x glx) on Ivybridge with Wayland.
 
 HSW too?
 

My tested-by was on HSW.

  CC: Paul Berry stereotype...@gmail.com
  CC: Jordan Justen jordan.l.jus...@intel.com
  CC: Ben Widawsky b...@bwidawsk.net
  Signed-off-by: Chad Versace chad.vers...@linux.intel.com
  ---
   src/mesa/drivers/dri/i965/gen7_blorp.cpp| 3 ---
   src/mesa/drivers/dri/i965/gen7_misc_state.c | 5 -
   2 files changed, 8 deletions(-)
 
  diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
  b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
  index 9df3d92..158f801 100644
  --- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
  +++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
  @@ -705,9 +705,6 @@ gen7_blorp_emit_depth_stencil_config(struct 
  brw_context *brw,
  */
 surfwidth = params-depth.width;
 surfheight = params-depth.height;
  -   } else {
  -  surfwidth = params-depth.mt-physical_width0;
  -  surfheight = params-depth.mt-physical_height0;
  }
 
  It looks like surfwidth/height doesn't get initialized in this case any
  more.  logical_width0 wouldn't be right either, since you actually want
  the logical of the particular slice.
 
 This didn't cause an issue for depthstencil-render-miplevel for levels  0?
 
 -Jordan

-- 
Ben Widawsky, Intel Open Source Technology Center
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] megadrivers series

2013-10-02 Thread Eric Anholt
Emil Velikov emil.l.veli...@gmail.com writes:

 On 30/09/13 21:44, Eric Anholt wrote:
 Here are the megadrivers changes, after the prep series I posted earlier.
 A few tiny updates to the prep series are available in my tree as
 megadriver-prep and this series is available as megadrivers-5
 
 FPS improvement on GLB2.7 with INTEL_NO_HW=1: 2.61061% +/- 1.16957% (n=50)
 
 One question I have is whether the hardlinks are going to cause problems
 for packaging.  I noticed that when I went and stripped the binaries
 trying to do a space comparison, I of course got brand new inodes each
 taking up their own set of disk space.  I do really like how hardlinks end
 up for installing on my test systems a single binary I can move around
 however I need.
 
 Great work Eric :)

 A couple of trivial ones (apart from patch 8 and 13)

 * IMHO you safely drop dridir from nouveau, radeon, r200, i915 's
 Makefile.am. It's already set in src/mesa/drivers/dri/Makefile.am

Oh, yeah.  I definitely liked how much little we ended up with in the
per-driver Makefile.am's there, and more reduction is great.

 * Can you please leave a comment in code, wrt the i915/radeon header
 reshuffle ?

Not sure quite what you're asking for here -- not just the comment above
the #defines?

 video from the talk I gave at XDC:
 http://www.youtube.com/watch?v=0fJq-2haT3Y
 
 As a follow up to a question from XDC, size of st/dri wrt the driver
 itself here are some numbers that give can give you a rough idea.

 Release build with debug symbols
 [323K]  libdricommon.a
 [424K]  libdridrm.a
 [ 12M]  libgallium.a
 [ 47M]  libmesagallium.a
 [ 25M]  libnouveau.a
 [ 52K]  libnouveaudrm.a
 [408K]  librbug.a
 [619K]  libtrace.a
 [ 36M]  nouveau_dri.so

 Release build without debug symbols
 [ 51K]  libdricommon.a
 [ 48K]  libdridrm.a
 [2.4M]  libgallium.a
 [5.3M]  libmesagallium.a
 [2.1M]  libnouveau.a
 [2.0K]  libnouveaudrm.a
 [ 41K]  librbug.a
 [147K]  libtrace.a
 [6.1M]  nouveau_dri.so

Ultimately, the only size we care about as far as justifying
dricore/megadrivers' existence is the sum of the size of the installed
files.  Cutting size of build byproducts, if we manage to, is just a
minor win for developers.

 I think Emil has been looking at doing the gallium side of things, so I
 haven't pushed forward with that.
 
 Initially I got over-exited over the idea until I realized that gallium
 does not use/build libdricore :)

 I'm planning to have something by the end of the week (just got my final
 year project at Uni), although my plan is to leave it optional. Any
 suggestions/preferences ?

Maintaining build options is work, and it means that people get the
wrong thing or developers end up breaking options they aren't testing.
That's why we removed non-dricore before.


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


Re: [Mesa-dev] Janitorial work: no more intel_context.[ch]; tidying

2013-10-02 Thread Matt Turner
On Wed, Oct 2, 2013 at 11:02 AM, Ian Romanick i...@freedesktop.org wrote:
 (Adding Alan to the CC list.)

 On 10/01/2013 10:51 PM, Vinson Lee wrote:
 On Mon, Sep 30, 2013 at 10:21 PM, Kenneth Graunke kenn...@whitecape.org 
 wrote:
 On 09/27/2013 06:24 PM, Emil Velikov wrote:
 * With the recent split of the intel driver codebase, the new i965
 headers has been getting a bunch of #pragma once over the standard
 #ifndef _HEADER_H_... Are those intentional ?

 Yup, that's intentional.  #pragma once doesn't require inventing a
 unique #define name, is less typing, and is faster on some compilers.

 I actually forgot that it wasn't standard.  It's supported basically
 everywhere, though, so I'd be really shocked if it caused problems.

 Oracle Solaris Studio does not support #pragma once.

 Is there *any* reason to use that compiler over GCC?  This isn't the
 first time that we've discovered it to be lacking some feature that GCC,
 clang, and Visual Studio all support. :(

Before we go down this rabbit hole -- Vinson said it doesn't support
#pragma once. He didn't say it caused problems. I don't expect it is,
since we're already using it and have been for a long time.

It probably just means that you have to to #pragma once along with the
standard #ifndef ... #endif wrapper.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 04/14] glx: Add an optional function call for getting the DRI driver interface.

2013-10-02 Thread Eric Anholt
Marek Olšák mar...@gmail.com writes:

 On Mon, Sep 30, 2013 at 10:44 PM, Eric Anholt e...@anholt.net wrote:
 The previous interface relied on a static struct, which meant tha the
 driver didn't get a chance to edit the struct before the struct got used.
 For megadrivers, I want to return a variable struct based on what driver
 is getting loaded.

 diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
 index f1d1164..16f820f 100644
 --- a/src/glx/dri_common.c
 +++ b/src/glx/dri_common.c
 @@ -188,9 +188,25 @@ driOpenDriver(const char *driverName)
  }

  _X_HIDDEN const __DRIextension **
 -driGetDriverExtensions(void *handle)
 +driGetDriverExtensions(void *handle, const char *driver_name)
  {
 const __DRIextension **extensions = NULL;
 +   const __DRIextension **(*get_extensions)(void);

 This doesn't match the documentation you put in dri_interface.h. It
 says the first parameter should be const char*.

 Marek

Thanks, I fixed the docs.  Originally I think I was going to have a
single getextensions with the driver name passed in, but this ended up
being easier in the linking process.


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


Re: [Mesa-dev] [PATCH 08/14] i965: Build the driver into a shared mesa_dri_drivers.so .

2013-10-02 Thread Eric Anholt
Emil Velikov emil.l.veli...@gmail.com writes:

 On 30/09/13 21:44, Eric Anholt wrote:
 Previously, we've split things such that mesa core is in libdricore,
 exposing the whole Mesa core interface in the global namespace, and the
 i965_dri.so code all links against that.  Along with polluting application
 namespace terribly, it requires extra PLT indirections and prevents LTO.
 
 Instead, we can build all of the driver contents into the same .so with
 just a few symbols exposed to be referenced from the actual driver .so
 file, allowing LTO and reducing our exposed symbol count massively.
 ---
  configure.ac  | 29 +++---
  src/mesa/drivers/dri/Makefile.am  | 54 
 ++-
  src/mesa/drivers/dri/common/Makefile.am   |  3 ++
  src/mesa/drivers/dri/common/dri_util.c| 10 +++--
  src/mesa/drivers/dri/common/megadriver_stub.c | 41 
  src/mesa/drivers/dri/i965/Makefile.am | 27 +++---
  src/mesa/drivers/dri/i965/intel_screen.c  | 16 ++--
  src/mesa/drivers/dri/i965/intel_screen.h  |  2 +
  8 files changed, 147 insertions(+), 35 deletions(-)
  create mode 100644 src/mesa/drivers/dri/common/megadriver_stub.c
 
 [...]
 diff --git a/src/mesa/drivers/dri/common/dri_util.c 
 b/src/mesa/drivers/dri/common/dri_util.c
 index 9a99ea9..3126ac8 100644
 --- a/src/mesa/drivers/dri/common/dri_util.c
 +++ b/src/mesa/drivers/dri/common/dri_util.c
 @@ -106,10 +106,12 @@ dri2CreateNewScreen2(int scrn, int fd,
  /* If the driver exposes its vtable through its extensions list
   * (megadrivers), use that instead.
   */
 -for (int i = 0; driver_extensions[i]; i++) {
 -   if (strcmp(driver_extensions[i]-name, __DRI_DRIVER_VTABLE) == 0) {
 -  psp-driver =
 - ((__DRIDriverVtableExtension *)driver_extensions[i])-vtable;
 +if (driver_extensions) {
 +   for (int i = 0; driver_extensions[i]; i++) {
 +  if (strcmp(driver_extensions[i]-name, __DRI_DRIVER_VTABLE) == 0) 
 {
 + psp-driver =
 +((__DRIDriverVtableExtension 
 *)driver_extensions[i])-vtable;
 +  }
 }
  }
  
 I believe this hunk would need to be squashed in previous patch.
 Otherwise we'll fail with null ptr deref due to as driver_extensions is
 NULL, when called from dri*CreateNewScreen() context.

Thanks, fixed!


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


Re: [Mesa-dev] Janitorial work: no more intel_context.[ch]; tidying

2013-10-02 Thread Ian Romanick
On 10/02/2013 12:51 PM, Matt Turner wrote:
 On Wed, Oct 2, 2013 at 11:02 AM, Ian Romanick i...@freedesktop.org wrote:
 (Adding Alan to the CC list.)

 On 10/01/2013 10:51 PM, Vinson Lee wrote:
 On Mon, Sep 30, 2013 at 10:21 PM, Kenneth Graunke kenn...@whitecape.org 
 wrote:
 On 09/27/2013 06:24 PM, Emil Velikov wrote:
 * With the recent split of the intel driver codebase, the new i965
 headers has been getting a bunch of #pragma once over the standard
 #ifndef _HEADER_H_... Are those intentional ?

 Yup, that's intentional.  #pragma once doesn't require inventing a
 unique #define name, is less typing, and is faster on some compilers.

 I actually forgot that it wasn't standard.  It's supported basically
 everywhere, though, so I'd be really shocked if it caused problems.

 Oracle Solaris Studio does not support #pragma once.

 Is there *any* reason to use that compiler over GCC?  This isn't the
 first time that we've discovered it to be lacking some feature that GCC,
 clang, and Visual Studio all support. :(
 
 Before we go down this rabbit hole -- Vinson said it doesn't support
 #pragma once. He didn't say it caused problems. I don't expect it is,
 since we're already using it and have been for a long time.
 
 It probably just means that you have to to #pragma once along with the
 standard #ifndef ... #endif wrapper.

Understood.  The changes in this patch series use only the pragma, and
we've identified some benefits of that approach.  I'd like to have those
benefits, but this compiler seems to stand in the way.  We've had the
do we need to support this compiler for other compilers in the past.
Sometimes the answer is yes, and sometimes the answer is no.

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


[Mesa-dev] [Bug 70054] New: EnumStrings.LookUpByNumber regression

2013-10-02 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=70054

  Priority: medium
Bug ID: 70054
  Keywords: regression
CC: i...@freedesktop.org, kenn...@whitecape.org
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: EnumStrings.LookUpByNumber regression
  Severity: major
Classification: Unclassified
OS: Linux (All)
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Mesa core
   Product: Mesa

mesa: 61519f15aceae3e986a6e287e69684a01de3221a (master)

[ RUN  ] EnumStrings.LookUpByNumber
enum_strings.cpp:42: Failure
Value of: _mesa_lookup_enum_by_nr(everything[i].value)
  Actual: GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB
Expected: everything[i].name
Which is: GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET
enum_strings.cpp:42: Failure
Value of: _mesa_lookup_enum_by_nr(everything[i].value)
  Actual: GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB
Expected: everything[i].name
Which is: GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET
enum_strings.cpp:42: Failure
Value of: _mesa_lookup_enum_by_nr(everything[i].value)
  Actual: GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB
Expected: everything[i].name
Which is: GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS
[  FAILED  ] EnumStrings.LookUpByNumber (0 ms)


d3575622b7897c88c62e4f57341c196eb913c960 is the first bad commit
commit d3575622b7897c88c62e4f57341c196eb913c960
Author: Maxence Le Dore maxence.led...@gmail.com
Date:   Mon Dec 24 00:57:02 2012 +0100

mesa: add texture gather changes

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

:04 04 7f11fa847c0df393902f5913db63a3a896f3d654
69623c98c7b21a8397fe52ef62135660595f5b80 Msrc
bisect run success

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


[Mesa-dev] [Bug 70057] New: src/mesa/drivers/dri/common/xmlpool.h:103:29: fatal error: xmlpool/options.h: No such file or directory

2013-10-02 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=70057

  Priority: medium
Bug ID: 70057
  Keywords: regression
CC: emil.l.veli...@gmail.com, johannesoberm...@gmx.de,
tstel...@gmail.com
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: src/mesa/drivers/dri/common/xmlpool.h:103:29: fatal
error: xmlpool/options.h: No such file or directory
  Severity: blocker
Classification: Unclassified
OS: All
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Mesa core
   Product: Mesa

mesa: 61519f15aceae3e986a6e287e69684a01de3221a (master)

$ ./autogen.sh --with-dri-drivers= --with-gallium-drivers=swrast
$ make
[...]
  CC dri_screen.lo
In file included from dri_screen.c:33:0:
../../../../../src/mesa/drivers/dri/common/xmlpool.h:103:29: fatal error:
xmlpool/options.h: No such file or directory


cb1febb074ca5a9d4674c953106b467f175c4c0f is the first bad commit
commit cb1febb074ca5a9d4674c953106b467f175c4c0f
Author: Johannes Obermayr johannesoberm...@gmx.de
Date:   Tue Sep 17 18:09:02 2013 +0100

gallium/targets: Make use of prebuilt libdricommon.la.

libdricommon.la is available whenever a non swrast driver is built.
All the classic dri drivers make use of the prebuild library but all
of the gallium ones rebuild it explicitly.

While we're here gallium/{llvm,soft}pipe does not require HAVE_COMMON_DRI
thus do not set in during configure.

v2: [Emil] Add commit message and drop HAVE_COMMON_DRI from configure.ac
v3: [Emil] Rebase and resolve targets/r*/dri conflicts

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
Reviewed-by: Tom Stellard thomas.stell...@amd.com

:100644 100644 1f0a646a61f80ca7d9e8a2c7bf2c196194734081
389ac9180a48a061b6e8c18a08b3980b4424d679 Mconfigure.ac
:04 04 c71c616f37d5946284c9faaca2db8299d66343b7
d5b72d61df382e1a1ea79b8513b9369c78ab7660 Msrc

-- 
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] gen7: Use logical, not physical, dims in 3DSTATE_DEPTH_BUFFER

2013-10-02 Thread Chad Versace

On 10/02/2013 10:48 AM, Eric Anholt wrote:

Chad Versace chad.vers...@linux.intel.com writes:


In 3DSTATE_DEPTH_BUFFER, we set Width and Height to the miptree slice's
physical dimensions. (Logical and physical dimensions may differ for
multisample surfaces).

However, in SURFACE_STATE, we always set Width and Height to the slice's
logical dimensions. We should do the same for 3DSTATE_DEPTH_BUFFER,
because the hw docs say so.

No Piglit regressions (-x glx) on Ivybridge with Wayland.

CC: Paul Berry stereotype...@gmail.com
CC: Jordan Justen jordan.l.jus...@intel.com
CC: Ben Widawsky b...@bwidawsk.net
Signed-off-by: Chad Versace chad.vers...@linux.intel.com
---
  src/mesa/drivers/dri/i965/gen7_blorp.cpp| 3 ---
  src/mesa/drivers/dri/i965/gen7_misc_state.c | 5 -
  2 files changed, 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index 9df3d92..158f801 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -705,9 +705,6 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context 
*brw,
 */
surfwidth = params-depth.width;
surfheight = params-depth.height;
-   } else {
-  surfwidth = params-depth.mt-physical_width0;
-  surfheight = params-depth.mt-physical_height0;
 }


It looks like surfwidth/height doesn't get initialized in this case any
more.  logical_width0 wouldn't be right either, since you actually want
the logical of the particular slice.



This function doesn't use offsets into the depth buffer. It sets the 
3DSTATE_DEPTH_BUFFER
lod and min_array_element fields, just as is done by gen7_misc_state.c. 
Therefore,
I think that the deleted else branch should now look like this:

  } else {
 surfwidth = params-depth.mt-logical_width0;
 surfheight = params-depth.mt-logical_height0;
  }

Does anyone see any problems with that? Of course, I'll retest the patch.



The gen7_misc_state.c hunk is good, though.



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


[Mesa-dev] [Bug 70057] src/mesa/drivers/dri/common/xmlpool.h:103:29: fatal error: xmlpool/options.h: No such file or directory

2013-10-02 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=70057

Johannes Obermayr johannesoberm...@gmx.de changed:

   What|Removed |Added

   Assignee|mesa-dev@lists.freedesktop. |emil.l.veli...@gmail.com
   |org |

--- Comment #1 from Johannes Obermayr johannesoberm...@gmx.de ---
Assign to Emil because he didn't trust my build tests and did:
 v2: [Emil] Add commit message and drop HAVE_COMMON_DRI from configure.ac

-- 
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 1/2] r600g: texture offsets for non-TXF instructions

2013-10-02 Thread Grigori Goronzy
All texture instructions can use offsets, not just TXF. Offsets into
the literals array were wrong, too.
---
 src/gallium/drivers/r600/r600_shader.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 80cdcd5..6289d97 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -3779,16 +3779,16 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
}
}
 
-   if (inst-Instruction.Opcode == TGSI_OPCODE_TXF) {
-   /* get offset values */
-   if (inst-Texture.NumOffsets) {
-   assert(inst-Texture.NumOffsets == 1);
-
-   offset_x = ctx-literals[inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleX]  1;
-   offset_y = ctx-literals[inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleY]  1;
-   offset_z = ctx-literals[inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleZ]  1;
-   }
-   } else if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
+   /* get offset values */
+   if (inst-Texture.NumOffsets) {
+   assert(inst-Texture.NumOffsets == 1);
+
+   offset_x = ctx-literals[4 * inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleX]  1;
+   offset_y = ctx-literals[4 * inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleY]  1;
+   offset_z = ctx-literals[4 * inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleZ]  1;
+   }
+
+   if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
/* TGSI moves the sampler to src reg 3 for TXD */
sampler_src_reg = 3;
 
-- 
1.8.1.2

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


[Mesa-dev] [PATCH] configure: set HAVE_COMMON_DRI when building only swrast

2013-10-02 Thread Emil Velikov
With commit cb1febb07, I have incorrectly removed HAVE_COMMON_DRI
assuming that swrast does not need to build the the translations
for driconf options, as effectively swrast/drisw does not use them.

With the incomming unification work of dri and drisw, it makes
sense just to revert the offending hunk.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70057
Reported-by: Vinson Lee v...@freedesktop.org
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index e7c8223..9546163 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1823,6 +1823,7 @@ if test x$with_gallium_drivers != x; then
 
 if test x$enable_dri = xyes; then
 GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS dri-swrast
+HAVE_COMMON_DRI=yes
 fi
 if test x$enable_vdpau = xyes; then
 GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS vdpau-softpipe
-- 
1.8.4

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


Re: [Mesa-dev] [PATCH 1/2] r600g: texture offsets for non-TXF instructions

2013-10-02 Thread Grigori Goronzy

On 03.10.2013 00:12, Grigori Goronzy wrote:

All texture instructions can use offsets, not just TXF. Offsets into
the literals array were wrong, too.


BTW, I just noticed it now: this fixes the fs-textureOffset-2D piglit 
test, which unfortunately does not appear to be part of any of the test 
suites.



---
  src/gallium/drivers/r600/r600_shader.c | 20 ++--
  1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 80cdcd5..6289d97 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -3779,16 +3779,16 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
}
}

-   if (inst-Instruction.Opcode == TGSI_OPCODE_TXF) {
-   /* get offset values */
-   if (inst-Texture.NumOffsets) {
-   assert(inst-Texture.NumOffsets == 1);
-
-   offset_x = ctx-literals[inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleX]  1;
-   offset_y = ctx-literals[inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleY]  1;
-   offset_z = ctx-literals[inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleZ]  1;
-   }
-   } else if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
+   /* get offset values */
+   if (inst-Texture.NumOffsets) {
+   assert(inst-Texture.NumOffsets == 1);
+
+   offset_x = ctx-literals[4 * inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleX]  1;
+   offset_y = ctx-literals[4 * inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleY]  1;
+   offset_z = ctx-literals[4 * inst-TexOffsets[0].Index + 
inst-TexOffsets[0].SwizzleZ]  1;
+   }
+
+   if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
/* TGSI moves the sampler to src reg 3 for TXD */
sampler_src_reg = 3;




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


Re: [Mesa-dev] [PATCH] configure: set HAVE_COMMON_DRI when building only swrast

2013-10-02 Thread Ian Romanick
On 10/02/2013 03:27 PM, Emil Velikov wrote:
 With commit cb1febb07, I have incorrectly removed HAVE_COMMON_DRI
 assuming that swrast does not need to build the the translations
  ^^^
Just the. :)

 for driconf options, as effectively swrast/drisw does not use them.
 
 With the incomming unification work of dri and drisw, it makes
   ^
incoming

 sense just to revert the offending hunk.
 
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70057
 Reported-by: Vinson Lee v...@freedesktop.org
 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
 ---
  configure.ac | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/configure.ac b/configure.ac
 index e7c8223..9546163 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -1823,6 +1823,7 @@ if test x$with_gallium_drivers != x; then
  
  if test x$enable_dri = xyes; then
  GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS dri-swrast
 +HAVE_COMMON_DRI=yes
  fi
  if test x$enable_vdpau = xyes; then
  GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS vdpau-softpipe
 

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


Re: [Mesa-dev] [PATCH] i965: Implement ABO surface state emission.

2013-10-02 Thread Ian Romanick
On 10/02/2013 11:46 AM, Adrian M Negreanu wrote:
 
 On Oct 2, 2013 9:29 PM, Francisco Jerez curroje...@riseup.net
 mailto:curroje...@riseup.net wrote:

 The maximum number of atomic buffer objects is somewhat arbitrary, we
 can change it in the future easily if it turns out it's not enough...

 v2: Add comments with the relevant mesa dirty bits.  Fix usage of
 BRW_NEW_UNIFORM_BUFFER in the GS ABO state atom.
 v3: Update binding table layout diagrams.

 Reviewed-by: Paul Berry stereotype...@gmail.com
 mailto:stereotype...@gmail.com
 Hi,
 I guess this patch also depends on pending patches, right?
 Aiaiai-mesa fails to built it:
 
 On Oct 2, 2013 9:39 PM, Aiaiai aia...@aiaiai.ku wrote:
 Hi,
 
 I have tested your changes:
 
 [Mesa-dev] [PATCH] i965: Implement ABO surface state emission.
 
 Project: mesa (Mesa build tests)
 
 Configurations: android linux
 
 
 Tested the patch(es) on top of the following commits:
 4e4c32b r600/llvm: Adds support for MSAA
 8edbd76 r600g/llvm: Undef z and w component of 2D TXP inst
 9f183eb r600g/llvm: fix txq for texture buffer
 848c0e7 i965: compute DDX in a subspan based only on top row
 72edba1 i965/blorp: Use passed in framebuffer rather than ctx-DrawBuffer
 ef8cc3e ralloc: Remove the rzalloc-based new/delete operator definition
 macro.
 fcbbecb st/mesa: Switch glsl_to_tgsi_instruction to the non-zeroing
 allocator.
 
 
 Failed to build for android
 
 4e4c32b r600/llvm: Adds support for MSAA
 8edbd76 r600g/llvm: Undef z and w component of 2D TXP inst
 9f183eb r600g/llvm: fix txq for texture buffer
 848c0e7 i965: compute DDX in a subspan based only on top row
 72edba1 i965/blorp: Use passed in framebuffer rather than ctx-DrawBuffer
 ef8cc3e ralloc: Remove the rzalloc-based new/delete operator definition
 macro.
 fcbbecb st/mesa: Switch glsl_to_tgsi_instruction to the non-zeroing
 allocator.
 src/mesa/drivers/dri/i965/brw_state_dump.c:423:63: warning: pointer of
 type 'void *' used in arithmetic [-Wpointer-arith]
 src/mesa/drivers/dri/i965/brw_state_dump.c: In function 'dump_vs_constants':
 src/mesa/drivers/dri/i965/brw_state_dump.c:435:47: warning: pointer of
 type 'void *' used in arithmetic [-Wpointer-arith]
 src/mesa/drivers/dri/i965/brw_state_dump.c:436:45: warning: pointer of
 type 'void *' used in arithmetic [-Wpointer-arith]
 src/mesa/drivers/dri/i965/brw_state_dump.c: In function 'dump_wm_constants':
 src/mesa/drivers/dri/i965/brw_state_dump.c:451:47: warning: pointer of
 type 'void *' used in arithmetic [-Wpointer-arith]
 src/mesa/drivers/dri/i965/brw_state_dump.c:452:45: warning: pointer of
 type 'void *' used in arithmetic [-Wpointer-arith]
 src/mesa/drivers/dri/i965/brw_state_dump.c: In function
 'dump_binding_table':
 src/mesa/drivers/dri/i965/brw_state_dump.c:468:44: warning: pointer of
 type 'void *' used in arithmetic [-Wpointer-arith]
 src/mesa/drivers/dri/i965/brw_state_dump.c: In function 'dump_prog_cache':
 src/mesa/drivers/dri/i965/brw_state_dump.c:495:33: warning: pointer of
 type 'void *' used in arithmetic [-Wpointer-arith]
 src/mesa/drivers/dri/i965/brw_vs_surface_state.c: In function
 'brw_upload_vec4_pull_constants':
 src/mesa/drivers/dri/i965/brw_vs_surface_state.c:72:45: warning: pointer
 of type 'void *' used in arithmetic [-Wpointer-arith]
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c: In function
 'brw_upload_abo_surfaces':
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c:842:28: error: 'struct
 gl_shader_program' has no member named 'NumAtomicBuffers'
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c:844:14: error: 'struct
 gl_context' has no member named 'AtomicBufferBindings'
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c:844:41: error: 'struct
 gl_shader_program' has no member named 'AtomicBuffers'
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c:846:37: error:
 dereferencing pointer to incomplete type
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c:850:16: error: 'struct
 anonymous' has no member named 'create_raw_surface'
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c:850:52: error:
 dereferencing pointer to incomplete type
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c:851:54: error:
 dereferencing pointer to incomplete type
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c:855:12: error: 'struct
 gl_shader_program' has no member named 'NumAtomicBuffers'
 make: ***
 [out/target/product/samsungxe700t/obj/SHARED_LIBRARIES/i965_dri_intermediates/brw_wm_surface_state.o]
 Error 1
 FAILURE

I believe this patch depends on a large (20?) number of patches that
Curro previously posted.

 
 
 ---
  src/mesa/drivers/dri/i965/brw_context.h  | 27 --
  src/mesa/drivers/dri/i965/brw_gs_surface_state.c | 21 +++
  src/mesa/drivers/dri/i965/brw_state.h|  3 ++
  src/mesa/drivers/dri/i965/brw_state_upload.c  

[Mesa-dev] [PATCHv2] configure: set HAVE_COMMON_DRI when building only swrast

2013-10-02 Thread Emil Velikov
With commit cb1febb07, I have incorrectly removed HAVE_COMMON_DRI
assuming that swrast does not need to build the translations for
driconf options, as effectively swrast/drisw does not use them.

With the incoming unification work of dri and drisw, it makes
sense just to revert the offending hunk.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70057
Reported-by: Vinson Lee v...@freedesktop.org
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
v2: resolve typos in the commit message. Thanks Ian

 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index e7c8223..9546163 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1823,6 +1823,7 @@ if test x$with_gallium_drivers != x; then
 
 if test x$enable_dri = xyes; then
 GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS dri-swrast
+HAVE_COMMON_DRI=yes
 fi
 if test x$enable_vdpau = xyes; then
 GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS vdpau-softpipe
-- 
1.8.4

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


Re: [Mesa-dev] [PATCH 1/2] r600g: texture offsets for non-TXF instructions

2013-10-02 Thread Marek Olšák
I don't understand. All piglit tests should be listed in all.tests. Is
it not the case with fs-textureOffset-2D?

Marek

On Thu, Oct 3, 2013 at 12:36 AM, Grigori Goronzy g...@chown.ath.cx wrote:
 On 03.10.2013 00:12, Grigori Goronzy wrote:

 All texture instructions can use offsets, not just TXF. Offsets into
 the literals array were wrong, too.


 BTW, I just noticed it now: this fixes the fs-textureOffset-2D piglit test,
 which unfortunately does not appear to be part of any of the test suites.


 ---
   src/gallium/drivers/r600/r600_shader.c | 20 ++--
   1 file changed, 10 insertions(+), 10 deletions(-)

 diff --git a/src/gallium/drivers/r600/r600_shader.c
 b/src/gallium/drivers/r600/r600_shader.c
 index 80cdcd5..6289d97 100644
 --- a/src/gallium/drivers/r600/r600_shader.c
 +++ b/src/gallium/drivers/r600/r600_shader.c
 @@ -3779,16 +3779,16 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
 }
 }

 -   if (inst-Instruction.Opcode == TGSI_OPCODE_TXF) {
 -   /* get offset values */
 -   if (inst-Texture.NumOffsets) {
 -   assert(inst-Texture.NumOffsets == 1);
 -
 -   offset_x = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleX]  1;
 -   offset_y = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleY]  1;
 -   offset_z = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleZ]  1;
 -   }
 -   } else if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
 +   /* get offset values */
 +   if (inst-Texture.NumOffsets) {
 +   assert(inst-Texture.NumOffsets == 1);
 +
 +   offset_x = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleX]  1;
 +   offset_y = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleY]  1;
 +   offset_z = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleZ]  1;
 +   }
 +
 +   if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
 /* TGSI moves the sampler to src reg 3 for TXD */
 sampler_src_reg = 3;



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


Re: [Mesa-dev] [PATCH 1/2] r600g: texture offsets for non-TXF instructions

2013-10-02 Thread Ian Romanick
On 10/02/2013 04:20 PM, Marek Olšák wrote:
 I don't understand. All piglit tests should be listed in all.tests. Is
 it not the case with fs-textureOffset-2D?

I think that's a shader_runner test (file name is *.shader_test).
shader_runner tests aren't explicitly listed in all.tests.  Instead some
code in all.tests finds and adds all of them.  Perhaps that is adding to
the confusion here?

 Marek
 
 On Thu, Oct 3, 2013 at 12:36 AM, Grigori Goronzy g...@chown.ath.cx wrote:
 On 03.10.2013 00:12, Grigori Goronzy wrote:

 All texture instructions can use offsets, not just TXF. Offsets into
 the literals array were wrong, too.


 BTW, I just noticed it now: this fixes the fs-textureOffset-2D piglit test,
 which unfortunately does not appear to be part of any of the test suites.


 ---
   src/gallium/drivers/r600/r600_shader.c | 20 ++--
   1 file changed, 10 insertions(+), 10 deletions(-)

 diff --git a/src/gallium/drivers/r600/r600_shader.c
 b/src/gallium/drivers/r600/r600_shader.c
 index 80cdcd5..6289d97 100644
 --- a/src/gallium/drivers/r600/r600_shader.c
 +++ b/src/gallium/drivers/r600/r600_shader.c
 @@ -3779,16 +3779,16 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
 }
 }

 -   if (inst-Instruction.Opcode == TGSI_OPCODE_TXF) {
 -   /* get offset values */
 -   if (inst-Texture.NumOffsets) {
 -   assert(inst-Texture.NumOffsets == 1);
 -
 -   offset_x = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleX]  1;
 -   offset_y = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleY]  1;
 -   offset_z = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleZ]  1;
 -   }
 -   } else if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
 +   /* get offset values */
 +   if (inst-Texture.NumOffsets) {
 +   assert(inst-Texture.NumOffsets == 1);
 +
 +   offset_x = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleX]  1;
 +   offset_y = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleY]  1;
 +   offset_z = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleZ]  1;
 +   }
 +
 +   if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
 /* TGSI moves the sampler to src reg 3 for TXD */
 sampler_src_reg = 3;



 ___
 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 mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH V4 01/13] mesa: add texture gather changes

2013-10-02 Thread Paul Berry
On 30 September 2013 03:08, Chris Forbes chr...@ijw.co.nz wrote:

 From: Maxence Le Dore maxence.led...@gmail.com

 Reviewed-by: Kenneth Graunke kenn...@whitecape.org


This patch broke make check for me.  src/mesa/main/tests/test-suite.log
shows:

==
   Mesa 9.3.0-devel: src/mesa/main/tests/test-suite.log
==

# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: main-test
===

Running main() from gtest_main.cc
[==] Running 6 tests from 2 test cases.
[--] Global test environment set-up.
[--] 2 tests from EnumStrings
[ RUN  ] EnumStrings.LookUpByNumber
enum_strings.cpp:42: Failure
Value of: _mesa_lookup_enum_by_nr(everything[i].value)
  Actual: GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB
Expected: everything[i].name
Which is: GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET
enum_strings.cpp:42: Failure
Value of: _mesa_lookup_enum_by_nr(everything[i].value)
  Actual: GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB
Expected: everything[i].name
Which is: GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET
enum_strings.cpp:42: Failure
Value of: _mesa_lookup_enum_by_nr(everything[i].value)
  Actual: GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB
Expected: everything[i].name
Which is: GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS
[  FAILED  ] EnumStrings.LookUpByNumber (0 ms)
[ RUN  ] EnumStrings.LookUpUnknownNumber
[   OK ] EnumStrings.LookUpUnknownNumber (0 ms)
[--] 2 tests from EnumStrings (0 ms total)

[--] 4 tests from DispatchSanity_test
[ RUN  ] DispatchSanity_test.GL31_CORE
[   OK ] DispatchSanity_test.GL31_CORE (2 ms)
[ RUN  ] DispatchSanity_test.GLES11
[   OK ] DispatchSanity_test.GLES11 (0 ms)
[ RUN  ] DispatchSanity_test.GLES2
[   OK ] DispatchSanity_test.GLES2 (1 ms)
[ RUN  ] DispatchSanity_test.GLES3
[   OK ] DispatchSanity_test.GLES3 (0 ms)
[--] 4 tests from DispatchSanity_test (3 ms total)

[--] Global test environment tear-down
[==] 6 tests from 2 test cases ran. (3 ms total)
[  PASSED  ] 5 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] EnumStrings.LookUpByNumber

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


Re: [Mesa-dev] [PATCH 1/2] r600g: texture offsets for non-TXF instructions

2013-10-02 Thread Roland Scheidegger
That's news to me that all tests must be part of all.tests. You can
blame me for that, I thought there were others not being part of
all.tests, but the README indeed states all new tests must be part of
it. So maybe the only tests not added there are those I wrote :-).

Roland


Am 03.10.2013 01:20, schrieb Marek Olšák:
 I don't understand. All piglit tests should be listed in all.tests. Is
 it not the case with fs-textureOffset-2D?
 
 Marek
 
 On Thu, Oct 3, 2013 at 12:36 AM, Grigori Goronzy g...@chown.ath.cx wrote:
 On 03.10.2013 00:12, Grigori Goronzy wrote:

 All texture instructions can use offsets, not just TXF. Offsets into
 the literals array were wrong, too.


 BTW, I just noticed it now: this fixes the fs-textureOffset-2D piglit test,
 which unfortunately does not appear to be part of any of the test suites.


 ---
   src/gallium/drivers/r600/r600_shader.c | 20 ++--
   1 file changed, 10 insertions(+), 10 deletions(-)

 diff --git a/src/gallium/drivers/r600/r600_shader.c
 b/src/gallium/drivers/r600/r600_shader.c
 index 80cdcd5..6289d97 100644
 --- a/src/gallium/drivers/r600/r600_shader.c
 +++ b/src/gallium/drivers/r600/r600_shader.c
 @@ -3779,16 +3779,16 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
 }
 }

 -   if (inst-Instruction.Opcode == TGSI_OPCODE_TXF) {
 -   /* get offset values */
 -   if (inst-Texture.NumOffsets) {
 -   assert(inst-Texture.NumOffsets == 1);
 -
 -   offset_x = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleX]  1;
 -   offset_y = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleY]  1;
 -   offset_z = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleZ]  1;
 -   }
 -   } else if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
 +   /* get offset values */
 +   if (inst-Texture.NumOffsets) {
 +   assert(inst-Texture.NumOffsets == 1);
 +
 +   offset_x = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleX]  1;
 +   offset_y = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleY]  1;
 +   offset_z = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleZ]  1;
 +   }
 +
 +   if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
 /* TGSI moves the sampler to src reg 3 for TXD */
 sampler_src_reg = 3;



 ___
 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 mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] r600g: texture offsets for non-TXF instructions

2013-10-02 Thread Ian Romanick
On 10/02/2013 05:08 PM, Roland Scheidegger wrote:
 That's news to me that all tests must be part of all.tests. You can
 blame me for that, I thought there were others not being part of
 all.tests, but the README indeed states all new tests must be part of
 it. So maybe the only tests not added there are those I wrote :-).

It only required if... you know... you want people to actually run them. :)

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


Re: [Mesa-dev] [PATCH V4 01/13] mesa: add texture gather changes

2013-10-02 Thread Chris Forbes
Hi Paul,

Sorry, I should have run make check first.

I'll fix this when I get home.

-- Chris

On Thu, Oct 3, 2013 at 1:06 PM, Paul Berry stereotype...@gmail.com wrote:
 On 30 September 2013 03:08, Chris Forbes chr...@ijw.co.nz wrote:

 From: Maxence Le Dore maxence.led...@gmail.com

 Reviewed-by: Kenneth Graunke kenn...@whitecape.org


 This patch broke make check for me.  src/mesa/main/tests/test-suite.log
 shows:

 ==
Mesa 9.3.0-devel: src/mesa/main/tests/test-suite.log
 ==

 # TOTAL: 1
 # PASS:  0
 # SKIP:  0
 # XFAIL: 0
 # FAIL:  1
 # XPASS: 0
 # ERROR: 0

 .. contents:: :depth: 2

 FAIL: main-test
 ===

 Running main() from gtest_main.cc
 [==] Running 6 tests from 2 test cases.
 [--] Global test environment set-up.
 [--] 2 tests from EnumStrings
 [ RUN  ] EnumStrings.LookUpByNumber
 enum_strings.cpp:42: Failure
 Value of: _mesa_lookup_enum_by_nr(everything[i].value)
   Actual: GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB
 Expected: everything[i].name
 Which is: GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET
 enum_strings.cpp:42: Failure
 Value of: _mesa_lookup_enum_by_nr(everything[i].value)
   Actual: GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB
 Expected: everything[i].name
 Which is: GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET
 enum_strings.cpp:42: Failure
 Value of: _mesa_lookup_enum_by_nr(everything[i].value)
   Actual: GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB
 Expected: everything[i].name
 Which is: GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS
 [  FAILED  ] EnumStrings.LookUpByNumber (0 ms)
 [ RUN  ] EnumStrings.LookUpUnknownNumber
 [   OK ] EnumStrings.LookUpUnknownNumber (0 ms)
 [--] 2 tests from EnumStrings (0 ms total)

 [--] 4 tests from DispatchSanity_test
 [ RUN  ] DispatchSanity_test.GL31_CORE
 [   OK ] DispatchSanity_test.GL31_CORE (2 ms)
 [ RUN  ] DispatchSanity_test.GLES11
 [   OK ] DispatchSanity_test.GLES11 (0 ms)
 [ RUN  ] DispatchSanity_test.GLES2
 [   OK ] DispatchSanity_test.GLES2 (1 ms)
 [ RUN  ] DispatchSanity_test.GLES3
 [   OK ] DispatchSanity_test.GLES3 (0 ms)
 [--] 4 tests from DispatchSanity_test (3 ms total)

 [--] Global test environment tear-down
 [==] 6 tests from 2 test cases ran. (3 ms total)
 [  PASSED  ] 5 tests.
 [  FAILED  ] 1 test, listed below:
 [  FAILED  ] EnumStrings.LookUpByNumber

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


Re: [Mesa-dev] [PATCH 1/2] r600g: texture offsets for non-TXF instructions

2013-10-02 Thread Ian Romanick
On 10/02/2013 05:03 PM, Ian Romanick wrote:
 On 10/02/2013 04:20 PM, Marek Olšák wrote:
 I don't understand. All piglit tests should be listed in all.tests. Is
 it not the case with fs-textureOffset-2D?
 
 I think that's a shader_runner test (file name is *.shader_test).
 shader_runner tests aren't explicitly listed in all.tests.  Instead some
 code in all.tests finds and adds all of them.  Perhaps that is adding to
 the confusion here?

Nope... it's not a shader_runner test.

 Marek

 On Thu, Oct 3, 2013 at 12:36 AM, Grigori Goronzy g...@chown.ath.cx wrote:
 On 03.10.2013 00:12, Grigori Goronzy wrote:

 All texture instructions can use offsets, not just TXF. Offsets into
 the literals array were wrong, too.


 BTW, I just noticed it now: this fixes the fs-textureOffset-2D piglit test,
 which unfortunately does not appear to be part of any of the test suites.


 ---
   src/gallium/drivers/r600/r600_shader.c | 20 ++--
   1 file changed, 10 insertions(+), 10 deletions(-)

 diff --git a/src/gallium/drivers/r600/r600_shader.c
 b/src/gallium/drivers/r600/r600_shader.c
 index 80cdcd5..6289d97 100644
 --- a/src/gallium/drivers/r600/r600_shader.c
 +++ b/src/gallium/drivers/r600/r600_shader.c
 @@ -3779,16 +3779,16 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
 }
 }

 -   if (inst-Instruction.Opcode == TGSI_OPCODE_TXF) {
 -   /* get offset values */
 -   if (inst-Texture.NumOffsets) {
 -   assert(inst-Texture.NumOffsets == 1);
 -
 -   offset_x = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleX]  1;
 -   offset_y = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleY]  1;
 -   offset_z = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleZ]  1;
 -   }
 -   } else if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
 +   /* get offset values */
 +   if (inst-Texture.NumOffsets) {
 +   assert(inst-Texture.NumOffsets == 1);
 +
 +   offset_x = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleX]  1;
 +   offset_y = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleY]  1;
 +   offset_z = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleZ]  1;
 +   }
 +
 +   if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
 /* TGSI moves the sampler to src reg 3 for TXD */
 sampler_src_reg = 3;



 ___
 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 mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 

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


Re: [Mesa-dev] [PATCH 1/2] r600g: texture offsets for non-TXF instructions

2013-10-02 Thread Marek Olšák
Not all tests have to be part of all.tests, like the
framebuffer_blit_scaled ones, because they are more strict than the
spec mandates.

However generally, all tests that it makes sense to test regularly
should be listed in all.tests. I only use quick.tests, which is the
only way I use piglit. I don't run tests manually unless I have to
based on a report from quick.tests.

Marek

On Thu, Oct 3, 2013 at 2:08 AM, Roland Scheidegger srol...@vmware.com wrote:
 That's news to me that all tests must be part of all.tests. You can
 blame me for that, I thought there were others not being part of
 all.tests, but the README indeed states all new tests must be part of
 it. So maybe the only tests not added there are those I wrote :-).

 Roland


 Am 03.10.2013 01:20, schrieb Marek Olšák:
 I don't understand. All piglit tests should be listed in all.tests. Is
 it not the case with fs-textureOffset-2D?

 Marek

 On Thu, Oct 3, 2013 at 12:36 AM, Grigori Goronzy g...@chown.ath.cx wrote:
 On 03.10.2013 00:12, Grigori Goronzy wrote:

 All texture instructions can use offsets, not just TXF. Offsets into
 the literals array were wrong, too.


 BTW, I just noticed it now: this fixes the fs-textureOffset-2D piglit test,
 which unfortunately does not appear to be part of any of the test suites.


 ---
   src/gallium/drivers/r600/r600_shader.c | 20 ++--
   1 file changed, 10 insertions(+), 10 deletions(-)

 diff --git a/src/gallium/drivers/r600/r600_shader.c
 b/src/gallium/drivers/r600/r600_shader.c
 index 80cdcd5..6289d97 100644
 --- a/src/gallium/drivers/r600/r600_shader.c
 +++ b/src/gallium/drivers/r600/r600_shader.c
 @@ -3779,16 +3779,16 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
 }
 }

 -   if (inst-Instruction.Opcode == TGSI_OPCODE_TXF) {
 -   /* get offset values */
 -   if (inst-Texture.NumOffsets) {
 -   assert(inst-Texture.NumOffsets == 1);
 -
 -   offset_x = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleX]  1;
 -   offset_y = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleY]  1;
 -   offset_z = ctx-literals[inst-TexOffsets[0].Index
 + inst-TexOffsets[0].SwizzleZ]  1;
 -   }
 -   } else if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
 +   /* get offset values */
 +   if (inst-Texture.NumOffsets) {
 +   assert(inst-Texture.NumOffsets == 1);
 +
 +   offset_x = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleX]  1;
 +   offset_y = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleY]  1;
 +   offset_z = ctx-literals[4 * inst-TexOffsets[0].Index +
 inst-TexOffsets[0].SwizzleZ]  1;
 +   }
 +
 +   if (inst-Instruction.Opcode == TGSI_OPCODE_TXD) {
 /* TGSI moves the sampler to src reg 3 for TXD */
 sampler_src_reg = 3;



 ___
 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 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 00/19] glsl: Support redeclaration of gl_PerVertex interface blck.

2013-10-02 Thread Paul Berry
This patch series adds the necessary machinery to the GLSL compiler to
allow shaders to redeclare the gl_PerVertex interface block.  Although
the precise rules for how to redeclare gl_PerVertex were not published
until GLSL 4.10, it seems clear from context that this was intended as
a clarification rather than a change in behaviour, so it makes sense
to implement the rules now.  Also, redeclaration of gl_PerVertex is
required in order to get some corner cases of gl_ClipDistance working
with geometry shaders.

This patch series represents the last of the scary geometry shader
tasks.  Everything that's left after this is bug fixing and a lot more
testing.  Once this series lands, I plan to turn on geometry shader
support for i965 so people can start trying it out.

Patches 1-2 make some minor corrections to previous work I've done.
Patches 3-4 create the built-in gl_PerVertex output block (previously
we only created gl_PerVertex for geometry shader inputs).  Patch 5
fixes the interface block comparison code to properly account for the
location field (without this, there would be subtle bugs in later
patches).

Patches 6-11 implement the rules for what's allowed to be declared in
an interface block and what's not, including fixing a bunch of
loopholes where we allowed identifiers starting with gl_ where we
shouldn't.

Patches 12-15 set up the groundwork for allowing gl_PerVertex to be
redeclared.  Patch 16 adds the ability to redeclare the gl_PerVertex
output interface block.  Patch 17 closes a loophole in detecting
compile-time errors.  Patch 18 adds the ability to redeclare the
gl_PerVertex input interface block.

Finally, patch 19 implements the rule that gl_PerVertex is not allowed
to be redeclared after a shader has used it.

Note: I recently published a piglit series containing the tests that I
used to validate this series.  A few minor corner cases still don't
pass yet:

- gs-redeclares-pervertex-out-after-global-redeclaration.geom
- gs-redeclares-pervertex-out-after-other-global-redeclaration.geom
- gs-redeclares-pervertex-out-before-global-redeclaration.geom
- vs-redeclares-pervertex-out-after-global-redeclaration.vert
- vs-redeclares-pervertex-out-after-other-global-redeclaration.vert
- vs-redeclares-pervertex-out-before-global-redeclaration.vert
- interstage-pervertex-redeclaration-unneeded
- intrastage-pervertex-in-redeclaration-unneeded
- intrastage-pervertex-out-redeclaration-unneeded

I plan to address these corner cases in forthcoming patches once this
series lands.

This series depends on two other patch series that have not yet landed:

- the series starting with glsl: Keep track of location for interface
  block fields. (partially reviewed by Ian)

- the series called glsl: Support unsized arrays in interface
  blocks. (not yet reviewed)

To see the series in its proper context, check out branch gs-phase-5
of https://github.com/stereotype441/mesa.git.

[PATCH 01/19] glsl: Construct gl_in with a location of -1.
[PATCH 02/19] glsl: Fix block name of built-in gl_PerVertex interface block.
[PATCH 03/19] glsl: Refactor code for creating gl_PerVertex interface block.
[PATCH 04/19] glsl: Construct gl_PerVertex interfaces for GS and VS outputs.
[PATCH 05/19] glsl: Account for location field when comparing interface blocks.
[PATCH 06/19] glsl: Refactor code to check that identifier names are valid.
[PATCH 07/19] glsl: Don't allow unnamed interface blocks to redeclare variables.
[PATCH 08/19] glsl: Don't allow invalid identifiers as interface block names.
[PATCH 09/19] glsl: Don't allow invalid identifier names in struct/interface 
fields.
[PATCH 10/19] glsl: Don't allow invalid identifiers as interface block instance 
names.
[PATCH 11/19] glsl: Don't allow invalid identifiers as struct names.
[PATCH 12/19] glsl: Generalize processing of variable redeclarations.
[PATCH 13/19] glsl: Add an ir_variable::reinit_interface_type() function.
[PATCH 14/19] glsl: Make it possible to remove a variable from the symbol table.
[PATCH 15/19] glsl: Error check redeclarations of gl_PerVertex.
[PATCH 16/19] glsl: Support redeclaration of VS and GS gl_PerVertex output.
[PATCH 17/19] glsl: Catch redeclaration of interface block instance names at 
compile time.
[PATCH 18/19] glsl: Support redeclaration of GS gl_PerVertex input.
[PATCH 19/19] glsl: Don't allow gl_PerVertex to be redeclared after it's been 
used.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 01/19] glsl: Construct gl_in with a location of -1.

2013-10-02 Thread Paul Berry
We use a location of -1 for variables which don't have their own
assigned locations--this includes ir_variables which represent named
interface blocks.  Technically the location assigned to gl_in doesn't
matter, since gl_in is only accessed via its members (which have their
own locations).  But it's nice to be consistent.
---
 src/glsl/builtin_variables.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 7ab120a..3667dc8 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -829,7 +829,7 @@ builtin_variable_generator::generate_varyings()
GLSL_INTERFACE_PACKING_STD140,
gl_in);
   ir_variable *var = add_variable(gl_in, array(per_vertex_type, 0),
-  ir_var_shader_in, 0);
+  ir_var_shader_in, -1);
   var-init_interface_type(per_vertex_type);
}
 }
-- 
1.8.4

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


[Mesa-dev] [PATCH 02/19] glsl: Fix block name of built-in gl_PerVertex interface block.

2013-10-02 Thread Paul Berry
Previously, we erroneously used the name gl_in for both the block
name and the instance name.
---
 src/glsl/builtin_variables.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 3667dc8..91518ba 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -827,7 +827,7 @@ builtin_variable_generator::generate_varyings()
  glsl_type::get_interface_instance(this-per_vertex_fields,
this-num_per_vertex_fields,
GLSL_INTERFACE_PACKING_STD140,
-   gl_in);
+   gl_PerVertex);
   ir_variable *var = add_variable(gl_in, array(per_vertex_type, 0),
   ir_var_shader_in, -1);
   var-init_interface_type(per_vertex_type);
-- 
1.8.4

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


[Mesa-dev] [PATCH 04/19] glsl: Construct gl_PerVertex interfaces for GS and VS outputs.

2013-10-02 Thread Paul Berry
Although these interfaces can't be accessed directly by GLSL (since
they don't have an instance name), they will be necessary in order to
allow redeclarations of gl_PerVertex.
---
 src/glsl/builtin_variables.cpp | 26 +++---
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 0ab7dda..f97fb8e 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -404,7 +404,8 @@ private:
const glsl_type * const mat3_t;
const glsl_type * const mat4_t;
 
-   per_vertex_accumulator per_vertex;
+   per_vertex_accumulator per_vertex_in;
+   per_vertex_accumulator per_vertex_out;
 };
 
 
@@ -803,10 +804,10 @@ builtin_variable_generator::add_varying(int slot, const 
glsl_type *type,
 {
switch (state-target) {
case geometry_shader:
-  this-per_vertex.add_field(slot, type, name);
+  this-per_vertex_in.add_field(slot, type, name);
   /* FALLTHROUGH */
case vertex_shader:
-  add_output(slot, type, name);
+  this-per_vertex_out.add_field(slot, type, name);
   break;
case fragment_shader:
   add_input(slot, type, name);
@@ -852,11 +853,22 @@ builtin_variable_generator::generate_varyings()
}
 
if (state-target == geometry_shader) {
-  const glsl_type *per_vertex_type =
- this-per_vertex.construct_interface_instance();
-  ir_variable *var = add_variable(gl_in, array(per_vertex_type, 0),
+  const glsl_type *per_vertex_in_type =
+ this-per_vertex_in.construct_interface_instance();
+  ir_variable *var = add_variable(gl_in, array(per_vertex_in_type, 0),
   ir_var_shader_in, -1);
-  var-init_interface_type(per_vertex_type);
+  var-init_interface_type(per_vertex_in_type);
+   }
+   if (state-target == vertex_shader || state-target == geometry_shader) {
+  const glsl_type *per_vertex_out_type =
+ this-per_vertex_out.construct_interface_instance();
+  const glsl_struct_field *fields = per_vertex_out_type-fields.structure;
+  for (unsigned i = 0; i  per_vertex_out_type-length; i++) {
+ ir_variable *var =
+add_variable(fields[i].name, fields[i].type, ir_var_shader_out,
+ fields[i].location);
+ var-init_interface_type(per_vertex_out_type);
+  }
}
 }
 
-- 
1.8.4

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


[Mesa-dev] [PATCH 05/19] glsl: Account for location field when comparing interface blocks.

2013-10-02 Thread Paul Berry
In commit e2660770731b018411fbe1620cacddaf8dff5287 (glsl: Keep track
of location for interface block fields), I neglected to update
glsl_type::record_key_compare to account for the fact that interface
types now contain location information.  As a result, interface types
that differ only by their location information would not be properly
distinguished.

At the moment this is not a problem, because the only interface block
in which location information != -1 is gl_PerVertex, and gl_PerVertex
is always created in the same way.  However, in the patches that
follow, we'll be adding new ways to create gl_PerVertex (by
redeclaring it), so we'll need location information to be handled
properly.
---
 src/glsl/glsl_types.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 4782d15..84414fd 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -452,6 +452,9 @@ glsl_type::record_key_compare(const void *a, const void *b)
   if (key1-fields.structure[i].row_major
  != key2-fields.structure[i].row_major)
 return 1;
+  if (key1-fields.structure[i].location
+  != key2-fields.structure[i].location)
+ return 1;
}
 
return 0;
-- 
1.8.4

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


[Mesa-dev] [PATCH 06/19] glsl: Refactor code to check that identifier names are valid.

2013-10-02 Thread Paul Berry
GLSL reserves identifiers beginning with gl_ or containing __, but
we haven't been consistent about enforcing this rule.  This patch
makes a new function to check whether identifier names are valid.  In
the process it closes a loophole where we would previously allow
function argument names to contain __.
---
 src/glsl/ast_to_hir.cpp | 65 -
 1 file changed, 32 insertions(+), 33 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index c1e3c08..f4f81e0 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2649,6 +2649,36 @@ handle_geometry_shader_input_decl(struct 
_mesa_glsl_parse_state *state,
}
 }
 
+
+void
+check_valid_identifier(const char *identifier, YYLTYPE loc,
+   struct _mesa_glsl_parse_state *state)
+{
+   /* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec,
+*
+*   Identifiers starting with gl_ are reserved for use by
+*   OpenGL, and may not be declared in a shader as either a
+*   variable or a function.
+*/
+   if (strncmp(identifier, gl_, 3) == 0)
+  _mesa_glsl_error(loc, state,
+   identifier `%s' uses reserved `gl_' prefix,
+   identifier);
+   else if (strstr(identifier, __)) {
+  /* From page 14 (page 20 of the PDF) of the GLSL 1.10
+   * spec:
+   *
+   * In addition, all identifiers containing two
+   *  consecutive underscores (__) are reserved as
+   *  possible future keywords.
+   */
+  _mesa_glsl_error(loc, state,
+   identifier `%s' uses reserved `__' string,
+   identifier);
+   }
+}
+
+
 ir_rvalue *
 ast_declarator_list::hir(exec_list *instructions,
 struct _mesa_glsl_parse_state *state)
@@ -3243,28 +3273,7 @@ ast_declarator_list::hir(exec_list *instructions,
* created for the declaration should be added to the IR stream.
*/
   if (earlier == NULL) {
-/* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec,
- *
- *   Identifiers starting with gl_ are reserved for use by
- *   OpenGL, and may not be declared in a shader as either a
- *   variable or a function.
- */
-if (strncmp(decl-identifier, gl_, 3) == 0)
-   _mesa_glsl_error( loc, state,
-identifier `%s' uses reserved `gl_' prefix,
-decl-identifier);
-else if (strstr(decl-identifier, __)) {
-   /* From page 14 (page 20 of the PDF) of the GLSL 1.10
-* spec:
-*
-* In addition, all identifiers containing two
-*  consecutive underscores (__) are reserved as
-*  possible future keywords.
-*/
-   _mesa_glsl_error( loc, state,
-identifier `%s' uses reserved `__' string,
-decl-identifier);
-}
+ check_valid_identifier(decl-identifier, loc, state);
 
 /* Add the variable to the symbol table.  Note that the initializer's
  * IR was already processed earlier (though it hasn't been emitted
@@ -3505,17 +3514,7 @@ ast_function::hir(exec_list *instructions,
   function body, name);
}
 
-   /* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec,
-*
-*   Identifiers starting with gl_ are reserved for use by
-*   OpenGL, and may not be declared in a shader as either a
-*   variable or a function.
-*/
-   if (strncmp(name, gl_, 3) == 0) {
-  YYLTYPE loc = this-get_location();
-  _mesa_glsl_error(loc, state,
-  identifier `%s' uses reserved `gl_' prefix, name);
-   }
+   check_valid_identifier(name, this-get_location(), state);
 
/* Convert the list of function parameters to HIR now so that they can be
 * used below to compare this function's signature with previously seen
-- 
1.8.4

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


[Mesa-dev] [PATCH 07/19] glsl: Don't allow unnamed interface blocks to redeclare variables.

2013-10-02 Thread Paul Berry
Note: some limited amount of redeclaration is actually allowed,
provided the shader is redeclaring the built-in gl_PerVertex interface
block.  Support for this will be added in future patches.

Fixes piglit tests
spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-{block-elem,global}.vert.
---
 src/glsl/ast_to_hir.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index f4f81e0..3615587 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4742,6 +4742,9 @@ ast_interface_block::hir(exec_list *instructions,
var_mode);
  var-init_interface_type(block_type);
 
+ if (state-symbols-get_variable(var-name) != NULL)
+_mesa_glsl_error(loc, state, `%s' redeclared, var-name);
+
  /* Propagate the binding keyword into this UBO's fields;
   * the UBO declaration itself doesn't get an ir_variable unless it
   * has an instance name.  This is ugly.
-- 
1.8.4

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


[Mesa-dev] [PATCH 08/19] glsl: Don't allow invalid identifiers as interface block names.

2013-10-02 Thread Paul Berry
Note: we need to make an exception for the gl_PerVertex interface
block, since this is allowed to be redeclared.  Future patches will
make redeclaration of gl_PerVertex work properly.

Fixes piglit test
spec/glsl-1.50/compiler/interface-block-name-uses-gl-prefix.vert.
---
 src/glsl/ast_to_hir.cpp | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 3615587..e2ec23c 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4614,6 +4614,7 @@ ast_interface_block::hir(exec_list *instructions,
   packing = GLSL_INTERFACE_PACKING_STD140;
}
 
+   bool redeclaring_per_vertex = strcmp(this-block_name, gl_PerVertex) == 0;
bool block_row_major = this-layout.flags.q.row_major;
exec_list declared_variables;
glsl_struct_field *fields;
@@ -4643,6 +4644,9 @@ ast_interface_block::hir(exec_list *instructions,
   assert(!interface block layout qualifier not found!);
}
 
+   if (!redeclaring_per_vertex)
+  check_valid_identifier(this-block_name, loc, state);
+
const glsl_type *block_type =
   glsl_type::get_interface_instance(fields,
 num_variables,
-- 
1.8.4

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


[Mesa-dev] [PATCH 09/19] glsl: Don't allow invalid identifier names in struct/interface fields.

2013-10-02 Thread Paul Berry
Note: we need to make an exception for the gl_PerVertex interface
block, since built-in variables are allowed to be redeclared inside
it.  Future patches will make redeclaration of gl_PerVertex work
properly.

Fixes piglit tests:
- spec/glsl-1.50/compiler/interface-block-array-elem-uses-gl-prefix.vert
- spec/glsl-1.50/compiler/named-interface-block-elem-uses-gl-prefix.vert
- spec/glsl-1.50/compiler/unnamed-interface-block-elem-uses-gl-prefix.vert
---
 src/glsl/ast_to_hir.cpp | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index e2ec23c..aabf201 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4410,7 +4410,8 @@ ast_process_structure_or_interface_block(exec_list 
*instructions,
 YYLTYPE loc,
 glsl_struct_field **fields_ret,
  bool is_interface,
- bool block_row_major)
+ bool block_row_major,
+ bool allow_reserved_names)
 {
unsigned decl_count = 0;
 
@@ -4452,6 +4453,9 @@ ast_process_structure_or_interface_block(exec_list 
*instructions,
 
   foreach_list_typed (ast_declaration, decl, link,
  decl_list-declarations) {
+ if (!allow_reserved_names)
+check_valid_identifier(decl-identifier, loc, state);
+
  /* From the GL_ARB_uniform_buffer_object spec:
   *
   * Sampler types are not allowed inside of uniform
@@ -4568,7 +4572,8 @@ ast_struct_specifier::hir(exec_list *instructions,
   loc,
   fields,
false,
-   false);
+   false,
+   false /* allow_reserved_names 
*/);
 
const glsl_type *t =
   glsl_type::get_record_instance(fields, decl_count, this-name);
@@ -4625,7 +4630,8 @@ ast_interface_block::hir(exec_list *instructions,
loc,
fields,
true,
-   block_row_major);
+   block_row_major,
+   redeclaring_per_vertex);
 
ir_variable_mode var_mode;
const char *iface_type_name;
-- 
1.8.4

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


[Mesa-dev] [PATCH 10/19] glsl: Don't allow invalid identifiers as interface block instance names.

2013-10-02 Thread Paul Berry
Note: we need to make an exception for the gl_PerVertex interface
block, since in geometry shaders it is allowed to be redeclared with
the instance name gl_in.  Future patches will make redeclaration of
gl_PerVertex work properly.

Fixes piglit test
spec/glsl-1.50/compiler/interface-block-instance-name-uses-gl-prefix.vert.
---
 src/glsl/ast_to_hir.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index aabf201..bb14fc9 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4692,6 +4692,9 @@ ast_interface_block::hir(exec_list *instructions,
 * field selector ( . ) operator (analogously to structures).
 */
if (this-instance_name) {
+  if (!redeclaring_per_vertex)
+ check_valid_identifier(this-instance_name, loc, state);
+
   ir_variable *var;
 
   if (this-is_array) {
-- 
1.8.4

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


[Mesa-dev] [PATCH 11/19] glsl: Don't allow invalid identifiers as struct names.

2013-10-02 Thread Paul Berry
Fixes piglit test
spec/glsl-1.10/compiler/struct/struct-name-uses-gl-prefix.vert.
---
 src/glsl/ast_to_hir.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index bb14fc9..8fb7f2f 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4575,6 +4575,8 @@ ast_struct_specifier::hir(exec_list *instructions,
false,
false /* allow_reserved_names 
*/);
 
+   check_valid_identifier(this-name, loc, state);
+
const glsl_type *t =
   glsl_type::get_record_instance(fields, decl_count, this-name);
 
-- 
1.8.4

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


[Mesa-dev] [PATCH 12/19] glsl: Generalize processing of variable redeclarations.

2013-10-02 Thread Paul Berry
This patch modifies the get_variable_being_redeclared() function so
that it no longer relies on the ast_declaration for the variable being
redeclared.  In future patches, this will allow
get_variable_being_redeclared() to be used for processing
redeclarations of the built-in gl_PerVertex interface block.
---
 src/glsl/ast_to_hir.cpp | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 8fb7f2f..de65c71 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2327,7 +2327,7 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
  * is a redeclaration, \c NULL otherwise.
  */
 ir_variable *
-get_variable_being_redeclared(ir_variable *var, ast_declaration *decl,
+get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
  struct _mesa_glsl_parse_state *state)
 {
/* Check if this declaration is actually a re-declaration, either to
@@ -2336,16 +2336,14 @@ get_variable_being_redeclared(ir_variable *var, 
ast_declaration *decl,
 * This is allowed for variables in the current scope, or when at
 * global scope (for built-ins in the implicit outer scope).
 */
-   ir_variable *earlier = state-symbols-get_variable(decl-identifier);
+   ir_variable *earlier = state-symbols-get_variable(var-name);
if (earlier == NULL ||
(state-current_function != NULL 
-   !state-symbols-name_declared_this_scope(decl-identifier))) {
+   !state-symbols-name_declared_this_scope(var-name))) {
   return NULL;
}
 
 
-   YYLTYPE loc = decl-get_location();
-
/* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec,
 *
 * It is legal to declare an array without a size and then
@@ -2434,7 +2432,7 @@ get_variable_being_redeclared(ir_variable *var, 
ast_declaration *decl,
   earlier-depth_layout = var-depth_layout;
 
} else {
-  _mesa_glsl_error(loc, state, `%s' redeclared, decl-identifier);
+  _mesa_glsl_error(loc, state, `%s' redeclared, var-name);
}
 
return earlier;
@@ -3221,7 +3219,8 @@ ast_declarator_list::hir(exec_list *instructions,
* instruction stream.
*/
   exec_list initializer_instructions;
-  ir_variable *earlier = get_variable_being_redeclared(var, decl, state);
+  ir_variable *earlier =
+ get_variable_being_redeclared(var, decl-get_location(), state);
 
   if (decl-initializer != NULL) {
 result = process_initializer((earlier == NULL) ? var : earlier,
-- 
1.8.4

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


[Mesa-dev] [PATCH 13/19] glsl: Add an ir_variable::reinit_interface_type() function.

2013-10-02 Thread Paul Berry
This will be used by future patches to change an ir_variable's
interface type when the gl_PerVertex built-in interface block is
redeclared.
---
 src/glsl/ir.h | 25 +
 1 file changed, 25 insertions(+)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 25c7e82..595c935 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -436,6 +436,31 @@ public:
   this-interface_type = type;
}
 
+   /**
+* Change this-interface_type on a variable that previously had a
+* different, and incompatible, interface_type. This is used during
+* compilation to handle redeclaration of the built-in gl_PerVertex
+* interface block.
+*/
+   void reinit_interface_type(const struct glsl_type *type)
+   {
+  if (this-max_ifc_array_access != NULL) {
+#ifndef _NDEBUG
+ /* Redeclaring gl_PerVertex is only allowed if none of the built-ins
+  * it defines have been accessed yet; so it's safe to throw away the
+  * old max_ifc_array_access pointer, since all of its values are
+  * zero.
+  */
+ for (unsigned i = 0; i  this-interface_type-length; i++)
+assert(this-max_ifc_array_access[i] == 0);
+#endif
+ ralloc_free(this-max_ifc_array_access);
+ this-max_ifc_array_access = NULL;
+  }
+  this-interface_type = NULL;
+  init_interface_type(type);
+   }
+
const glsl_type *get_interface_type() const
{
   return this-interface_type;
-- 
1.8.4

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


[Mesa-dev] [PATCH 14/19] glsl: Make it possible to remove a variable from the symbol table.

2013-10-02 Thread Paul Berry
In later patches, we'll use this in order to implement the required
behaviour that after the gl_PerVertex interface block has been
redeclared, only members of the redeclared interface block may be
used.
---
 src/glsl/glsl_symbol_table.cpp | 9 +
 src/glsl/glsl_symbol_table.h   | 7 +++
 2 files changed, 16 insertions(+)

diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp
index 6e916b4..694713a 100644
--- a/src/glsl/glsl_symbol_table.cpp
+++ b/src/glsl/glsl_symbol_table.cpp
@@ -256,3 +256,12 @@ symbol_table_entry *glsl_symbol_table::get_entry(const 
char *name)
return (symbol_table_entry *)
   _mesa_symbol_table_find_symbol(table, -1, name);
 }
+
+void
+glsl_symbol_table::remove_variable(const char *name)
+{
+   symbol_table_entry *entry = get_entry(name);
+   if (entry != NULL) {
+  entry-v = NULL;
+   }
+}
diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h
index 62d26b8..b73db3b 100644
--- a/src/glsl/glsl_symbol_table.h
+++ b/src/glsl/glsl_symbol_table.h
@@ -121,6 +121,13 @@ public:
   enum ir_variable_mode mode);
/*@}*/
 
+   /**
+* Remove a variable from the symbol table.  This is necessary when
+* gl_PerVertex is redeclared, to ensure that previously-available built-in
+* variables are no longer available.
+*/
+   void remove_variable(const char *name);
+
 private:
symbol_table_entry *get_entry(const char *name);
 
-- 
1.8.4

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


[Mesa-dev] [PATCH 15/19] glsl: Error check redeclarations of gl_PerVertex.

2013-10-02 Thread Paul Berry
This patch verifies that:

- The gl_PerVertex input interface block may only be redeclared in a
  geometry shader, and that it may only be redeclared as gl_in[].

- The gl_PerVertex output interface block may only be redeclared in a
  vertex or geometry shader, and that it may only be redeclared as a
  non-array without an interface name.

- gl_PerVertex may not be redeclared as any other type of interface
  block (i.e. as a uniform interface block).

As a side-effect, the code now keeps track of what the previous
declaration of gl_PerVertex was--this will be needed in future
patches.

Fixes piglit tests:
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-with-incorrect-name.geom
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-as-array.geom
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-with-instance-name.geom
---
 src/glsl/ast_to_hir.cpp | 60 +
 1 file changed, 60 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index de65c71..0badac7 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4654,6 +4654,66 @@ ast_interface_block::hir(exec_list *instructions,
if (!redeclaring_per_vertex)
   check_valid_identifier(this-block_name, loc, state);
 
+   const glsl_type *earlier_per_vertex = NULL;
+   if (redeclaring_per_vertex) {
+  /* Find the previous declaration of gl_PerVertex.  If we're redeclaring
+   * the named interface block gl_in, we can find it by looking at the
+   * previous declaration of gl_in.  Otherwise we can find it by looking
+   * at the previous decalartion of any of the built-in outputs,
+   * e.g. gl_Position.
+   *
+   * Also check that the instance name and array-ness of the redeclaration
+   * are correct.
+   */
+  switch (var_mode) {
+  case ir_var_shader_in:
+ if (ir_variable *earlier_gl_in =
+ state-symbols-get_variable(gl_in)) {
+earlier_per_vertex = earlier_gl_in-get_interface_type();
+ } else {
+_mesa_glsl_error(loc, state,
+ redeclaration of gl_PerVertex input not allowed 
+ in the %s shader,
+ _mesa_glsl_shader_target_name(state-target));
+ }
+ if (this-instance_name == NULL ||
+ strcmp(this-instance_name, gl_in) != 0 || !this-is_array) {
+_mesa_glsl_error(loc, state,
+ gl_PerVertex input must be redeclared as 
+ gl_in[]);
+ }
+ break;
+  case ir_var_shader_out:
+ if (ir_variable *earlier_gl_Position =
+ state-symbols-get_variable(gl_Position)) {
+earlier_per_vertex = earlier_gl_Position-get_interface_type();
+ } else {
+_mesa_glsl_error(loc, state,
+ redeclaration of gl_PerVertex output not 
+ allowed in the %s shader,
+ _mesa_glsl_shader_target_name(state-target));
+ }
+ if (this-instance_name != NULL) {
+_mesa_glsl_error(loc, state,
+ gl_PerVertex input may not be redeclared with 
+ an instance name);
+ }
+ break;
+  default:
+ _mesa_glsl_error(loc, state,
+  gl_PerVertex must be declared as an input or an 
+  output);
+ break;
+  }
+
+  if (earlier_per_vertex == NULL) {
+ /* An error has already been reported.  Bail out to avoid null
+  * dereferences later in this function.
+  */
+ return NULL;
+  }
+   }
+
const glsl_type *block_type =
   glsl_type::get_interface_instance(fields,
 num_variables,
-- 
1.8.4

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


[Mesa-dev] [PATCH 16/19] glsl: Support redeclaration of VS and GS gl_PerVertex output.

2013-10-02 Thread Paul Berry
Fixes piglit tests:
- spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs
- spec/glsl-1.50/execution/redeclare-pervertex-subset-vs
---
 src/glsl/ast_to_hir.cpp | 62 +++--
 1 file changed, 60 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 0badac7..c8a38e7 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2328,7 +2328,8 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
  */
 ir_variable *
 get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
- struct _mesa_glsl_parse_state *state)
+ struct _mesa_glsl_parse_state *state,
+  bool allow_all_redeclarations)
 {
/* Check if this declaration is actually a re-declaration, either to
 * resize an array or add qualifiers to an existing variable.
@@ -2431,6 +2432,16 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE 
loc,
 
   earlier-depth_layout = var-depth_layout;
 
+   } else if (allow_all_redeclarations) {
+  if (earlier-mode != var-mode) {
+ _mesa_glsl_error(loc, state,
+  redeclaration of `%s' with incorrect qualifiers,
+  var-name);
+  } else if (earlier-type != var-type) {
+ _mesa_glsl_error(loc, state,
+  redeclaration of `%s' has incorrect type,
+  var-name);
+  }
} else {
   _mesa_glsl_error(loc, state, `%s' redeclared, var-name);
}
@@ -3220,7 +3231,8 @@ ast_declarator_list::hir(exec_list *instructions,
*/
   exec_list initializer_instructions;
   ir_variable *earlier =
- get_variable_being_redeclared(var, decl-get_location(), state);
+ get_variable_being_redeclared(var, decl-get_location(), state,
+   false /* allow_all_redeclarations */);
 
   if (decl-initializer != NULL) {
 result = process_initializer((earlier == NULL) ? var : earlier,
@@ -4816,6 +4828,20 @@ ast_interface_block::hir(exec_list *instructions,
var_mode);
  var-init_interface_type(block_type);
 
+ if (redeclaring_per_vertex) {
+ir_variable *earlier =
+   get_variable_being_redeclared(var, loc, state,
+ true /* allow_all_redeclarations 
*/);
+if (strncmp(var-name, gl_, 3) != 0 || earlier == NULL) {
+   _mesa_glsl_error(loc, state,
+redeclaration of gl_PerVertex can only 
+include built-in variables);
+} else {
+   earlier-reinit_interface_type(block_type);
+}
+continue;
+ }
+
  if (state-symbols-get_variable(var-name) != NULL)
 _mesa_glsl_error(loc, state, `%s' redeclared, var-name);
 
@@ -4829,6 +4855,38 @@ ast_interface_block::hir(exec_list *instructions,
  state-symbols-add_variable(var);
  instructions-push_tail(var);
   }
+
+  if (redeclaring_per_vertex  block_type != earlier_per_vertex) {
+ /* From section 7.1 (Built-in Language Variables) of the GLSL 4.10 
spec:
+  *
+  * It is also a compilation error ... to redeclare a built-in
+  * block and then use a member from that built-in block that was
+  * not included in the redeclaration.
+  *
+  * This appears to be a clarification to the behaviour established
+  * for gl_PerVertex by GLSL 1.50, therefore we implement this
+  * behaviour regardless of GLSL version.
+  *
+  * To prevent the shader from using a member that was not included in
+  * the redeclaration, we simply remove any ir_variables that are
+  * still associated with the old declaration of gl_PerVertex (since
+  * we've already updated all of the variables contained in the new
+  * gl_PerVertex to point to it).
+  *
+  * As a side effect this will prevent
+  * validate_intrastage_interface_blocks() from getting confused and
+  * thinking there are conflicting definitions of gl_PerVertex in the
+  * shader.
+  */
+ foreach_list_safe(node, instructions) {
+ir_variable *const var = ((ir_instruction *) node)-as_variable();
+if (var != NULL 
+var-get_interface_type() == earlier_per_vertex) {
+   state-symbols-remove_variable(var-name);
+   var-remove();
+}
+ }
+  }
}
 
return NULL;
-- 
1.8.4

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


[Mesa-dev] [PATCH 17/19] glsl: Catch redeclaration of interface block instance names at compile time.

2013-10-02 Thread Paul Berry
From section 4.1.9 (Arrays) of the GLSL 4.40 spec (as of revision 7):

However, unless noted otherwise, blocks cannot be redeclared;
an unsized array in a user-declared block cannot be sized
through redeclaration.

The only place where the spec notes that interface blocks can be
redeclared is to allow for redeclaration of built-in interface blocks
such as gl_PerVertex.  Therefore, user-defined interface blocks can
never be redeclared.  This is a clarification of previous intent (see
Khronos bug 10659:
https://cvs.khronos.org/bugzilla/show_bug.cgi?id=10659).

We were already preventing interface block redeclaration using the
same block name at compile time, but we weren't preventing interface
block redeclaration using the same instance name (and different block
names) at compile time.  And we weren't preventing an instance name
from conflicting with a previously-declared ordinary variable.

In practice the problem would be caught at link time, but only because
of a coincidence: since ast_interface_block::hir() wasn't doing any
checking to see if the instance name already existed in the shader, it
was creating a second ir_variable in the shader having the same name
but a different type.  Coincidentally, when the linker checked for
intrastage consistency of global variable declarations, it treated the
two declarations from the same shader as a conflict, so it reported a
link error.

But it seems dangerous to rely on that linker behaviour to catch
illegal redeclarations that really ought to be detected at compile
time.
---
 src/glsl/ast_to_hir.cpp | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index c8a38e7..f44e97d 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4813,8 +4813,14 @@ ast_interface_block::hir(exec_list *instructions,
   var-init_interface_type(block_type);
   if (state-target == geometry_shader  var_mode == ir_var_shader_in)
  handle_geometry_shader_input_decl(state, loc, var);
-  state-symbols-add_variable(var);
-  instructions-push_tail(var);
+
+  if (state-symbols-get_variable(this-instance_name)) {
+ _mesa_glsl_error(loc, state, `%s' redeclared, this-instance_name);
+ delete var;
+  } else {
+ state-symbols-add_variable(var);
+ instructions-push_tail(var);
+  }
} else {
   /* In order to have an array size, the block must also be declared with
* an instane name.
-- 
1.8.4

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


[Mesa-dev] [PATCH 18/19] glsl: Support redeclaration of GS gl_PerVertex input.

2013-10-02 Thread Paul Berry
Fixes piglit test
spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.
---
 src/glsl/ast_to_hir.cpp | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index f44e97d..a4af562 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4724,6 +4724,19 @@ ast_interface_block::hir(exec_list *instructions,
   */
  return NULL;
   }
+
+  /* Copy locations from the old gl_PerVertex interface block. */
+  for (unsigned i = 0; i  num_variables; i++) {
+ int j = earlier_per_vertex-field_index(fields[i].name);
+ if (j == -1) {
+_mesa_glsl_error(loc, state,
+ redeclaration of gl_PerVertex must be a subset 
+ of the built-in members of gl_PerVertex);
+ } else {
+fields[i].location =
+   earlier_per_vertex-fields.structure[j].location;
+ }
+  }
}
 
const glsl_type *block_type =
@@ -4814,8 +4827,14 @@ ast_interface_block::hir(exec_list *instructions,
   if (state-target == geometry_shader  var_mode == ir_var_shader_in)
  handle_geometry_shader_input_decl(state, loc, var);
 
-  if (state-symbols-get_variable(this-instance_name)) {
- _mesa_glsl_error(loc, state, `%s' redeclared, this-instance_name);
+  if (ir_variable *earlier =
+  state-symbols-get_variable(this-instance_name)) {
+ if (!redeclaring_per_vertex) {
+_mesa_glsl_error(loc, state, `%s' redeclared,
+ this-instance_name);
+ }
+ earlier-type = var-type;
+ earlier-reinit_interface_type(block_type);
  delete var;
   } else {
  state-symbols-add_variable(var);
-- 
1.8.4

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


[Mesa-dev] [PATCH 19/19] glsl: Don't allow gl_PerVertex to be redeclared after it's been used.

2013-10-02 Thread Paul Berry
Fixes piglit tests:
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-after-other-usage.geom
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-after-other-usage.geom
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-after-usage.geom
- spec/glsl-1.50/compiler/vs-redeclares-pervertex-out-after-other-usage.vert
- spec/glsl-1.50/compiler/vs-redeclares-pervertex-out-after-usage.vert
---
 src/glsl/ast_to_hir.cpp | 53 +
 1 file changed, 53 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index a4af562..0294036 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4611,6 +4611,39 @@ ast_struct_specifier::hir(exec_list *instructions,
return NULL;
 }
 
+
+/**
+ * Visitor class which detects whether a given interface block has been used.
+ */
+class interface_block_usage_visitor : public ir_hierarchical_visitor
+{
+public:
+   interface_block_usage_visitor(ir_variable_mode mode, const glsl_type *block)
+  : mode(mode), block(block), found(false)
+   {
+   }
+
+   virtual ir_visitor_status visit(ir_dereference_variable *ir)
+   {
+  if (ir-var-mode == mode  ir-var-get_interface_type() == block) {
+ found = true;
+ return visit_stop;
+  }
+  return visit_continue;
+   }
+
+   bool usage_found() const
+   {
+  return this-found;
+   }
+
+private:
+   ir_variable_mode mode;
+   const glsl_type *block;
+   bool found;
+};
+
+
 ir_rvalue *
 ast_interface_block::hir(exec_list *instructions,
  struct _mesa_glsl_parse_state *state)
@@ -4737,6 +4770,26 @@ ast_interface_block::hir(exec_list *instructions,
earlier_per_vertex-fields.structure[j].location;
  }
   }
+
+  /* From section 7.1 (Built-in Language Variables) of the GLSL 4.10
+   * spec:
+   *
+   * If a built-in interface block is redeclared, it must appear in
+   * the shader before any use of any member included in the built-in
+   * declaration, or a compilation error will result.
+   *
+   * This appears to be a clarification to the behaviour established for
+   * gl_PerVertex by GLSL 1.50, therefore we implement this behaviour
+   * regardless of GLSL version.
+   */
+  interface_block_usage_visitor v(var_mode, earlier_per_vertex);
+  v.run(instructions);
+  if (v.usage_found()) {
+ _mesa_glsl_error(loc, state,
+  redeclaration of a built-in interface block must 
+  appear before any use of any member of the 
+  interface block);
+  }
}
 
const glsl_type *block_type =
-- 
1.8.4

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


[Mesa-dev] [PATCH] gen7: Use logical, not physical, dims in 3DSTATE_DEPTH_BUFFER (v2)

2013-10-02 Thread Chad Versace
In 3DSTATE_DEPTH_BUFFER, we set Width and Height to the miptree slice's
physical dimensions. (Logical and physical dimensions may differ for
multisample surfaces).

However, in SURFACE_STATE, we always set Width and Height to the slice's
logical dimensions. We should do the same for 3DSTATE_DEPTH_BUFFER,
because the hw docs say so.

No Piglit regressions (-x glx -x glean) on Ivybridge with Wayland.

v2: No Piglit regressions, for real this time.

CC: Jordan Justen jordan.l.jus...@intel.com
CC: Eric Anholt e...@anholt.org
Signed-off-by: Chad Versace chad.vers...@linux.intel.com
---

My first patch was garbage. It segfaulted in gen7_misc_state.c and hung the GPU
in gen7_blorp.cpp. I thought I regression tested it, but my Piglit automation
scripts suck; the scripts just ran Piglit twice on master.

I really regression tested this patch. I promise.



 src/mesa/drivers/dri/i965/gen7_blorp.cpp| 4 ++--
 src/mesa/drivers/dri/i965/gen7_misc_state.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index 9df3d92..f64e536 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -706,8 +706,8 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context 
*brw,
   surfwidth = params-depth.width;
   surfheight = params-depth.height;
} else {
-  surfwidth = params-depth.mt-physical_width0;
-  surfheight = params-depth.mt-physical_height0;
+  surfwidth = params-depth.mt-logical_width0;
+  surfheight = params-depth.mt-logical_height0;
}
 
/* 3DSTATE_DEPTH_BUFFER */
diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c 
b/src/mesa/drivers/dri/i965/gen7_misc_state.c
index eb942cf..3f3833e 100644
--- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
@@ -93,8 +93,8 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw,
lod = irb ? irb-mt_level - irb-mt-first_level : 0;
 
if (mt) {
-  width = mt-physical_width0;
-  height = mt-physical_height0;
+  width = mt-logical_width0;
+  height = mt-logical_height0;
}
 
/* _NEW_DEPTH, _NEW_STENCIL, _NEW_BUFFERS */
-- 
1.8.3.1

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


[Mesa-dev] [PATCH 03/19] glsl: Refactor code for creating gl_PerVertex interface block.

2013-10-02 Thread Paul Berry
Currently, we create just a single gl_PerVertex interface block for
geometry shader inputs.  In later patches, we'll also need to create
an interface block for geometry and vertex shader outputs.  Moving the
code into its own class will make reuse easier.
---
 src/glsl/builtin_variables.cpp | 72 --
 1 file changed, 49 insertions(+), 23 deletions(-)

diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 91518ba..0ab7dda 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -293,6 +293,51 @@ static const struct gl_builtin_uniform_desc 
_mesa_builtin_uniform_desc[] = {
 
 namespace {
 
+/**
+ * Data structure that accumulates fields for the gl_PerVertex interface
+ * block.
+ */
+class per_vertex_accumulator
+{
+public:
+   per_vertex_accumulator();
+   void add_field(int slot, const glsl_type *type, const char *name);
+   const glsl_type *construct_interface_instance() const;
+
+private:
+   glsl_struct_field fields[10];
+   unsigned num_fields;
+};
+
+
+per_vertex_accumulator::per_vertex_accumulator()
+   : num_fields(0)
+{
+}
+
+
+void
+per_vertex_accumulator::add_field(int slot, const glsl_type *type,
+  const char *name)
+{
+   assert(this-num_fields  ARRAY_SIZE(this-fields));
+   this-fields[this-num_fields].type = type;
+   this-fields[this-num_fields].name = name;
+   this-fields[this-num_fields].row_major = false;
+   this-fields[this-num_fields].location = slot;
+   this-num_fields++;
+}
+
+
+const glsl_type *
+per_vertex_accumulator::construct_interface_instance() const
+{
+   return glsl_type::get_interface_instance(this-fields, this-num_fields,
+GLSL_INTERFACE_PACKING_STD140,
+gl_PerVertex);
+}
+
+
 class builtin_variable_generator
 {
 public:
@@ -359,16 +404,7 @@ private:
const glsl_type * const mat3_t;
const glsl_type * const mat4_t;
 
-   /**
-* Array where the contents of the gl_PerVertex interface instance are
-* accumulated.
-*/
-   glsl_struct_field per_vertex_fields[10];
-
-   /**
-* Number of elements of per_vertex_fields which have been populated.
-*/
-   unsigned num_per_vertex_fields;
+   per_vertex_accumulator per_vertex;
 };
 
 
@@ -379,8 +415,7 @@ builtin_variable_generator::builtin_variable_generator(
  bool_t(glsl_type::bool_type), int_t(glsl_type::int_type),
  float_t(glsl_type::float_type), vec2_t(glsl_type::vec2_type),
  vec3_t(glsl_type::vec3_type), vec4_t(glsl_type::vec4_type),
- mat3_t(glsl_type::mat3_type), mat4_t(glsl_type::mat4_type),
- num_per_vertex_fields(0)
+ mat3_t(glsl_type::mat3_type), mat4_t(glsl_type::mat4_type)
 {
 }
 
@@ -768,13 +803,7 @@ builtin_variable_generator::add_varying(int slot, const 
glsl_type *type,
 {
switch (state-target) {
case geometry_shader:
-  assert(this-num_per_vertex_fields 
- ARRAY_SIZE(this-per_vertex_fields));
-  this-per_vertex_fields[this-num_per_vertex_fields].type = type;
-  this-per_vertex_fields[this-num_per_vertex_fields].name = name;
-  this-per_vertex_fields[this-num_per_vertex_fields].row_major = false;
-  this-per_vertex_fields[this-num_per_vertex_fields].location = slot;
-  this-num_per_vertex_fields++;
+  this-per_vertex.add_field(slot, type, name);
   /* FALLTHROUGH */
case vertex_shader:
   add_output(slot, type, name);
@@ -824,10 +853,7 @@ builtin_variable_generator::generate_varyings()
 
if (state-target == geometry_shader) {
   const glsl_type *per_vertex_type =
- glsl_type::get_interface_instance(this-per_vertex_fields,
-   this-num_per_vertex_fields,
-   GLSL_INTERFACE_PACKING_STD140,
-   gl_PerVertex);
+ this-per_vertex.construct_interface_instance();
   ir_variable *var = add_variable(gl_in, array(per_vertex_type, 0),
   ir_var_shader_in, -1);
   var-init_interface_type(per_vertex_type);
-- 
1.8.4

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


[Mesa-dev] [PATCH] mesa: fix make check for ARB_texture_gather

2013-10-02 Thread Chris Forbes
Clean up inconsistency in enum decoration:
- Use the undecorated enums where possible.
- MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB remains decorated, since it
  has no undecorated equivalent in GL4.

Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 src/mapi/glapi/gen/ARB_texture_gather.xml | 6 --
 src/mapi/glapi/gen/Makefile.am| 1 +
 src/mesa/main/get_hash_params.py  | 4 ++--
 src/mesa/main/tests/enum_strings.cpp  | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_texture_gather.xml 
b/src/mapi/glapi/gen/ARB_texture_gather.xml
index 01c7b88..41714ac 100644
--- a/src/mapi/glapi/gen/ARB_texture_gather.xml
+++ b/src/mapi/glapi/gen/ARB_texture_gather.xml
@@ -5,8 +5,10 @@
 
 category name=GL_ARB_texture_gather number=72
 
- enum name=MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB value=0x8E5E/
- enum name=MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB value=0x8E5F/
+ enum name=MIN_PROGRAM_TEXTURE_GATHER_OFFSET value=0x8E5E/
+ enum name=MAX_PROGRAM_TEXTURE_GATHER_OFFSET value=0x8E5F/
+
+ !-- This exists only in the ARB extension; not in GL4 --
  enum name=MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB value=0x8F9F/
 
 /category
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index 9b9b995..6bb2f1e 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -111,6 +111,7 @@ API_XML = \
ARB_texture_buffer_range.xml \
ARB_texture_compression_rgtc.xml \
ARB_texture_float.xml \
+   ARB_texture_gather.xml \
ARB_texture_rg.xml \
ARB_texture_storage.xml \
ARB_vertex_array_object.xml \
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 29cad26..e80a23c 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -718,8 +718,8 @@ descriptor=[
   [ TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB, LOC_CUSTOM, TYPE_INT, 
TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array ],
 
 # GL_ARB_texture_gather
-  [ MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB, 
CONTEXT_INT(Const.MinProgramTextureGatherOffset), extra_ARB_texture_gather],
-  [ MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB, 
CONTEXT_INT(Const.MaxProgramTextureGatherOffset), extra_ARB_texture_gather],
+  [ MIN_PROGRAM_TEXTURE_GATHER_OFFSET, 
CONTEXT_INT(Const.MinProgramTextureGatherOffset), extra_ARB_texture_gather],
+  [ MAX_PROGRAM_TEXTURE_GATHER_OFFSET, 
CONTEXT_INT(Const.MaxProgramTextureGatherOffset), extra_ARB_texture_gather],
   [ MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB, 
CONTEXT_INT(Const.MaxProgramTextureGatherComponents), 
extra_ARB_texture_gather],
 
 ]},
diff --git a/src/mesa/main/tests/enum_strings.cpp 
b/src/mesa/main/tests/enum_strings.cpp
index 6994f79..8a3103b 100644
--- a/src/mesa/main/tests/enum_strings.cpp
+++ b/src/mesa/main/tests/enum_strings.cpp
@@ -1789,7 +1789,7 @@ const struct enum_info everything[] = {
{ 0x8F9C, GL_SIGNED_NORMALIZED },
{ 0x8F9D, GL_PRIMITIVE_RESTART },
{ 0x8F9E, GL_PRIMITIVE_RESTART_INDEX },
-   { 0x8F9F, GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS },
+   { 0x8F9F, GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB },
{ 0x906F, GL_RGB10_A2UI },
{ 0x9100, GL_TEXTURE_2D_MULTISAMPLE },
{ 0x9101, GL_PROXY_TEXTURE_2D_MULTISAMPLE },
-- 
1.8.4

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


Re: [Mesa-dev] Updates to 9.2 branch

2013-10-02 Thread Carl Worth
Maarten Lankhorst maarten.lankho...@canonical.com writes:
 The 9.2 branch is falling a bit behind.  I'm going to trickle out
 patches to the stable branch over the next few days / week.  My plan is
 to do 9.2.1 during the week of XDC.
...
 Waiting for mesa 9.2.1. :D

And I interfered with Ian's plans by reminding him that I was taking
this over, and then being too-particularly prompt with it myself.

At this point, the 9.2 branch in git should be pretty good. There's only
the one patch in get-pick-list.sh output that hasn't been cherry-picked,
(and I asked for a refresh of that here on the list).

I'm giving the 9.1 branch one last pass so that we can give it one last
release simultaneous with 9.2.1 and then you should see 9.2.1 very soon
with the commits as they now stand.

Thanks for your patience, everyone!

-Carl


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


[Mesa-dev] gallium clear and depth mask clarification

2013-10-02 Thread Dave Airlie
Just want to check an inconsistency,

so GL clears respect glDepthMask, gallium docs don't explicitly
mention depth masking, they say clear isn't affected by color or
stencil write masks, should that sentence contain depth?

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