Mesa (master): mesa: add GL_EXT_copy_image support

2016-03-30 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: a94d8d51d7e426485a72e6cfd6185dee9df5e070
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a94d8d51d7e426485a72e6cfd6185dee9df5e070

Author: Ilia Mirkin 
Date:   Wed Feb 17 13:27:14 2016 -0500

mesa: add GL_EXT_copy_image support

The extension is identical to GL_OES_copy_image. But dEQP has tests that
want the EXT variant.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 

---

 src/mapi/glapi/gen/es_EXT.xml| 22 ++
 src/mesa/main/extensions_table.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index 149acd5..471f6b6 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -915,6 +915,28 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 717efab..1b00360 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -186,6 +186,7 @@ EXT(EXT_blend_subtract  , dummy_true
 EXT(EXT_buffer_storage  , ARB_buffer_storage   
  ,  x ,  x ,  x ,  31, 2015)
 EXT(EXT_color_buffer_float  , dummy_true   
  ,  x ,  x , ES1,  30, 2013)
 EXT(EXT_compiled_vertex_array   , dummy_true   
  , GLL,  x ,  x ,  x , 1996)
+EXT(EXT_copy_image  , OES_copy_image   
  ,  x ,  x ,  x ,  30, 2014)
 EXT(EXT_copy_texture, dummy_true   
  , GLL,  x ,  x ,  x , 1995)
 EXT(EXT_depth_bounds_test   , EXT_depth_bounds_test
  , GLL, GLC,  x ,  x , 2002)
 EXT(EXT_discard_framebuffer , dummy_true   
  ,  x ,  x , ES1, ES2, 2009)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: add GL_OES_copy_image support

2016-03-30 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: ebdb5345480957c4fc3068fab17926be28d7dcd4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ebdb5345480957c4fc3068fab17926be28d7dcd4

Author: Ilia Mirkin 
Date:   Mon Feb 15 20:34:52 2016 -0500

mesa: add GL_OES_copy_image support

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 

---

 docs/GL3.txt|  2 +-
 src/mapi/glapi/gen/es_EXT.xml   | 22 +
 src/mesa/main/copyimage.c   | 27 ++-
 src/mesa/main/extensions_table.h|  1 +
 src/mesa/main/mtypes.h  |  1 +
 src/mesa/main/tests/dispatch_sanity.cpp |  3 ++
 src/mesa/main/textureview.c | 86 +
 src/mesa/state_tracker/st_extensions.c  | 11 +
 8 files changed, 151 insertions(+), 2 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 489b821..c76b1e2 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -256,7 +256,7 @@ GLES3.2, GLSL ES 3.2
   GL_KHR_debug  DONE (all drivers)
   GL_KHR_robustness not started (90% done 
with the ARB variant)
   GL_KHR_texture_compression_astc_ldr   DONE (i965/gen9+)
-  GL_OES_copy_image not started (based on 
GL_ARB_copy_image, which is done for some drivers)
+  GL_OES_copy_image DONE (core only)
   GL_OES_draw_buffers_indexed   not started
   GL_OES_draw_elements_base_vertex  DONE (all drivers)
   GL_OES_geometry_shaderstarted (Marta)
diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index 8e51c05..149acd5 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -1013,6 +1013,28 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c
index d571d22..a0f1c69 100644
--- a/src/mesa/main/copyimage.c
+++ b/src/mesa/main/copyimage.c
@@ -25,6 +25,7 @@
  *Jason Ekstrand 
  */
 
+#include "context.h"
 #include "glheader.h"
 #include "errors.h"
 #include "enums.h"
@@ -360,8 +361,32 @@ compressed_format_compatible(const struct gl_context *ctx,
   case GL_COMPRESSED_SIGNED_RED_RGTC1:
  compressedClass = BLOCK_CLASS_64_BITS;
  break;
+  case GL_COMPRESSED_RGBA8_ETC2_EAC:
+  case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
+  case GL_COMPRESSED_RG11_EAC:
+  case GL_COMPRESSED_SIGNED_RG11_EAC:
+ if (_mesa_is_gles(ctx))
+compressedClass = BLOCK_CLASS_128_BITS;
+ else
+return false;
+ break;
+  case GL_COMPRESSED_RGB8_ETC2:
+  case GL_COMPRESSED_SRGB8_ETC2:
+  case GL_COMPRESSED_R11_EAC:
+  case GL_COMPRESSED_SIGNED_R11_EAC:
+  case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+  case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ if (_mesa_is_gles(ctx))
+compressedClass = BLOCK_CLASS_64_BITS;
+ else
+return false;
+ break;
   default:
- return false;
+ if (_mesa_is_gles(ctx) && _mesa_is_astc_format(compressedFormat))
+compressedClass = BLOCK_CLASS_128_BITS;
+ else
+return false;
+ break;
}
 
switch (otherFormat) {
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 84401fd..717efab 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -309,6 +309,7 @@ EXT(OES_blend_subtract  , dummy_true
 EXT(OES_byte_coordinates, dummy_true   
  ,  x ,  x , ES1,  x , 2002)
 EXT(OES_compressed_ETC1_RGB8_texture, OES_compressed_ETC1_RGB8_texture 
  ,  x ,  x , ES1, ES2, 2005)
 EXT(OES_compressed_paletted_texture , dummy_true   
  ,  x ,  x , ES1,  x , 2003)
+EXT(OES_copy_image  , OES_copy_image   
  ,  x ,  x ,  x ,  30, 2014)
 EXT(OES_depth24 , dummy_true   
  ,  x ,  x , ES1, ES2, 2005)
 EXT(OES_depth32 , dummy_false  
  ,  x ,  x ,  x ,  x , 2005)
 EXT(OES_depth_texture   , ARB_depth_texture
  ,  x ,  x ,  x , ES2, 2006)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index be8c21e..f2cb4cb 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3911,6 +3911,7 @@ struct gl_extensions
GLboolean EXT_transform_feedback;
GLboolean EXT_timer_query;
GLboolean EXT_vertex_array_bgra;
+   GLboolean 

Mesa (master): mesa: add GL_OES_shader_multisample_interpolation support

2016-03-30 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 3002296cb68ebc9705b29e024e5fc67d5565ed46
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3002296cb68ebc9705b29e024e5fc67d5565ed46

Author: Ilia Mirkin 
Date:   Sat Feb 20 15:03:55 2016 -0500

mesa: add GL_OES_shader_multisample_interpolation support

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 
Reviewed-by: Ian Romanick 

---

 src/compiler/glsl/builtin_functions.cpp  | 12 +++-
 src/compiler/glsl/glcpp/glcpp-parse.y|  4 +++-
 src/compiler/glsl/glsl_lexer.ll  |  2 +-
 src/compiler/glsl/glsl_parser_extras.cpp |  1 +
 src/compiler/glsl/glsl_parser_extras.h   |  2 ++
 src/mesa/main/extensions_table.h |  1 +
 src/mesa/main/get.c  |  5 +
 src/mesa/main/get_hash_params.py | 11 ---
 8 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/src/compiler/glsl/builtin_functions.cpp 
b/src/compiler/glsl/builtin_functions.cpp
index 62f07b2..65309fd 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -264,10 +264,12 @@ shader_packing_or_es31_or_gpu_shader5(const 
_mesa_glsl_parse_state *state)
 }
 
 static bool
-fs_gpu_shader5(const _mesa_glsl_parse_state *state)
+fs_interpolate_at(const _mesa_glsl_parse_state *state)
 {
return state->stage == MESA_SHADER_FRAGMENT &&
-  (state->is_version(400, 0) || state->ARB_gpu_shader5_enable);
+  (state->is_version(400, 320) ||
+   state->ARB_gpu_shader5_enable ||
+   state->OES_shader_multisample_interpolation_enable);
 }
 
 
@@ -5165,7 +5167,7 @@ builtin_builder::_interpolateAtCentroid(const glsl_type 
*type)
 {
ir_variable *interpolant = in_var(type, "interpolant");
interpolant->data.must_be_shader_input = 1;
-   MAKE_SIG(type, fs_gpu_shader5, 1, interpolant);
+   MAKE_SIG(type, fs_interpolate_at, 1, interpolant);
 
body.emit(ret(interpolate_at_centroid(interpolant)));
 
@@ -5178,7 +5180,7 @@ builtin_builder::_interpolateAtOffset(const glsl_type 
*type)
ir_variable *interpolant = in_var(type, "interpolant");
interpolant->data.must_be_shader_input = 1;
ir_variable *offset = in_var(glsl_type::vec2_type, "offset");
-   MAKE_SIG(type, fs_gpu_shader5, 2, interpolant, offset);
+   MAKE_SIG(type, fs_interpolate_at, 2, interpolant, offset);
 
body.emit(ret(interpolate_at_offset(interpolant, offset)));
 
@@ -5191,7 +5193,7 @@ builtin_builder::_interpolateAtSample(const glsl_type 
*type)
ir_variable *interpolant = in_var(type, "interpolant");
interpolant->data.must_be_shader_input = 1;
ir_variable *sample_num = in_var(glsl_type::int_type, "sample_num");
-   MAKE_SIG(type, fs_gpu_shader5, 2, interpolant, sample_num);
+   MAKE_SIG(type, fs_interpolate_at, 2, interpolant, sample_num);
 
body.emit(ret(interpolate_at_sample(interpolant, sample_num)));
 
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y 
b/src/compiler/glsl/glcpp/glcpp-parse.y
index 14d2c7d..e8646c0 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -2371,8 +2371,10 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t 
*parser, intmax_t versio
   if (extensions != NULL) {
  if (extensions->OES_EGL_image_external)
 add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
-  if (extensions->OES_sample_variables)
+  if (extensions->OES_sample_variables) {
  add_builtin_define(parser, "GL_OES_sample_variables", 1);
+ add_builtin_define(parser, 
"GL_OES_shader_multisample_interpolation", 1);
+  }
   if (extensions->OES_standard_derivatives)
  add_builtin_define(parser, "GL_OES_standard_derivatives", 1);
   if (extensions->ARB_texture_multisample)
diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll
index 5492045..0b7695f 100644
--- a/src/compiler/glsl/glsl_lexer.ll
+++ b/src/compiler/glsl/glsl_lexer.ll
@@ -584,7 +584,7 @@ usamplerBuffer  KEYWORD_WITH_ALT(140, 300, 140, 320, 
yyextra->EXT_texture_buffer_
 
 /* Additional reserved words in GLSL ES 3.00 */
 resource   KEYWORD(0, 300, 0, 0, RESOURCE);
-sample KEYWORD_WITH_ALT(400, 300, 400, 0, 
yyextra->ARB_gpu_shader5_enable, SAMPLE);
+sample KEYWORD_WITH_ALT(400, 300, 400, 320, 
yyextra->ARB_gpu_shader5_enable || 
yyextra->OES_shader_multisample_interpolation_enable, SAMPLE);
 subroutine KEYWORD_WITH_ALT(400, 300, 400, 0, 
yyextra->ARB_shader_subroutine_enable, SUBROUTINE);
 
 
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp 
b/src/compiler/glsl/glsl_parser_extras.cpp
index def86e1..3dc6874 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -617,6 +617,7 @@ static const _mesa_glsl_extension 
_mesa_glsl_supported_extensions[] = {
 

Mesa (master): st/mesa: add ES sample-shading support

2016-03-30 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 2c7f5fe2960362b266aeb8e1ed0ebea762131df5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c7f5fe2960362b266aeb8e1ed0ebea762131df5

Author: Ilia Mirkin 
Date:   Tue Feb 16 01:27:27 2016 -0500

st/mesa: add ES sample-shading support

We require the full ARB_gpu_shader5 for now, but in the future some
other CAP could get exposed to indicate that only the multisample-related
behavior of ARB_gpu_shader5 is available.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 

---

 docs/GL3.txt   | 6 +++---
 src/mesa/state_tracker/st_extensions.c | 6 ++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index f6248da..489b821 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -262,11 +262,11 @@ GLES3.2, GLSL ES 3.2
   GL_OES_geometry_shaderstarted (Marta)
   GL_OES_gpu_shader5DONE (all drivers that 
support GL_ARB_gpu_shader5)
   GL_OES_primitive_bounding box not started
-  GL_OES_sample_shading not started (based on 
parts of GL_ARB_sample_shading, which is done for some drivers)
-  GL_OES_sample_variables   not started (based on 
parts of GL_ARB_sample_shading, which is done for some drivers)
+  GL_OES_sample_shading DONE (nvc0, r600, 
radeonsi)
+  GL_OES_sample_variables   DONE (nvc0, r600, 
radeonsi)
   GL_OES_shader_image_atomicDONE (all drivers that 
support GL_ARB_shader_image_load_store)
   GL_OES_shader_io_blocks   not started (based on 
parts of GLSL 1.50, which is done)
-  GL_OES_shader_multisample_interpolation   not started (based on 
parts of GL_ARB_gpu_shader5, which is done)
+  GL_OES_shader_multisample_interpolation   DONE (nvc0, r600, 
radeonsi)
   GL_OES_tessellation_shadernot started (based on 
GL_ARB_tessellation_shader, which is done for some drivers)
   GL_OES_texture_border_clamp   DONE (all drivers)
   GL_OES_texture_buffer DONE (core only)
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 36a1201..0a25770 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -921,6 +921,12 @@ void st_init_extensions(struct pipe_screen *screen,
   extensions->ARB_sync = GL_TRUE;
}
 
+   /* Needs PIPE_CAP_SAMPLE_SHADING + all the sample-related bits of
+* ARB_gpu_shader5. This enables all the per-sample shading ES extensions.
+*/
+   extensions->OES_sample_variables = extensions->ARB_sample_shading &&
+  extensions->ARB_gpu_shader5;
+
/* Maximum sample count. */
{
   enum pipe_format color_formats[] = {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: add GL_OES_sample_shading support

2016-03-30 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 411a88accc8a2728abbdfbef4315addbc08cf5a3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=411a88accc8a2728abbdfbef4315addbc08cf5a3

Author: Ilia Mirkin 
Date:   Tue Feb 16 14:29:38 2016 -0500

mesa: add GL_OES_sample_shading support

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 
Reviewed-by: Ian Romanick 

---

 src/mapi/glapi/gen/es_EXT.xml   | 6 ++
 src/mesa/main/enable.c  | 4 ++--
 src/mesa/main/extensions_table.h| 1 +
 src/mesa/main/multisample.c | 3 ++-
 src/mesa/main/tests/dispatch_sanity.cpp | 3 +++
 5 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index 8f8f997..8e51c05 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -798,6 +798,12 @@
 
 
 
+
+
+
+
+
+
 
 
 
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index b90a60b..d283077 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -807,7 +807,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
 
   /* GL_ARB_sample_shading */
   case GL_SAMPLE_SHADING:
- if (!_mesa_is_desktop_gl(ctx))
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
 goto invalid_enum_error;
  CHECK_EXTENSION(ARB_sample_shading, cap);
  if (ctx->Multisample.SampleShading == state)
@@ -1606,7 +1606,7 @@ _mesa_IsEnabled( GLenum cap )
 
   /* ARB_sample_shading */
   case GL_SAMPLE_SHADING:
- if (!_mesa_is_desktop_gl(ctx))
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
 goto invalid_enum_error;
  CHECK_EXTENSION(ARB_sample_shading);
  return ctx->Multisample.SampleShading;
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 700ef24..c1bcfc5 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -330,6 +330,7 @@ EXT(OES_point_sprite, 
ARB_point_sprite
 EXT(OES_query_matrix, dummy_true   
  ,  x ,  x , ES1,  x , 2003)
 EXT(OES_read_format , dummy_true   
  , GLL, GLC, ES1,  x , 2003)
 EXT(OES_rgb8_rgba8  , dummy_true   
  ,  x ,  x , ES1, ES2, 2005)
+EXT(OES_sample_shading  , OES_sample_variables 
  ,  x ,  x ,  x ,  30, 2014)
 EXT(OES_sample_variables, OES_sample_variables 
  ,  x ,  x ,  x ,  30, 2014)
 EXT(OES_shader_image_atomic , ARB_shader_image_load_store  
  ,  x ,  x ,  x ,  31, 2015)
 EXT(OES_single_precision, dummy_true   
  ,  x ,  x , ES1,  x , 2003)
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index 3a2..5453e38 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -127,7 +127,8 @@ _mesa_MinSampleShading(GLclampf value)
 {
GET_CURRENT_CONTEXT(ctx);
 
-   if (!ctx->Extensions.ARB_sample_shading || !_mesa_is_desktop_gl(ctx)) {
+   if (!_mesa_has_ARB_sample_shading(ctx) &&
+   !_mesa_has_OES_sample_shading(ctx)) {
   _mesa_error(ctx, GL_INVALID_OPERATION, "glMinSampleShading");
   return;
}
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index 309e574..06e7ec1 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -2454,6 +2454,9 @@ const struct function gles3_functions_possible[] = {
{ "glTexBufferOES", 31, -1 },
{ "glTexBufferRangeOES", 31, -1 },
 
+   /* GL_OES_sample_shading */
+   { "glMinSampleShadingOES", 30, -1 },
+
{ NULL, 0, -1 }
 };
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glsl: add gl_MaxSamples, new in GL 4.5 / GL ES 3.2

2016-03-30 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 903640c2accb4617afd7036f47cbd14077586394
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=903640c2accb4617afd7036f47cbd14077586394

Author: Ilia Mirkin 
Date:   Fri Feb 19 13:20:48 2016 -0500

glsl: add gl_MaxSamples, new in GL 4.5 / GL ES 3.2

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 
Reviewed-by: Ian Romanick 

---

 src/compiler/glsl/builtin_variables.cpp  | 3 +++
 src/compiler/glsl/glsl_parser_extras.cpp | 3 +++
 src/compiler/glsl/glsl_parser_extras.h   | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/src/compiler/glsl/builtin_variables.cpp 
b/src/compiler/glsl/builtin_variables.cpp
index 76a22ce..6a77291 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -878,6 +878,9 @@ builtin_variable_generator::generate_constants()
   add_const("gl_MaxTessControlUniformComponents", 
state->Const.MaxTessControlUniformComponents);
   add_const("gl_MaxTessEvaluationUniformComponents", 
state->Const.MaxTessEvaluationUniformComponents);
}
+
+   if (state->is_version(450, 320))
+  add_const("gl_MaxSamples", state->Const.MaxSamples);
 }
 
 
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp 
b/src/compiler/glsl/glsl_parser_extras.cpp
index 0ce89ce..e592e5c 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -179,6 +179,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct 
gl_context *_ctx,
this->Const.MaxTessControlUniformComponents = 
ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxUniformComponents;
this->Const.MaxTessEvaluationUniformComponents = 
ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxUniformComponents;
 
+   /* GL 4.5 / OES_sample_variables */
+   this->Const.MaxSamples = ctx->Const.MaxSamples;
+
this->current_function = NULL;
this->toplevel_ir = NULL;
this->found_return = false;
diff --git a/src/compiler/glsl/glsl_parser_extras.h 
b/src/compiler/glsl/glsl_parser_extras.h
index 86008b4..6185d14 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -461,6 +461,9 @@ struct _mesa_glsl_parse_state {
   unsigned MaxTessControlTotalOutputComponents;
   unsigned MaxTessControlUniformComponents;
   unsigned MaxTessEvaluationUniformComponents;
+
+  /* GL 4.5 / OES_sample_variables */
+  unsigned MaxSamples;
} Const;
 
/**

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glsl: add GL_OES_sample_variables support

2016-03-30 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 5283e810157a3c392c9887e51c6ee0df849a4973
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5283e810157a3c392c9887e51c6ee0df849a4973

Author: Ilia Mirkin 
Date:   Fri Feb 19 13:23:10 2016 -0500

glsl: add GL_OES_sample_variables support

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 
Reviewed-by: Ian Romanick 

---

 src/compiler/glsl/builtin_variables.cpp  | 15 +++
 src/compiler/glsl/glcpp/glcpp-parse.y|  2 ++
 src/compiler/glsl/glsl_parser_extras.cpp |  1 +
 src/compiler/glsl/glsl_parser_extras.h   |  2 ++
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/compiler/glsl/builtin_variables.cpp 
b/src/compiler/glsl/builtin_variables.cpp
index 6a77291..7d77f70 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -879,7 +879,8 @@ builtin_variable_generator::generate_constants()
   add_const("gl_MaxTessEvaluationUniformComponents", 
state->Const.MaxTessEvaluationUniformComponents);
}
 
-   if (state->is_version(450, 320))
+   if (state->is_version(450, 320) ||
+   state->OES_sample_variables_enable)
   add_const("gl_MaxSamples", state->Const.MaxSamples);
 }
 
@@ -890,7 +891,9 @@ builtin_variable_generator::generate_constants()
 void
 builtin_variable_generator::generate_uniforms()
 {
-   if (state->is_version(400, 0) || state->ARB_sample_shading_enable)
+   if (state->is_version(400, 320) ||
+   state->ARB_sample_shading_enable ||
+   state->OES_sample_variables_enable)
   add_uniform(int_t, "gl_NumSamples");
add_uniform(type("gl_DepthRangeParameters"), "gl_DepthRange");
add_uniform(array(vec4_t, VERT_ATTRIB_MAX), "gl_CurrentAttribVertMESA");
@@ -1143,7 +1146,9 @@ builtin_variable_generator::generate_fs_special_vars()
  var->enable_extension_warning("GL_AMD_shader_stencil_export");
}
 
-   if (state->is_version(400, 0) || state->ARB_sample_shading_enable) {
+   if (state->is_version(400, 320) ||
+   state->ARB_sample_shading_enable ||
+   state->OES_sample_variables_enable) {
   add_system_value(SYSTEM_VALUE_SAMPLE_ID, int_t, "gl_SampleID");
   add_system_value(SYSTEM_VALUE_SAMPLE_POS, vec2_t, "gl_SamplePosition");
   /* From the ARB_sample_shading specification:
@@ -1156,7 +1161,9 @@ builtin_variable_generator::generate_fs_special_vars()
   add_output(FRAG_RESULT_SAMPLE_MASK, array(int_t, 1), "gl_SampleMask");
}
 
-   if (state->is_version(400, 0) || state->ARB_gpu_shader5_enable) {
+   if (state->is_version(400, 320) ||
+   state->ARB_gpu_shader5_enable ||
+   state->OES_sample_variables_enable) {
   add_system_value(SYSTEM_VALUE_SAMPLE_MASK_IN, array(int_t, 1), 
"gl_SampleMaskIn");
}
 
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y 
b/src/compiler/glsl/glcpp/glcpp-parse.y
index fbbf85b..14d2c7d 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -2371,6 +2371,8 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t 
*parser, intmax_t versio
   if (extensions != NULL) {
  if (extensions->OES_EGL_image_external)
 add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
+  if (extensions->OES_sample_variables)
+ add_builtin_define(parser, "GL_OES_sample_variables", 1);
   if (extensions->OES_standard_derivatives)
  add_builtin_define(parser, "GL_OES_standard_derivatives", 1);
   if (extensions->ARB_texture_multisample)
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp 
b/src/compiler/glsl/glsl_parser_extras.cpp
index e592e5c..def86e1 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -615,6 +615,7 @@ static const _mesa_glsl_extension 
_mesa_glsl_supported_extensions[] = {
EXT(OES_geometry_point_size,false, true,  OES_geometry_shader),
EXT(OES_geometry_shader,false, true,  OES_geometry_shader),
EXT(OES_gpu_shader5,false, true,  ARB_gpu_shader5),
+   EXT(OES_sample_variables,   false, true,  OES_sample_variables),
EXT(OES_shader_image_atomic,false, true,  
ARB_shader_image_load_store),
EXT(OES_standard_derivatives,   false, true,  
OES_standard_derivatives),
EXT(OES_texture_3D, false, true,  dummy_true),
diff --git a/src/compiler/glsl/glsl_parser_extras.h 
b/src/compiler/glsl/glsl_parser_extras.h
index 6185d14..219fb42 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -604,6 +604,8 @@ struct _mesa_glsl_parse_state {
bool OES_geometry_shader_warn;
bool OES_gpu_shader5_enable;
bool OES_gpu_shader5_warn;
+   bool OES_sample_variables_enable;
+   bool OES_sample_variables_warn;
bool 

Mesa (master): mesa: add OES_sample_variables to extension table, add enable bit

2016-03-30 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 6a8ca859f913cf56bc8abce6d1cde02b36a74289
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a8ca859f913cf56bc8abce6d1cde02b36a74289

Author: Ilia Mirkin 
Date:   Tue Feb 16 01:20:15 2016 -0500

mesa: add OES_sample_variables to extension table, add enable bit

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 
Reviewed-by: Ian Romanick 

---

 src/mesa/main/extensions_table.h | 1 +
 src/mesa/main/mtypes.h   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 7885aef..700ef24 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -330,6 +330,7 @@ EXT(OES_point_sprite, 
ARB_point_sprite
 EXT(OES_query_matrix, dummy_true   
  ,  x ,  x , ES1,  x , 2003)
 EXT(OES_read_format , dummy_true   
  , GLL, GLC, ES1,  x , 2003)
 EXT(OES_rgb8_rgba8  , dummy_true   
  ,  x ,  x , ES1, ES2, 2005)
+EXT(OES_sample_variables, OES_sample_variables 
  ,  x ,  x ,  x ,  30, 2014)
 EXT(OES_shader_image_atomic , ARB_shader_image_load_store  
  ,  x ,  x ,  x ,  31, 2015)
 EXT(OES_single_precision, dummy_true   
  ,  x ,  x , ES1,  x , 2003)
 EXT(OES_standard_derivatives, OES_standard_derivatives 
  ,  x ,  x ,  x , ES2, 2005)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ff0707d..be8c21e 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3911,6 +3911,7 @@ struct gl_extensions
GLboolean EXT_transform_feedback;
GLboolean EXT_timer_query;
GLboolean EXT_vertex_array_bgra;
+   GLboolean OES_sample_variables;
GLboolean OES_standard_derivatives;
GLboolean OES_texture_buffer;
/* vendor extensions */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: remove duplicate MAX_GEOMETRY_SHADER_INVOCATIONS entry

2016-03-30 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 571f538a622d9a7050015b58b7b1ac240f289dcb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=571f538a622d9a7050015b58b7b1ac240f289dcb

Author: Ilia Mirkin 
Date:   Wed Mar 30 22:03:06 2016 -0400

mesa: remove duplicate MAX_GEOMETRY_SHADER_INVOCATIONS entry

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 

---

 src/mesa/main/get_hash_params.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 7998d03..a0cc4f8 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -888,9 +888,6 @@ descriptor=[
   [ "VIEWPORT_BOUNDS_RANGE", "CONTEXT_FLOAT2(Const.ViewportBounds), 
extra_ARB_viewport_array" ],
   [ "VIEWPORT_INDEX_PROVOKING_VERTEX", 
"CONTEXT_ENUM(Const.LayerAndVPIndexProvokingVertex), extra_ARB_viewport_array" 
],
 
-# GL_ARB_gpu_shader5
-  [ "MAX_GEOMETRY_SHADER_INVOCATIONS", 
"CONST(MAX_GEOMETRY_SHADER_INVOCATIONS), extra_ARB_gpu_shader5" ],
-
 # GL_ARB_tessellation_shader
   [ "PATCH_VERTICES", "CONTEXT_INT(TessCtrlProgram.patch_vertices), 
extra_ARB_tessellation_shader" ],
   [ "PATCH_DEFAULT_OUTER_LEVEL", 
"CONTEXT_FLOAT4(TessCtrlProgram.patch_default_outer_level), 
extra_ARB_tessellation_shader" ],

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Add and use is_scheduling_barrier() function.

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 3495265158cce55d24a7a7f38a0a40d8c9448d38
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3495265158cce55d24a7a7f38a0a40d8c9448d38

Author: Matt Turner 
Date:   Sat Mar 12 21:15:19 2016 -0800

i965: Add and use is_scheduling_barrier() function.

---

 .../drivers/dri/i965/brw_schedule_instructions.cpp  | 21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp 
b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index 98fa5e3..befa9ff 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -892,6 +892,14 @@ fs_instruction_scheduler::is_compressed(fs_inst *inst)
return inst->exec_size == 16;
 }
 
+static bool
+is_scheduling_barrier(const fs_inst *inst)
+{
+   return inst->opcode == FS_OPCODE_PLACEHOLDER_HALT ||
+  inst->is_control_flow() ||
+  inst->has_side_effects();
+}
+
 void
 fs_instruction_scheduler::calculate_deps()
 {
@@ -917,9 +925,7 @@ fs_instruction_scheduler::calculate_deps()
foreach_in_list(schedule_node, n, ) {
   fs_inst *inst = (fs_inst *)n->inst;
 
-  if (inst->opcode == FS_OPCODE_PLACEHOLDER_HALT ||
-  inst->is_control_flow() ||
-  inst->has_side_effects())
+  if (is_scheduling_barrier(inst))
  add_barrier_deps(n);
 
   /* read-after-write deps. */
@@ -1131,6 +1137,13 @@ fs_instruction_scheduler::calculate_deps()
}
 }
 
+static bool
+is_scheduling_barrier(const vec4_instruction *inst)
+{
+   return inst->is_control_flow() ||
+  inst->has_side_effects();
+}
+
 void
 vec4_instruction_scheduler::calculate_deps()
 {
@@ -1152,7 +1165,7 @@ vec4_instruction_scheduler::calculate_deps()
foreach_in_list(schedule_node, n, ) {
   vec4_instruction *inst = (vec4_instruction *)n->inst;
 
-  if (inst->is_control_flow() || inst->has_side_effects())
+  if (is_scheduling_barrier(inst))
  add_barrier_deps(n);
 
   /* read-after-write deps. */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): Revert "i965: Don't add barrier deps for FB write messages. "

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 436bdd7403bfa260ce6dedcbd0ba96df2ae40ce8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=436bdd7403bfa260ce6dedcbd0ba96df2ae40ce8

Author: Matt Turner 
Date:   Wed Feb 17 11:04:50 2016 -0800

Revert "i965: Don't add barrier deps for FB write messages."

This reverts commit d0e1d6b7e27bf5f05436e47080d326d7daa63af2.

The change in the vec4 code is a mistake -- there's never an
FS_OPCODE_FB_WRITE in vec4 code.

The change in the fs code had the (harmless) effect of not recognizing
an FB_WRITE as a scheduling barrier even if it was marked EOT --
harmless because the scheduler marked the last instruction of a block as
a barrier, something I'm changing in the following patches.

This will be reimplemented later in the series.

---

 src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp 
b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index 2153898..66eb07e 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -939,9 +939,8 @@ fs_instruction_scheduler::calculate_deps()
foreach_in_list(schedule_node, n, ) {
   fs_inst *inst = (fs_inst *)n->inst;
 
-  if ((inst->opcode == FS_OPCODE_PLACEHOLDER_HALT ||
-   inst->has_side_effects()) &&
-  inst->opcode != FS_OPCODE_FB_WRITE)
+  if (inst->opcode == FS_OPCODE_PLACEHOLDER_HALT ||
+ inst->has_side_effects())
  add_barrier_deps(n);
 
   /* read-after-write deps. */
@@ -1183,7 +1182,7 @@ vec4_instruction_scheduler::calculate_deps()
foreach_in_list(schedule_node, n, ) {
   vec4_instruction *inst = (vec4_instruction *)n->inst;
 
-  if (inst->has_side_effects() && inst->opcode != FS_OPCODE_FB_WRITE)
+  if (inst->has_side_effects())
  add_barrier_deps(n);
 
   /* read-after-write deps. */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Remove NOP insertion kludge in scheduler.

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: b4e223cfbf4d46e2ca4c7313f4ebd52798d21551
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4e223cfbf4d46e2ca4c7313f4ebd52798d21551

Author: Matt Turner 
Date:   Mon Feb 15 10:43:39 2016 -0800

i965: Remove NOP insertion kludge in scheduler.

Instead of removing every instruction in add_insts_from_block(), just
move the instruction to its scheduled location. This is a step towards
doing both bottom-up and top-down scheduling without conflicts.

Note that this patch changes cycle counts for programs because it begins
including control flow instructions in the estimates.

Reviewed-by: Francisco Jerez 

---

 .../drivers/dri/i965/brw_schedule_instructions.cpp | 25 +-
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp 
b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index 46b45a5..98fa5e3 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -783,26 +783,13 @@ schedule_node::schedule_node(backend_instruction *inst,
 void
 instruction_scheduler::add_insts_from_block(bblock_t *block)
 {
-   /* Removing the last instruction from a basic block removes the block as
-* well, so put a NOP at the end to keep it alive.
-*/
-   if (!block->end()->is_control_flow()) {
-  backend_instruction *nop = new(mem_ctx) backend_instruction();
-  nop->opcode = BRW_OPCODE_NOP;
-  block->end()->insert_after(block, nop);
-   }
-
-   foreach_inst_in_block_safe(backend_instruction, inst, block) {
-  if (inst->opcode == BRW_OPCODE_NOP || inst->is_control_flow())
- continue;
-
+   foreach_inst_in_block(backend_instruction, inst, block) {
   schedule_node *n = new(mem_ctx) schedule_node(inst, this);
 
-  this->instructions_to_schedule++;
-
-  inst->remove(block);
   instructions.push_tail(n);
}
+
+   this->instructions_to_schedule = block->end_ip - block->start_ip + 1;
 }
 
 /** Recursive computation of the delay member of a node. */
@@ -1463,7 +1450,6 @@ void
 instruction_scheduler::schedule_instructions(bblock_t *block)
 {
const struct brw_device_info *devinfo = bs->devinfo;
-   backend_instruction *inst = block->end();
time = 0;
if (!post_reg_alloc)
   reg_pressure = reg_pressure_in[block->num];
@@ -1482,7 +1468,8 @@ instruction_scheduler::schedule_instructions(bblock_t 
*block)
   /* Schedule this instruction. */
   assert(chosen);
   chosen->remove();
-  inst->insert_before(block, chosen->inst);
+  chosen->inst->exec_node::remove();
+  block->instructions.push_tail(chosen->inst);
   instructions_to_schedule--;
 
   if (!post_reg_alloc) {
@@ -1551,8 +1538,6 @@ instruction_scheduler::schedule_instructions(bblock_t 
*block)
   }
}
 
-   if (block->end()->opcode == BRW_OPCODE_NOP)
-  block->end()->remove(block);
assert(instructions_to_schedule == 0);
 
block->cycle_count = time;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Assert that an instruction is not inserted around itself.

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: a607f4aa57def51236687ec17d7a6391fb147333
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a607f4aa57def51236687ec17d7a6391fb147333

Author: Matt Turner 
Date:   Mon Feb 15 10:42:14 2016 -0800

i965: Assert that an instruction is not inserted around itself.

Reviewed-by: Francisco Jerez 

---

 src/mesa/drivers/dri/i965/brw_shader.cpp | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp 
b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 21977a2..736deb4 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -948,6 +948,8 @@ adjust_later_block_ips(bblock_t *start_block, int 
ip_adjustment)
 void
 backend_instruction::insert_after(bblock_t *block, backend_instruction *inst)
 {
+   assert(this != inst);
+
if (!this->is_head_sentinel())
   assert(inst_is_in_block(block, this) || !"Instruction not in block");
 
@@ -961,6 +963,8 @@ backend_instruction::insert_after(bblock_t *block, 
backend_instruction *inst)
 void
 backend_instruction::insert_before(bblock_t *block, backend_instruction *inst)
 {
+   assert(this != inst);
+
if (!this->is_tail_sentinel())
   assert(inst_is_in_block(block, this) || !"Instruction not in block");
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Don't add barrier deps for FB write messages.

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 4fea98991c8f94f14e469d4621eddc5247d4efbd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4fea98991c8f94f14e469d4621eddc5247d4efbd

Author: Matt Turner 
Date:   Sat Mar 12 21:16:03 2016 -0800

i965: Don't add barrier deps for FB write messages.

Ken did this earlier, and this is just me reimplementing his patch a
little differently.

Reviewed-by: Francisco Jerez 

---

 src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp 
b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index befa9ff..8d92584 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -897,7 +897,8 @@ is_scheduling_barrier(const fs_inst *inst)
 {
return inst->opcode == FS_OPCODE_PLACEHOLDER_HALT ||
   inst->is_control_flow() ||
-  inst->has_side_effects();
+  inst->eot ||
+  (inst->has_side_effects() && inst->opcode != FS_OPCODE_FB_WRITE);
 }
 
 void

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Relax restriction on scheduling last instruction.

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 7b208a731277b4b99b86af3df98c1219099036d7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b208a731277b4b99b86af3df98c1219099036d7

Author: Matt Turner 
Date:   Mon Feb 15 10:05:33 2016 -0800

i965: Relax restriction on scheduling last instruction.

I think when this code was written, basic blocks were always ended by a
control flow instruction or an end-of-thread message. That's no longer
the case, and removing this restriction actually helps things:

   instructions in affected programs: 7267 -> 7244 (-0.32%)
   helped: 4

   total cycles in shared programs: 66559580 -> 66431900 (-0.19%)
   cycles in affected programs: 28310152 -> 28182472 (-0.45%)
   helped: 9577
   HURT: 879

   GAINED: 2

The addition of the is_control_flow() checks is not a functional change,
since the add_insts_from_block() does not put them in the list of
instructions to schedule. I plan to change this in a later patch.

Reviewed-by: Francisco Jerez 

---

 .../drivers/dri/i965/brw_schedule_instructions.cpp | 23 +++---
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp 
b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index 66eb07e..46b45a5 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -923,15 +923,6 @@ fs_instruction_scheduler::calculate_deps()
 */
schedule_node *last_fixed_grf_write = NULL;
 
-   /* The last instruction always needs to still be the last
-* instruction.  Either it's flow control (IF, ELSE, ENDIF, DO,
-* WHILE) and scheduling other things after it would disturb the
-* basic block, or it's FB_WRITE and we should do a better job at
-* dead code elimination anyway.
-*/
-   schedule_node *last = (schedule_node *)instructions.get_tail();
-   add_barrier_deps(last);
-
memset(last_grf_write, 0, sizeof(last_grf_write));
memset(last_mrf_write, 0, sizeof(last_mrf_write));
 
@@ -940,7 +931,8 @@ fs_instruction_scheduler::calculate_deps()
   fs_inst *inst = (fs_inst *)n->inst;
 
   if (inst->opcode == FS_OPCODE_PLACEHOLDER_HALT ||
- inst->has_side_effects())
+  inst->is_control_flow() ||
+  inst->has_side_effects())
  add_barrier_deps(n);
 
   /* read-after-write deps. */
@@ -1166,15 +1158,6 @@ vec4_instruction_scheduler::calculate_deps()
 */
schedule_node *last_fixed_grf_write = NULL;
 
-   /* The last instruction always needs to still be the last instruction.
-* Either it's flow control (IF, ELSE, ENDIF, DO, WHILE) and scheduling
-* other things after it would disturb the basic block, or it's the EOT
-* URB_WRITE and we should do a better job at dead code eliminating
-* anything that could have been scheduled after it.
-*/
-   schedule_node *last = (schedule_node *)instructions.get_tail();
-   add_barrier_deps(last);
-
memset(last_grf_write, 0, sizeof(last_grf_write));
memset(last_mrf_write, 0, sizeof(last_mrf_write));
 
@@ -1182,7 +1165,7 @@ vec4_instruction_scheduler::calculate_deps()
foreach_in_list(schedule_node, n, ) {
   vec4_instruction *inst = (vec4_instruction *)n->inst;
 
-  if (inst->has_side_effects())
+  if (inst->is_control_flow() || inst->has_side_effects())
  add_barrier_deps(n);
 
   /* read-after-write deps. */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965/vec4/tcs: Set conditional mod on TCS_OPCODE_SRC0_010_IS_ZERO.

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: f60750968c66f7aa15181c4ba315bb594e615044
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f60750968c66f7aa15181c4ba315bb594e615044

Author: Matt Turner 
Date:   Mon Mar 14 17:39:19 2016 -0700

i965/vec4/tcs: Set conditional mod on TCS_OPCODE_SRC0_010_IS_ZERO.

Missing this causes an assertion failure in the scheduler with the next
patch.

Additionally, this gives cmod propagation enough information to optimize
code better.

total instructions in shared programs: 7112991 -> 7112852 (-0.00%)
instructions in affected programs: 25704 -> 25565 (-0.54%)
helped: 139

total cycles in shared programs: 64812898 -> 64810674 (-0.00%)
cycles in affected programs: 127224 -> 125000 (-1.75%)
helped: 139

Acked-by: Francisco Jerez 

---

 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 1 -
 src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp   | 4 +++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
index 621c332..8409e82 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
@@ -1931,7 +1931,6 @@ generate_code(struct brw_codegen *p,
   case TCS_OPCODE_SRC0_010_IS_ZERO:
  /* If src_reg had stride like fs_reg, we wouldn't need this. */
  brw_MOV(p, brw_null_reg(), stride(src[0], 0, 1, 0));
- brw_inst_set_cond_modifier(devinfo, brw_last_inst, BRW_CONDITIONAL_Z);
  break;
 
   case TCS_OPCODE_RELEASE_INPUT:
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp
index 2046b94..84aa89a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp
@@ -184,7 +184,9 @@ vec4_tcs_visitor::emit_thread_end()
* we don't have stride in the vec4 world, nor UV immediates in
* align16, so we need an opcode to get invocation_id<0,4,0>.
*/
-  emit(TCS_OPCODE_SRC0_010_IS_ZERO, dst_null_d(), invocation_id);
+  set_condmod(BRW_CONDITIONAL_Z,
+  emit(TCS_OPCODE_SRC0_010_IS_ZERO, dst_null_d(),
+   invocation_id));
   emit(IF(BRW_PREDICATE_NORMAL));
   for (unsigned i = 0; i < key->input_vertices; i += 2) {
  /* If we have an odd number of input vertices, the last will be

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Remove incorrect cycle estimates.

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 65bc94022b0fd31d01c8de65f7f1115a86baa65a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=65bc94022b0fd31d01c8de65f7f1115a86baa65a

Author: Matt Turner 
Date:   Sun Feb 14 23:23:53 2016 -0800

i965: Remove incorrect cycle estimates.

These printed the cycle count the last basic block (sched.time is set
per basic block!). We have accurate, full program, data printed
elsewhere.

Reviewed-by: Francisco Jerez 

---

 src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp | 10 --
 1 file changed, 10 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp 
b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index 5b54b51..51d9ce1 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -1674,11 +1674,6 @@ 
fs_visitor::schedule_instructions(instruction_scheduler_mode mode)
   cfg->num_blocks, mode);
sched.run(cfg);
 
-   if (unlikely(debug_enabled) && mode == SCHEDULE_POST) {
-  fprintf(stderr, "%s%d estimated execution time: %d cycles\n",
-  stage_abbrev, dispatch_width, sched.time);
-   }
-
invalidate_live_intervals();
 }
 
@@ -1688,10 +1683,5 @@ vec4_visitor::opt_schedule_instructions()
vec4_instruction_scheduler sched(this, prog_data->total_grf);
sched.run(cfg);
 
-   if (unlikely(debug_enabled)) {
-  fprintf(stderr, "%s estimated execution time: %d cycles\n",
-  stage_abbrev, sched.time);
-   }
-
invalidate_live_intervals();
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nir: Fix typo from commit 6702f1acde9.

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 05ee6627d6112b2874f373e8302540e22ccc317c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=05ee6627d6112b2874f373e8302540e22ccc317c

Author: Matt Turner 
Date:   Wed Mar 30 19:18:16 2016 -0700

nir: Fix typo from commit 6702f1acde9.

---

 src/compiler/nir/nir_opt_algebraic.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index c2e56e7..2fac9ad 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -271,7 +271,7 @@ optimizations = [
 
# Propagate negation up multiplication chains
(('fmul', ('fneg', a), b), ('fneg', ('fmul', a, b))),
-   (('imul', ('ineg', a), b), ('ineg', ('fmul', a, b))),
+   (('imul', ('ineg', a), b), ('ineg', ('imul', a, b))),
 
# Misc. lowering
(('fmod', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b, 
'options->lower_fmod'),

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): 37 new commits

2016-03-30 Thread Timothy Arceri
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b273958c747b77fe000b513caa3033cf1fde5422
Author: Timothy Arceri 
Date:   Thu Mar 10 16:41:03 2016 +1100

docs: mark xfb_* qualifiers as DONE

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5704bb350425162011367e47be8c69d424a8797
Author: Timothy Arceri 
Date:   Thu Mar 10 16:17:13 2016 +1100

mesa: add query support for GL_TRANSFORM_FEEDBACK_BUFFER interface

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7234be0338813c0acd5b700ea2f7f20f7a972e51
Author: Timothy Arceri 
Date:   Thu Mar 10 15:04:02 2016 +1100

glsl: add transform feedback buffers to resource list

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e317271d7694d912da99e524294156b6c2de96e
Author: Timothy Arceri 
Date:   Thu Mar 10 15:57:19 2016 +1100

mesa: add support to query GL_TRANSFORM_FEEDBACK_BUFFER_INDEX

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=51142e7705a5e0c28de9fc097fa7c8446ba0cffe
Author: Timothy Arceri 
Date:   Thu Mar 10 11:40:37 2016 +1100

mesa: add support to query GL_OFFSET for GL_TRANSFORM_FEEDBACK_VARYING

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=047139e8a027d81141b6e0b1bc939942e873f3ce
Author: Timothy Arceri 
Date:   Thu Mar 10 15:20:32 2016 +1100

mesa: rename tranform feeback varying macro XFB to XFV

A latter patch will use XFB for buffers.

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b77c9098782a36cb811891b2bcb572eb61e608ac
Author: Timothy Arceri 
Date:   Mon Mar 14 11:16:55 2016 +1100

glsl: always enable transform feedback mode when xfb_stride defined

This enables in shader defined transform feedback mode even if the
only place xfb_stride is defined is on the global out.

We don't worry about xfb_buffer since Issue 22 c) in the spec says:

   "If the shader has an "xfb_buffer" qualifier identifying a buffer,
but doesn't declare "xfb_offset" on anything associated with it,
what happens?

...

variables not qualified with "xfb_offset" are not captured, which
makes the associated "xfb_buffer" qualifier irrelevant."

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c95e92b14d69c114b79d941c7e8902a0ea62c287
Author: Timothy Arceri 
Date:   Mon Mar 14 10:32:17 2016 +1100

glsl: handle varyings that are not written to but have an xfb_offset

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d5c09d40b909cca43936b7f1a3ea16d6568d6203
Author: Timothy Arceri 
Date:   Mon Mar 14 10:17:48 2016 +1100

glsl: when lowering named interface set assigned flag

This will be used when checking if xfb should attempt to capture
a varying.

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a2fbc5ed44ec8ebf0e8936ff5b21425159511413
Author: Timothy Arceri 
Date:   Sun Mar 13 16:36:25 2016 +1100

glsl: reset current stream tracker

When we move to the next buffer we need to reset the stream
so that we don't generate an error message about streams not
matching.

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2a3c87a00bb38aa63dfb3a5818b2d53ca46c663
Author: Timothy Arceri 
Date:   Fri Mar 11 13:53:13 2016 +1100

glsl: generate link error when implicit stride is to large

This moves the check until after we have done the stride
calculation and applies it to the xfb_* qualifiers.

Reviewed-by: Dave Airlie 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2fab85aaea59cb2d31d34ea6de94180ca83fe2dd
Author: Timothy Arceri 
Date:   Thu Mar 3 15:26:53 2016 +1100

glsl: add xfb_stride link time validation

From the ARB_enhanced_layous spec:

   "It is a compile-time or link-time error to have any *xfb_offset*
that overflows *xfb_stride*, whether stated on declarations before
or after the *xfb_stride*, or in different compilation units.

...

When no *xfb_stride* is specified for a buffer, the stride of a
buffer will be the 

Mesa (master): softpipe: add image support to softpipe (v3)

2016-03-30 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: eb9ad9faa3975fc4f044b81d3b4b793866ef5563
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb9ad9faa3975fc4f044b81d3b4b793866ef5563

Author: Dave Airlie 
Date:   Tue Mar 22 07:59:35 2016 +1000

softpipe: add image support to softpipe (v3)

This adds support for ARB_shader_image_load_store to softpipe.

v2: add RESQ support (Ilia)
v3: constify, cleanup internals, add some comments (Brian).

Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 src/gallium/auxiliary/tgsi/tgsi_exec.h  |   4 +-
 src/gallium/drivers/softpipe/Makefile.sources   |   2 +
 src/gallium/drivers/softpipe/sp_context.c   |  20 +-
 src/gallium/drivers/softpipe/sp_context.h   |   2 +
 src/gallium/drivers/softpipe/sp_flush.c |  26 +
 src/gallium/drivers/softpipe/sp_flush.h |   2 +
 src/gallium/drivers/softpipe/sp_fs_exec.c   |   6 +-
 src/gallium/drivers/softpipe/sp_image.c | 762 
 src/gallium/drivers/softpipe/sp_image.h |  37 ++
 src/gallium/drivers/softpipe/sp_state.h |   7 +-
 src/gallium/drivers/softpipe/sp_state_derived.c |   3 +-
 src/gallium/drivers/softpipe/sp_state_image.c   |  57 ++
 src/gallium/drivers/softpipe/sp_texture.c   |   8 +-
 src/gallium/drivers/softpipe/sp_texture.h   |   4 +-
 14 files changed, 928 insertions(+), 12 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h 
b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 2c81d5e..45fb8d4 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -497,8 +497,10 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS:
-   case PIPE_SHADER_CAP_MAX_SHADER_IMAGES:
   return 0;
+   case PIPE_SHADER_CAP_MAX_SHADER_IMAGES:
+  return PIPE_MAX_SHADER_IMAGES;
+
case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT:
   return 32;
}
diff --git a/src/gallium/drivers/softpipe/Makefile.sources 
b/src/gallium/drivers/softpipe/Makefile.sources
index 2af3d6a..efe8846 100644
--- a/src/gallium/drivers/softpipe/Makefile.sources
+++ b/src/gallium/drivers/softpipe/Makefile.sources
@@ -10,6 +10,7 @@ C_SOURCES := \
sp_flush.h \
sp_fs_exec.c \
sp_fs.h \
+   sp_image.c \
sp_limits.h \
sp_prim_vbuf.c \
sp_prim_vbuf.h \
@@ -31,6 +32,7 @@ C_SOURCES := \
sp_state_blend.c \
sp_state_clip.c \
sp_state_derived.c \
+   sp_state_image.c \
sp_state.h \
sp_state_rasterizer.c \
sp_state_sampler.c \
diff --git a/src/gallium/drivers/softpipe/sp_context.c 
b/src/gallium/drivers/softpipe/sp_context.c
index d2a3220..30b0276 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -50,7 +50,7 @@
 #include "sp_query.h"
 #include "sp_screen.h"
 #include "sp_tex_sample.h"
-
+#include "sp_image.h"
 
 static void
 softpipe_destroy( struct pipe_context *pipe )
@@ -199,6 +199,10 @@ softpipe_create_context(struct pipe_screen *screen,
   softpipe->tgsi.sampler[i] = sp_create_tgsi_sampler();
}
 
+   for (i = 0; i < PIPE_SHADER_TYPES; i++) {
+  softpipe->tgsi.image[i] = sp_create_tgsi_image();
+   }
+
softpipe->dump_fs = debug_get_bool_option( "SOFTPIPE_DUMP_FS", FALSE );
softpipe->dump_gs = debug_get_bool_option( "SOFTPIPE_DUMP_GS", FALSE );
 
@@ -216,6 +220,7 @@ softpipe_create_context(struct pipe_screen *screen,
softpipe_init_streamout_funcs(>pipe);
softpipe_init_texture_funcs( >pipe );
softpipe_init_vertex_funcs(>pipe);
+   softpipe_init_image_funcs(>pipe);
 
softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
 
@@ -223,7 +228,8 @@ softpipe_create_context(struct pipe_screen *screen,
 
softpipe->pipe.clear = softpipe_clear;
softpipe->pipe.flush = softpipe_flush_wrapped;
-
+   softpipe->pipe.texture_barrier = softpipe_texture_barrier;
+   softpipe->pipe.memory_barrier = softpipe_memory_barrier;
softpipe->pipe.render_condition = softpipe_render_condition;

/*
@@ -272,6 +278,16 @@ softpipe_create_context(struct pipe_screen *screen,
 (struct tgsi_sampler *)
softpipe->tgsi.sampler[PIPE_SHADER_GEOMETRY]);
 
+   draw_image(softpipe->draw,
+  PIPE_SHADER_VERTEX,
+  (struct tgsi_image *)
+  softpipe->tgsi.image[PIPE_SHADER_VERTEX]);
+
+   draw_image(softpipe->draw,
+  PIPE_SHADER_GEOMETRY,
+  (struct tgsi_image *)
+  softpipe->tgsi.image[PIPE_SHADER_GEOMETRY]);
+
if (debug_get_bool_option( "SOFTPIPE_NO_RAST", FALSE ))
   softpipe->no_rast = TRUE;
 
diff --git a/src/gallium/drivers/softpipe/sp_context.h 
b/src/gallium/drivers/softpipe/sp_context.h
index d18bbe6..20a1235 100644
--- 

Mesa (master): tgsi: introduce NonHelperMask

2016-03-30 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 827393b76fffa352e0ff3cae077c7817d6cfbf8a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=827393b76fffa352e0ff3cae077c7817d6cfbf8a

Author: Dave Airlie 
Date:   Tue Mar 22 07:50:37 2016 +1000

tgsi: introduce NonHelperMask

This is a mask of which of the current 2x2 grid are non-helper
invocations. This allows us to mask off the helper invocations
later for the image operations.

Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 src/gallium/auxiliary/tgsi/tgsi_exec.c | 2 ++
 src/gallium/auxiliary/tgsi/tgsi_exec.h | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index a44a05c..fa1c916 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -5199,6 +5199,8 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach )
   default_mask = 0x1;
}
 
+   if (mach->NonHelperMask == 0)
+  mach->NonHelperMask = default_mask;
mach->CondMask = default_mask;
mach->LoopMask = default_mask;
mach->ContMask = default_mask;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h 
b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 8b5a580..6bcf45b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -312,6 +312,9 @@ struct tgsi_exec_machine
struct tgsi_exec_vector   QuadPos;
float Face;/**< +1 if front facing, -1 if back 
facing */
bool  flatshade_color;
+
+   /* See GLSL 4.50 specification for definition of helper invocations */
+   uint NonHelperMask;  /**< non-helpers */
/* Conditional execution masks */
uint CondMask;  /**< For IF/ELSE/ENDIF */
uint LoopMask;  /**< For BGNLOOP/ENDLOOP */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): draw: add support for passing images to vs/gs shaders.

2016-03-30 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 0d1f679dedfb47944259e846d7f2eadbcf0907ca
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d1f679dedfb47944259e846d7f2eadbcf0907ca

Author: Dave Airlie 
Date:   Tue Mar 22 07:58:39 2016 +1000

draw: add support for passing images to vs/gs shaders.

This just adds support for passing through images to the
tgsi execution stage.

Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 src/gallium/auxiliary/draw/draw_context.c | 18 ++
 src/gallium/auxiliary/draw/draw_context.h |  6 ++
 src/gallium/auxiliary/draw/draw_gs.c  |  2 +-
 src/gallium/auxiliary/draw/draw_private.h |  3 +++
 src/gallium/auxiliary/draw/draw_vs_exec.c |  2 +-
 5 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c 
b/src/gallium/auxiliary/draw/draw_context.c
index 16a261c..2ba9b09 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -731,6 +731,24 @@ draw_texture_sampler(struct draw_context *draw,
}
 }
 
+/**
+ * Provide TGSI image objects for vertex/geometry shaders that use
+ * texture fetches.  This state only needs to be set once per context.
+ * This might only be used by software drivers for the time being.
+ */
+void
+draw_image(struct draw_context *draw,
+   uint shader,
+   struct tgsi_image *image)
+{
+   if (shader == PIPE_SHADER_VERTEX) {
+  draw->vs.tgsi.image = image;
+   } else {
+  debug_assert(shader == PIPE_SHADER_GEOMETRY);
+  draw->gs.tgsi.image = image;
+   }
+}
+
 
 
 
diff --git a/src/gallium/auxiliary/draw/draw_context.h 
b/src/gallium/auxiliary/draw/draw_context.h
index a5a6df5..5d9870b 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -48,6 +48,7 @@ struct draw_vertex_shader;
 struct draw_geometry_shader;
 struct draw_fragment_shader;
 struct tgsi_sampler;
+struct tgsi_image;
 
 /*
  * structure to contain driver internal information 
@@ -155,6 +156,11 @@ draw_texture_sampler(struct draw_context *draw,
  struct tgsi_sampler *sampler);
 
 void
+draw_image(struct draw_context *draw,
+   uint shader_type,
+   struct tgsi_image *image);
+
+void
 draw_set_sampler_views(struct draw_context *draw,
unsigned shader_stage,
struct pipe_sampler_view **views,
diff --git a/src/gallium/auxiliary/draw/draw_gs.c 
b/src/gallium/auxiliary/draw/draw_gs.c
index 2f18df8..14db2d6 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -681,7 +681,7 @@ void draw_geometry_shader_prepare(struct 
draw_geometry_shader *shader,
if (!use_llvm && shader && shader->machine->Tokens != shader->state.tokens) 
{
   tgsi_exec_machine_bind_shader(shader->machine,
 shader->state.tokens,
-draw->gs.tgsi.sampler, NULL);
+draw->gs.tgsi.sampler, 
draw->gs.tgsi.image);
}
 }
 
diff --git a/src/gallium/auxiliary/draw/draw_private.h 
b/src/gallium/auxiliary/draw/draw_private.h
index 8774beb..211bd6f 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -66,6 +66,7 @@ struct draw_stage;
 struct vbuf_render;
 struct tgsi_exec_machine;
 struct tgsi_sampler;
+struct tgsi_image;
 struct draw_pt_front_end;
 struct draw_assembler;
 struct draw_llvm;
@@ -267,6 +268,7 @@ struct draw_context
  struct tgsi_exec_machine *machine;
 
  struct tgsi_sampler *sampler;
+ struct tgsi_image *image;
   } tgsi;
 
   struct translate *fetch;
@@ -286,6 +288,7 @@ struct draw_context
  struct tgsi_exec_machine *machine;
 
  struct tgsi_sampler *sampler;
+ struct tgsi_image *image;
   } tgsi;
 
} gs;
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c 
b/src/gallium/auxiliary/draw/draw_vs_exec.c
index c1266e7..5b53cff 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -70,7 +70,7 @@ vs_exec_prepare( struct draw_vertex_shader *shader,
if (evs->machine->Tokens != shader->state.tokens) {
   tgsi_exec_machine_bind_shader(evs->machine,
 shader->state.tokens,
-draw->vs.tgsi.sampler, NULL);
+draw->vs.tgsi.sampler, 
draw->vs.tgsi.image);
}
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): softpipe: add support for explicit early depth testing

2016-03-30 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 493eab76792307d066489bc1d88798f14a5df31d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=493eab76792307d066489bc1d88798f14a5df31d

Author: Dave Airlie 
Date:   Tue Mar 22 07:52:26 2016 +1000

softpipe: add support for explicit early depth testing

ARB_shader_image_load_store adds support for explicit early
depth testing. However we need to make sure we don't overwrite
values using the shader written values in this case.

This fixes early depth testing in softpipe to conform with
those requirements.

Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 src/gallium/drivers/softpipe/sp_context.h |  2 ++
 src/gallium/drivers/softpipe/sp_fs_exec.c | 16 ++--
 src/gallium/drivers/softpipe/sp_quad_depth_test.c |  4 ++--
 src/gallium/drivers/softpipe/sp_quad_fs.c |  2 +-
 src/gallium/drivers/softpipe/sp_quad_pipe.c   |  6 --
 src/gallium/drivers/softpipe/sp_state.h   |  3 ++-
 6 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_context.h 
b/src/gallium/drivers/softpipe/sp_context.h
index d5c4aaa..d18bbe6 100644
--- a/src/gallium/drivers/softpipe/sp_context.h
+++ b/src/gallium/drivers/softpipe/sp_context.h
@@ -175,6 +175,8 @@ struct softpipe_context {
} tgsi;
 
struct tgsi_exec_machine *fs_machine;
+   /** whether early depth testing is enabled */
+   bool early_depth;
 
/** The primitive drawing context */
struct draw_context *draw;
diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c 
b/src/gallium/drivers/softpipe/sp_fs_exec.c
index 8941177..e2d527d 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -116,7 +116,8 @@ setup_pos_vector(const struct tgsi_interp_coef *coef,
 static unsigned 
 exec_run( const struct sp_fragment_shader_variant *var,
  struct tgsi_exec_machine *machine,
- struct quad_header *quad )
+ struct quad_header *quad,
+ bool early_depth_test )
 {
/* Compute X, Y, Z, W vals for this quad */
setup_pos_vector(quad->posCoef, 
@@ -155,16 +156,19 @@ exec_run( const struct sp_fragment_shader_variant *var,
 {
uint j;
 
-   for (j = 0; j < 4; j++)
-  quad->output.depth[j] = machine->Outputs[i].xyzw[2].f[j];
+   if (!early_depth_test) {
+  for (j = 0; j < 4; j++)
+ quad->output.depth[j] = machine->Outputs[i].xyzw[2].f[j];
+   }
 }
 break;
  case TGSI_SEMANTIC_STENCIL:
 {
uint j;
-
-   for (j = 0; j < 4; j++)
-  quad->output.stencil[j] = 
(unsigned)machine->Outputs[i].xyzw[1].u[j];
+   if (!early_depth_test) {
+  for (j = 0; j < 4; j++)
+ quad->output.stencil[j] = 
(unsigned)machine->Outputs[i].xyzw[1].u[j];
+   }
 }
 break;
  }
diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c 
b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 4cce9e9..847a616 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -782,7 +782,7 @@ depth_test_quads_fallback(struct quad_stage *qs,
 {
unsigned i, pass = 0;
const struct tgsi_shader_info *fsInfo = >softpipe->fs_variant->info;
-   boolean interp_depth = !fsInfo->writes_z;
+   boolean interp_depth = !fsInfo->writes_z || qs->softpipe->early_depth;
boolean shader_stencil_ref = fsInfo->writes_stencil;
struct depth_data data;
unsigned vp_idx = quads[0]->input.viewport_index;
@@ -902,7 +902,7 @@ choose_depth_test(struct quad_stage *qs,
 {
const struct tgsi_shader_info *fsInfo = >softpipe->fs_variant->info;
 
-   boolean interp_depth = !fsInfo->writes_z;
+   boolean interp_depth = !fsInfo->writes_z || qs->softpipe->early_depth;
 
boolean alpha = qs->softpipe->depth_stencil->alpha.enabled;
 
diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c 
b/src/gallium/drivers/softpipe/sp_quad_fs.c
index 395bc70..8fb632d 100644
--- a/src/gallium/drivers/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -80,7 +80,7 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad)
 
/* run shader */
machine->flatshade_color = softpipe->rasterizer->flatshade ? TRUE : FALSE;
-   return softpipe->fs_variant->run( softpipe->fs_variant, machine, quad );
+   return softpipe->fs_variant->run( softpipe->fs_variant, machine, quad, 
softpipe->early_depth );
 }
 
 
diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.c 
b/src/gallium/drivers/softpipe/sp_quad_pipe.c
index 7131512..dbe4c0e 100644
--- a/src/gallium/drivers/softpipe/sp_quad_pipe.c
+++ b/src/gallium/drivers/softpipe/sp_quad_pipe.c
@@ -43,15 +43,17 @@ void
 sp_build_quad_pipeline(struct 

Mesa (master): docs: update softpipe status for shader_image_load_store.

2016-03-30 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: c9367c13ca420528cd0d9a9e8dacd2fd5d6a0a41
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9367c13ca420528cd0d9a9e8dacd2fd5d6a0a41

Author: Dave Airlie 
Date:   Tue Mar 22 08:00:52 2016 +1000

docs: update softpipe status for shader_image_load_store.

Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 docs/GL3.txt  | 2 +-
 docs/relnotes/11.3.0.html | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 03ebf70..804a96c 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -154,7 +154,7 @@ GL 4.2, GLSL 4.20:
   GL_ARB_texture_storageDONE (all drivers)
   GL_ARB_transform_feedback_instanced   DONE (i965, nv50, 
nvc0, r600, radeonsi, llvmpipe, softpipe)
   GL_ARB_base_instance  DONE (i965, nv50, 
nvc0, r600, radeonsi, llvmpipe, softpipe)
-  GL_ARB_shader_image_load_storeDONE (i965, radeonsi)
+  GL_ARB_shader_image_load_storeDONE (i965, radeonsi, 
softpipe)
   GL_ARB_conservative_depth DONE (all drivers that 
support GLSL 1.30)
   GL_ARB_shading_language_420pack   DONE (all drivers that 
support GLSL 1.30)
   GL_ARB_shading_language_packing   DONE (all drivers)
diff --git a/docs/relnotes/11.3.0.html b/docs/relnotes/11.3.0.html
index 508fbd3..4e23959 100644
--- a/docs/relnotes/11.3.0.html
+++ b/docs/relnotes/11.3.0.html
@@ -46,7 +46,7 @@ Note: some of the new features are only available with 
certain drivers.
 
 GL_ARB_internalformat_query2 on all drivers
 GL_ARB_shader_atomic_counter_ops on nvc0
-GL_ARB_shader_image_load_store on radeonsi
+GL_ARB_shader_image_load_store on radeonsi, softpipe
 GL_ARB_shader_image_size on radeonsi
 GL_ATI_fragment_shader on all Gallium drivers
 GL_OES_texture_border_clamp and GL_EXT_texture_border_clamp on all drivers 
that support GL_ARB_texture_border_clamp

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): tgsi: add support for image operations to tgsi_exec. (v2.1)

2016-03-30 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 22d1296013825a4dce84e6f579581202a18767c7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=22d1296013825a4dce84e6f579581202a18767c7

Author: Dave Airlie 
Date:   Tue Mar 22 07:53:48 2016 +1000

tgsi: add support for image operations to tgsi_exec. (v2.1)

This adds support for load/store/atomic operations on images
along with image tracking support.

v2: add RESQ support. (Ilia)
v2.1: constify interface (Brian)
split get_image_coord_dim (Brian)

Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 src/gallium/auxiliary/draw/draw_gs.c  |   2 +-
 src/gallium/auxiliary/draw/draw_vs_exec.c |   2 +-
 src/gallium/auxiliary/tgsi/tgsi_exec.c| 273 +-
 src/gallium/auxiliary/tgsi/tgsi_exec.h|  44 -
 src/gallium/drivers/softpipe/sp_fs_exec.c |   4 +-
 5 files changed, 319 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c 
b/src/gallium/auxiliary/draw/draw_gs.c
index fcef31b..2f18df8 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -681,7 +681,7 @@ void draw_geometry_shader_prepare(struct 
draw_geometry_shader *shader,
if (!use_llvm && shader && shader->machine->Tokens != shader->state.tokens) 
{
   tgsi_exec_machine_bind_shader(shader->machine,
 shader->state.tokens,
-draw->gs.tgsi.sampler);
+draw->gs.tgsi.sampler, NULL);
}
 }
 
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c 
b/src/gallium/auxiliary/draw/draw_vs_exec.c
index 3fd8ef3..c1266e7 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -70,7 +70,7 @@ vs_exec_prepare( struct draw_vertex_shader *shader,
if (evs->machine->Tokens != shader->state.tokens) {
   tgsi_exec_machine_bind_shader(evs->machine,
 shader->state.tokens,
-draw->vs.tgsi.sampler);
+draw->vs.tgsi.sampler, NULL);
}
 }
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index fa1c916..53d5937 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -853,7 +853,8 @@ void
 tgsi_exec_machine_bind_shader(
struct tgsi_exec_machine *mach,
const struct tgsi_token *tokens,
-   struct tgsi_sampler *sampler)
+   struct tgsi_sampler *sampler,
+   struct tgsi_image *image)
 {
uint k;
struct tgsi_parse_context parse;
@@ -871,6 +872,7 @@ tgsi_exec_machine_bind_shader(
 
mach->Tokens = tokens;
mach->Sampler = sampler;
+   mach->Image = image;
 
if (!tokens) {
   /* unbind and free all */
@@ -3706,6 +3708,247 @@ exec_dfracexp(struct tgsi_exec_machine *mach,
}
 }
 
+static int
+get_image_coord_dim(unsigned tgsi_tex)
+{
+   int dim;
+   switch (tgsi_tex) {
+   case TGSI_TEXTURE_BUFFER:
+   case TGSI_TEXTURE_1D:
+  dim = 1;
+  break;
+   case TGSI_TEXTURE_2D:
+   case TGSI_TEXTURE_RECT:
+   case TGSI_TEXTURE_1D_ARRAY:
+   case TGSI_TEXTURE_2D_MSAA:
+  dim = 2;
+  break;
+   case TGSI_TEXTURE_3D:
+   case TGSI_TEXTURE_CUBE:
+   case TGSI_TEXTURE_2D_ARRAY:
+   case TGSI_TEXTURE_2D_ARRAY_MSAA:
+   case TGSI_TEXTURE_CUBE_ARRAY:
+  dim = 3;
+  break;
+   default:
+  assert(!"unknown texture target");
+  dim = 0;
+  break;
+   }
+
+   return dim;
+}
+
+static int
+get_image_coord_sample(unsigned tgsi_tex)
+{
+   int sample = 0;
+   switch (tgsi_tex) {
+   case TGSI_TEXTURE_2D_MSAA:
+  sample = 3;
+  break;
+   case TGSI_TEXTURE_2D_ARRAY_MSAA:
+  sample = 4;
+  break;
+   default:
+  break;
+   }
+   return sample;
+}
+
+static void
+exec_load(struct tgsi_exec_machine *mach,
+  const struct tgsi_full_instruction *inst)
+{
+   union tgsi_exec_channel r[4], sample_r;
+   uint unit;
+   int sample;
+   int i, j;
+   int dim;
+   uint chan;
+   float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
+   struct tgsi_image_params params;
+   int kilmask = mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
+
+   unit = fetch_sampler_unit(mach, inst, 0);
+   dim = get_image_coord_dim(inst->Memory.Texture);
+   sample = get_image_coord_sample(inst->Memory.Texture);
+   assert(dim <= 3);
+
+   params.execmask = mach->ExecMask & mach->NonHelperMask & ~kilmask;
+   params.unit = unit;
+   params.tgsi_tex_instr = inst->Memory.Texture;
+   params.format = inst->Memory.Format;
+
+   for (i = 0; i < dim; i++) {
+  IFETCH([i], 1, TGSI_CHAN_X + i);
+   }
+
+   if (sample)
+  IFETCH(_r, 1, TGSI_CHAN_X + sample);
+
+   mach->Image->load(mach->Image, ,
+ r[0].i, r[1].i, r[2].i, sample_r.i,
+ rgba);
+   for (j = 0; j < TGSI_QUAD_SIZE; j++) {
+  r[0].f[j] = rgba[0][j];
+  r[1].f[j] = 

Mesa (master): tgsi_exec: add support for up to 3 address registers (v2)

2016-03-30 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 1ff4cc053589ae2ea10a63116b1e1fe15ecdfbeb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ff4cc053589ae2ea10a63116b1e1fe15ecdfbeb

Author: Dave Airlie 
Date:   Mon Mar 21 08:51:54 2016 +1000

tgsi_exec: add support for up to 3 address registers (v2)

v2: be consistent with other definitions.

Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 src/gallium/auxiliary/tgsi/tgsi_exec.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h 
b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 991c3bf..8b5a580 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -201,12 +201,13 @@ struct tgsi_sampler
 #define TGSI_EXEC_NUM_TEMP_R4
 
 #define TGSI_EXEC_TEMP_ADDR (TGSI_EXEC_NUM_TEMPS + 8)
+#define TGSI_EXEC_NUM_ADDRS 3
 
 /* predicate register */
-#define TGSI_EXEC_TEMP_P0   (TGSI_EXEC_NUM_TEMPS + 9)
+#define TGSI_EXEC_TEMP_P0   (TGSI_EXEC_NUM_TEMPS + 11)
 #define TGSI_EXEC_NUM_PREDS 1
 
-#define TGSI_EXEC_NUM_TEMP_EXTRAS   10
+#define TGSI_EXEC_NUM_TEMP_EXTRAS   12
 
 
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): tgsi_exec: handle execmask when doing indirect lookups

2016-03-30 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: ca180c09bb0941468814796f13c0701590523be4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca180c09bb0941468814796f13c0701590523be4

Author: Dave Airlie 
Date:   Mon Mar 21 08:52:14 2016 +1000

tgsi_exec: handle execmask when doing indirect lookups

Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 src/gallium/auxiliary/tgsi/tgsi_exec.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 126259f..a44a05c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1995,11 +1995,11 @@ fetch_sampler_unit(struct tgsi_exec_machine *mach,
uint sampler)
 {
uint unit;
-
+   int i;
if (inst->Src[sampler].Register.Indirect) {
   const struct tgsi_full_src_register *reg = >Src[sampler];
   union tgsi_exec_channel indir_index, index2;
-
+  const uint execmask = mach->ExecMask;
   index2.i[0] =
   index2.i[1] =
   index2.i[2] =
@@ -2012,7 +2012,13 @@ fetch_sampler_unit(struct tgsi_exec_machine *mach,
  ,
  ,
  _index);
-  unit = inst->Src[sampler].Register.Index + indir_index.i[0];
+  for (i = 0; i < TGSI_QUAD_SIZE; i++) {
+ if (execmask & (1 << i)) {
+unit = inst->Src[sampler].Register.Index + indir_index.i[i];
+break;
+ }
+  }
+
} else {
   unit = inst->Src[sampler].Register.Index;
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nir: Propagate negates up multiplication chains.

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 6702f1acde9e93e41783fd2f4a7999fed8d9cb75
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6702f1acde9e93e41783fd2f4a7999fed8d9cb75

Author: Matt Turner 
Date:   Mon Feb 22 15:16:49 2016 -0800

nir: Propagate negates up multiplication chains.

total instructions in shared programs: 7112159 -> 7088092 (-0.34%)
instructions in affected programs: 1374915 -> 1350848 (-1.75%)
helped: 7392
HURT: 621

GAINED: 2
LOST:   2

---

 src/compiler/nir/nir_opt_algebraic.py | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 5363323..c2e56e7 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -269,6 +269,10 @@ optimizations = [
(('fabs', ('fsub', 0.0, a)), ('fabs', a)),
(('iabs', ('isub', 0, a)), ('iabs', a)),
 
+   # Propagate negation up multiplication chains
+   (('fmul', ('fneg', a), b), ('fneg', ('fmul', a, b))),
+   (('imul', ('ineg', a), b), ('ineg', ('fmul', a, b))),
+
# Misc. lowering
(('fmod', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b, 
'options->lower_fmod'),
(('uadd_carry', a, b), ('b2i', ('ult', ('iadd', a, b), a)), 
'options->lower_uadd_carry'),

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Don't inline intel_batchbuffer_require_space().

2016-03-30 Thread Matt Turner
Module: Mesa
Branch: master
Commit: a74fc3fe8ada87e1fedeea86f2d93f736a1217bc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a74fc3fe8ada87e1fedeea86f2d93f736a1217bc

Author: Matt Turner 
Date:   Tue Nov 24 17:17:29 2015 -0800

i965: Don't inline intel_batchbuffer_require_space().

It's called by the inline intel_batchbuffer_begin() function which
itself is used in BEGIN_BATCH. So in sequence of code emitting multiple
packets, we have inlined this ~200 byte function multiple times. Making
it an out-of-line function presumably improved icache usage.

Improves performance of Gl32Batch7 by 3.39898% +/- 0.358674% (n=155) on
Ivybridge.

Reviewed-by: Abdiel Janulgue 

---

 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 26 +
 src/mesa/drivers/dri/i965/intel_batchbuffer.h | 28 ++-
 2 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index f778074..e41f927 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -106,6 +106,32 @@ intel_batchbuffer_free(struct brw_context *brw)
drm_intel_bo_unreference(brw->batch.bo);
 }
 
+void
+intel_batchbuffer_require_space(struct brw_context *brw, GLuint sz,
+enum brw_gpu_ring ring)
+{
+   /* If we're switching rings, implicitly flush the batch. */
+   if (unlikely(ring != brw->batch.ring) && brw->batch.ring != UNKNOWN_RING &&
+   brw->gen >= 6) {
+  intel_batchbuffer_flush(brw);
+   }
+
+#ifdef DEBUG
+   assert(sz < BATCH_SZ - BATCH_RESERVED);
+#endif
+   if (intel_batchbuffer_space(brw) < sz)
+  intel_batchbuffer_flush(brw);
+
+   enum brw_gpu_ring prev_ring = brw->batch.ring;
+   /* The intel_batchbuffer_flush() calls above might have changed
+* brw->batch.ring to UNKNOWN_RING, so we need to set it here at the end.
+*/
+   brw->batch.ring = ring;
+
+   if (unlikely(prev_ring == UNKNOWN_RING && ring == RENDER_RING))
+  intel_batchbuffer_emit_render_ring_prelude(brw);
+}
+
 static void
 do_batch_dump(struct brw_context *brw)
 {
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
index f473690..aa1dc38 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
@@ -44,6 +44,8 @@ void intel_batchbuffer_init(struct brw_context *brw);
 void intel_batchbuffer_free(struct brw_context *brw);
 void intel_batchbuffer_save_state(struct brw_context *brw);
 void intel_batchbuffer_reset_to_saved(struct brw_context *brw);
+void intel_batchbuffer_require_space(struct brw_context *brw, GLuint sz,
+ enum brw_gpu_ring ring);
 
 int _intel_batchbuffer_flush(struct brw_context *brw,
 const char *file, int line);
@@ -117,32 +119,6 @@ intel_batchbuffer_emit_float(struct brw_context *brw, 
float f)
 }
 
 static inline void
-intel_batchbuffer_require_space(struct brw_context *brw, GLuint sz,
-enum brw_gpu_ring ring)
-{
-   /* If we're switching rings, implicitly flush the batch. */
-   if (unlikely(ring != brw->batch.ring) && brw->batch.ring != UNKNOWN_RING &&
-   brw->gen >= 6) {
-  intel_batchbuffer_flush(brw);
-   }
-
-#ifdef DEBUG
-   assert(sz < BATCH_SZ - BATCH_RESERVED);
-#endif
-   if (intel_batchbuffer_space(brw) < sz)
-  intel_batchbuffer_flush(brw);
-
-   enum brw_gpu_ring prev_ring = brw->batch.ring;
-   /* The intel_batchbuffer_flush() calls above might have changed
-* brw->batch.ring to UNKNOWN_RING, so we need to set it here at the end.
-*/
-   brw->batch.ring = ring;
-
-   if (unlikely(prev_ring == UNKNOWN_RING && ring == RENDER_RING))
-  intel_batchbuffer_emit_render_ring_prelude(brw);
-}
-
-static inline void
 intel_batchbuffer_begin(struct brw_context *brw, int n, enum brw_gpu_ring ring)
 {
intel_batchbuffer_require_space(brw, n * 4, ring);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/vdpau: correct null check

2016-03-30 Thread Christian König
Module: Mesa
Branch: master
Commit: 9a73f5728e9b834c51128e34317854702281bf3e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a73f5728e9b834c51128e34317854702281bf3e

Author: Thomas Hindoe Paaboel Andersen 
Date:   Wed Mar 30 08:13:24 2016 +0200

st/vdpau: correct null check

The null check of result was the wrong way around. Also, move memset
and dereference of result after the null check.

Reviewed-by: Christian König 

---

 src/gallium/state_trackers/vdpau/surface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/surface.c 
b/src/gallium/state_trackers/vdpau/surface.c
index 0550141..d418d56 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -426,18 +426,18 @@ VdpStatus vlVdpVideoSurfaceDMABuf(VdpVideoSurface surface,
 
struct pipe_surface *surf;
 
-   memset(result, 0, sizeof(*result));
-   result->handle = -1;
-
if (!p_surf)
   return VDP_STATUS_INVALID_HANDLE;
 
if (plane > 3)
   return VDP_STATUS_INVALID_VALUE;
 
-   if (result)
+   if (!result)
   return VDP_STATUS_INVALID_POINTER;
 
+   memset(result, 0, sizeof(*result));
+   result->handle = -1;
+
pipe_mutex_lock(p_surf->device->mutex);
if (p_surf->video_buffer == NULL) {
   struct pipe_context *pipe = p_surf->device->context;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): r600: ignore PIPE_BIND_LINEAR in *_is_format_supported

2016-03-30 Thread Christian König
Module: Mesa
Branch: master
Commit: 1faca438bdbf11d85a6158d41ea91cab40fc2033
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1faca438bdbf11d85a6158d41ea91cab40fc2033

Author: Christian König 
Date:   Wed Mar 30 15:38:29 2016 +0200

r600: ignore PIPE_BIND_LINEAR in *_is_format_supported

Similar to radeonsi linear layout should work for all not compressed
or depth/stencil formats. Fixes issues with VDPAU on r600.

Signed-off-by: Christian König 
Tested-by: Dieter Nützel 

---

 src/gallium/drivers/r600/evergreen_state.c | 5 +
 src/gallium/drivers/r600/r600_state.c  | 5 +
 2 files changed, 10 insertions(+)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 83313cb..6595267 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -299,6 +299,11 @@ boolean evergreen_is_format_supported(struct pipe_screen 
*screen,
if (usage & PIPE_BIND_TRANSFER_WRITE)
retval |= PIPE_BIND_TRANSFER_WRITE;
 
+   if ((usage & PIPE_BIND_LINEAR) &&
+   !util_format_is_compressed(format) &&
+   !(usage & PIPE_BIND_DEPTH_STENCIL))
+   retval |= PIPE_BIND_LINEAR;
+
return retval == usage;
 }
 
diff --git a/src/gallium/drivers/r600/r600_state.c 
b/src/gallium/drivers/r600/r600_state.c
index f902619..3189a13 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -239,6 +239,11 @@ boolean r600_is_format_supported(struct pipe_screen 
*screen,
if (usage & PIPE_BIND_TRANSFER_WRITE)
retval |= PIPE_BIND_TRANSFER_WRITE;
 
+   if ((usage & PIPE_BIND_LINEAR) &&
+   !util_format_is_compressed(format) &&
+   !(usage & PIPE_BIND_DEPTH_STENCIL))
+   retval |= PIPE_BIND_LINEAR;
+
return retval == usage;
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): docs: remove docs/COPYING which contains GPL license

2016-03-30 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4541a785020aa6b9c6472d0fc4fb0fe8cdcec40f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4541a785020aa6b9c6472d0fc4fb0fe8cdcec40f

Author: Brian Paul 
Date:   Wed Mar 30 11:22:07 2016 -0600

docs: remove docs/COPYING which contains GPL license

There hasn't been GPL code in Mesa for a long time now.

Reviewed-by: Jose Fonseca 

---

 docs/COPYING | 490 ---
 1 file changed, 490 deletions(-)

diff --git a/docs/COPYING b/docs/COPYING
deleted file mode 100644
index b88946c..000
--- a/docs/COPYING
+++ /dev/null
@@ -1,490 +0,0 @@
-
-Some parts of Mesa are copyrighted under the GNU LGPL.  See the
-Mesa/docs/COPYRIGHT file for details.
-
-The following is the standard GNU copyright file.
---
-
-
- GNU LIBRARY GENERAL PUBLIC LICENSE
-  Version 2, June 1991
-
- Copyright (C) 1991 Free Software Foundation, Inc.
-675 Mass Ave, Cambridge, MA 02139, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the library GPL.  It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
-
-   Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it.  You can use it for
-your libraries, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library.  If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software.  To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
-  Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs.  This
-license, the GNU Library General Public License, applies to certain
-designated libraries.  This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
-  The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it.  Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program.  However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public 

Mesa (master): glsl: add missing types for buffer images

2016-03-30 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: bb37886f75f48727e5d3f5e2715c4a2f418ac1a1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb37886f75f48727e5d3f5e2715c4a2f418ac1a1

Author: Samuel Pitoiset 
Date:   Tue Mar 29 23:11:07 2016 +0200

glsl: add missing types for buffer images

Type of GLSL_SAMPLER_DIM_BUF can be sampler or image.

Spotted while trying to run dEQP tests related to
ARB_shader_image_load_store.

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Kenneth Graunke 
Tested-by: Ilia Mirkin 

---

 src/compiler/glsl/ast_to_hir.cpp | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 29a4642..fcc542a 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -2353,11 +2353,11 @@ get_type_name_for_precision_qualifier(const glsl_type 
*type)
 return names[type_idx];
  }
  case GLSL_SAMPLER_DIM_BUF: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
-static const char *const names[4] = {
-  "samplerBuffer", NULL, NULL, NULL
+static const char *const names[8] = {
+  "samplerBuffer", NULL, NULL, NULL,
+  "imageBuffer", NULL, NULL, NULL
 };
-return names[type_idx];
+return names[offset + type_idx];
  }
  case GLSL_SAMPLER_DIM_EXTERNAL: {
 assert(type->base_type == GLSL_TYPE_SAMPLER);
@@ -2415,11 +2415,11 @@ get_type_name_for_precision_qualifier(const glsl_type 
*type)
 return names[type_idx];
  }
  case GLSL_SAMPLER_DIM_BUF: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
-static const char *const names[4] = {
-  "isamplerBuffer", NULL, NULL, NULL
+static const char *const names[8] = {
+  "isamplerBuffer", NULL, NULL, NULL,
+  "iimageBuffer", NULL, NULL, NULL
 };
-return names[type_idx];
+return names[offset + type_idx];
  }
  default:
 unreachable("Unsupported isampler/iimage dimensionality");
@@ -2470,11 +2470,11 @@ get_type_name_for_precision_qualifier(const glsl_type 
*type)
 return names[type_idx];
  }
  case GLSL_SAMPLER_DIM_BUF: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
-static const char *const names[4] = {
-  "usamplerBuffer", NULL, NULL, NULL
+static const char *const names[8] = {
+  "usamplerBuffer", NULL, NULL, NULL,
+  "uimageBuffer", NULL, NULL, NULL
 };
-return names[type_idx];
+return names[offset + type_idx];
  }
  default:
 unreachable("Unsupported usampler/uimage dimensionality");

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (dummy): Another dummy commit.

2016-03-30 Thread Jose Fonseca
Module: Mesa
Branch: dummy
Commit: 09325b68c01ca442b6ce50240a811eb99be01fb5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=09325b68c01ca442b6ce50240a811eb99be01fb5

Author: Jose Fonseca 
Date:   Wed Mar 30 16:05:50 2016 +0100

Another dummy commit.

This time to ensure that github mirror hook works well (it was spewing
some errors), upon request from Daniel Stone.

This branch will be immediately removed.

---

 DUMMY | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/DUMMY b/DUMMY
new file mode 100644
index 000..e69de29

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (appveyor): appveyor: Dummy commit to verify the new AppVeyor hook.

2016-03-30 Thread Jose Fonseca
Module: Mesa
Branch: appveyor
Commit: dc4598c280907e8be6178017b64a47ecee0f58e7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc4598c280907e8be6178017b64a47ecee0f58e7

Author: Jose Fonseca 
Date:   Wed Mar 30 13:55:49 2016 +0100

appveyor: Dummy commit to verify the new AppVeyor hook.

This branch will be pruned once the experiement is over.

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

---

 DUMMY | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/DUMMY b/DUMMY
new file mode 100644
index 000..e69de29

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit