Re: Mesa (update-reviewers-for-vmware): i965/clear: clear_value better precision

2019-08-02 Thread Brian Paul
Ugh, I didn't mean to do this.  I'm trying to figure out how to make a 
merge request with gitlab.


-Brian


On 08/02/2019 09:35 AM, GitLab Mirror wrote:

Module: Mesa
Branch: update-reviewers-for-vmware
Commit: a86eccfb78092493b3999849db62613838951756
URL:
https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcgit.freedesktop.org%2Fmesa%2Fmesa%2Fcommit%2F%3Fid%3Da86eccfb78092493b3999849db62613838951756&data=02%7C01%7Cbrianp%40vmware.com%7C6aa9bf59501d420b03af08d7175f0b0f%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637003569293293608&sdata=bLEb7XY3mLFAkME7v8QJ0GugG%2FbzFoNONSSGTjKSfFs%3D&reserved=0

Author: Sergii Romantsov 
Date:   Fri Jul 12 16:46:45 2019 +0300

i965/clear: clear_value better precision

Test-case with depth-clear 0.5 and format
MESA_FORMAT_Z24_UNORM_X8_UINT fails due inconsistent
clear-value of 0.497.
Maybe its better to improve?

CC: Jason Ekstrand 
Fixes: 0ae9ce0f29ea (i965/clear: Quantize the depth clear value based on the 
format)
Bugzilla: 
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.freedesktop.org%2Fshow_bug.cgi%3Fid%3D13&data=02%7C01%7Cbrianp%40vmware.com%7C6aa9bf59501d420b03af08d7175f0b0f%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637003569293293608&sdata=OD1YuhGY%2B4IZG7g8PMh%2Bk3amc6O9HjDV92pOFPd8RlE%3D&reserved=0
Signed-off-by: Sergii Romantsov 
Signed-off-by: Danylo Piliaiev 
Reviewed-by: Jason Ekstrand 

---

  src/mesa/drivers/dri/i965/brw_clear.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_clear.c 
b/src/mesa/drivers/dri/i965/brw_clear.c
index 30e09861491..1508171da10 100644
--- a/src/mesa/drivers/dri/i965/brw_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_clear.c
@@ -167,7 +167,7 @@ brw_fast_clear_depth(struct gl_context *ctx)
  */
 float clear_value =
mt->format == MESA_FORMAT_Z_FLOAT32 ? ctx->Depth.Clear :
-  (unsigned)(ctx->Depth.Clear * fb->_DepthMax) / (float)fb->_DepthMax;
+  _mesa_lroundeven(ctx->Depth.Clear * fb->_DepthMax) / 
(float)(fb->_DepthMax);
  
 const uint32_t num_layers = depth_att->Layered ? depth_irb->layer_count : 1;
  


___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fmesa-commit&data=02%7C01%7Cbrianp%40vmware.com%7C6aa9bf59501d420b03af08d7175f0b0f%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637003569293293608&sdata=UWAkli3USsLDpnoElsuycRJ8KTrJV%2FC0r%2FarUay7SNQ%3D&reserved=0



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

Mesa (master): llvmpipe: fix check for a no-op shader

2018-05-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 42aee8f4f68d9fd3ece5ece57f23f63a60e7d1fa
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=42aee8f4f68d9fd3ece5ece57f23f63a60e7d1fa

Author: Brian Paul 
Date:   Thu May 17 19:57:21 2018 -0600

llvmpipe: fix check for a no-op shader

The tgsi_info.num_tokens fix broke llvmpipe's detection of no-op shaders.
Fix the code to check for num_instructions <= 1 instead.

Fixes: 8fde9429c36b75 ("tgsi: fix incorrect tgsi_shader_info::num_tokens
computation")
Tested-by: Roland Scheidegger 
Reviewed-by: Roland Scheidegger 

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 74b8d4dd96..91b68e7c96 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -2843,7 +2843,8 @@ generate_variant(struct llvmpipe_context *lp,
  !shader->info.base.writes_samplemask
   ? TRUE : FALSE;
 
-   if ((shader->info.base.num_tokens <= 1) &&
+   /* if num_instructions == 1, it's a nop shader with only an END instruction 
*/
+   if ((shader->info.base.num_instructions <= 1) &&
!key->depth.enabled && !key->stencil[0].enabled) {
   variant->ps_inv_multiplier = 0;
} else {
@@ -3478,7 +3479,8 @@ llvmpipe_init_fs_funcs(struct llvmpipe_context *llvmpipe)
 boolean
 llvmpipe_rasterization_disabled(struct llvmpipe_context *lp)
 {
-   boolean null_fs = !lp->fs || lp->fs->info.base.num_tokens <= 1;
+   /* if num_instructions == 1, it's a nop shader with only an END instruction 
*/
+   boolean null_fs = !lp->fs || lp->fs->info.base.num_instructions <= 1;
 
return (null_fs &&
!lp->depth_stencil->depth.enabled &&

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


Mesa (master): tgsi: fix incorrect tgsi_shader_info::num_tokens computation

2018-05-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 8fde9429c36b75d9e5afec4e221aff9b47db54f6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8fde9429c36b75d9e5afec4e221aff9b47db54f6

Author: Brian Paul 
Date:   Thu May 17 13:38:05 2018 -0600

tgsi: fix incorrect tgsi_shader_info::num_tokens computation

We were incrementing num_tokens in each loop iteration while parsing
the shader.  But each call to tgsi_parse_token() can consume more than
one token (and often does).  Instead, just call the tgsi_num_tokens()
function.

Luckily, this issue doesn't seem to effect any current users of this
field (llvmpipe just checks for <= 1, for example).

Reviewed-by: Neha Bhende
Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 18488d776e..685a413c4e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -836,13 +836,12 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
   procType == PIPE_SHADER_TESS_EVAL ||
   procType == PIPE_SHADER_COMPUTE);
info->processor = procType;
+   info->num_tokens = tgsi_num_tokens(parse.Tokens);
 
/**
 ** Loop over incoming program tokens/instructions
 */
while (!tgsi_parse_end_of_tokens(&parse)) {
-  info->num_tokens++;
-
   tgsi_parse_token( &parse );
 
   switch( parse.FullToken.Token.Type ) {

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


Mesa (master): svga: fix incompatible bind flags at buffer validation time

2018-05-16 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 33a86acd785ed4ee5d1325d3e87e4f593d4c07b0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=33a86acd785ed4ee5d1325d3e87e4f593d4c07b0

Author: Charmaine Lee 
Date:   Fri May 11 11:21:52 2018 -0700

svga: fix incompatible bind flags at buffer validation time

At buffer resource validation time, if the resource handle is not yet
created and if the initial buffer bind flags and the tobind flags are
incompatible, just use the tobind flags to create the resource handle.
On the other hand, if the bind flags are compatible, we can combine
the bind flags for the resource handle creation.

Fixes piglit gl-3.1-buffer-bindings crash.

Reviewed-by: Brian Paul 

---

 src/gallium/drivers/svga/svga_resource_buffer_upload.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_resource_buffer_upload.c 
b/src/gallium/drivers/svga/svga_resource_buffer_upload.c
index 104cb6dbd2..9daae9c0f4 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer_upload.c
+++ b/src/gallium/drivers/svga/svga_resource_buffer_upload.c
@@ -1003,9 +1003,14 @@ svga_buffer_handle(struct svga_context *svga, struct 
pipe_resource *buf,
 return NULL;
   }
} else {
-  if (!sbuf->bind_flags) {
+  /* If there is no resource handle yet, then combine the buffer bind
+   * flags and the tobind_flags if they are compatible.
+   * If not, just use the tobind_flags for creating the resource handle.
+   */
+  if (compatible_bind_flags(sbuf->bind_flags, tobind_flags))
+ sbuf->bind_flags = sbuf->bind_flags | tobind_flags;
+  else
  sbuf->bind_flags = tobind_flags;
-  }
 
   assert((sbuf->bind_flags & tobind_flags) == tobind_flags);
 

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


Mesa (master): mesa: cast the GLenum16 to GLint to avoid compile warning on android

2018-05-16 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1261b34cd592822703a6848e78963c011447d2e7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1261b34cd592822703a6848e78963c011447d2e7

Author: jenny.q.cao 
Date:   Wed May 16 01:02:00 2018 -0600

mesa: cast the GLenum16 to GLint to avoid compile warning on android

Cast the enum to GLint to avoid the compile warning:
/src/mesa/main/get.c:3005:19:
warning: comparison of constant -32768 with expression of type
'GLenum16' (aka 'unsigned short') is always false
-Wtautologicalia-constant-out-of-range-compare

Tests: compilation without this warning
Signed-off-by: jenny.q.cao 
Reviewed-by: Brian Paul 

---

 src/mesa/main/get.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 62d4f1ea5d..0bf5c1ff0c 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -3068,7 +3068,7 @@ _mesa_GetFixedv(GLenum pname, GLfixed *params)
   break;
 
case TYPE_ENUM16:
-  params[0] = INT_TO_FIXED(((GLenum16 *) p)[0]);
+  params[0] = INT_TO_FIXED((GLint)(((GLenum16 *) p)[0]));
   break;
 
case TYPE_INT_N:

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


Mesa (master): mesa: revert GL_[SECONDARY_]COLOR_ARRAY_SIZE glGet type to TYPE_INT

2018-05-10 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e4211b36bba4acde3e56ce1e22b12759e820a241
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4211b36bba4acde3e56ce1e22b12759e820a241

Author: Brian Paul 
Date:   Thu May 10 09:24:20 2018 -0600

mesa: revert GL_[SECONDARY_]COLOR_ARRAY_SIZE glGet type to TYPE_INT

Since size can be 3, 4 or GL_BGRA we need to keep these glGet types
as TYPE_INT, not TYPE_UBYTE.

Fixes: d07466fe18522 ("mesa: fix glGetInteger/Float/etc queries for
vertex arrays attribs")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106462
cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Mathias Fröhlich 

---

 src/mesa/main/get_hash_params.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index bb7d23aa10..a97b948a79 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -219,7 +219,7 @@ descriptor=[
   [ "NORMAL_ARRAY_TYPE", "ARRAY_ENUM16(VertexAttrib[VERT_ATTRIB_NORMAL].Type), 
NO_EXTRA" ],
   [ "NORMAL_ARRAY_STRIDE", 
"ARRAY_SHORT(VertexAttrib[VERT_ATTRIB_NORMAL].Stride), NO_EXTRA" ],
   [ "COLOR_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR0].Enabled), 
NO_EXTRA" ],
-  [ "COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_UBYTE, 0, NO_EXTRA" ],
+  [ "COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
   [ "COLOR_ARRAY_TYPE", "ARRAY_ENUM16(VertexAttrib[VERT_ATTRIB_COLOR0].Type), 
NO_EXTRA" ],
   [ "COLOR_ARRAY_STRIDE", 
"ARRAY_SHORT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA" ],
   [ "TEXTURE_COORD_ARRAY", "LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct 
gl_array_attributes, Enabled), NO_EXTRA" ],
@@ -825,7 +825,7 @@ descriptor=[
   [ "SECONDARY_COLOR_ARRAY", 
"ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR1].Enabled), NO_EXTRA" ],
   [ "SECONDARY_COLOR_ARRAY_TYPE", 
"ARRAY_ENUM16(VertexAttrib[VERT_ATTRIB_COLOR1].Type), NO_EXTRA" ],
   [ "SECONDARY_COLOR_ARRAY_STRIDE", 
"ARRAY_SHORT(VertexAttrib[VERT_ATTRIB_COLOR1].Stride), NO_EXTRA" ],
-  [ "SECONDARY_COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_UBYTE, 0, NO_EXTRA" ],
+  [ "SECONDARY_COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
 
 # GL_EXT_fog_coord
   [ "CURRENT_FOG_COORDINATE", 
"CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]), extra_flush_current" ],

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


Mesa (master): mesa: fix glGetInteger/Float/etc queries for vertex arrays attribs

2018-05-10 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d07466fe18522cde1acadfc597583f80b69c15b7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d07466fe18522cde1acadfc597583f80b69c15b7

Author: Brian Paul 
Date:   Wed May  9 19:46:32 2018 -0600

mesa: fix glGetInteger/Float/etc queries for vertex arrays attribs

The vertex array Size and Stride attributes are now ubyte and short,
respectively.  The glGet code needed to be updated to handle those
types, but wasn't.

Fixes the new piglit test gl-1.5-get-array-attribs test.

v2: fix inadvertant whitespace change, change COLOR_ARRAY_SIZE to UBYTE,
misc fixes suggested by Justin

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106450
Fixes: d5f42f96e16 ("mesa: shrink size of gl_array_attributes (v2)")
Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Mathias Fröhlich 
Reviewed-by: Jordan Justen 

---

 src/mesa/main/get.c  | 71 
 src/mesa/main/get_hash_params.py | 26 +++
 2 files changed, 84 insertions(+), 13 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 44b7b838a3..62d4f1ea5d 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -105,6 +105,8 @@ enum value_type {
TYPE_ENUM,
TYPE_ENUM_2,
TYPE_BOOLEAN,
+   TYPE_UBYTE,
+   TYPE_SHORT,
TYPE_BIT_0,
TYPE_BIT_1,
TYPE_BIT_2,
@@ -188,6 +190,8 @@ union value {
GLint value_int_4[4];
GLint64 value_int64;
GLenum value_enum;
+   GLubyte value_ubyte;
+   GLshort value_short;
 
/* Sigh, see GL_COMPRESSED_TEXTURE_FORMATS_ARB handling */
struct {
@@ -235,10 +239,13 @@ union value {
 #define CONTEXT_MATRIX(field) CONTEXT_FIELD(field, TYPE_MATRIX)
 #define CONTEXT_MATRIX_T(field) CONTEXT_FIELD(field, TYPE_MATRIX_T)
 
+/* Vertex array fields */
 #define ARRAY_INT(field) ARRAY_FIELD(field, TYPE_INT)
 #define ARRAY_ENUM(field) ARRAY_FIELD(field, TYPE_ENUM)
 #define ARRAY_ENUM16(field) ARRAY_FIELD(field, TYPE_ENUM16)
 #define ARRAY_BOOL(field) ARRAY_FIELD(field, TYPE_BOOLEAN)
+#define ARRAY_UBYTE(field) ARRAY_FIELD(field, TYPE_UBYTE)
+#define ARRAY_SHORT(field) ARRAY_FIELD(field, TYPE_SHORT)
 
 #define EXT(f) \
offsetof(struct gl_extensions, f)
@@ -1520,6 +1527,10 @@ get_value_size(enum value_type type, const union value 
*v)
   return sizeof(GLenum) * 2;
case TYPE_BOOLEAN:
   return sizeof(GLboolean);
+   case TYPE_UBYTE:
+  return sizeof(GLubyte);
+   case TYPE_SHORT:
+  return sizeof(GLshort);
case TYPE_BIT_0:
case TYPE_BIT_1:
case TYPE_BIT_2:
@@ -1631,6 +1642,14 @@ _mesa_GetBooleanv(GLenum pname, GLboolean *params)
   params[0] = ((GLboolean*) p)[0];
   break;
 
+   case TYPE_UBYTE:
+  params[0] = INT_TO_BOOLEAN(((GLubyte *) p)[0]);
+  break;
+
+   case TYPE_SHORT:
+  params[0] = INT_TO_BOOLEAN(((GLshort *) p)[0]);
+  break;
+
case TYPE_MATRIX:
   m = *(GLmatrix **) p;
   for (i = 0; i < 16; i++)
@@ -1738,6 +1757,14 @@ _mesa_GetFloatv(GLenum pname, GLfloat *params)
   params[0] = BOOLEAN_TO_FLOAT(*(GLboolean*) p);
   break;
 
+   case TYPE_UBYTE:
+  params[0] = (GLfloat) ((GLubyte *) p)[0];
+  break;
+
+   case TYPE_SHORT:
+  params[0] = (GLfloat) ((GLshort *) p)[0];
+  break;
+
case TYPE_MATRIX:
   m = *(GLmatrix **) p;
   for (i = 0; i < 16; i++)
@@ -1845,6 +1872,14 @@ _mesa_GetIntegerv(GLenum pname, GLint *params)
   params[0] = BOOLEAN_TO_INT(*(GLboolean*) p);
   break;
 
+   case TYPE_UBYTE:
+  params[0] = ((GLubyte *) p)[0];
+  break;
+
+   case TYPE_SHORT:
+  params[0] = ((GLshort *) p)[0];
+  break;
+
case TYPE_MATRIX:
   m = *(GLmatrix **) p;
   for (i = 0; i < 16; i++)
@@ -2065,6 +2100,14 @@ _mesa_GetDoublev(GLenum pname, GLdouble *params)
   params[0] = *(GLboolean*) p;
   break;
 
+   case TYPE_UBYTE:
+  params[0] = ((GLubyte *) p)[0];
+  break;
+
+   case TYPE_SHORT:
+  params[0] = ((GLshort *) p)[0];
+  break;
+
case TYPE_MATRIX:
   m = *(GLmatrix **) p;
   for (i = 0; i < 16; i++)
@@ -2144,6 +2187,8 @@ _mesa_GetUnsignedBytevEXT(GLenum pname, GLubyte *data)
case TYPE_ENUM:
case TYPE_ENUM_2:
case TYPE_BOOLEAN:
+   case TYPE_UBYTE:
+   case TYPE_SHORT:
case TYPE_FLOAT:
case TYPE_FLOATN:
case TYPE_FLOAT_2:
@@ -2793,6 +2838,14 @@ _mesa_GetFloati_v(GLenum pname, GLuint index, GLfloat 
*params)
   params[0] = BOOLEAN_TO_FLOAT(v.value_bool);
   break;
 
+   case TYPE_UBYTE:
+  params[0] = (GLfloat) v.value_ubyte;
+  break;
+
+   case TYPE_SHORT:
+  params[0] = (GLfloat) v.value_short;
+  break;
+
case TYPE_MATRIX:
   m = *(GLmatrix **) &v;
   for (i = 0; i < 16; i++)
@@ -2876,6 +2929,14 @@ _mesa_GetDoublei_v(GLenum pname, GLuint index, GLdouble 
*params)
   params[0] = (GLdouble) BOOLEAN_TO_FLOAT(v.value_bool);
   break;
 
+   case TYPE_UBYTE:
+  params[0] = (GLd

Mesa (master): glsl: change ast_type_qualifier bitset size to work around GCC 5.4 bug

2018-05-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 901db25d5b7cd2ac2dd648b370c4bddf23dd5c44
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=901db25d5b7cd2ac2dd648b370c4bddf23dd5c44

Author: Brian Paul 
Date:   Tue May  8 08:24:21 2018 -0600

glsl: change ast_type_qualifier bitset size to work around GCC 5.4 bug

Change the size of the bitset from 128 bits to 96.  This works around an
apparent GCC 5.4 bug in which bad SSE code is generated, leading to a
crash in ast_type_qualifier::validate_in_qualifier() (ast_type.cpp:654).

This can be repro'd with the Piglit test tests/spec/glsl-1.50/execution/
varying-struct-basic-gs-fs.shader_test

Bugzilla:https://bugs.freedesktop.org/show_bug.cgi?id=105497
Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Charmaine Lee 
Tested-by: Charmaine Lee 
Reviewed-by: Ian Romanick 

---

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

diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index a1ec0d566f..9b88ff51d4 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -474,7 +474,13 @@ enum {
 
 struct ast_type_qualifier {
DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier);
-   DECLARE_BITSET_T(bitset_t, 128);
+   /* Note: this bitset needs to have at least as many bits as the 'q'
+* struct has flags, below.  Previously, the size was 128 instead of 96.
+* But an apparent bug in GCC 5.4.0 causes bad SSE code generation
+* elsewhere, leading to a crash.  96 bits works around the issue.
+* See https://bugs.freedesktop.org/show_bug.cgi?id=105497
+*/
+   DECLARE_BITSET_T(bitset_t, 96);
 
union flags {
   struct {

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


Mesa (master): gallium/i915: fix PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE typo

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: f298ed93d9ded6ef355cf6381b49a845c76084b0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f298ed93d9ded6ef355cf6381b49a845c76084b0

Author: Brian Paul 
Date:   Tue May  1 09:51:45 2018 -0600

gallium/i915: fix PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE typo

Fixes: fffe5e2d14f807c ("gallium: add initial support for conservative
rasterization")
Trivial.

---

 src/gallium/drivers/i915/i915_screen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c
index 9d99238f2b..1b8c0ad9a2 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -441,7 +441,7 @@ i915_get_paramf(struct pipe_screen *screen, enum pipe_capf 
cap)
case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS:
   return 16.0;
 
-   case PIPE_CAPF_MIN_CONSERVTIVE_RASTER_DILATE:
+   case PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE:
   /* fall-through */
case PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE:
   /* fall-through */

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


Mesa (master): gallium: add initial support for conservative rasterization

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: fffe5e2d14f807cd6b778d91e1aaea3a73434547
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fffe5e2d14f807cd6b778d91e1aaea3a73434547

Author: Rhys Perry 
Date:   Sat Apr  7 16:15:00 2018 -0600

gallium: add initial support for conservative rasterization

Signed-off-by: Rhys Perry 
Reviewed-by: Brian Paul 
Reviewed-by: Marek Olšák 

---

 src/gallium/docs/source/cso/rasterizer.rst   | 23 +++
 src/gallium/docs/source/screen.rst   | 18 ++
 src/gallium/drivers/etnaviv/etnaviv_screen.c | 10 ++
 src/gallium/drivers/freedreno/freedreno_screen.c | 10 ++
 src/gallium/drivers/i915/i915_screen.c   | 13 +
 src/gallium/drivers/llvmpipe/lp_screen.c | 12 
 src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 10 ++
 src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 10 ++
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 10 ++
 src/gallium/drivers/r300/r300_screen.c   | 10 ++
 src/gallium/drivers/r600/r600_pipe.c |  6 ++
 src/gallium/drivers/r600/r600_pipe_common.c  |  4 
 src/gallium/drivers/radeonsi/si_get.c| 10 ++
 src/gallium/drivers/softpipe/sp_screen.c | 12 
 src/gallium/drivers/svga/svga_screen.c   | 13 +
 src/gallium/drivers/swr/swr_screen.cpp   | 10 ++
 src/gallium/drivers/vc4/vc4_screen.c | 13 -
 src/gallium/drivers/vc5/vc5_screen.c | 13 -
 src/gallium/drivers/virgl/virgl_screen.c | 10 ++
 src/gallium/include/pipe/p_defines.h | 20 
 src/gallium/include/pipe/p_state.h   |  8 
 21 files changed, 243 insertions(+), 2 deletions(-)

diff --git a/src/gallium/docs/source/cso/rasterizer.rst 
b/src/gallium/docs/source/cso/rasterizer.rst
index 616e4511a2..4dabcc032f 100644
--- a/src/gallium/docs/source/cso/rasterizer.rst
+++ b/src/gallium/docs/source/cso/rasterizer.rst
@@ -340,3 +340,26 @@ clip_plane_enable
 If any clip distance output is written, those half-spaces for which no
 clip distance is written count as disabled; i.e. user clip planes and
 shader clip distances cannot be mixed, and clip distances take precedence.
+
+conservative_raster_mode
+The conservative rasterization mode.  For PIPE_CONSERVATIVE_RASTER_OFF,
+conservative rasterization is disabled.  For 
IPE_CONSERVATIVE_RASTER_POST_SNAP
+or PIPE_CONSERVATIVE_RASTER_PRE_SNAP, conservative rasterization is nabled.
+When conservative rasterization is enabled, the polygon smooth, line mooth,
+point smooth and line stipple settings are ignored.
+With the post-snap mode, unlike the pre-snap mode, fragments are never
+generated for degenerate primitives.  Degenerate primitives, when 
rasterized,
+are considered back-facing and the vertex attributes and depth are that of
+the provoking vertex.
+If the post-snap mode is used with an unsupported primitive, the pre-snap
+mode is used, if supported.  Behavior is similar for the pre-snap mode.
+If the pre-snap mode is used, fragments are generated with respect to the 
primitive
+before vertex snapping.
+
+conservative_raster_dilate
+The amount of dilation during conservative rasterization.
+
+subpixel_precision_x
+A bias added to the horizontal subpixel precision during conservative 
rasterization.
+subpixel_precision_y
+A bias added to the vertical subpixel precision during conservative 
rasterization.
diff --git a/src/gallium/docs/source/screen.rst 
b/src/gallium/docs/source/screen.rst
index 3837360fb4..5bc6ee99f0 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -420,6 +420,18 @@ The integer capabilities:
   by the driver, and the driver can throw assertion failures.
 * ``PIPE_CAP_PACKED_UNIFORMS``: True if the driver supports packed uniforms
   as opposed to padding to vec4s.
+* ``PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES``: Whether the
+  PIPE_CONSERVATIVE_RASTER_POST_SNAP mode is supported for triangles.
+* ``PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES``: Whether the
+PIPE_CONSERVATIVE_RASTER_POST_SNAP mode is supported for points and lines.
+* ``PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES``: Whether the
+PIPE_CONSERVATIVE_RASTER_PRE_SNAP mode is supported for triangles.
+* ``PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES``: Whether the
+PIPE_CONSERVATIVE_RASTER_PRE_SNAP mode is supported for points and lines.
+* ``PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE``: Whether 
PIPE_CAP_POST_DEPTH_COVERAGE
+works with conservative rasterization.
+* ``PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS``: The maximum
+subpixel precision bias in bits during conservative rasterization.
 
 
 .. _pipe_capf:
@@ -437,6 +449,12 @@ The floating-point capabilities are:
   applied

Mesa (master): mesa: add support for nvidia conservative rasterization extensions

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4580617509d1ba48a7806227533a07e1c495ca81
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4580617509d1ba48a7806227533a07e1c495ca81

Author: Rhys Perry 
Date:   Fri Apr 27 11:35:00 2018 -0600

mesa: add support for nvidia conservative rasterization extensions

Although the specs are written against compatibility GL 4.3 and allows core
profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+.

Signed-off-by: Rhys Perry 
Reviewed-by: Brian Paul 

---

 src/mapi/glapi/gen/gl_API.xml   |  47 
 src/mapi/glapi/gen/gl_genexec.py|   1 +
 src/mesa/Makefile.sources   |   2 +
 src/mesa/main/attrib.c  |  60 ---
 src/mesa/main/conservativeraster.c  | 128 
 src/mesa/main/conservativeraster.h  |  48 
 src/mesa/main/context.c |  10 +++
 src/mesa/main/dlist.c   |  86 +
 src/mesa/main/enable.c  |  14 
 src/mesa/main/extensions_table.h|   4 +
 src/mesa/main/get.c |   3 +
 src/mesa/main/get_hash_params.py|  13 
 src/mesa/main/mtypes.h  |  28 ++-
 src/mesa/main/tests/dispatch_sanity.cpp |  27 +++
 src/mesa/main/viewport.c|  58 +++
 src/mesa/main/viewport.h|   6 ++
 src/mesa/meson.build|   2 +
 17 files changed, 526 insertions(+), 11 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 38c1921047..db312370b1 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -12871,6 +12871,53 @@
   
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 http://www.w3.org/2001/XInclude"/>
 
 
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index aaff9f230b..be8013b62b 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -62,6 +62,7 @@ header = """/**
 #include "main/colortab.h"
 #include "main/compute.h"
 #include "main/condrender.h"
+#include "main/conservativeraster.h"
 #include "main/context.h"
 #include "main/convolve.h"
 #include "main/copyimage.h"
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index f910b41d0a..00aba0a2f7 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -47,6 +47,8 @@ MAIN_FILES = \
main/condrender.c \
main/condrender.h \
main/config.h \
+   main/conservativeraster.c \
+   main/conservativeraster.h \
main/context.c \
main/context.h \
main/convolve.c \
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 9f0e7161f3..6127a556d7 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -137,6 +137,9 @@ struct gl_enable_attrib
 
/* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
GLboolean sRGBEnabled;
+
+   /* GL_NV_conservative_raster */
+   GLboolean ConservativeRasterization;
 };
 
 
@@ -177,6 +180,13 @@ struct texture_state
 };
 
 
+struct viewport_state
+{
+   struct gl_viewport_attrib ViewportArray[MAX_VIEWPORTS];
+   GLuint SubpixelPrecisionBias[2];
+};
+
+
 /** An unused GL_*_BIT value */
 #define DUMMY_BIT 0x1000
 
@@ -393,6 +403,9 @@ _mesa_PushAttrib(GLbitfield mask)
 
   /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
   attr->sRGBEnabled = ctx->Color.sRGBEnabled;
+
+  /* GL_NV_conservative_raster */
+  attr->ConservativeRasterization = ctx->ConservativeRasterization;
}
 
if (mask & GL_EVAL_BIT) {
@@ -544,11 +557,23 @@ _mesa_PushAttrib(GLbitfield mask)
}
 
if (mask & GL_VIEWPORT_BIT) {
-  if (!push_attrib(ctx, &head, GL_VIEWPORT_BIT,
-   sizeof(struct gl_viewport_attrib)
-   * ctx->Const.MaxViewports,
-   (void*)&ctx->ViewportArray))
+  struct viewport_state *viewstate = CALLOC_STRUCT(viewport_state);
+  if (!viewstate) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_VIEWPORT_BIT)");
+ goto end;
+  }
+
+  if (!save_attrib_data(&head, GL_VIEWPORT_BIT, viewstate)) {
+ free(viewstate);
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_VIEWPORT_BIT)");
  goto end;
+  }
+
+  memcpy(&viewstate->ViewportArray, &ctx->ViewportArray,
+ sizeof(struct gl_viewport_attrib)*ctx->Const.MaxViewports);
+
+  viewstate->SubpixelPrecisionBias[0] = ctx->SubpixelPrecisionBias[0];

Mesa (master): nvc0: add conservative rasterization support

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 07dac3e04056f7e90661eeb39aea66ba0b82538d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=07dac3e04056f7e90661eeb39aea66ba0b82538d

Author: Rhys Perry 
Date:   Sat Apr  7 16:15:00 2018 -0600

nvc0: add conservative rasterization support

Subpixel precision bias, dilation and the post-snap mode are supported on
GM200 and newer. The pre-snap mode is supported for triangle primitives on
GP100.

Signed-off-by: Rhys Perry 
Reviewed-by: Ilia Mirkin 

---

 src/gallium/drivers/nouveau/nvc0/mme/com9097.mme   | 30 ++
 src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h | 21 +++
 src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h |  5 
 src/gallium/drivers/nouveau/nvc0/nvc0_macros.h |  4 ++-
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 19 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_state.c  | 14 ++
 src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h   |  2 +-
 7 files changed, 87 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme 
b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
index 7c5ec8f52b..ecf9960667 100644
--- a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
+++ b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
@@ -550,3 +550,33 @@ qbw_postclamp:
 qbw_done:
exit send (extrinsrt 0x0 $r4 0x0 0x10 0x10)
maddrsend 0x44
+
+/* NVC0_3D_MACRO_CONSERVATIVE_RASTER_STATE:
+ *
+ * This sets basically all the conservative rasterization state. It sets
+ * CONSERVATIVE_RASTER to one while doing so.
+ *
+ * arg = biasx | biasy<<4 | (dilation*4)<<8 | mode<<10
+ */
+.section #mme9097_conservative_raster_state
+   /* Mode and dilation */
+   maddr 0x1d00 /* SCRATCH[0] */
+   send 0x0 /* unknown */
+   send (extrinsrt 0x0 $r1 8 3 23) /* value */
+   mov $r2 0x7
+   send (extrinsrt 0x0 $r2 0 3 23) /* write mask */
+   maddr 0x18c4 /* FIRMWARE[4] */
+   mov $r2 0x831
+   send (extrinsrt 0x0 $r2 0 12 11) /* sends 0x418800 */
+   /* Subpixel precision */
+   mov $r2 (extrinsrt 0x0 $r1 0 3 0)
+   mov $r2 (extrinsrt $r2 $r1 4 4 8)
+   maddr 0x8287 /* SUBPIXEL_PRECISION[0] (incrementing by 8 methods) */
+   mov $r3 16 /* loop counter */
+crs_loop:
+   mov $r3 (add $r3 -1)
+   branz $r3 #crs_loop
+   send $r2
+   /* Enable */
+   exit maddr 0x1452 /* CONSERVATIVE_RASTER */
+   send 0x1
diff --git a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h 
b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
index 9618da6e28..3eacda9a27 100644
--- a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
+++ b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
@@ -373,3 +373,24 @@ uint32_t mme9097_query_buffer_write[] = {
0x840100c2,
0x00110071,
 };
+
+uint32_t mme9097_conservative_raster_state[] = {
+   0x07400021,
+   0x0041,
+   0xb8d04042,
+/* 0x000c: crs_loop */
+   0x0001c211,
+   0xb8c08042,
+   0x06310021,
+   0x020c4211,
+   0x5b008042,
+   0x00c04212,
+   0x41085212,
+   0x20a1c021,
+   0x00040311,
+   0xdb11,
+   0xd817,
+   0x1041,
+   0x051480a1,
+   0x4041,
+};
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h 
b/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
index d7245fbcae..c5456e48b5 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
@@ -447,6 +447,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define NVC0_3D_VIEWPORT_TRANSLATE_Z__ESIZE0x0020
 #define NVC0_3D_VIEWPORT_TRANSLATE_Z__LEN  0x0010
 
+#define NVC0_3D_SUBPIXEL_PRECISION(i0)(0x0a1c + 
0x20*(i0))
+#define NVC0_3D_SUBPIXEL_PRECISION__ESIZE  0x0020
+#define NVC0_3D_SUBPIXEL_PRECISION__LEN
0x0010
+
 #define NVC0_3D_VIEWPORT_HORIZ(i0)(0x0c00 + 
0x10*(i0))
 #define NVC0_3D_VIEWPORT_HORIZ__ESIZE  0x0010
 #define NVC0_3D_VIEWPORT_HORIZ__LEN0x0010
@@ -780,6 +784,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define NVC0_3D_UNK11400x1140
 
 #define NVC0_3D_UNK11440x1144
+#define NVC0_3D_CONSERVATIVE_RASTER0x1148
 
 #define NVC0_3D_VTX_ATTR_DEFINE0x114c
 #define NVC0_3D_VTX_ATTR_DEFINE_ATTR__MASK 0x00ff
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_macros.h 
b/src/gallium/drivers/nouveau/nvc0/nvc0_macros.h
index eeacc714f3..7aa0633795 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_macros.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_macros.h
@@ -35,6 +35,8 @@
 
 #define NVC0_3D_MACRO_QUERY_BUFFER_WRITE   0x3858
 
-#define NVC0_CP_MACRO_LAUNCH_GRID_INDIRECT   0x3

Mesa (master): glsl/tests: add GLSL_TYPE_UINT8, GLSL_TYPE_INT8 cases to switch statements

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 31ab0427a767c6c8377c00203e87bf0a03ac3247
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=31ab0427a767c6c8377c00203e87bf0a03ac3247

Author: Brian Paul 
Date:   Thu Apr 26 11:55:46 2018 -0600

glsl/tests: add GLSL_TYPE_UINT8, GLSL_TYPE_INT8 cases to switch statements

To silence warnings about unhandled switch values.
Untested otherwise.

v2: move the INT/UINT8 cases after the INT/UINT16 cases, per Eric.

Reviewed-by: Eric Anholt 

---

 src/compiler/glsl/tests/uniform_initializer_utils.cpp | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/compiler/glsl/tests/uniform_initializer_utils.cpp 
b/src/compiler/glsl/tests/uniform_initializer_utils.cpp
index 0d7fa26752..8c00c69b29 100644
--- a/src/compiler/glsl/tests/uniform_initializer_utils.cpp
+++ b/src/compiler/glsl/tests/uniform_initializer_utils.cpp
@@ -113,6 +113,8 @@ generate_data_element(void *mem_ctx, const glsl_type *type,
   case GLSL_TYPE_FLOAT16:
   case GLSL_TYPE_UINT16:
   case GLSL_TYPE_INT16:
+  case GLSL_TYPE_UINT8:
+  case GLSL_TYPE_INT8:
 ASSERT_TRUE(false);
 break;
   }
@@ -156,6 +158,8 @@ generate_data_element(void *mem_ctx, const glsl_type *type,
   case GLSL_TYPE_FLOAT16:
   case GLSL_TYPE_UINT16:
   case GLSL_TYPE_INT16:
+  case GLSL_TYPE_UINT8:
+  case GLSL_TYPE_INT8:
 ASSERT_TRUE(false);
 break;
   }
@@ -287,6 +291,8 @@ verify_data(gl_constant_value *storage, unsigned 
storage_array_size,
  case GLSL_TYPE_FLOAT16:
  case GLSL_TYPE_UINT16:
  case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
ASSERT_TRUE(false);
break;
 }

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


Mesa (master): tgsi: use enums instead of unsigned in ureg code

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: efec712d515a329dbd20fd867de9601c4d4a0915
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=efec712d515a329dbd20fd867de9601c4d4a0915

Author: Brian Paul 
Date:   Thu Apr 26 11:55:16 2018 -0600

tgsi: use enums instead of unsigned in ureg code

Reviewed-by: Charmaine Lee 

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c | 14 +++---
 src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 393e015001..7d2b9af140 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -170,7 +170,7 @@ struct ureg_program
struct {
   unsigned index;
   enum tgsi_texture_type target;
-  unsigned format;
+  enum pipe_format format;
   boolean wr;
   boolean raw;
} image[PIPE_MAX_SHADER_IMAGES];
@@ -773,7 +773,7 @@ struct ureg_src
 ureg_DECL_image(struct ureg_program *ureg,
 unsigned index,
 enum tgsi_texture_type target,
-unsigned format,
+enum pipe_format format,
 boolean wr,
 boolean raw)
 {
@@ -1363,8 +1363,8 @@ void
 ureg_emit_memory(struct ureg_program *ureg,
  unsigned extended_token,
  unsigned qualifier,
- unsigned texture,
- unsigned format)
+ enum tgsi_texture_type texture,
+ enum pipe_format format)
 {
union tgsi_any_token *out, *insn;
 
@@ -1478,8 +1478,8 @@ ureg_memory_insn(struct ureg_program *ureg,
  const struct ureg_src *src,
  unsigned nr_src,
  unsigned qualifier,
- unsigned texture,
- unsigned format)
+ enum tgsi_texture_type texture,
+ enum pipe_format format)
 {
struct ureg_emit_insn_result insn;
unsigned i;
@@ -1719,7 +1719,7 @@ static void
 emit_decl_image(struct ureg_program *ureg,
 unsigned index,
 enum tgsi_texture_type target,
-unsigned format,
+enum pipe_format format,
 boolean wr,
 boolean raw)
 {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 7eef94a65e..ac46da5508 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -372,7 +372,7 @@ struct ureg_src
 ureg_DECL_image(struct ureg_program *ureg,
 unsigned index,
 enum tgsi_texture_type target,
-unsigned format,
+enum pipe_format format,
 boolean wr,
 boolean raw);
 
@@ -579,8 +579,8 @@ ureg_memory_insn(struct ureg_program *ureg,
  const struct ureg_src *src,
  unsigned nr_src,
  unsigned qualifier,
- unsigned texture,
- unsigned format);
+ enum tgsi_texture_type texture,
+ enum pipe_format format);
 
 /***
  * Internal instruction helpers, don't call these directly:
@@ -619,8 +619,8 @@ void
 ureg_emit_memory(struct ureg_program *ureg,
  unsigned insn_token,
  unsigned qualifier,
- unsigned texture,
- unsigned format);
+ enum tgsi_texture_type texture,
+ enum pipe_format format);
 
 void 
 ureg_emit_dst( struct ureg_program *ureg,

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


Mesa (master): st/mesa: add support for nvidia conservative rasterization extensions

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 97f5f399ef79d72dc7bb6e7fe7b35c10b9000855
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=97f5f399ef79d72dc7bb6e7fe7b35c10b9000855

Author: Rhys Perry 
Date:   Fri Apr 27 08:43:00 2018 -0600

st/mesa: add support for nvidia conservative rasterization extensions

Signed-off-by: Rhys Perry 
Reviewed-by: Brian Paul 

---

 src/mesa/state_tracker/st_atom_rasterizer.c | 15 +
 src/mesa/state_tracker/st_context.c |  2 ++
 src/mesa/state_tracker/st_extensions.c  | 34 +
 3 files changed, 51 insertions(+)

diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c 
b/src/mesa/state_tracker/st_atom_rasterizer.c
index 1be072e6e3..0383b8ac4a 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -298,5 +298,20 @@ st_update_rasterizer(struct st_context *st)
raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled;
raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE);
 
+/* ST_NEW_RASTERIZER */
+   if (ctx->ConservativeRasterization) {
+  if (ctx->ConservativeRasterMode == 
GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV)
+ raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_POST_SNAP;
+  else
+ raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_PRE_SNAP;
+   } else {
+  raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_OFF;
+   }
+
+   raster->conservative_raster_dilate = ctx->ConservativeRasterDilate;
+
+   raster->subpixel_precision_x = ctx->SubpixelPrecisionBias[0];
+   raster->subpixel_precision_y = ctx->SubpixelPrecisionBias[1];
+
cso_set_rasterizer(st->cso_context, raster);
 }
diff --git a/src/mesa/state_tracker/st_context.c 
b/src/mesa/state_tracker/st_context.c
index b0266bef8b..ee76e07a7d 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -344,6 +344,8 @@ st_init_driver_flags(struct st_context *st)
f->NewPolygonState = ST_NEW_RASTERIZER;
f->NewPolygonStipple = ST_NEW_POLY_STIPPLE;
f->NewViewport = ST_NEW_VIEWPORT;
+   f->NewNvConservativeRasterization = ST_NEW_RASTERIZER;
+   f->NewNvConservativeRasterizationParams = ST_NEW_RASTERIZER;
 }
 
 
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 0dc8adb262..5479e637af 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -494,6 +494,16 @@ void st_init_limits(struct pipe_screen *screen,
c->UseSTD430AsDefaultPacking =
   screen->get_param(screen, PIPE_CAP_LOAD_CONSTBUF);
 
+   c->MaxSubpixelPrecisionBiasBits =
+  screen->get_param(screen, 
PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS);
+
+   c->ConservativeRasterDilateRange[0] =
+  screen->get_paramf(screen, PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE);
+   c->ConservativeRasterDilateRange[1] =
+  screen->get_paramf(screen, PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE);
+   c->ConservativeRasterDilateGranularity =
+  screen->get_paramf(screen, 
PIPE_CAPF_CONSERVATIVE_RASTER_DILATE_GRANULARITY);
+
/* limit the max combined shader output resources to a driver limit */
temp = screen->get_param(screen, 
PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES);
if (temp > 0 && c->MaxCombinedShaderOutputResources > temp)
@@ -1364,4 +1374,28 @@ void st_init_extensions(struct pipe_screen *screen,
   extensions->ARB_texture_cube_map_array &&
   extensions->ARB_texture_stencil8 &&
   extensions->ARB_texture_multisample;
+
+   if (screen->get_param(screen, 
PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES) &&
+   screen->get_param(screen, 
PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES) &&
+   screen->get_param(screen, 
PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE)) {
+  float max_dilate;
+  bool pre_snap_triangles, pre_snap_points_lines;
+
+  max_dilate = screen->get_paramf(screen, 
PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE);
+
+  pre_snap_triangles =
+ screen->get_param(screen, 
PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES);
+  pre_snap_points_lines =
+ screen->get_param(screen, 
PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES);
+
+  extensions->NV_conservative_raster =
+ screen->get_param(screen, 
PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS) > 1;
+
+  if (extensions->NV_conservative_raster) {
+ extensions->NV_conservative_raster_dilate = max_dilate >= 0.75;
+ extensions->NV_conservative_raster_pre_snap_triangles = 
pre_snap_triangles;
+ extensions->NV_conservative_raster_pre_snap =
+pre_snap_triangles && pre_snap_points_lines;
+  }
+   }
 }

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


Mesa (master): mesa: remove unused 'i' in dimensions_error_check()

2018-04-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: bf67fec2355ed6f44cfb26a66763c7e1d6f5baa2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf67fec2355ed6f44cfb26a66763c7e1d6f5baa2

Author: Brian Paul 
Date:   Fri Apr 13 15:31:20 2018 -0600

mesa: remove unused 'i' in dimensions_error_check()

Reviewed-by: Charmaine Lee 
Reviewed-by: Marek Olšák 

---

 src/mesa/main/texgetimage.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 69521c5dd0..0ab9ed445d 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -913,7 +913,6 @@ dimensions_error_check(struct gl_context *ctx,
const char *caller)
 {
const struct gl_texture_image *texImage;
-   int i;
 
if (xoffset < 0) {
   _mesa_error(ctx, GL_INVALID_VALUE, "%s(xoffset = %d)", caller, xoffset);

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


Mesa (master): gallium/osmesa: link with winsock2 library on Windows

2018-04-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6a519a157b5fe5d449444c04a0429e8a24546e9c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a519a157b5fe5d449444c04a0429e8a24546e9c

Author: Brian Paul 
Date:   Fri Apr 13 15:34:23 2018 -0600

gallium/osmesa: link with winsock2 library on Windows

To fix the MSVC build.  The build broke because we started to compile
the ddebug code on Windows after the mtypes.h changes.  Building ddebug
caused us to also use the u_network.c code for the first time.

Reviewed-by: Charmaine Lee 

---

 src/gallium/targets/osmesa/SConscript | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/targets/osmesa/SConscript 
b/src/gallium/targets/osmesa/SConscript
index f49f1fe538..3df5c50097 100644
--- a/src/gallium/targets/osmesa/SConscript
+++ b/src/gallium/targets/osmesa/SConscript
@@ -39,6 +39,9 @@ if env['platform'] == 'windows':
 sources += ['osmesa.mingw.def']
 else:
 sources += ['osmesa.def']
+# Link with winsock2 library
+env.Append(LIBS = ['ws2_32'])
+
 
 gallium_osmesa = env.SharedLibrary(
 target ='osmesa',

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


Mesa (master): ddebug: add PIPE_OS_UNIX/LINUX checks to fix MSVC build

2018-04-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 65d1040435005ea01c9e18d00f937d9be0a90839
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=65d1040435005ea01c9e18d00f937d9be0a90839

Author: Brian Paul 
Date:   Fri Apr 13 15:32:48 2018 -0600

ddebug: add PIPE_OS_UNIX/LINUX checks to fix MSVC build

Don't include Unix headers or use Unix functions when building with MSVC.

Reviewed-by: Marek Olšák 
Reviewed-by: Charmaine Lee 

---

 src/gallium/auxiliary/driver_ddebug/dd_draw.c | 5 +
 src/gallium/auxiliary/driver_ddebug/dd_util.h | 9 +++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/driver_ddebug/dd_draw.c 
b/src/gallium/auxiliary/driver_ddebug/dd_draw.c
index c404ea0607..cb5db8ab83 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_draw.c
+++ b/src/gallium/auxiliary/driver_ddebug/dd_draw.c
@@ -37,6 +37,7 @@
 #include "tgsi/tgsi_scan.h"
 #include "util/os_time.h"
 #include 
+#include "pipe/p_config.h"
 
 
 static void
@@ -69,6 +70,7 @@ dd_get_file_stream(struct dd_screen *dscreen, unsigned 
apitrace_call_number)
 static void
 dd_dump_dmesg(FILE *f)
 {
+#ifdef PIPE_OS_LINUX
char line[2000];
FILE *p = popen("dmesg | tail -n60", "r");
 
@@ -80,6 +82,7 @@ dd_dump_dmesg(FILE *f)
   fputs(line, f);
 
pclose(p);
+#endif
 }
 
 static unsigned
@@ -611,7 +614,9 @@ dd_dump_call(FILE *f, struct dd_draw_state *state, struct 
dd_call *call)
 static void
 dd_kill_process(void)
 {
+#ifdef PIPE_OS_UNIX
sync();
+#endif
fprintf(stderr, "dd: Aborting the process...\n");
fflush(stdout);
fflush(stderr);
diff --git a/src/gallium/auxiliary/driver_ddebug/dd_util.h 
b/src/gallium/auxiliary/driver_ddebug/dd_util.h
index bdfb7cc916..8953e34d58 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_util.h
+++ b/src/gallium/auxiliary/driver_ddebug/dd_util.h
@@ -30,14 +30,19 @@
 
 #include 
 #include 
-#include 
-#include 
 
 #include "c99_alloca.h"
 #include "os/os_process.h"
 #include "util/u_atomic.h"
 #include "util/u_debug.h"
 
+#include "pipe/p_config.h"
+#ifdef PIPE_OS_UNIX
+#include 
+#include 
+#endif
+
+
 /* name of the directory in home */
 #define DD_DIR "ddebug_dumps"
 

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


Mesa (master): mesa: protect #include of unistd.h with _MSV_VER check

2018-04-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6d41edbf8a352bd8c5e13a6e15073fb3a6e0e79e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d41edbf8a352bd8c5e13a6e15073fb3a6e0e79e

Author: Brian Paul 
Date:   Fri Apr 13 15:31:49 2018 -0600

mesa: protect #include of unistd.h with _MSV_VER check

unistd.h is unix only.

Reviewed-by: Marek Olšák 
Reviewed-by: Charmaine Lee 

---

 src/mesa/program/program_lexer.l | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/program/program_lexer.l b/src/mesa/program/program_lexer.l
index 13eb902514..c4973fd279 100644
--- a/src/mesa/program/program_lexer.l
+++ b/src/mesa/program/program_lexer.l
@@ -21,7 +21,11 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
+
+#ifndef _MSC_VER
 #include 
+#endif
+
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "program/prog_instruction.h"

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


Mesa (master): gallium/util: put (void) in a few function signatures

2018-04-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 201c08c463f95e4906ef9858597d17867b293fd4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=201c08c463f95e4906ef9858597d17867b293fd4

Author: Brian Paul 
Date:   Fri Apr 13 15:33:39 2018 -0600

gallium/util: put (void) in a few function signatures

To match the header file.

Reviewed-by: Marek Olšák 
Reviewed-by: Charmaine Lee 

---

 src/gallium/auxiliary/util/u_network.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_network.c 
b/src/gallium/auxiliary/util/u_network.c
index e74293bb10..89395f54ea 100644
--- a/src/gallium/auxiliary/util/u_network.c
+++ b/src/gallium/auxiliary/util/u_network.c
@@ -20,7 +20,7 @@
 #endif
 
 boolean
-u_socket_init()
+u_socket_init(void)
 {
 #if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
WORD wVersionRequested;
@@ -44,7 +44,7 @@ u_socket_init()
 }
 
 void
-u_socket_stop()
+u_socket_stop(void)
 {
 #if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
WSACleanup();

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


Mesa (master): glsl: #undef THIS macro to fix MSVC build

2018-04-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1098c18af3f432968be9c46a2be0ff7f420060d7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1098c18af3f432968be9c46a2be0ff7f420060d7

Author: Brian Paul 
Date:   Fri Apr 13 09:56:33 2018 -0600

glsl: #undef THIS macro to fix MSVC build

THIS is a macro in one of the MSVC header files.  It's also a token
in the GLSL lexer.  This causes a compilation failure with MSVC.
This issue seems to be newly exposed after the recent mtypes.h removal
patches.

Reviewed-by: Charmaine Lee 
Reviewed-by: Neha Bhende 

---

 src/compiler/glsl/glsl_parser_extras.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/compiler/glsl/glsl_parser_extras.h 
b/src/compiler/glsl/glsl_parser_extras.h
index 66bd1a3db6..5b9b6cc862 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -33,6 +33,11 @@
 #include 
 #include "glsl_symbol_table.h"
 
+/* THIS is a macro defined somewhere deep in the Windows MSVC header files.
+ * Undefine it here to avoid collision with the lexer's THIS token.
+ */
+#undef THIS
+
 struct gl_context;
 
 struct glsl_switch_state {

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


Mesa (master): glsl: rename 'interface' var to 'iface' to fix MSVC build

2018-04-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 5dc7233f444a84f6317509e690c861a87562775e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5dc7233f444a84f6317509e690c861a87562775e

Author: Brian Paul 
Date:   Fri Apr 13 09:38:16 2018 -0600

glsl: rename 'interface' var to 'iface' to fix MSVC build

The recent mtypes.h removal patches seems to have exposed a MSVC
issue where 'interface' is defined as a macro in an MSVC header file.

Reviewed-by: Charmaine Lee 
Reviewed-by: Neha Bhende 

---

 src/compiler/glsl/linker.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index ecd267b24f..f060c5316f 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4201,7 +4201,7 @@ get_array_size(struct gl_uniform_storage *uni, const 
glsl_struct_field *field,
 
 static int
 get_array_stride(struct gl_context *ctx, struct gl_uniform_storage *uni,
- const glsl_type *interface, const glsl_struct_field *field,
+ const glsl_type *iface, const glsl_struct_field *field,
  char *interface_name, char *var_name)
 {
/* The ARB_program_interface_query spec says:
@@ -4227,7 +4227,7 @@ get_array_stride(struct gl_context *ctx, struct 
gl_uniform_storage *uni,
  return 0;
 
   if (GLSL_INTERFACE_PACKING_STD140 ==
-  interface->
+  iface->
  get_internal_ifc_packing(ctx->Const.UseSTD430AsDefaultPacking)) {
  if (array_type->is_record() || array_type->is_array())
 return glsl_align(array_type->std140_size(row_major), 16);
@@ -4281,17 +4281,17 @@ calculate_array_size_and_stride(struct gl_context *ctx,
  var->data.mode != ir_var_shader_storage)
 continue;
 
- const glsl_type *interface = var->get_interface_type();
+ const glsl_type *iface = var->get_interface_type();
 
- if (strcmp(interface_name, interface->name) != 0)
+ if (strcmp(interface_name, iface->name) != 0)
 continue;
 
- for (unsigned i = 0; i < interface->length; i++) {
-const glsl_struct_field *field = &interface->fields.structure[i];
+ for (unsigned i = 0; i < iface->length; i++) {
+const glsl_struct_field *field = &iface->fields.structure[i];
 if (strcmp(field->name, var_name) != 0)
continue;
 
-array_stride = get_array_stride(ctx, uni, interface, field,
+array_stride = get_array_stride(ctx, uni, iface, field,
 interface_name, var_name);
 array_size = get_array_size(uni, field, interface_name, var_name);
 goto write_top_level_array_size_and_stride;

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


Mesa (master): mesa: remove snprintf macro in imports.h to fix MSVC build

2018-04-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 73f1e33d34b2044f2252a73e0fdd827d39724505
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=73f1e33d34b2044f2252a73e0fdd827d39724505

Author: Brian Paul 
Date:   Fri Apr 13 09:32:31 2018 -0600

mesa: remove snprintf macro in imports.h to fix MSVC build

snprintf is a macro in the MSVC stdio.h header and we needed to
include that header before imports.h where we also defined an
snprintf macro.  Otherwise, the MSVC build would fail.  The recent
mtypes.h removal patches seems to have exposed this issue.

This patch simply removes our snprintf macro and replaces one use
of it in teximage.c with _mesa_snprintf().  There are other calls
to snprintf() in DRI drivers, but none of them are built on Windows.

Reviewed-by: Charmaine Lee 
Reviewed-by: Neha Bhende 

---

 src/mesa/main/imports.h  | 4 
 src/mesa/main/teximage.c | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 72ce8783dd..a761f01851 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -339,10 +339,6 @@ extern int
 _mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list arg);
 
 
-#if defined(_MSC_VER) && !defined(snprintf)
-#define snprintf _snprintf
-#endif
-
 #if defined(_WIN32) && !defined(strtok_r)
 #define strtok_r strtok_s
 #endif
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 8d5f8aa545..5284e60b20 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1911,7 +1911,7 @@ texture_error_check( struct gl_context *ctx,
 * requires GL_OES_texture_float) are filtered elsewhere.
 */
char bufCallerName[20];
-   snprintf(bufCallerName, 20, "glTexImage%dD", dimensions);
+   _mesa_snprintf(bufCallerName, 20, "glTexImage%dD", dimensions);
if (_mesa_is_gles(ctx) &&
texture_format_error_check_gles(ctx, format, type,
internalFormat, bufCallerName)) {

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


Mesa (master): nir: Fix a typo in src/compiler/Makefile.nir.am

2018-04-09 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 42c2f5b579caf487069daca85a3fd77f9fd00304
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=42c2f5b579caf487069daca85a3fd77f9fd00304

Author: Bastien Orivel 
Date:   Fri Apr  6 10:28:00 2018 -0600

nir: Fix a typo in src/compiler/Makefile.nir.am

Since 31d91f019b58ca362c05db1fd0c75fedd169cd7b, the makefile tries to
find the file SConstript.spirv instead of SConscript.spirv which breaks
the make dist command.

Reviewed-by: Brian Paul 

---

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

diff --git a/src/compiler/Makefile.nir.am b/src/compiler/Makefile.nir.am
index 27dc129e57..4ccd7f36be 100644
--- a/src/compiler/Makefile.nir.am
+++ b/src/compiler/Makefile.nir.am
@@ -101,4 +101,4 @@ EXTRA_DIST += \
nir/tests \
nir/README \
SConscript.nir \
-   SConstript.spirv
+   SConscript.spirv

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


Mesa (master): st/wgl: check if WGL_SWAP_INTERVAL is defined in wglSwapIntervalEXT()

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

Author: Brian Paul 
Date:   Fri Mar 30 14:44:50 2018 -0600

st/wgl: check if WGL_SWAP_INTERVAL is defined in wglSwapIntervalEXT()

This allows the WGL_SWAP_INTERVAL env var to override any application
calls to wglSwapIntervalEXT().  Useful for debugging, or to set the
interval to zero to effectively disable the swap interval.

Note: we also rename the previous instance of SVGA_SWAP_INTERVAL to
WGL_SWAP_INTERVAL since this is a WGL feature and not related to the
svga driver.

Reviewed-by: Charmaine Lee 

---

 src/gallium/state_trackers/wgl/stw_device.c   | 2 +-
 src/gallium/state_trackers/wgl/stw_ext_swapinterval.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/stw_device.c 
b/src/gallium/state_trackers/wgl/stw_device.c
index b88e1100eb..e43f12f7f2 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -135,7 +135,7 @@ stw_init(const struct stw_winsys *stw_winsys)
stw_pixelformat_init();
 
/* env var override for WGL_EXT_swap_control, useful for testing/debugging 
*/
-   const char *s = os_get_option("SVGA_SWAP_INTERVAL");
+   const char *s = os_get_option("WGL_SWAP_INTERVAL");
if (s) {
   stw_dev->swap_interval = atoi(s);
}
diff --git a/src/gallium/state_trackers/wgl/stw_ext_swapinterval.c 
b/src/gallium/state_trackers/wgl/stw_ext_swapinterval.c
index b2074a73fb..3b913e7db9 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_swapinterval.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_swapinterval.c
@@ -48,7 +48,7 @@ wglSwapIntervalEXT(int interval)
   SetLastError(ERROR_INVALID_DATA);
   return FALSE;
}
-   if (stw_dev) {
+   if (stw_dev && !os_get_option("WGL_SWAP_INTERVAL")) {
   stw_dev->swap_interval = interval;
}
return TRUE;

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


Mesa (master): docs: document WGL_SWAP_INTERVAL env var

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

Author: Brian Paul 
Date:   Tue Mar 27 12:39:05 2018 -0600

docs: document WGL_SWAP_INTERVAL env var

Reviewed-by: Charmaine Lee 

---

 docs/envvars.html | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/docs/envvars.html b/docs/envvars.html
index a08f5b9402..08c259cc7b 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -323,6 +323,12 @@ such as the OpenGL program's name and command line 
arguments.
 See the driver code for other, lesser-used variables.
 
 
+WGL environment variables
+
+WGL_SWAP_INTERVAL - to set a swap interval, equivalent to calling
+wglSwapIntervalEXT() in an application.  If this environment variable
+is set, application calls to wglSwapIntervalEXT() will have no effect.
+
 
 VA-API state tracker environment variables
 

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


Mesa (master): glapi: define GL_API to be KEYWORD1 in glapi_dispatch.c (v2)

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

Author: Brian Paul 
Date:   Tue Mar 27 12:56:49 2018 -0600

glapi: define GL_API to be KEYWORD1 in glapi_dispatch.c (v2)

This fixes a Windows build warning where the prototypes for the ES
function in the header file don't match the prototypes in this file
because the GL_API and GLAPI macros are defined differently.

v2: defined GL_API to KEYWORD1 instead of GLAPI, per Mathias.

Reviewed-by: Mathias Fröhlich 

---

 src/mapi/glapi/glapi_dispatch.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c
index 323952366d..ca15449ed0 100644
--- a/src/mapi/glapi/glapi_dispatch.c
+++ b/src/mapi/glapi/glapi_dispatch.c
@@ -97,6 +97,13 @@
  */
 #include 
 
+
+/* Redefine GL_API to avoid MSVC/MinGW warnings about different dllimport
+ * attributes for these prototypes vs those in the GLES/gl.h header.
+ */
+#undef GL_API
+#define GL_API KEYWORD1
+
 GL_API void GL_APIENTRY glClearDepthf (GLclampf depth);
 GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);
 GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat 
bottom, GLfloat top, GLfloat zNear, GLfloat zFar);

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


Mesa (master): nir/spirv: s/uint32_t/SpvOp/ in various functions

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

Author: Brian Paul 
Date:   Fri Mar 30 11:10:11 2018 -0600

nir/spirv: s/uint32_t/SpvOp/ in various functions

The MSVC compiler warns when the function parameter types don't
exactly match with respect to enum vs. uint32_t.  Use SpvOp everywhere.

Alternately, uint32_t could be used everywhere.  There doesn't seem
to be an advantage to one over the other.

Reviewed-by: Neil Roberts 

---

 src/compiler/spirv/vtn_amd.c | 4 ++--
 src/compiler/spirv/vtn_glsl450.c | 2 +-
 src/compiler/spirv/vtn_private.h | 8 
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/compiler/spirv/vtn_amd.c b/src/compiler/spirv/vtn_amd.c
index 320e3b0586..0d5b429783 100644
--- a/src/compiler/spirv/vtn_amd.c
+++ b/src/compiler/spirv/vtn_amd.c
@@ -27,7 +27,7 @@
 #include "GLSL.ext.AMD.h"
 
 bool
-vtn_handle_amd_gcn_shader_instruction(struct vtn_builder *b, uint32_t 
ext_opcode,
+vtn_handle_amd_gcn_shader_instruction(struct vtn_builder *b, SpvOp ext_opcode,
   const uint32_t *w, unsigned count)
 {
const struct glsl_type *dest_type =
@@ -57,7 +57,7 @@ vtn_handle_amd_gcn_shader_instruction(struct vtn_builder *b, 
uint32_t ext_opcode
 }
 
 bool
-vtn_handle_amd_shader_trinary_minmax_instruction(struct vtn_builder *b, 
uint32_t ext_opcode,
+vtn_handle_amd_shader_trinary_minmax_instruction(struct vtn_builder *b, SpvOp 
ext_opcode,
  const uint32_t *w, unsigned 
count)
 {
struct nir_builder *nb = &b->nb;
diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c
index eb0b90f797..d208215ccb 100644
--- a/src/compiler/spirv/vtn_glsl450.c
+++ b/src/compiler/spirv/vtn_glsl450.c
@@ -810,7 +810,7 @@ handle_glsl450_interpolation(struct vtn_builder *b, enum 
GLSLstd450 opcode,
 }
 
 bool
-vtn_handle_glsl450_instruction(struct vtn_builder *b, uint32_t ext_opcode,
+vtn_handle_glsl450_instruction(struct vtn_builder *b, SpvOp ext_opcode,
const uint32_t *w, unsigned count)
 {
switch ((enum GLSLstd450)ext_opcode) {
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index 982b426e70..b501bbf9b4 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -230,7 +230,7 @@ struct vtn_function {
SpvFunctionControlMask control;
 };
 
-typedef bool (*vtn_instruction_handler)(struct vtn_builder *, uint32_t,
+typedef bool (*vtn_instruction_handler)(struct vtn_builder *, SpvOp,
 const uint32_t *, unsigned);
 
 void vtn_build_cfg(struct vtn_builder *b, const uint32_t *words,
@@ -718,7 +718,7 @@ void vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
 void vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
  const uint32_t *w, unsigned count);
 
-bool vtn_handle_glsl450_instruction(struct vtn_builder *b, uint32_t ext_opcode,
+bool vtn_handle_glsl450_instruction(struct vtn_builder *b, SpvOp ext_opcode,
 const uint32_t *words, unsigned count);
 
 struct vtn_builder* vtn_create_builder(const uint32_t *words, size_t 
word_count,
@@ -744,9 +744,9 @@ vtn_u64_literal(const uint32_t *w)
return (uint64_t)w[1] << 32 | w[0];
 }
 
-bool vtn_handle_amd_gcn_shader_instruction(struct vtn_builder *b, uint32_t 
ext_opcode,
+bool vtn_handle_amd_gcn_shader_instruction(struct vtn_builder *b, SpvOp 
ext_opcode,
const uint32_t *words, unsigned 
count);
 
-bool vtn_handle_amd_shader_trinary_minmax_instruction(struct vtn_builder *b, 
uint32_t ext_opcode,
+bool vtn_handle_amd_shader_trinary_minmax_instruction(struct vtn_builder *b, 
SpvOp ext_opcode,
  const uint32_t *words, 
unsigned count);
 #endif /* _VTN_PRIVATE_H_ */

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


Mesa (master): nir/spirv: move NORETURN annotation on _vtn_fail() prototype

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

Author: Brian Paul 
Date:   Fri Mar 30 11:07:46 2018 -0600

nir/spirv: move NORETURN annotation on _vtn_fail() prototype

This needs to before the function, not after, to compile with MSVC.
This works with gcc too.

Reviewed-by: Neil Roberts 

---

 src/compiler/spirv/vtn_private.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index 269de92225..982b426e70 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -71,8 +71,10 @@ void _vtn_warn(struct vtn_builder *b, const char *file, 
unsigned line,
  * So long as these two things continue to hold, we can easily longjmp back to
  * spirv_to_nir(), clean up the builder, and return NULL.
  */
-void _vtn_fail(struct vtn_builder *b, const char *file, unsigned line,
-   const char *fmt, ...) NORETURN PRINTFLIKE(4, 5);
+NORETURN void
+_vtn_fail(struct vtn_builder *b, const char *file, unsigned line,
+ const char *fmt, ...) PRINTFLIKE(4, 5);
+
 #define vtn_fail(...) _vtn_fail(b, __FILE__, __LINE__, __VA_ARGS__)
 
 /** Fail if the given expression evaluates to true */

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


Mesa (master): spirv: s/uint/unsigned/ to fix MSVC build

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

Author: Brian Paul 
Date:   Fri Mar 30 11:30:05 2018 -0600

spirv: s/uint/unsigned/ to fix MSVC build

Reviewed-by: Neil Roberts 

---

 src/compiler/spirv/vtn_cfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index 3d5de378ac..e7d2f9ea61 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -513,7 +513,7 @@ vtn_cfg_walk_blocks(struct vtn_builder *b, struct list_head 
*cf_list,
  "Selector of OpSelect must have a type of OpTypeInt");
 
  bool is_default = true;
- const uint bitsize = nir_alu_type_get_type_size(cond_type);
+ const unsigned bitsize = nir_alu_type_get_type_size(cond_type);
  for (const uint32_t *w = block->branch + 2; w < branch_end;) {
 uint64_t literal = 0;
 if (!is_default) {

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


Mesa (master): nir/spirv: fix MSVC syntax error in vtn_handle_texture()

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

Author: Brian Paul 
Date:   Fri Mar 30 11:09:07 2018 -0600

nir/spirv: fix MSVC syntax error in vtn_handle_texture()

Reviewed-by: Neil Roberts 

---

 src/compiler/spirv/spirv_to_nir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c 
b/src/compiler/spirv/spirv_to_nir.c
index 2550ef0a23..72ab426e80 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2086,8 +2086,9 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
  (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_offset);
 
   if (operands & SpvImageOperandsConstOffsetsMask) {
+ nir_tex_src none = {0};
  gather_offsets = vtn_ssa_value(b, w[idx++]);
- (*p++) = (nir_tex_src){};
+ (*p++) = none;
   }
 
   if (operands & SpvImageOperandsSampleMask) {

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


Mesa (master): nir/spirv: fix MSVC warning in vtn_align_u32()

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

Author: Brian Paul 
Date:   Fri Mar 30 11:06:50 2018 -0600

nir/spirv: fix MSVC warning in vtn_align_u32()

Fixes warning that "negation of an unsigned value results in an
unsigned value".

Reviewed-by: Neil Roberts 

---

 src/compiler/spirv/vtn_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index d8a00f99b9..269de92225 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -732,7 +732,7 @@ void vtn_handle_decoration(struct vtn_builder *b, SpvOp 
opcode,
 static inline uint32_t
 vtn_align_u32(uint32_t v, uint32_t a)
 {
-   assert(a != 0 && a == (a & -a));
+   assert(a != 0 && a == (a & -((int32_t) a)));
return (v + a - 1) & ~(a - 1);
 }
 

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


Mesa (master): spirv: Fix building with SCons

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

Author: Neil Roberts 
Date:   Fri Mar 30 09:12:00 2018 -0600

spirv: Fix building with SCons

The SCons build broke with commit ba975140d3c9 because a SPIR-V
function is called from Mesa main. This adds a convenience library for
SPIR-V and adds it to everything that was including nir. It also adds
both nir and spirv to drivers/x11/SConscript.

Also add nir/spirv modules to osmesa and libgl-gdi targets. (Brian Paul)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105817
Reviewed-by: Brian Paul 
Tested-by: Brian Paul 

---

 src/compiler/Makefile.nir.am  |  3 +-
 src/compiler/SConscript   |  1 +
 src/compiler/SConscript.spirv | 54 +++
 src/gallium/targets/dri/SConscript|  1 +
 src/gallium/targets/haiku-softpipe/SConscript |  1 +
 src/gallium/targets/libgl-gdi/SConscript  |  6 ++-
 src/gallium/targets/libgl-xlib/SConscript |  1 +
 src/gallium/targets/osmesa/SConscript |  1 +
 src/mesa/drivers/osmesa/SConscript|  2 +
 src/mesa/drivers/x11/SConscript   |  2 +
 10 files changed, 70 insertions(+), 2 deletions(-)

diff --git a/src/compiler/Makefile.nir.am b/src/compiler/Makefile.nir.am
index 32e4145b70..27dc129e57 100644
--- a/src/compiler/Makefile.nir.am
+++ b/src/compiler/Makefile.nir.am
@@ -100,4 +100,5 @@ EXTRA_DIST += \
nir/nir_opt_algebraic.py\
nir/tests \
nir/README \
-   SConscript.nir
+   SConscript.nir \
+   SConstript.spirv
diff --git a/src/compiler/SConscript b/src/compiler/SConscript
index 44509a9a95..0a0c073742 100644
--- a/src/compiler/SConscript
+++ b/src/compiler/SConscript
@@ -27,3 +27,4 @@ Export('compiler')
 
 SConscript('SConscript.glsl')
 SConscript('SConscript.nir')
+SConscript('SConscript.spirv')
diff --git a/src/compiler/SConscript.spirv b/src/compiler/SConscript.spirv
new file mode 100644
index 00..49410881d0
--- /dev/null
+++ b/src/compiler/SConscript.spirv
@@ -0,0 +1,54 @@
+import common
+
+Import('*')
+
+from sys import executable as python_cmd
+
+env = env.Clone()
+
+env.MSVC2013Compat()
+
+env.Prepend(CPPPATH = [
+'#include',
+'#src',
+'#src/mapi',
+'#src/mesa',
+'#src/gallium/include',
+'#src/gallium/auxiliary',
+'#src/compiler/nir',
+'#src/compiler/spirv',
+])
+
+# Make generated headers reachable from the include path.
+env.Prepend(CPPPATH = [Dir('.').abspath, Dir('nir').abspath])
+env.Prepend(CPPPATH = [Dir('.').abspath, Dir('spirv').abspath])
+
+# spirv generated sources
+
+env.CodeGenerate(
+target = 'spirv/spirv_info.c',
+script = 'spirv/spirv_info_c.py',
+source = ['spirv/spirv.core.grammar.json'],
+command = python_cmd + ' $SCRIPT $SOURCE $TARGET'
+)
+
+env.CodeGenerate(
+target = 'spirv/vtn_gather_types.c',
+script = 'spirv/vtn_gather_types_c.py',
+source = ['spirv/spirv.core.grammar.json'],
+command = python_cmd + ' $SCRIPT $SOURCE $TARGET'
+)
+
+# parse Makefile.sources
+source_lists = env.ParseSourceList('Makefile.sources')
+
+spirv_sources = source_lists['SPIRV_FILES']
+spirv_sources += source_lists['SPIRV_GENERATED_FILES']
+
+spirv = env.ConvenienceLibrary(
+target = 'spirv',
+source = spirv_sources,
+)
+
+env.Alias('spirv', spirv)
+Export('spirv')
diff --git a/src/gallium/targets/dri/SConscript 
b/src/gallium/targets/dri/SConscript
index f5c2818d04..ff6ce3bf4e 100644
--- a/src/gallium/targets/dri/SConscript
+++ b/src/gallium/targets/dri/SConscript
@@ -45,6 +45,7 @@ env.Prepend(LIBS = [
 mesa,
 glsl,
 nir,
+spirv,
 gallium,
 megadrivers_stub,
 dri_common,
diff --git a/src/gallium/targets/haiku-softpipe/SConscript 
b/src/gallium/targets/haiku-softpipe/SConscript
index f80c167d83..89792fba13 100644
--- a/src/gallium/targets/haiku-softpipe/SConscript
+++ b/src/gallium/targets/haiku-softpipe/SConscript
@@ -10,6 +10,7 @@ env.Prepend(LIBS = [
 mesa,
 glsl,
 nir,
+spirv,
 gallium
 ])
 
diff --git a/src/gallium/targets/libgl-gdi/SConscript 
b/src/gallium/targets/libgl-gdi/SConscript
index d3251caec5..b5ba0fabcd 100644
--- a/src/gallium/targets/libgl-gdi/SConscript
+++ b/src/gallium/targets/libgl-gdi/SConscript
@@ -18,7 +18,11 @@ env.Append(LIBS = [
 'ws2_32',
 ])
 
-env.Prepend(LIBS = [mesautil])
+env.Prepend(LIBS = [
+mesautil,
+nir,
+spirv
+])
 
 sources = ['libgl_gdi.c']
 drivers = []
diff --git a/src/gallium/targets/libgl-xlib/SConscript 
b/

Mesa (master): st/mesa: add missing GLSL_TYPE_[U]INT8 cases in st_glsl_type_dword_size()

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

Author: Brian Paul 
Date:   Wed Mar 28 19:38:00 2018 -0600

st/mesa: add missing GLSL_TYPE_[U]INT8 cases in st_glsl_type_dword_size()

Silences a compiler warning about unhandled enum switch cases.

Reviewed-by: Mathias Fröhlich 

---

 src/mesa/state_tracker/st_glsl_types.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/state_tracker/st_glsl_types.cpp 
b/src/mesa/state_tracker/st_glsl_types.cpp
index baba2d414b..42d4e9cef2 100644
--- a/src/mesa/state_tracker/st_glsl_types.cpp
+++ b/src/mesa/state_tracker/st_glsl_types.cpp
@@ -124,6 +124,9 @@ st_glsl_type_dword_size(const struct glsl_type *type)
case GLSL_TYPE_INT16:
case GLSL_TYPE_FLOAT16:
   return DIV_ROUND_UP(type->components(), 2);
+   case GLSL_TYPE_UINT8:
+   case GLSL_TYPE_INT8:
+  return DIV_ROUND_UP(type->components(), 4);
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:

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


Mesa (master): mesa: fix MSVC bitshift overflow warnings

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

Author: Brian Paul 
Date:   Fri Mar 30 09:06:01 2018 -0600

mesa: fix MSVC bitshift overflow warnings

In the BITFIELD_MASK() macro, if b==32 the expression evaluates to
~0u, but the compiler still sees the expression (1 << 32) in the
unused part and issues a warning about integer bitshift overflow.

Fix that by using (b) % 32 to ensure the max shift is 31 bits.

This issue has been present for a while, but shows up much more
often because of the recent VBO changes.

Reviewed-by: Mathias Fröhlich 
Reviewed-by: Roland Scheidegger 

---

 src/mesa/main/mtypes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 801bd17666..b7a7b34a09 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -59,7 +59,7 @@ extern "C" {
 #define BITFIELD_BIT(b)  ((GLbitfield)1 << (b))
 /** Set all bits up to excluding bit b */
 #define BITFIELD_MASK(b)  \
-   ((b) == 32 ? (~(GLbitfield)0) : BITFIELD_BIT(b) - 1)
+   ((b) == 32 ? (~(GLbitfield)0) : BITFIELD_BIT((b) % 32) - 1)
 /** Set count bits starting from bit b  */
 #define BITFIELD_RANGE(b, count) \
(BITFIELD_MASK((b) + (count)) & ~BITFIELD_MASK(b))

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


Mesa (master): nir: s/uint/unsigned/ to fix MSVC/MinGW build

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

Author: Brian Paul 
Date:   Thu Mar 29 22:02:37 2018 -0600

nir: s/uint/unsigned/ to fix MSVC/MinGW build

Reviewed-by: Roland Scheidegger 
Reviewed-by: Neha Bhende 

---

 src/compiler/glsl/glsl_to_nir.cpp  | 2 +-
 src/compiler/nir/nir_gather_info.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp 
b/src/compiler/glsl/glsl_to_nir.cpp
index c4a6d52a5b..dbb58d82e8 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -369,7 +369,7 @@ nir_visitor::visit(ir_variable *ir)
   /* Mark all the locations that require two slots */
   if (shader->info.stage == MESA_SHADER_VERTEX &&
   glsl_type_is_dual_slot(glsl_without_array(var->type))) {
- for (uint i = 0; i < glsl_count_attribute_slots(var->type, true); 
i++) {
+ for (unsigned i = 0; i < glsl_count_attribute_slots(var->type, true); 
i++) {
 uint64_t bitfield = BITFIELD64_BIT(var->data.location + i);
 shader->info.vs.double_inputs |= bitfield;
  }
diff --git a/src/compiler/nir/nir_gather_info.c 
b/src/compiler/nir/nir_gather_info.c
index 743f968035..5530009255 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -250,7 +250,7 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, 
nir_shader *shader)
  if (shader->info.stage == MESA_SHADER_VERTEX &&
  var->data.mode == nir_var_shader_in &&
  glsl_type_is_dual_slot(glsl_without_array(var->type))) {
-for (uint i = 0; i < glsl_count_attribute_slots(var->type, false); 
i++) {
+for (unsigned i = 0; i < glsl_count_attribute_slots(var->type, 
false); i++) {
int idx = var->data.location + i;
shader->info.vs.double_inputs |= BITFIELD64_BIT(idx);
 }

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


Mesa (master): gl.h: remove stale comment, trailing whitespace

2018-03-29 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e520ca562a410d3dc3708515b44ca09a50c59830
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e520ca562a410d3dc3708515b44ca09a50c59830

Author: Brian Paul 
Date:   Tue Mar 27 12:56:19 2018 -0600

gl.h: remove stale comment, trailing whitespace

Reviewed-by: Emil Velikov 

---

 include/GL/gl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/GL/gl.h b/include/GL/gl.h
index 5b28480288..f5bac3670a 100644
--- a/include/GL/gl.h
+++ b/include/GL/gl.h
@@ -47,9 +47,9 @@
 #define GLAPI __declspec(dllimport)
 #  else /* for use with static link lib build of Win32 edition only */
 #define GLAPI extern
-#  endif /* _STATIC_MESA support */
+#  endif
 #  if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE)  /* 
The generated DLLs by MingW with STDCALL are not compatible with the ones done 
by Microsoft's compilers */
-#define GLAPIENTRY 
+#define GLAPIENTRY
 #  else
 #define GLAPIENTRY __stdcall
 #  endif

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


Mesa (master): glapi: add glBlendBarrier(), glPrimitiveBoundingBox() prototypes

2018-03-29 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4ff6a7b0de47b1f4037068497281aa824ddb914a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4ff6a7b0de47b1f4037068497281aa824ddb914a

Author: Brian Paul 
Date:   Mon Mar 26 16:47:46 2018 -0600

glapi: add glBlendBarrier(), glPrimitiveBoundingBox() prototypes

in glapi_dispatch.c, as we have for many other GLES functions.
Fixes a cross-compile issue (missing prototype) when GLES support
is disabled.

Reviewed-by: Sinclair Yeh 

---

 src/mapi/glapi/glapi_dispatch.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c
index 269adc7ea0..323952366d 100644
--- a/src/mapi/glapi/glapi_dispatch.c
+++ b/src/mapi/glapi/glapi_dispatch.c
@@ -143,6 +143,8 @@ GL_API void GL_APIENTRY glTexParameterx (GLenum target, 
GLenum pname, GLfixed pa
 GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const 
GLfixed *params);
 GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
 GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, 
const GLvoid *pointer);
+GL_API void GL_APIENTRY glBlendBarrier (void);
+GL_API void GL_APIENTRY glPrimitiveBoundingBox (GLfloat minX, GLfloat minY, 
GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat 
maxW);
 
 /* Enable frame pointer elimination on Windows, otherwise forgetting to add
  * APIENTRY to _mesa_* entrypoints will not cause crashes on debug builds, as

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


Mesa (master): st/mesa: silence unhandled switch case warning

2018-03-29 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 5cd5878a1f8cbd2d878f0941d86f33530950acb4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5cd5878a1f8cbd2d878f0941d86f33530950acb4

Author: Brian Paul 
Date:   Thu Mar 22 09:23:09 2018 -0600

st/mesa: silence unhandled switch case warning

And improve the unreachable() error message.

Reviewed-by: Mathias Fröhlich 

---

 src/mesa/state_tracker/st_glsl_types.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_glsl_types.cpp 
b/src/mesa/state_tracker/st_glsl_types.cpp
index ef7b7fa777..baba2d414b 100644
--- a/src/mesa/state_tracker/st_glsl_types.cpp
+++ b/src/mesa/state_tracker/st_glsl_types.cpp
@@ -146,7 +146,8 @@ st_glsl_type_dword_size(const struct glsl_type *type)
case GLSL_TYPE_ERROR:
case GLSL_TYPE_INTERFACE:
case GLSL_TYPE_FUNCTION:
-  unreachable("not reached");
+   default:
+  unreachable("invalid type in st_glsl_type_dword_size()");
}
 
return 0;

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


Mesa (master): mesa/st/tests: Use tgsi opcode enum also in the test classes

2018-03-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: a21da49e5c55f8e61253503d865cef936125ea5f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a21da49e5c55f8e61253503d865cef936125ea5f

Author: Gert Wollny 
Date:   Mon Mar 26 02:17:00 2018 -0600

mesa/st/tests: Use tgsi opcode enum also in the test classes

Fixes: ec478cf9c31K ("st/mesa,tgsi: use enum tgsi_opcode")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105737
Signed-off-by: Gert Wollny 
Reviewed-by: Brian Paul 

---

 src/mesa/state_tracker/tests/st_tests_common.cpp |  6 +++---
 src/mesa/state_tracker/tests/st_tests_common.h   | 10 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/mesa/state_tracker/tests/st_tests_common.cpp 
b/src/mesa/state_tracker/tests/st_tests_common.cpp
index ea01ca..63e3d6b2c4 100644
--- a/src/mesa/state_tracker/tests/st_tests_common.cpp
+++ b/src/mesa/state_tracker/tests/st_tests_common.cpp
@@ -43,7 +43,7 @@ using std::tuple;
 /* Implementation of helper and test classes */
 void *FakeCodeline::mem_ctx = nullptr;
 
-FakeCodeline::FakeCodeline(unsigned _op, const vector& _dst,
+FakeCodeline::FakeCodeline(tgsi_opcode _op, const vector& _dst,
const vector& _src, const vector&_to):
op(_op),
max_temp_id(0)
@@ -59,7 +59,7 @@ FakeCodeline::FakeCodeline(unsigned _op, const vector& 
_dst,
 
 }
 
-FakeCodeline::FakeCodeline(unsigned _op, const vector>& _dst,
+FakeCodeline::FakeCodeline(tgsi_opcode _op, const vector>& _dst,
const vector>& _src,
const vector>&_to,
SWZ with_swizzle):
@@ -84,7 +84,7 @@ FakeCodeline::FakeCodeline(unsigned _op, const 
vector>& _dst,
});
 }
 
-FakeCodeline::FakeCodeline(unsigned _op, const vector>& 
_dst,
+FakeCodeline::FakeCodeline(tgsi_opcode _op, const vector>& 
_dst,
const vector>& _src,
const vector>&_to, RA 
with_reladdr):
op(_op),
diff --git a/src/mesa/state_tracker/tests/st_tests_common.h 
b/src/mesa/state_tracker/tests/st_tests_common.h
index 2e18832923..6d855fe581 100644
--- a/src/mesa/state_tracker/tests/st_tests_common.h
+++ b/src/mesa/state_tracker/tests/st_tests_common.h
@@ -40,15 +40,15 @@ struct RA {};
 
 /* A line to describe a TGSI instruction for building mock shaders. */
 struct FakeCodeline {
-   FakeCodeline(unsigned _op): op(_op), max_temp_id(0) {}
-   FakeCodeline(unsigned _op, const std::vector& _dst, const 
std::vector& _src,
+   FakeCodeline(tgsi_opcode _op): op(_op), max_temp_id(0) {}
+   FakeCodeline(tgsi_opcode _op, const std::vector& _dst, const 
std::vector& _src,
 const std::vector&_to);
 
-   FakeCodeline(unsigned _op, const std::vector>& _dst,
+   FakeCodeline(tgsi_opcode _op, const std::vector>& _dst,
 const std::vector>& _src,
 const std::vector>&_to, SWZ 
with_swizzle);
 
-   FakeCodeline(unsigned _op, const std::vector>& _dst,
+   FakeCodeline(tgsi_opcode _op, const std::vector>& 
_dst,
 const std::vector>& _src,
 const std::vector>&_to, RA 
with_reladdr);
 
@@ -78,7 +78,7 @@ private:
template 
void read_reg(const st_reg& s);
 
-   unsigned op;
+   tgsi_opcode op;
std::vector dst;
std::vector src;
std::vector tex_offsets;

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


Mesa (master): svga: simplify uses_flat_interp expression in emit_input_declarations()

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 93581c2ca0776b290f9817f46eaca5edfaa32528
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=93581c2ca0776b290f9817f46eaca5edfaa32528

Author: Brian Paul 
Date:   Tue Mar  6 09:29:21 2018 -0700

svga: simplify uses_flat_interp expression in emit_input_declarations()

Reviewed-by: Neha Bhende 

---

 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 04d83038b0..4292894056 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -2396,7 +2396,7 @@ emit_input_declarations(struct svga_shader_emitter_v10 
*emit)
emit->info.input_interpolate_loc[i]);
 
 /* keeps track if flat interpolation mode is being used */
-emit->uses_flat_interp = emit->uses_flat_interp ||
+emit->uses_flat_interp |=
(interpolationMode == VGPU10_INTERPOLATION_CONSTANT);
 
 name = VGPU10_NAME_UNDEFINED;

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


Mesa (master): tgsi,softpipe: use enum tgsi_opcode

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 7181a9fa0e8141794e76d383b7747b5bb4216e1c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7181a9fa0e8141794e76d383b7747b5bb4216e1c

Author: Brian Paul 
Date:   Mon Mar  5 10:28:03 2018 -0700

tgsi,softpipe: use enum tgsi_opcode

Reviewed-by: Eric Anholt 

---

 src/gallium/auxiliary/tgsi/tgsi_exec.h   | 4 ++--
 src/gallium/drivers/softpipe/sp_buffer.c | 4 ++--
 src/gallium/drivers/softpipe/sp_image.c  | 8 
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h 
b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index ad920dcf16..0fac7ea456 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -134,7 +134,7 @@ struct tgsi_image {
 
void (*op)(const struct tgsi_image *image,
   const struct tgsi_image_params *params,
-  unsigned opcode,
+  enum tgsi_opcode opcode,
   const int s[TGSI_QUAD_SIZE],
   const int t[TGSI_QUAD_SIZE],
   const int r[TGSI_QUAD_SIZE],
@@ -167,7 +167,7 @@ struct tgsi_buffer {
 
void (*op)(const struct tgsi_buffer *buffer,
   const struct tgsi_buffer_params *params,
-  unsigned opcode,
+  enum tgsi_opcode opcode,
   const int s[TGSI_QUAD_SIZE],
   float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE],
   float rgba2[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]);
diff --git a/src/gallium/drivers/softpipe/sp_buffer.c 
b/src/gallium/drivers/softpipe/sp_buffer.c
index 69a6bd18c3..e91d2af78e 100644
--- a/src/gallium/drivers/softpipe/sp_buffer.c
+++ b/src/gallium/drivers/softpipe/sp_buffer.c
@@ -159,7 +159,7 @@ handle_op_uint(const struct pipe_shader_buffer *bview,
bool just_read,
unsigned char *data_ptr,
uint qi,
-   unsigned opcode,
+   enum tgsi_opcode opcode,
unsigned writemask,
float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE],
float rgba2[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
@@ -281,7 +281,7 @@ handle_op_uint(const struct pipe_shader_buffer *bview,
 static void
 sp_tgsi_op(const struct tgsi_buffer *buffer,
const struct tgsi_buffer_params *params,
-   unsigned opcode,
+   enum tgsi_opcode opcode,
const int s[TGSI_QUAD_SIZE],
float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE],
float rgba2[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
diff --git a/src/gallium/drivers/softpipe/sp_image.c 
b/src/gallium/drivers/softpipe/sp_image.c
index d5547e294a..49b775cf0c 100644
--- a/src/gallium/drivers/softpipe/sp_image.c
+++ b/src/gallium/drivers/softpipe/sp_image.c
@@ -384,7 +384,7 @@ handle_op_uint(const struct pipe_image_view *iview,
char *data_ptr,
uint qi,
unsigned stride,
-   unsigned opcode,
+   enum tgsi_opcode opcode,
int s,
int t,
float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE],
@@ -501,7 +501,7 @@ handle_op_int(const struct pipe_image_view *iview,
   char *data_ptr,
   uint qi,
   unsigned stride,
-  unsigned opcode,
+  enum tgsi_opcode opcode,
   int s,
   int t,
   float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE],
@@ -615,7 +615,7 @@ handle_op_r32f_xchg(const struct pipe_image_view *iview,
 char *data_ptr,
 uint qi,
 unsigned stride,
-unsigned opcode,
+enum tgsi_opcode opcode,
 int s,
 int t,
 float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
@@ -649,7 +649,7 @@ handle_op_r32f_xchg(const struct pipe_image_view *iview,
 static void
 sp_tgsi_op(const struct tgsi_image *image,
const struct tgsi_image_params *params,
-   unsigned opcode,
+   enum tgsi_opcode opcode,
const int s[TGSI_QUAD_SIZE],
const int t[TGSI_QUAD_SIZE],
const int r[TGSI_QUAD_SIZE],

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


Mesa (master): tgsi: use enum tgsi_opcode

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 22a3190c85621a55e8498499e1006a9dc242ac6f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=22a3190c85621a55e8498499e1006a9dc242ac6f

Author: Brian Paul 
Date:   Mon Mar  5 10:16:01 2018 -0700

tgsi: use enum tgsi_opcode

Reviewed-by: Eric Anholt 

---

 src/gallium/auxiliary/tgsi/tgsi_build.c |  2 +-
 src/gallium/auxiliary/tgsi/tgsi_lowering.c  |  6 +++---
 src/gallium/auxiliary/tgsi/tgsi_scan.c  |  6 +++---
 src/gallium/auxiliary/tgsi/tgsi_transform.c |  2 +-
 src/gallium/auxiliary/tgsi/tgsi_transform.h | 12 ++--
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c 
b/src/gallium/auxiliary/tgsi/tgsi_build.c
index 0c4ec8d1cf..36c36d93c0 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -660,7 +660,7 @@ tgsi_default_instruction( void )
 }
 
 static struct tgsi_instruction
-tgsi_build_instruction(unsigned opcode,
+tgsi_build_instruction(enum tgsi_opcode opcode,
unsigned saturate,
unsigned precise,
unsigned num_dst_regs,
diff --git a/src/gallium/auxiliary/tgsi/tgsi_lowering.c 
b/src/gallium/auxiliary/tgsi/tgsi_lowering.c
index bfc3a6bfe3..47aa3df61d 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_lowering.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_lowering.c
@@ -823,7 +823,7 @@ transform_dotp(struct tgsi_transform_context *tctx,
struct tgsi_full_src_register *src0 = &inst->Src[0];
struct tgsi_full_src_register *src1 = &inst->Src[1];
struct tgsi_full_instruction new_inst;
-   unsigned opcode = inst->Instruction.Opcode;
+   enum tgsi_opcode opcode = inst->Instruction.Opcode;
 
/* NOTE: any potential last instruction must replicate src on all
 * components (since it could be re-written to write to final dst)
@@ -908,7 +908,7 @@ transform_flr_ceil(struct tgsi_transform_context *tctx,
struct tgsi_full_dst_register *dst  = &inst->Dst[0];
struct tgsi_full_src_register *src0 = &inst->Src[0];
struct tgsi_full_instruction new_inst;
-   unsigned opcode = inst->Instruction.Opcode;
+   enum tgsi_opcode opcode = inst->Instruction.Opcode;
 
if (dst->Register.WriteMask & TGSI_WRITEMASK_XYZW) {
   /* FLR: FRC tmpA, src  CEIL: FRC tmpA, -src */
@@ -1038,7 +1038,7 @@ transform_samp(struct tgsi_transform_context *tctx,
/* mask is clamped coords, pmask is all coords (for projection): */
unsigned mask = 0, pmask = 0, smask;
unsigned tex = inst->Texture.Texture;
-   unsigned opcode = inst->Instruction.Opcode;
+   enum tgsi_opcode opcode = inst->Instruction.Opcode;
bool lower_txp = (opcode == TGSI_OPCODE_TXP) &&
   (ctx->config->lower_TXP & (1 << tex));
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 4a2b354063..18488d776e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -55,7 +55,7 @@ is_memory_file(unsigned file)
 
 
 static bool
-is_mem_query_inst(unsigned opcode)
+is_mem_query_inst(enum tgsi_opcode opcode)
 {
return opcode == TGSI_OPCODE_RESQ ||
   opcode == TGSI_OPCODE_TXQ ||
@@ -68,7 +68,7 @@ is_mem_query_inst(unsigned opcode)
  * texture map?
  */
 static bool
-is_texture_inst(unsigned opcode)
+is_texture_inst(enum tgsi_opcode opcode)
 {
return (!is_mem_query_inst(opcode) &&
tgsi_get_opcode_info(opcode)->is_tex);
@@ -80,7 +80,7 @@ is_texture_inst(unsigned opcode)
  * implicitly?
  */
 static bool
-computes_derivative(unsigned opcode)
+computes_derivative(enum tgsi_opcode opcode)
 {
if (tgsi_get_opcode_info(opcode)->is_tex) {
   return opcode != TGSI_OPCODE_TG4 &&
diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c 
b/src/gallium/auxiliary/tgsi/tgsi_transform.c
index a13cf90a27..cd076c9e79 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_transform.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c
@@ -169,7 +169,7 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
  {
 struct tgsi_full_instruction *fullinst
= &parse.FullToken.FullInstruction;
-unsigned opcode = fullinst->Instruction.Opcode;
+enum tgsi_opcode opcode = fullinst->Instruction.Opcode;
 
 if (first_instruction && ctx->prolog) {
ctx->prolog(ctx);
diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.h 
b/src/gallium/auxiliary/tgsi/tgsi_transform.h
index e4da0f5deb..018e4a06d8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_transform.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_transform.h
@@ -267,7 +267,7 @@ tgsi_transform_src_reg(struct tgsi_full_src_register *reg,
  */
 static inline void
 tgsi_transform_op1_inst(struct tgsi_transform_context *ctx,
-unsigned opcode,
+  

Mesa (master): st/mesa,tgsi: use enum tgsi_opcode

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: ec478cf9c31c3775a21cd7b5b4b5cdd9263bde9e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ec478cf9c31c3775a21cd7b5b4b5cdd9263bde9e

Author: Brian Paul 
Date:   Mon Mar  5 10:20:32 2018 -0700

st/mesa,tgsi: use enum tgsi_opcode

Need to update the tgsi code and st_glsl_to_tgsi code at the same time
to prevent compile break since C++ is much pickier about implicit
enum/unsigned casting.

Bump size of glsl_to_tgsi_instruction::op to 10 bits to be sure to
avoid MSVC signed enum overflow issue.  No change in class size.

Reviewed-by: Eric Anholt 

---

 src/gallium/auxiliary/tgsi/tgsi_info.c   | 10 ++---
 src/gallium/auxiliary/tgsi/tgsi_info.h   | 10 ++---
 src/gallium/auxiliary/tgsi/tgsi_ureg.c   | 10 ++---
 src/gallium/auxiliary/tgsi/tgsi_ureg.h   | 28 ++--
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp   | 55 
 src/mesa/state_tracker/st_glsl_to_tgsi_private.h |  2 +-
 6 files changed, 58 insertions(+), 57 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c 
b/src/gallium/auxiliary/tgsi/tgsi_info.c
index a2046822a5..4aa658785c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -51,7 +51,7 @@ static const struct tgsi_opcode_info 
opcode_info[TGSI_OPCODE_LAST] =
 #undef OPCODE_GAP
 
 const struct tgsi_opcode_info *
-tgsi_get_opcode_info( uint opcode )
+tgsi_get_opcode_info(enum tgsi_opcode opcode)
 {
static boolean firsttime = 1;
 
@@ -85,7 +85,7 @@ static const char * const opcode_names[TGSI_OPCODE_LAST] =
 #undef OPCODE_GAP
 
 const char *
-tgsi_get_opcode_name( uint opcode )
+tgsi_get_opcode_name(enum tgsi_opcode opcode)
 {
if (opcode >= ARRAY_SIZE(opcode_names))
   return "UNK_OOB";
@@ -120,7 +120,7 @@ tgsi_get_processor_name(enum pipe_shader_type processor)
  * MOV and UCMP is special so return VOID
  */
 static inline enum tgsi_opcode_type
-tgsi_opcode_infer_type( uint opcode )
+tgsi_opcode_infer_type(enum tgsi_opcode opcode)
 {
switch (opcode) {
case TGSI_OPCODE_MOV:
@@ -246,7 +246,7 @@ tgsi_opcode_infer_type( uint opcode )
  * infer the source type of a TGSI opcode.
  */
 enum tgsi_opcode_type
-tgsi_opcode_infer_src_type(uint opcode, uint src_idx)
+tgsi_opcode_infer_src_type(enum tgsi_opcode opcode, uint src_idx)
 {
if (src_idx == 1 &&
(opcode == TGSI_OPCODE_DLDEXP || opcode == TGSI_OPCODE_LDEXP))
@@ -317,7 +317,7 @@ tgsi_opcode_infer_src_type(uint opcode, uint src_idx)
  * infer the destination type of a TGSI opcode.
  */
 enum tgsi_opcode_type
-tgsi_opcode_infer_dst_type( uint opcode, uint dst_idx )
+tgsi_opcode_infer_dst_type(enum tgsi_opcode opcode, uint dst_idx)
 {
if (dst_idx == 1 && opcode == TGSI_OPCODE_DFRACEXP)
   return TGSI_TYPE_SIGNED;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h 
b/src/gallium/auxiliary/tgsi/tgsi_info.h
index 2c97bb62de..f0bf27ea08 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.h
@@ -79,14 +79,14 @@ struct tgsi_opcode_info
unsigned pre_dedent:1;
unsigned post_indent:1;
enum tgsi_output_mode output_mode:4;
-   unsigned opcode:8;
+   enum tgsi_opcode opcode:10;
 };
 
 const struct tgsi_opcode_info *
-tgsi_get_opcode_info( uint opcode );
+tgsi_get_opcode_info(enum tgsi_opcode opcode);
 
 const char *
-tgsi_get_opcode_name( uint opcode );
+tgsi_get_opcode_name(enum tgsi_opcode opcode);
 
 const char *
 tgsi_get_processor_name(enum pipe_shader_type processor);
@@ -111,10 +111,10 @@ static inline bool tgsi_type_is_64bit(enum 
tgsi_opcode_type type)
 }
 
 enum tgsi_opcode_type
-tgsi_opcode_infer_src_type( uint opcode, uint src_idx );
+tgsi_opcode_infer_src_type(enum tgsi_opcode opcode, uint src_idx);
 
 enum tgsi_opcode_type
-tgsi_opcode_infer_dst_type( uint opcode, uint dst_idx );
+tgsi_opcode_infer_dst_type(enum tgsi_opcode opcode, uint dst_idx);
 
 #if defined __cplusplus
 }
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 41281dabc4..393e015001 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -1234,7 +1234,7 @@ ureg_emit_dst( struct ureg_program *ureg,
 }
 
 
-static void validate( unsigned opcode,
+static void validate( enum tgsi_opcode opcode,
   unsigned nr_dst,
   unsigned nr_src )
 {
@@ -1250,7 +1250,7 @@ static void validate( unsigned opcode,
 
 struct ureg_emit_insn_result
 ureg_emit_insn(struct ureg_program *ureg,
-   unsigned opcode,
+   enum tgsi_opcode opcode,
boolean saturate,
unsigned precise,
unsigned num_dst,
@@ -1392,7 +1392,7 @@ ureg_fixup_insn_size(struct ureg_program *ureg,
 
 void
 ureg_insn(struct ureg_program *ureg,
-  unsigned opcode,
+  enum tgsi_opcode opcode,
   const struct ureg_dst *dst,
   unsigned nr

Mesa (master): svga: use enum tgsi_opcode

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 7df96826f80231b988e8712f5bce7c9edb358360
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7df96826f80231b988e8712f5bce7c9edb358360

Author: Brian Paul 
Date:   Mon Mar  5 10:05:52 2018 -0700

svga: use enum tgsi_opcode

Reviewed-by: Eric Anholt 

---

 src/gallium/drivers/svga/svga_tgsi_insn.c   | 2 +-
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c 
b/src/gallium/drivers/svga/svga_tgsi_insn.c
index be99ad511b..c08809c550 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -40,7 +40,7 @@ static boolean emit_ps_postamble( struct svga_shader_emitter 
*emit );
 
 
 static unsigned
-translate_opcode(uint opcode)
+translate_opcode(enum tgsi_opcode opcode)
 {
switch (opcode) {
case TGSI_OPCODE_ADD:return SVGA3DOP_ADD;
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index b9b3d4fb3f..04d83038b0 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -501,7 +501,7 @@ translate_shader_type(unsigned type)
  * as seen below.  All other opcodes are handled/translated specially.
  */
 static VGPU10_OPCODE_TYPE
-translate_opcode(unsigned opcode)
+translate_opcode(enum tgsi_opcode opcode)
 {
switch (opcode) {
case TGSI_OPCODE_MOV:
@@ -5364,7 +5364,7 @@ static boolean
 emit_simple(struct svga_shader_emitter_v10 *emit,
 const struct tgsi_full_instruction *inst)
 {
-   const unsigned opcode = inst->Instruction.Opcode;
+   const enum tgsi_opcode opcode = inst->Instruction.Opcode;
const struct tgsi_opcode_info *op = tgsi_get_opcode_info(opcode);
unsigned i;
 
@@ -5415,7 +5415,7 @@ emit_simple_1dst(struct svga_shader_emitter_v10 *emit,
  unsigned dst_count,
  unsigned dst_index)
 {
-   const unsigned opcode = inst->Instruction.Opcode;
+   const enum tgsi_opcode opcode = inst->Instruction.Opcode;
const struct tgsi_opcode_info *op = tgsi_get_opcode_info(opcode);
unsigned i;
 
@@ -5447,7 +5447,7 @@ emit_vgpu10_instruction(struct svga_shader_emitter_v10 
*emit,
 unsigned inst_number,
 const struct tgsi_full_instruction *inst)
 {
-   const unsigned opcode = inst->Instruction.Opcode;
+   const enum tgsi_opcode opcode = inst->Instruction.Opcode;
 
switch (opcode) {
case TGSI_OPCODE_ADD:

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


Mesa (master): st/mesa: s/unsigned/enum pipe_shader_type/

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: aad23f91ee197446c81718d9003fb08edf680a01
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aad23f91ee197446c81718d9003fb08edf680a01

Author: Brian Paul 
Date:   Thu Mar 15 08:22:55 2018 -0600

st/mesa: s/unsigned/enum pipe_shader_type/

Reviewed-by: Eric Anholt 
Reviewed-by: Neha Bhende 

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 --
 src/mesa/state_tracker/st_glsl_to_tgsi.h   | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index fc53811be4..5f7a0dcd3e 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5450,7 +5450,7 @@ struct st_translate {
const ubyte *inputMapping;
const ubyte *outputMapping;
 
-   unsigned procType;  /**< PIPE_SHADER_VERTEX/FRAGMENT */
+   enum pipe_shader_type procType;  /**< PIPE_SHADER_VERTEX/FRAGMENT */
bool need_uarl;
 };
 
@@ -6290,7 +6290,7 @@ st_translate_interp(enum glsl_interp_mode glsl_qual, 
GLuint varying)
 extern "C" enum pipe_error
 st_translate_program(
struct gl_context *ctx,
-   uint procType,
+   enum pipe_shader_type procType,
struct ureg_program *ureg,
glsl_to_tgsi_visitor *program,
const struct gl_program *proginfo,
@@ -6723,6 +6723,8 @@ st_translate_program(
  }
   }
   break;
+   default:
+  ; /* nothing - silence compiler warning */
}
 
 out:
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.h 
b/src/mesa/state_tracker/st_glsl_to_tgsi.h
index f38d41d6c7..8ccfff9bd3 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.h
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.h
@@ -38,7 +38,7 @@ struct ureg_program;
 
 enum pipe_error st_translate_program(
struct gl_context *ctx,
-   uint procType,
+   enum pipe_shader_type procType,
struct ureg_program *ureg,
struct glsl_to_tgsi_visitor *program,
const struct gl_program *proginfo,

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


Mesa (master): gallivm: use enum tgis_opcode

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 9413d1c0fec74d2a7bd8f09049c2aaef8a232a9d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9413d1c0fec74d2a7bd8f09049c2aaef8a232a9d

Author: Brian Paul 
Date:   Mon Mar  5 10:07:03 2018 -0700

gallivm: use enum tgis_opcode

Reviewed-by: Eric Anholt 

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi.c |  8 
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 12 
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
index 079a6eed49..64d2cd703b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
@@ -198,7 +198,7 @@ void lp_build_fetch_args(
  *- map dst x,z to src xy;
  *- map dst y,w to src zw;
  */
-static int get_src_chan_idx(unsigned opcode,
+static int get_src_chan_idx(enum tgsi_opcode opcode,
 int dst_chan_index)
 {
enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(opcode, 0);
@@ -232,10 +232,10 @@ lp_build_tgsi_inst_llvm(
struct lp_build_tgsi_context * bld_base,
const struct tgsi_full_instruction * inst)
 {
-   unsigned tgsi_opcode = inst->Instruction.Opcode;
-   const struct tgsi_opcode_info * info = tgsi_get_opcode_info(tgsi_opcode);
+   enum tgsi_opcode opcode = inst->Instruction.Opcode;
+   const struct tgsi_opcode_info * info = tgsi_get_opcode_info(opcode);
const struct lp_build_tgsi_action * action =
- &bld_base->op_actions[tgsi_opcode];
+ &bld_base->op_actions[opcode];
struct lp_build_emit_data emit_data;
unsigned chan_index;
LLVMValueRef val;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index fad74c6801..e411f906c7 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -368,7 +368,8 @@ static void lp_exec_break(struct lp_exec_mask *mask,
   exec_mask, "break_full");
}
else {
-  unsigned opcode = bld_base->instructions[bld_base->pc + 
1].Instruction.Opcode;
+  enum tgsi_opcode opcode =
+ bld_base->instructions[bld_base->pc + 1].Instruction.Opcode;
   boolean break_always = (opcode == TGSI_OPCODE_ENDSWITCH ||
   opcode == TGSI_OPCODE_CASE);
 
@@ -630,7 +631,7 @@ static boolean default_analyse_is_last(struct lp_exec_mask 
*mask,
}
 
while (pc != ~0u && pc < bld_base->num_instructions) {
-  unsigned opcode = bld_base->instructions[pc].Instruction.Opcode;
+  enum tgsi_opcode opcode = bld_base->instructions[pc].Instruction.Opcode;
   switch (opcode) {
   case TGSI_OPCODE_CASE:
  if (curr_switch_stack == ctx->switch_stack_size) {
@@ -648,6 +649,8 @@ static boolean default_analyse_is_last(struct lp_exec_mask 
*mask,
  }
  curr_switch_stack--;
  break;
+  default:
+ ; /* nothing */
   }
   pc++;
}
@@ -700,7 +703,8 @@ static void lp_exec_default(struct lp_exec_mask *mask,
* which just gets rid of all case statements appearing together with
* default (or could do switch analysis at switch start time instead).
*/
-  unsigned opcode = bld_base->instructions[bld_base->pc - 
1].Instruction.Opcode;
+  enum tgsi_opcode opcode =
+ bld_base->instructions[bld_base->pc - 1].Instruction.Opcode;
   boolean ft_into = (opcode != TGSI_OPCODE_BRK &&
  opcode != TGSI_OPCODE_SWITCH);
   /*
@@ -2610,7 +2614,7 @@ near_end_of_shader(struct lp_build_tgsi_soa_context *bld,
unsigned i;
 
for (i = 0; i < 5; i++) {
-  unsigned opcode;
+  enum tgsi_opcode opcode;
 
   if (pc + i >= bld->bld_base.info->num_instructions)
  return TRUE;

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


Mesa (master): tgsi/nir: use enum tgsi_opcode

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: ccecb2bbd3aa080657e62fec6e2561d785e05e79
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ccecb2bbd3aa080657e62fec6e2561d785e05e79

Author: Brian Paul 
Date:   Mon Mar  5 10:20:01 2018 -0700

tgsi/nir: use enum tgsi_opcode

Reviewed-by: Eric Anholt 

---

 src/gallium/auxiliary/nir/tgsi_to_nir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c 
b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index bbbf101157..b5b4869b04 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -773,8 +773,8 @@ ttn_get_src(struct ttn_compile *c, struct 
tgsi_full_src_register *tgsi_fsrc,
 {
nir_builder *b = &c->build;
struct tgsi_src_register *tgsi_src = &tgsi_fsrc->Register;
-   unsigned tgsi_opcode = c->token->FullInstruction.Instruction.Opcode;
-   unsigned tgsi_src_type = tgsi_opcode_infer_src_type(tgsi_opcode, src_idx);
+   enum tgsi_opcode opcode = c->token->FullInstruction.Instruction.Opcode;
+   unsigned tgsi_src_type = tgsi_opcode_infer_src_type(opcode, src_idx);
bool src_is_float = !(tgsi_src_type == TGSI_TYPE_SIGNED ||
  tgsi_src_type == TGSI_TYPE_UNSIGNED);
nir_alu_src src;

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


Mesa (master): st/mesa: whitespace/formatting fixes in st_atom_constbuf.c

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6a93deedf553091ef195c7878832c7a9d8d46494
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a93deedf553091ef195c7878832c7a9d8d46494

Author: Brian Paul 
Date:   Thu Mar 15 08:23:13 2018 -0600

st/mesa: whitespace/formatting fixes in st_atom_constbuf.c

Reviewed-by: Eric Anholt 
Reviewed-by: Neha Bhende 

---

 src/mesa/state_tracker/st_atom_constbuf.c | 57 +++
 1 file changed, 36 insertions(+), 21 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_constbuf.c 
b/src/mesa/state_tracker/st_atom_constbuf.c
index 87a72b2622..0c094dcf92 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -1,8 +1,8 @@
 /**
- * 
+ *
  * Copyright 2007 VMware, Inc.
  * All Rights Reserved.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * "Software"), to deal in the Software without restriction, including
@@ -10,11 +10,11 @@
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -22,7 +22,7 @@
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
+ *
  **/
 
 /*
@@ -52,7 +52,8 @@
  * Pass the given program parameters to the graphics pipe as a
  * constant buffer.
  */
-void st_upload_constants(struct st_context *st, struct gl_program *prog)
+void
+st_upload_constants(struct st_context *st, struct gl_program *prog)
 {
gl_shader_stage stage = prog->info.stage;
struct gl_program_parameter_list *params = prog->Parameters;
@@ -77,7 +78,8 @@ void st_upload_constants(struct st_context *st, struct 
gl_program *prog)
ati_fs->Constants[c], sizeof(GLfloat) * 4);
  else
 memcpy(params->ParameterValues + offset,
-   st->ctx->ATIFragmentShader.GlobalConstants[c], 
sizeof(GLfloat) * 4);
+   st->ctx->ATIFragmentShader.GlobalConstants[c],
+   sizeof(GLfloat) * 4);
   }
}
 
@@ -132,7 +134,8 @@ void st_upload_constants(struct st_context *st, struct 
gl_program *prog)
 /**
  * Vertex shader:
  */
-void st_update_vs_constants(struct st_context *st )
+void
+st_update_vs_constants(struct st_context *st)
 {
st_upload_constants(st, &st->vp->Base);
 }
@@ -140,7 +143,8 @@ void st_update_vs_constants(struct st_context *st )
 /**
  * Fragment shader:
  */
-void st_update_fs_constants(struct st_context *st )
+void
+st_update_fs_constants(struct st_context *st)
 {
st_upload_constants(st, &st->fp->Base);
 }
@@ -148,7 +152,8 @@ void st_update_fs_constants(struct st_context *st )
 
 /* Geometry shader:
  */
-void st_update_gs_constants(struct st_context *st )
+void
+st_update_gs_constants(struct st_context *st)
 {
struct st_common_program *gp = st->gp;
 
@@ -158,7 +163,8 @@ void st_update_gs_constants(struct st_context *st )
 
 /* Tessellation control shader:
  */
-void st_update_tcs_constants(struct st_context *st )
+void
+st_update_tcs_constants(struct st_context *st)
 {
struct st_common_program *tcp = st->tcp;
 
@@ -168,7 +174,8 @@ void st_update_tcs_constants(struct st_context *st )
 
 /* Tessellation evaluation shader:
  */
-void st_update_tes_constants(struct st_context *st )
+void
+st_update_tes_constants(struct st_context *st)
 {
struct st_common_program *tep = st->tep;
 
@@ -178,7 +185,8 @@ void st_update_tes_constants(struct st_context *st )
 
 /* Compute shader:
  */
-void st_update_cs_constants(struct st_context *st )
+void
+st_update_cs_constants(struct st_context *st)
 {
struct st_compute_program *cp = st->cp;
 
@@ -186,8 +194,9 @@ void st_update_cs_constants(struct st_context *st )
   st_upload_constants(st, &cp->Base);
 }
 
-static void st_bind_ubos(struct st_context *st, struct gl_program *prog,
- unsigned shader_type)
+static void
+st_bind_ubos(struct st_context *st, struct gl_program *prog,
+ unsigned shader_type)
 {
unsigned i;
struct pipe_constant_buffer cb = { 0 };
@@ -224,7 +233,8 @@ static void st_bind_ubos(struct st_context *st, stru

Mesa (master): svga: replace unsigned with proper enum names

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c99f46c2acb71ac00812d7e1059a0a1610824421
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c99f46c2acb71ac00812d7e1059a0a1610824421

Author: Brian Paul 
Date:   Mon Mar  5 10:48:46 2018 -0700

svga: replace unsigned with proper enum names

Reviewed-by: Neha Bhende 

---

 src/gallium/drivers/svga/svga_tgsi_emit.h | 12 ++--
 src/gallium/drivers/svga/svga_tgsi_insn.c | 19 ++-
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h 
b/src/gallium/drivers/svga/svga_tgsi_emit.h
index 114c9563e2..357d772e7a 100644
--- a/src/gallium/drivers/svga/svga_tgsi_emit.h
+++ b/src/gallium/drivers/svga/svga_tgsi_emit.h
@@ -189,7 +189,7 @@ emit_instruction(struct svga_shader_emitter *emit,
 
 /** Generate a SVGA3dShaderInstToken for the given SVGA3D shader opcode */
 static inline SVGA3dShaderInstToken
-inst_token(unsigned opcode)
+inst_token(SVGA3dShaderOpCodeType opcode)
 {
SVGA3dShaderInstToken inst;
 
@@ -205,7 +205,7 @@ inst_token(unsigned opcode)
  * with the predication flag set.
  */
 static inline SVGA3dShaderInstToken
-inst_token_predicated(unsigned opcode)
+inst_token_predicated(SVGA3dShaderOpCodeType opcode)
 {
SVGA3dShaderInstToken inst;
 
@@ -222,7 +222,7 @@ inst_token_predicated(unsigned opcode)
  * using the given comparison operator (one of SVGA3DOPCOMP_xx).
  */
 static inline SVGA3dShaderInstToken
-inst_token_setp(unsigned operator)
+inst_token_setp(SVGA3dShaderOpCodeCompFnType operator)
 {
SVGA3dShaderInstToken inst;
 
@@ -240,7 +240,7 @@ inst_token_setp(unsigned operator)
  * temp registers AND constants (see emit_def_const()).
  */
 static inline SVGA3dShaderDestToken
-dst_register(unsigned file, int number)
+dst_register(SVGA3dShaderRegType file, int number)
 {
SVGA3dShaderDestToken dest;
 
@@ -278,7 +278,7 @@ writemask(SVGA3dShaderDestToken dest, unsigned mask)
 
 /** Create a SVGA3dShaderSrcToken given a register file and number */
 static inline SVGA3dShaderSrcToken
-src_token(unsigned file, int number)
+src_token(SVGA3dShaderRegType file, int number)
 {
SVGA3dShaderSrcToken src;
 
@@ -302,7 +302,7 @@ src_token(unsigned file, int number)
 
 /** Create a src_register given a register file and register number */
 static inline struct src_register
-src_register(unsigned file, int number)
+src_register(SVGA3dShaderRegType file, int number)
 {
struct src_register src;
 
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c 
b/src/gallium/drivers/svga/svga_tgsi_insn.c
index c08809c550..c7804b2680 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -39,7 +39,7 @@ static boolean emit_vs_postamble( struct svga_shader_emitter 
*emit );
 static boolean emit_ps_postamble( struct svga_shader_emitter *emit );
 
 
-static unsigned
+static SVGA3dShaderOpCodeType
 translate_opcode(enum tgsi_opcode opcode)
 {
switch (opcode) {
@@ -60,8 +60,8 @@ translate_opcode(enum tgsi_opcode opcode)
 }
 
 
-static unsigned
-translate_file(unsigned file)
+static SVGA3dShaderRegType
+translate_file(enum tgsi_file_type file)
 {
switch (file) {
case TGSI_FILE_TEMPORARY: return SVGA3DREG_TEMP;
@@ -1435,7 +1435,7 @@ same_register(struct src_register r1, struct src_register 
r2)
  */
 static boolean
 emit_conditional(struct svga_shader_emitter *emit,
- unsigned compare_func,
+ enum pipe_compare_func compare_func,
  SVGA3dShaderDestToken dst,
  struct src_register src0,
  struct src_register src1,
@@ -1516,7 +1516,7 @@ emit_conditional(struct svga_shader_emitter *emit,
  */
 static boolean
 emit_select(struct svga_shader_emitter *emit,
-unsigned compare_func,
+enum pipe_compare_func compare_func,
 SVGA3dShaderDestToken dst,
 struct src_register src0,
 struct src_register src1 )
@@ -1968,7 +1968,7 @@ emit_brk(struct svga_shader_emitter *emit,
  */
 static boolean
 emit_scalar_op1(struct svga_shader_emitter *emit,
-unsigned opcode,
+SVGA3dShaderOpCodeType opcode,
 const struct tgsi_full_instruction *insn)
 {
SVGA3dShaderInstToken inst;
@@ -1990,7 +1990,7 @@ emit_scalar_op1(struct svga_shader_emitter *emit,
  */
 static boolean
 emit_simple_instruction(struct svga_shader_emitter *emit,
-unsigned opcode,
+SVGA3dShaderOpCodeType opcode,
 const struct tgsi_full_instruction *insn)
 {
const struct tgsi_full_src_register *src = insn->Src;
@@ -2070,7 +2070,7 @@ emit_deriv(struct svga_shader_emitter *emit,
   return TRUE;
}
else {
-  unsigned opcode;
+  SVGA3dShaderOpCodeType opcode;
   const struct tgsi_full_src_register *reg = &insn->Src[0];
   SVGA3dShaderInstToken inst;
   SVGA3dShaderDestToken dst;
@@ -2923,7 +2923,8 @@ svga_emit_i

Mesa (master): st/mesa: s/unsigned/enum pipe_shader_type/ for st_bind_ubos()

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e31d5bd2f9d351db95f2bf4f92b297815745d25a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e31d5bd2f9d351db95f2bf4f92b297815745d25a

Author: Brian Paul 
Date:   Thu Mar 15 08:25:43 2018 -0600

st/mesa: s/unsigned/enum pipe_shader_type/ for st_bind_ubos()

Reviewed-by: Eric Anholt 
Reviewed-by: Neha Bhende 

---

 src/mesa/state_tracker/st_atom_constbuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_atom_constbuf.c 
b/src/mesa/state_tracker/st_atom_constbuf.c
index 0c094dcf92..6455e612e4 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -196,7 +196,7 @@ st_update_cs_constants(struct st_context *st)
 
 static void
 st_bind_ubos(struct st_context *st, struct gl_program *prog,
- unsigned shader_type)
+ enum pipe_shader_type shader_type)
 {
unsigned i;
struct pipe_constant_buffer cb = { 0 };

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


Mesa (master): tgsi: convert opcode macros to enums

2018-03-23 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4e0f967f6d535751ef4012f545836fbcfcd22646
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e0f967f6d535751ef4012f545836fbcfcd22646

Author: Brian Paul 
Date:   Mon Mar  5 10:04:30 2018 -0700

tgsi: convert opcode macros to enums

Enums are nicer in gdb.

Reviewed-by: Eric Anholt 

---

 src/gallium/include/pipe/p_shader_tokens.h | 548 +++--
 1 file changed, 275 insertions(+), 273 deletions(-)

diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
b/src/gallium/include/pipe/p_shader_tokens.h
index 4e95789c65..f4e45c2560 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -333,284 +333,286 @@ struct tgsi_property_data {
unsigned Data;
 };
 
-/* TGSI opcodes.  
- * 
+/* TGSI opcodes.
+ *
  * For more information on semantics of opcodes and
  * which APIs are known to use which opcodes, see
  * gallium/docs/source/tgsi.rst
  */
-#define TGSI_OPCODE_ARL 0
-#define TGSI_OPCODE_MOV 1
-#define TGSI_OPCODE_LIT 2
-#define TGSI_OPCODE_RCP 3
-#define TGSI_OPCODE_RSQ 4
-#define TGSI_OPCODE_EXP 5
-#define TGSI_OPCODE_LOG 6
-#define TGSI_OPCODE_MUL 7
-#define TGSI_OPCODE_ADD 8
-#define TGSI_OPCODE_DP3 9
-#define TGSI_OPCODE_DP4 10
-#define TGSI_OPCODE_DST 11
-#define TGSI_OPCODE_MIN 12
-#define TGSI_OPCODE_MAX 13
-#define TGSI_OPCODE_SLT 14
-#define TGSI_OPCODE_SGE 15
-#define TGSI_OPCODE_MAD 16
-#define TGSI_OPCODE_TEX_LZ  17
-#define TGSI_OPCODE_LRP 18
-#define TGSI_OPCODE_FMA 19
-#define TGSI_OPCODE_SQRT20
-#define TGSI_OPCODE_LDEXP   21
-#define TGSI_OPCODE_F2U64   22
-#define TGSI_OPCODE_F2I64   23
-#define TGSI_OPCODE_FRC 24
-#define TGSI_OPCODE_TXF_LZ  25
-#define TGSI_OPCODE_FLR 26
-#define TGSI_OPCODE_ROUND   27
-#define TGSI_OPCODE_EX2 28
-#define TGSI_OPCODE_LG2 29
-#define TGSI_OPCODE_POW 30
-/* gap */
-#define TGSI_OPCODE_U2I64   32
-#define TGSI_OPCODE_CLOCK   33
-#define TGSI_OPCODE_I2I64   34
-/* gap */
-#define TGSI_OPCODE_COS 36
-#define TGSI_OPCODE_DDX 37
-#define TGSI_OPCODE_DDY 38
-#define TGSI_OPCODE_KILL39 /* unconditional */
-#define TGSI_OPCODE_PK2H40
-#define TGSI_OPCODE_PK2US   41
-#define TGSI_OPCODE_PK4B42
-#define TGSI_OPCODE_PK4UB   43
-#define TGSI_OPCODE_D2U64   44
-#define TGSI_OPCODE_SEQ 45
-#define TGSI_OPCODE_D2I64   46
-#define TGSI_OPCODE_SGT 47
-#define TGSI_OPCODE_SIN 48
-#define TGSI_OPCODE_SLE 49
-#define TGSI_OPCODE_SNE 50
-#define TGSI_OPCODE_U642D   51
-#define TGSI_OPCODE_TEX 52
-#define TGSI_OPCODE_TXD 53
-#define TGSI_OPCODE_TXP 54
-#define TGSI_OPCODE_UP2H55
-#define TGSI_OPCODE_UP2US   56
-#define TGSI_OPCODE_UP4B57
-#define TGSI_OPCODE_UP4UB   58
-#define TGSI_OPCODE_U642F   59
-#define TGSI_OPCODE_I642F   60
-#define TGSI_OPCODE_ARR 61
-#define TGSI_OPCODE_I642D   62
-#define TGSI_OPCODE_CAL 63
-#define TGSI_OPCODE_RET 64
-#define TGSI_OPCODE_SSG 65 /* SGN */
-#define TGSI_OPCODE_CMP 66
-/* gap */
-#define TGSI_OPCODE_TXB 68
-#define TGSI_OPCODE_FBFETCH 69
-#define TGSI_OPCODE_DIV 70
-#define TGSI_OPCODE_DP2 71
-#define TGSI_OPCODE_TXL 72
-#define TGSI_OPCODE_BRK 73
-#define TGSI_OPCODE_IF  74
-#define TGSI_OPCODE_UIF 75
-#define TGSI_OPCODE_READ_INVOC  76
-#define TGSI_OPCODE_ELSE77
-#define TGSI_OPCODE_ENDIF   78
-
-#define TGSI_OPCODE_DDX_FINE79
-#define TGSI_OPCODE_DDY_FINE80
-/* gap */
-#define TGSI_OPCODE_CEIL83
-#define TGSI_OPCODE_I2F 84
-#define TGSI_OPCODE_NOT 85
-#define TGSI_OPCODE_TRUNC   86
-#define TGSI_OPCODE_SHL 87
-#define TGSI_OPCODE_BALLOT  88
-#define TGSI_OPCODE_AND 89
-#define TGSI_OPCODE_OR  90
-#define TGSI_OPCODE_MOD 91
-#define TGSI_OPCODE_XOR 92
-/* gap */
-#define TGSI_OPCODE_TXF 94
-#define TGSI_OPCODE_TXQ

Mesa (master): svga: let svga_update_state_retry() return a bool

2018-03-02 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 0a7deaa0d6d14fcc21cad08d9acae688ed7c9fcb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a7deaa0d6d14fcc21cad08d9acae688ed7c9fcb

Author: Brian Paul 
Date:   Thu Feb 22 09:32:33 2018 -0700

svga: let svga_update_state_retry() return a bool

This will allow minor simplifications elsewhere.

Reviewed-by: Charmaine Lee 
Reviewed-by: Neha Bhende 

---

 src/gallium/drivers/svga/svga_state.c | 11 ---
 src/gallium/drivers/svga/svga_state.h |  4 +---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state.c 
b/src/gallium/drivers/svga/svga_state.c
index 9ca6a18e0f..dad78389a2 100644
--- a/src/gallium/drivers/svga/svga_state.c
+++ b/src/gallium/drivers/svga/svga_state.c
@@ -237,19 +237,24 @@ done:
 }
 
 
-void
+/**
+ * Update state.  If the first attempt fails, flush the command buffer
+ * and retry.
+ * \return  true if success, false if second attempt fails.
+ */
+bool
 svga_update_state_retry(struct svga_context *svga, unsigned max_level)
 {
enum pipe_error ret;
 
ret = svga_update_state( svga, max_level );
 
-   if (ret == PIPE_ERROR_OUT_OF_MEMORY) {
+   if (ret != PIPE_OK) {
   svga_context_flush(svga, NULL);
   ret = svga_update_state( svga, max_level );
}
 
-   assert( ret == PIPE_OK );
+   return ret == PIPE_OK;
 }
 
 
diff --git a/src/gallium/drivers/svga/svga_state.h 
b/src/gallium/drivers/svga/svga_state.h
index 04b20e161f..d75617860e 100644
--- a/src/gallium/drivers/svga/svga_state.h
+++ b/src/gallium/drivers/svga/svga_state.h
@@ -91,9 +91,7 @@ extern struct svga_tracked_state svga_update_swtnl_vdecl;
 enum pipe_error svga_update_state( struct svga_context *svga,
unsigned level );
 
-void svga_update_state_retry( struct svga_context *svga,
-  unsigned level );
-
+bool svga_update_state_retry(struct svga_context *svga, unsigned level);
 
 enum pipe_error svga_emit_initial_state( struct svga_context *svga );
 

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


Mesa (master): svga: check svga_have_vgpu10() in svga_delete_blend_state()

2018-03-02 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b871a77316f301ae0262fb38036e3583c2a464c8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b871a77316f301ae0262fb38036e3583c2a464c8

Author: Brian Paul 
Date:   Thu Feb 22 13:22:11 2018 -0700

svga: check svga_have_vgpu10() in svga_delete_blend_state()

We were calling SVGA3D_vgpu10_DestroyBlendState() when vgpu10 was not
enabled (bs->id==0 by default), resulting in lots of device errors.

Reviewed-by: Neha Bhende

---

 src/gallium/drivers/svga/svga_pipe_blend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_blend.c 
b/src/gallium/drivers/svga/svga_pipe_blend.c
index a29fbd3ac2..04855fa7c9 100644
--- a/src/gallium/drivers/svga/svga_pipe_blend.c
+++ b/src/gallium/drivers/svga/svga_pipe_blend.c
@@ -361,7 +361,7 @@ static void svga_delete_blend_state(struct pipe_context 
*pipe,
struct svga_blend_state *bs =
   (struct svga_blend_state *) blend;
 
-   if (bs->id != SVGA3D_INVALID_ID) {
+   if (svga_have_vgpu10(svga) && bs->id != SVGA3D_INVALID_ID) {
   enum pipe_error ret;
 
   ret = SVGA3D_vgpu10_DestroyBlendState(svga->swc, bs->id);

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


Mesa (master): svga: fix blending regression

2018-03-02 Thread Brian Paul
Module: Mesa
Branch: master
Commit: dc79b8840248ccc1860ae740f16f0f5309191445
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc79b8840248ccc1860ae740f16f0f5309191445

Author: Brian Paul 
Date:   Wed Feb 21 21:00:38 2018 -0700

svga: fix blending regression

The earlier Mesa commit 3d06c8afb5 ("st/mesa: don't translate blend
state when it's disabled for a colorbuffer") subtly changed the
details of gallium's per-RT blend state.

In particular, when pipe_rt_blend_state[i].blend_enabled is true,
we have to get the src/dst blend terms from pipe_rt_blend_state[i],
not [0] as before.

We now have to scan the blend targets to find the first one that's
enabled (if any).  We have to use the index of that target for getting
the src/dst blend terms.  And note that we have to set identical blend
terms for all targets.

This fixes the Piglit fbo-drawbuffers2-blend test.  VMware bug 2063493.

Reviewed-by: Charmaine Lee 

---

 src/gallium/drivers/svga/svga_pipe_blend.c | 35 --
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_blend.c 
b/src/gallium/drivers/svga/svga_pipe_blend.c
index 04855fa7c9..6bb9d94369 100644
--- a/src/gallium/drivers/svga/svga_pipe_blend.c
+++ b/src/gallium/drivers/svga/svga_pipe_blend.c
@@ -148,6 +148,17 @@ svga_create_blend_state(struct pipe_context *pipe,
if (!blend)
   return NULL;
 
+   /* Find index of first target with blending enabled.  -1 means blending
+* is not enabled at all.
+*/
+   int first_enabled = -1;
+   for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+  if (templ->rt[i].blend_enable) {
+ first_enabled = i;
+ break;
+  }
+   }
+
/* Fill in the per-rendertarget blend state.  We currently only
 * support independent blend enable and colormask per render target.
 */
@@ -260,24 +271,26 @@ svga_create_blend_state(struct pipe_context *pipe,
  }
   }
   else {
- /* Note: the vgpu10 device does not yet support independent
-  * blend terms per render target.  Target[0] always specifies the
-  * blending terms.
+ /* Note: the vgpu10 device does not yet support independent blend
+  * terms per render target.  When blending is enabled, the blend
+  * terms must match for all targets.
   */
- if (templ->independent_blend_enable || templ->rt[0].blend_enable) {
-/* always use the 0th target's blending terms for now */
+ if (first_enabled >= 0) {
+/* use first enabled target's blending terms */
+const struct pipe_rt_blend_state *rt = &templ->rt[first_enabled];
+
 blend->rt[i].srcblend =
-   svga_translate_blend_factor(svga, templ->rt[0].rgb_src_factor);
+   svga_translate_blend_factor(svga, rt->rgb_src_factor);
 blend->rt[i].dstblend =
-   svga_translate_blend_factor(svga, templ->rt[0].rgb_dst_factor);
+   svga_translate_blend_factor(svga, rt->rgb_dst_factor);
 blend->rt[i].blendeq =
-   svga_translate_blend_func(templ->rt[0].rgb_func);
+   svga_translate_blend_func(rt->rgb_func);
 blend->rt[i].srcblend_alpha =
-   svga_translate_blend_factor(svga, 
templ->rt[0].alpha_src_factor);
+   svga_translate_blend_factor(svga, rt->alpha_src_factor);
 blend->rt[i].dstblend_alpha =
-   svga_translate_blend_factor(svga, 
templ->rt[0].alpha_dst_factor);
+   svga_translate_blend_factor(svga, rt->alpha_dst_factor);
 blend->rt[i].blendeq_alpha =
-   svga_translate_blend_func(templ->rt[0].alpha_func);
+   svga_translate_blend_func(rt->alpha_func);
 
 if (blend->rt[i].srcblend_alpha != blend->rt[i].srcblend ||
 blend->rt[i].dstblend_alpha != blend->rt[i].dstblend ||

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


Mesa (master): svga: add SVGA_NEW_PRESCALE to the tracked dirty mask for gs

2018-03-02 Thread Brian Paul
Module: Mesa
Branch: master
Commit: af8877af3b441947e94599a2af3e0fc50b912611
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=af8877af3b441947e94599a2af3e0fc50b912611

Author: Charmaine Lee 
Date:   Tue Feb 27 04:09:58 2018 -0800

svga: add SVGA_NEW_PRESCALE to the tracked dirty mask for gs

Since geometry shader also consumes prescale constants, the
geometry shader constant buffer will need to be updated when prescale
factor is changed.

Reviewed-by: Brian Paul 

---

 src/gallium/drivers/svga/svga_state_constants.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_state_constants.c 
b/src/gallium/drivers/svga/svga_state_constants.c
index 2a61e8e3d0..2c749c9338 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -810,7 +810,8 @@ emit_gs_consts(struct svga_context *svga, unsigned dirty)
 struct svga_tracked_state svga_hw_gs_constants =
 {
"hw gs params",
-   (SVGA_NEW_GS_CONST_BUFFER |
+   (SVGA_NEW_PRESCALE |
+SVGA_NEW_GS_CONST_BUFFER |
 SVGA_NEW_RAST |
 SVGA_NEW_GS_VARIANT),
emit_gs_consts

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


Mesa (master): svga: if svga_update_state() fails, skip the draw call

2018-03-02 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 72df3a7a3957a13c4a667ffb2295ced7b91e5620
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=72df3a7a3957a13c4a667ffb2295ced7b91e5620

Author: Brian Paul 
Date:   Wed Feb 21 13:57:39 2018 -0700

svga: if svga_update_state() fails, skip the draw call

If svga_update_state() fails, we flush the command buffer and retry.
If it fails again, it likely means we were unable to translate a shader
for some reason (uses too many resources, for example).  In that case,
let's just skip the draw call.  The alternative, just disabling the
shader stage in question, would certainly lead to bad rendering anyway,
and probably device errors.

Fixes failed assertion running Piglit glsl-1.50/execution/
variable-indexing/gs-output-array-vec4-index-wr.shader_test since it
uses too many GS output registers (though the test still fails).
VMware bug 2063492.

v2: also call pipe_debug_message() so apps or apitrace can be notified
when this issue occurs.
v3: use svga_update_state_retry().

Reviewed-by: Charmaine Lee 
Reviewed-by: Neha Bhende 

---

 src/gallium/drivers/svga/svga_pipe_draw.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c 
b/src/gallium/drivers/svga/svga_pipe_draw.c
index c73c406e69..ace1d2cb6f 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -203,11 +203,11 @@ svga_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
   ret = svga_swtnl_draw_vbo(svga, info, indexbuf, index_offset);
}
else {
-  ret = svga_update_state(svga, SVGA_STATE_HW_DRAW);
-  if (ret != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret = svga_update_state(svga, SVGA_STATE_HW_DRAW);
- assert(ret == PIPE_OK);
+  if (!svga_update_state_retry(svga, SVGA_STATE_HW_DRAW)) {
+ static const char *msg = "State update failed, skipping draw call";
+ debug_printf("%s\n", msg);
+ pipe_debug_message(&svga->debug.callback, INFO, "%s", msg);
+ goto done;
   }
 
   svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);

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


Mesa (master): svga: s/unsigned/boolean/ for a few local vars

2018-03-02 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 35c5cf895920a24062af73d108d20110c2057305
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=35c5cf895920a24062af73d108d20110c2057305

Author: Brian Paul 
Date:   Thu Feb 22 14:43:41 2018 -0700

svga: s/unsigned/boolean/ for a few local vars

Reviewed-by: Charmaine Lee 

---

 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 6b8337ccfd..b9b3d4fb3f 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -856,9 +856,9 @@ emit_dst_register(struct svga_shader_emitter_v10 *emit,
const enum tgsi_semantic sem_name = emit->info.output_semantic_name[index];
const unsigned sem_index = emit->info.output_semantic_index[index];
unsigned writemask = reg->Register.WriteMask;
-   const unsigned indirect = reg->Register.Indirect;
+   const boolean indirect = reg->Register.Indirect;
const unsigned tempArrayId = get_temp_array_id(emit, file, index);
-   const unsigned index2d = reg->Register.Dimension;
+   const boolean index2d = reg->Register.Dimension;
VGPU10OperandToken0 operand0;
 
if (file == TGSI_FILE_OUTPUT) {
@@ -971,15 +971,15 @@ emit_src_register(struct svga_shader_emitter_v10 *emit,
 {
enum tgsi_file_type file = reg->Register.File;
unsigned index = reg->Register.Index;
-   const unsigned indirect = reg->Register.Indirect;
+   const boolean indirect = reg->Register.Indirect;
const unsigned tempArrayId = get_temp_array_id(emit, file, index);
-   const unsigned index2d = reg->Register.Dimension;
+   const boolean index2d = reg->Register.Dimension;
const unsigned swizzleX = reg->Register.SwizzleX;
const unsigned swizzleY = reg->Register.SwizzleY;
const unsigned swizzleZ = reg->Register.SwizzleZ;
const unsigned swizzleW = reg->Register.SwizzleW;
-   const unsigned absolute = reg->Register.Absolute;
-   const unsigned negate = reg->Register.Negate;
+   const boolean absolute = reg->Register.Absolute;
+   const boolean negate = reg->Register.Negate;
bool is_prim_id = FALSE;
 
VGPU10OperandToken0 operand0;

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


Mesa (master): svga: replaced 'unsigned' with proper enum types in shader code

2018-02-20 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e7d1a9372309161d4faa06bcc2b38de021c9e398
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7d1a9372309161d4faa06bcc2b38de021c9e398

Author: Brian Paul 
Date:   Fri Feb 16 13:57:51 2018 -0700

svga: replaced 'unsigned' with proper enum types in shader code

Reviewed-by: Charmaine Lee 

---

 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 33 ++---
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 4d0834b3f6..6b8337ccfd 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -2053,11 +2053,15 @@ emit_decl_instruction(struct svga_shader_emitter_v10 
*emit,
  */
 static void
 emit_input_declaration(struct svga_shader_emitter_v10 *emit,
-   VGPU10_OPCODE_TYPE opcodeType, unsigned operandType,
-   unsigned dim, unsigned index, unsigned size,
-   unsigned name, unsigned numComp,
-   unsigned selMode, unsigned usageMask,
-   unsigned interpMode)
+   VGPU10_OPCODE_TYPE opcodeType,
+   VGPU10_OPERAND_TYPE operandType,
+   VGPU10_OPERAND_INDEX_DIMENSION dim,
+   unsigned index, unsigned size,
+   VGPU10_SYSTEM_NAME name,
+   VGPU10_OPERAND_NUM_COMPONENTS numComp,
+   VGPU10_OPERAND_4_COMPONENT_SELECTION_MODE selMode,
+   unsigned usageMask,
+   VGPU10_INTERPOLATION_MODE interpMode)
 {
VGPU10OpcodeToken0 opcode0;
VGPU10OperandToken0 operand0;
@@ -2117,8 +2121,9 @@ emit_input_declaration(struct svga_shader_emitter_v10 
*emit,
  */
 static void
 emit_output_declaration(struct svga_shader_emitter_v10 *emit,
-unsigned type, unsigned index,
-unsigned name, unsigned usageMask)
+VGPU10_OPCODE_TYPE type, unsigned index,
+VGPU10_SYSTEM_NAME name,
+unsigned usageMask)
 {
VGPU10OpcodeToken0 opcode0;
VGPU10OperandToken0 operand0;
@@ -2352,7 +2357,9 @@ emit_input_declarations(struct svga_shader_emitter_v10 
*emit)
  enum tgsi_semantic semantic_name = emit->info.input_semantic_name[i];
  unsigned usage_mask = emit->info.input_usage_mask[i];
  unsigned index = emit->linkage.input_map[i];
- unsigned type, interpolationMode, name;
+ VGPU10_OPCODE_TYPE type;
+ VGPU10_INTERPOLATION_MODE interpolationMode;
+ VGPU10_SYSTEM_NAME name;
 
  if (usage_mask == 0)
 continue;  /* register is not actually used */
@@ -2412,9 +2419,10 @@ emit_input_declarations(struct svga_shader_emitter_v10 
*emit)
  unsigned usage_mask = emit->info.input_usage_mask[i];
  unsigned index = emit->linkage.input_map[i];
  VGPU10_OPCODE_TYPE opcodeType, operandType;
- unsigned numComp, selMode;
- unsigned name;
- unsigned dim;
+ VGPU10_OPERAND_NUM_COMPONENTS numComp;
+ VGPU10_OPERAND_4_COMPONENT_SELECTION_MODE selMode;
+ VGPU10_SYSTEM_NAME name;
+ VGPU10_OPERAND_INDEX_DIMENSION dim;
 
  if (usage_mask == 0)
 continue;  /* register is not actually used */
@@ -2548,7 +2556,8 @@ emit_output_declarations(struct svga_shader_emitter_v10 
*emit)
   }
   else {
  /* VS or GS */
- unsigned name, type;
+ VGPU10_COMPONENT_NAME name;
+ VGPU10_OPCODE_TYPE type;
  unsigned writemask = VGPU10_OPERAND_4_COMPONENT_MASK_ALL;
 
  switch (semantic_name) {

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


Mesa (master): svga: replace gotos with else clauses

2018-02-15 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 64a1223a80560fae456dd62ea92936ee204aee27
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=64a1223a80560fae456dd62ea92936ee204aee27

Author: Brian Paul 
Date:   Thu Feb 15 09:12:03 2018 -0700

svga: replace gotos with else clauses

Simple clean-up.

Reviewed-by: Charmaine Lee 

---

 src/gallium/drivers/svga/svga_state_fs.c | 19 +--
 src/gallium/drivers/svga/svga_state_gs.c |  9 -
 src/gallium/drivers/svga/svga_state_vs.c | 15 +++
 3 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_fs.c 
b/src/gallium/drivers/svga/svga_state_fs.c
index eeb1ba60f6..5190542d02 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -383,18 +383,17 @@ svga_reemit_fs_bindings(struct svga_context *svga)
   ret =  svga->swc->resource_rebind(svga->swc, NULL,
 svga->state.hw_draw.fs->gb_shader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  if (svga_have_vgpu10(svga))
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS,
+   svga->state.hw_draw.fs->gb_shader,
+   svga->state.hw_draw.fs->id);
+  else
+ ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS,
+  svga->state.hw_draw.fs->gb_shader);
}
 
-   if (svga_have_vgpu10(svga))
-  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS,
-svga->state.hw_draw.fs->gb_shader,
-svga->state.hw_draw.fs->id);
-   else
-  ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS,
-   svga->state.hw_draw.fs->gb_shader);
-
- out:
if (ret != PIPE_OK)
   return ret;
 
diff --git a/src/gallium/drivers/svga/svga_state_gs.c 
b/src/gallium/drivers/svga/svga_state_gs.c
index 19f0887d2b..38d85f0325 100644
--- a/src/gallium/drivers/svga/svga_state_gs.c
+++ b/src/gallium/drivers/svga/svga_state_gs.c
@@ -153,13 +153,12 @@ svga_reemit_gs_bindings(struct svga_context *svga)
if (!svga_need_to_rebind_resources(svga)) {
   ret =  svga->swc->resource_rebind(svga->swc, NULL, gbshader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_GS,
+gbshader, shaderId);
}
 
-   ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_GS,
- gbshader, shaderId);
-
- out:
if (ret != PIPE_OK)
   return ret;
 
diff --git a/src/gallium/drivers/svga/svga_state_vs.c 
b/src/gallium/drivers/svga/svga_state_vs.c
index 3dfc9f451c..ad93f60048 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -227,16 +227,15 @@ svga_reemit_vs_bindings(struct svga_context *svga)
if (!svga_need_to_rebind_resources(svga)) {
   ret =  svga->swc->resource_rebind(svga->swc, NULL, gbshader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  if (svga_have_vgpu10(svga))
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS,
+   gbshader, shaderId);
+  else
+ ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader);
}
 
-   if (svga_have_vgpu10(svga))
-  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS,
-gbshader, shaderId);
-   else
-  ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader);
-
- out:
if (ret != PIPE_OK)
   return ret;
 

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


Mesa (master): svga: move duplicated code for setting fillmode/flatshade state

2018-02-15 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 8b54299c344d9fd35118fab50efa136f8971a7cc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8b54299c344d9fd35118fab50efa136f8971a7cc

Author: Brian Paul 
Date:   Wed Feb 14 09:37:27 2018 -0800

svga: move duplicated code for setting fillmode/flatshade state

Move the calls to svga_hwtnl_set_fillmode() and svga_hwtnl_set_flatshade()
out of the two retry_draw_*() functions to the svga_draw_vbo() function.

Reviewed-by: Charmaine Lee 

---

 src/gallium/drivers/svga/svga_pipe_draw.c | 30 ++
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c 
b/src/gallium/drivers/svga/svga_pipe_draw.c
index af538819ea..c73c406e69 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -64,16 +64,6 @@ retry_draw_range_elements(struct svga_context *svga,
 
SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_DRAWELEMENTS);
 
-   svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
-
-   /** determine if flatshade is to be used after svga_update_state()
-*  in case the fragment shader is changed.
-*/
-   svga_hwtnl_set_flatshade(svga->hwtnl,
-svga->curr.rast->templ.flatshade ||
-is_using_flat_shading(svga),
-svga->curr.rast->templ.flatshade_first);
-
for (unsigned try = 0; try < 2; try++) {
   ret = svga_hwtnl_draw_range_elements(svga->hwtnl,
index_buffer, index_size,
@@ -100,16 +90,6 @@ retry_draw_arrays(struct svga_context *svga,
 
SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_DRAWARRAYS);
 
-   svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
-
-   /** determine if flatshade is to be used after svga_update_state()
-*  in case the fragment shader is changed.
-*/
-   svga_hwtnl_set_flatshade(svga->hwtnl,
-svga->curr.rast->templ.flatshade ||
-is_using_flat_shading(svga),
-svga->curr.rast->templ.flatshade_first);
-
for (unsigned try = 0; try < 2; try++) {
   ret = svga_hwtnl_draw_arrays(svga->hwtnl, prim, start, count,
start_instance, instance_count);
@@ -230,6 +210,16 @@ svga_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
  assert(ret == PIPE_OK);
   }
 
+  svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
+
+  /** determine if flatshade is to be used after svga_update_state()
+   *  in case the fragment shader is changed.
+   */
+  svga_hwtnl_set_flatshade(svga->hwtnl,
+   svga->curr.rast->templ.flatshade ||
+   is_using_flat_shading(svga),
+   svga->curr.rast->templ.flatshade_first);
+
   if (info->index_size && indexbuf) {
  unsigned offset;
 

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


Mesa (master): svga: s/unsigned/enum pipe_shader_type/

2018-02-15 Thread Brian Paul
Module: Mesa
Branch: master
Commit: fa901768a4442e2376d03a57603bf2ca4bd1f490
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa901768a4442e2376d03a57603bf2ca4bd1f490

Author: Brian Paul 
Date:   Wed Feb 14 14:53:42 2018 -0700

svga: s/unsigned/enum pipe_shader_type/

Reviewed-by: Neha Bhende 

---

 src/gallium/drivers/svga/svga_tgsi.c| 3 ++-
 src/gallium/drivers/svga/svga_tgsi.h| 5 +++--
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi.c 
b/src/gallium/drivers/svga/svga_tgsi.c
index 0b2d8af64d..8819313fb5 100644
--- a/src/gallium/drivers/svga/svga_tgsi.c
+++ b/src/gallium/drivers/svga/svga_tgsi.c
@@ -168,7 +168,8 @@ svga_shader_emit_header(struct svga_shader_emitter *emit)
 struct svga_shader_variant *
 svga_tgsi_vgpu9_translate(struct svga_context *svga,
   const struct svga_shader *shader,
-  const struct svga_compile_key *key, unsigned unit)
+  const struct svga_compile_key *key,
+  enum pipe_shader_type unit)
 {
struct svga_shader_variant *variant = NULL;
struct svga_shader_emitter emit;
diff --git a/src/gallium/drivers/svga/svga_tgsi.h 
b/src/gallium/drivers/svga/svga_tgsi.h
index 2581135701..e98601127f 100644
--- a/src/gallium/drivers/svga/svga_tgsi.h
+++ b/src/gallium/drivers/svga/svga_tgsi.h
@@ -65,13 +65,14 @@ static inline void svga_generate_vdecl_semantics( unsigned 
idx,
 struct svga_shader_variant *
 svga_tgsi_vgpu9_translate(struct svga_context *svga,
   const struct svga_shader *shader,
-  const struct svga_compile_key *key, unsigned unit);
+  const struct svga_compile_key *key,
+  enum pipe_shader_type unit);
 
 struct svga_shader_variant *
 svga_tgsi_vgpu10_translate(struct svga_context *svga,
const struct svga_shader *shader,
const struct svga_compile_key *key,
-   unsigned unit);
+   enum pipe_shader_type unit);
 
 boolean svga_shader_verify(const uint32_t *tokens, unsigned nr_tokens);
 
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 73aa78b748..4d0834b3f6 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -6484,7 +6484,7 @@ struct svga_shader_variant *
 svga_tgsi_vgpu10_translate(struct svga_context *svga,
const struct svga_shader *shader,
const struct svga_compile_key *key,
-   unsigned unit)
+   enum pipe_shader_type unit)
 {
struct svga_shader_variant *variant = NULL;
struct svga_shader_emitter_v10 *emit;

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


Mesa (master): svga: call tgsi_scan_shader() for dummy shaders

2018-02-15 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6f0aec5671a1efd374f517d3f9e4b0ff1c4c4709
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f0aec5671a1efd374f517d3f9e4b0ff1c4c4709

Author: Brian Paul 
Date:   Wed Feb 14 13:50:00 2018 -0700

svga: call tgsi_scan_shader() for dummy shaders

If we fail to compile the normal VS or FS we fall back to a simple/
dummy shader.  We need to rescan the the shader to update the shader
info.  Otherwise, this can lead to further translations failures
because the shader info doesn't match the actual shader.

Found by adding some extra debug assertions in the state-update code
while debugging something else.

v2: also update shader generic_inputs/outputs, etc. per Charmaine

Reviewed-by: Charmaine Lee 

---

 src/gallium/drivers/svga/svga_state_fs.c | 4 
 src/gallium/drivers/svga/svga_state_vs.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/gallium/drivers/svga/svga_state_fs.c 
b/src/gallium/drivers/svga/svga_state_fs.c
index 5e568993fe..eeb1ba60f6 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -115,6 +115,10 @@ get_compiled_dummy_shader(struct svga_context *svga,
FREE((void *) fs->base.tokens);
fs->base.tokens = dummy;
 
+   tgsi_scan_shader(fs->base.tokens, &fs->base.info);
+   fs->generic_inputs = svga_get_generic_inputs_mask(&fs->base.info);
+   svga_remap_generics(fs->generic_inputs, fs->generic_remap_table);
+
variant = translate_fragment_program(svga, fs, key);
return variant;
 }
diff --git a/src/gallium/drivers/svga/svga_state_vs.c 
b/src/gallium/drivers/svga/svga_state_vs.c
index a0ab868cbb..3dfc9f451c 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -105,6 +105,9 @@ get_compiled_dummy_vertex_shader(struct svga_context *svga,
FREE((void *) vs->base.tokens);
vs->base.tokens = dummy;
 
+   tgsi_scan_shader(vs->base.tokens, &vs->base.info);
+   vs->generic_outputs = svga_get_generic_outputs_mask(&vs->base.info);
+
variant = translate_vertex_program(svga, vs, key);
return variant;
 }

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


Mesa (master): svga: move svga_update_state() call in draw code

2018-02-15 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 072df89a796f549cc0ad90ce3dcbc9ad5c58d892
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=072df89a796f549cc0ad90ce3dcbc9ad5c58d892

Author: Brian Paul 
Date:   Wed Feb 14 09:33:58 2018 -0800

svga: move svga_update_state() call in draw code

This fixes a few Piglit transform feedback regressions caused by
commit 7a1401938b351.

In that change I moved the moved svga_update_state() into the loops,
after the calls to svga_hwtnl_set_flatshade().  But
svga_hwtnl_set_flatshade() actually depends on some derived shader
state.  This patch moves the svga_update_state() call into
svga_draw_vbo() so it's not duplicated in two places.

Fixes: 7a1401938b351 ("svga: clean up retry_draw_range_elements(),
retry_draw_arrays()")

Reviewed-by: Charmaine Lee 

---

 src/gallium/drivers/svga/svga_pipe_draw.c | 37 ---
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c 
b/src/gallium/drivers/svga/svga_pipe_draw.c
index ee4a1057ad..af538819ea 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -75,17 +75,14 @@ retry_draw_range_elements(struct svga_context *svga,
 svga->curr.rast->templ.flatshade_first);
 
for (unsigned try = 0; try < 2; try++) {
-  ret = svga_update_state(svga, SVGA_STATE_HW_DRAW);
-  if (ret == PIPE_OK) {
- ret = svga_hwtnl_draw_range_elements(svga->hwtnl,
-  index_buffer, index_size,
-  index_bias,
-  min_index, max_index,
-  prim, start, count,
-  start_instance, instance_count);
- if (ret == PIPE_OK)
-break;
-  }
+  ret = svga_hwtnl_draw_range_elements(svga->hwtnl,
+   index_buffer, index_size,
+   index_bias,
+   min_index, max_index,
+   prim, start, count,
+   start_instance, instance_count);
+  if (ret == PIPE_OK)
+ break;
   svga_context_flush(svga, NULL);
}
 
@@ -114,13 +111,10 @@ retry_draw_arrays(struct svga_context *svga,
 svga->curr.rast->templ.flatshade_first);
 
for (unsigned try = 0; try < 2; try++) {
-  ret = svga_update_state(svga, SVGA_STATE_HW_DRAW);
-  if (ret == PIPE_OK) {
- ret = svga_hwtnl_draw_arrays(svga->hwtnl, prim, start, count,
-  start_instance, instance_count);
- if (ret == PIPE_OK)
-break;
-  }
+  ret = svga_hwtnl_draw_arrays(svga->hwtnl, prim, start, count,
+   start_instance, instance_count);
+  if (ret == PIPE_OK)
+ break;
   svga_context_flush(svga, NULL);
}
 
@@ -229,6 +223,13 @@ svga_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
   ret = svga_swtnl_draw_vbo(svga, info, indexbuf, index_offset);
}
else {
+  ret = svga_update_state(svga, SVGA_STATE_HW_DRAW);
+  if (ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = svga_update_state(svga, SVGA_STATE_HW_DRAW);
+ assert(ret == PIPE_OK);
+  }
+
   if (info->index_size && indexbuf) {
  unsigned offset;
 

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


Mesa (master): mesa: add glsl version query (v4)

2018-02-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: a553c54abf92533daf442073dd3408c35f57d8ba
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a553c54abf92533daf442073dd3408c35f57d8ba

Author: Vadym Shovkoplias 
Date:   Tue Feb 13 11:38:22 2018 -0700

mesa: add glsl version query (v4)

Add support for GL_NUM_SHADING_LANGUAGE_VERSIONS
and glGetStringi for GL_SHADING_LANGUAGE_VERSION

v2:
  - Combine similar functionality into
_mesa_get_shading_language_version() function.
  - Change GLSL version return mechanism.
v3:
  - Add return of empty string for GLSL ver 1.10.
  - Move _mesa_get_shading_language_version() function
to src/mesa/main/version.c.
v4:
  - Add OpenGL version check.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104915
Signed-off-by: Andriy Khulap 
Signed-off-by: Vadym Shovkoplias 
Reviewed-by: Brian Paul 

---

 src/mapi/glapi/gen/GL4x.xml  |  1 +
 src/mesa/main/get.c  | 11 +++
 src/mesa/main/get_hash_params.py |  3 ++
 src/mesa/main/getstring.c| 20 +
 src/mesa/main/version.c  | 64 
 src/mesa/main/version.h  |  5 
 6 files changed, 104 insertions(+)

diff --git a/src/mapi/glapi/gen/GL4x.xml b/src/mapi/glapi/gen/GL4x.xml
index cd2e3b831e..2116286b35 100644
--- a/src/mapi/glapi/gen/GL4x.xml
+++ b/src/mapi/glapi/gen/GL4x.xml
@@ -42,6 +42,7 @@
 
 
   
+  
   
   
   
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 57a211856c..13d5e857ab 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -143,6 +143,7 @@ enum value_extra {
EXTRA_VERSION_31,
EXTRA_VERSION_32,
EXTRA_VERSION_40,
+   EXTRA_VERSION_43,
EXTRA_API_GL,
EXTRA_API_GL_CORE,
EXTRA_API_ES2,
@@ -522,6 +523,7 @@ extra_NV_primitive_restart[] = {
 static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };
 static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };
 static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
+static const int extra_version_43[] = { EXTRA_VERSION_43, EXTRA_END };
 
 static const int extra_gl30_es3[] = {
 EXTRA_VERSION_30,
@@ -1084,6 +1086,10 @@ find_custom_value(struct gl_context *ctx, const struct 
value_desc *d, union valu
  v->value_int = 0;
   }
   break;
+   /* GL 4.3 */
+   case GL_NUM_SHADING_LANGUAGE_VERSIONS:
+  v->value_int = _mesa_get_shading_language_version(ctx, -1, NULL);
+  break;
/* GL_ARB_draw_indirect */
case GL_DRAW_INDIRECT_BUFFER_BINDING:
   v->value_int = ctx->DrawIndirectBuffer->Name;
@@ -1229,6 +1235,11 @@ check_extra(struct gl_context *ctx, const char *func, 
const struct value_desc *d
  if (version >= 40)
 api_found = GL_TRUE;
  break;
+  case EXTRA_VERSION_43:
+ api_check = TRUE;
+ if (_mesa_is_desktop_gl(ctx) && version >= 43)
+api_found = GL_TRUE;
+ break;
   case EXTRA_NEW_FRAG_CLAMP:
  if (ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
 _mesa_update_state(ctx);
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index e127b6bdb2..5d2afedc43 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -543,6 +543,9 @@ descriptor=[
 
   # GL_ARB_texture_cube_map_array
   [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, 
TEXTURE_CUBE_ARRAY_INDEX, 
extra_ARB_texture_cube_map_array_OES_texture_cube_map_array" ],
+
+  # GL_NUM_SHADING_LANGUAGE_VERSIONS
+  [ "NUM_SHADING_LANGUAGE_VERSIONS", "LOC_CUSTOM, TYPE_INT, 0, 
extra_version_43" ],
 ]},
 
 # Enums in OpenGL Core profile and ES 3.0
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index 931f6a476c..3d5ae0b694 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -32,6 +32,7 @@
 #include "extensions.h"
 #include "mtypes.h"
 #include "macros.h"
+#include "version.h"
 
 /**
  * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query.
@@ -186,6 +187,25 @@ _mesa_GetStringi(GLenum name, GLuint index)
  return (const GLubyte *) 0;
   }
   return _mesa_get_enabled_extension(ctx, index);
+   case GL_SHADING_LANGUAGE_VERSION:
+  {
+ char *version;
+ int num;
+ if (!_mesa_is_desktop_gl(ctx) || ctx->Version < 43) {
+_mesa_error(ctx, GL_INVALID_ENUM,
+"glGetStringi(GL_SHADING_LANGUAGE_VERSION): "
+"supported only in GL4.3 and later");
+return (const GLubyte *) 0;
+ }
+ num = _mesa_get_shading_language_version(ctx, index, &version);
+ if (index >= num) {
+_mesa_error(ctx, GL_INVALID_VALUE,
+"glGetStringi(GL_SHADING_LANGUAGE_VERSION, index=%d)",
+index);

Mesa (master): mesa: add missing switch case for EXTRA_VERSION_40 in check_extra()

2018-02-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b08d718703bc907d9cb99887f90ea80d7e91dc45
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b08d718703bc907d9cb99887f90ea80d7e91dc45

Author: Brian Paul 
Date:   Tue Feb 13 09:21:45 2018 -0700

mesa: add missing switch case for EXTRA_VERSION_40 in check_extra()

The EXTRA_VERSION_40 predicate is tested as part of
extra_gl40_ARB_sample_shading but there was no switch case for it.

Fixes: 77b440e42d8e7247c2295 ("mesa: Add new functions and enums required
by GL_ARB_sample_shading")
Reviewed-by: Eric Engestrom 

---

 src/mesa/main/get.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 218801791e..57a211856c 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1224,6 +1224,11 @@ check_extra(struct gl_context *ctx, const char *func, 
const struct value_desc *d
  if (version >= 32)
 api_found = GL_TRUE;
  break;
+  case EXTRA_VERSION_40:
+ api_check = GL_TRUE;
+ if (version >= 40)
+api_found = GL_TRUE;
+ break;
   case EXTRA_NEW_FRAG_CLAMP:
  if (ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
 _mesa_update_state(ctx);

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


Mesa (master): gallium/util: s/uint/enum tgsi_semantic/ in simple shader code

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 26948ba761e04e74a5d15a3115117b9954a4fcbb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=26948ba761e04e74a5d15a3115117b9954a4fcbb

Author: Brian Paul 
Date:   Wed Feb  7 18:28:34 2018 -0700

gallium/util: s/uint/enum tgsi_semantic/ in simple shader code

Reviewed-by: Mathias Fröhlich 
Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/util/u_simple_shaders.c | 4 ++--
 src/gallium/auxiliary/util/u_simple_shaders.h | 4 ++--
 src/gallium/auxiliary/util/u_tests.c  | 2 +-
 src/gallium/tests/trivial/quad-tex.c  | 4 ++--
 src/gallium/tests/trivial/tri.c   | 8 
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c 
b/src/gallium/auxiliary/util/u_simple_shaders.c
index bd5a97f7bf..4046ab1202 100644
--- a/src/gallium/auxiliary/util/u_simple_shaders.c
+++ b/src/gallium/auxiliary/util/u_simple_shaders.c
@@ -59,7 +59,7 @@
 void *
 util_make_vertex_passthrough_shader(struct pipe_context *pipe,
 uint num_attribs,
-const uint *semantic_names,
+const enum tgsi_semantic *semantic_names,
 const uint *semantic_indexes,
 bool window_space)
 {
@@ -72,7 +72,7 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
 void *
 util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe,
 uint num_attribs,
-const uint *semantic_names,
+const enum tgsi_semantic *semantic_names,
 const uint *semantic_indexes,
 bool window_space, bool layered,
const struct pipe_stream_output_info *so)
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.h 
b/src/gallium/auxiliary/util/u_simple_shaders.h
index cec556f05c..3afe4cc050 100644
--- a/src/gallium/auxiliary/util/u_simple_shaders.h
+++ b/src/gallium/auxiliary/util/u_simple_shaders.h
@@ -47,14 +47,14 @@ extern "C" {
 extern void *
 util_make_vertex_passthrough_shader(struct pipe_context *pipe,
 uint num_attribs,
-const uint *semantic_names,
+const enum tgsi_semantic *semantic_names,
 const uint *semantic_indexes,
 bool window_space);
 
 extern void *
 util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe,
 uint num_attribs,
-const uint *semantic_names,
+const enum tgsi_semantic *semantic_names,
 const uint *semantic_indexes,
 bool window_space, bool layered,
 const struct pipe_stream_output_info *so);
diff --git a/src/gallium/auxiliary/util/u_tests.c 
b/src/gallium/auxiliary/util/u_tests.c
index e8599e3203..86eee6e68b 100644
--- a/src/gallium/auxiliary/util/u_tests.c
+++ b/src/gallium/auxiliary/util/u_tests.c
@@ -147,7 +147,7 @@ util_set_passthrough_vertex_shader(struct cso_context *cso,
struct pipe_context *ctx,
bool window_space)
 {
-   static const uint vs_attribs[] = {
+   static const enum tgsi_semantic vs_attribs[] = {
   TGSI_SEMANTIC_POSITION,
   TGSI_SEMANTIC_GENERIC
};
diff --git a/src/gallium/tests/trivial/quad-tex.c 
b/src/gallium/tests/trivial/quad-tex.c
index 2ee544a412..df0e1301f5 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -263,8 +263,8 @@ static void init_prog(struct program *p)
 
/* vertex shader */
{
-   const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
-   TGSI_SEMANTIC_GENERIC };
+   const enum tgsi_semantic semantic_names[] =
+   { TGSI_SEMANTIC_POSITION, TGSI_SEMANTIC_GENERIC };
const uint semantic_indexes[] = { 0, 0 };
p->vs = util_make_vertex_passthrough_shader(p->pipe, 2, 
semantic_names, semantic_indexes, FALSE);
}
diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
index a2031696f0..71e9702275 100644
--- a/src/gallium/tests/trivial/tri.c
+++ b/src/gallium/tests/trivial/tri.c
@@ -208,10 +208,10 @@ static void init_prog(struct program *p)
 
/* vertex shader */
{
-   const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
-   TGSI_SEMANTIC_COLOR };
-   const uint semantic_in

Mesa (master): gallium/util: s/uint/enum tgsi_semantic/ in u_blitter.c

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c0dc337ecd7d785e8693cfcb772f49f856975bf0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c0dc337ecd7d785e8693cfcb772f49f856975bf0

Author: Brian Paul 
Date:   Wed Feb  7 16:14:11 2018 -0700

gallium/util: s/uint/enum tgsi_semantic/ in u_blitter.c

And put static qualifier on const arrays.

Reviewed-by: Mathias Fröhlich 
Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/util/u_blitter.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 057411fb3f..63d1307b83 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -333,7 +333,8 @@ static void bind_vs_pos_only(struct blitter_context_priv 
*ctx,
 
if (!ctx->vs_pos_only[index]) {
   struct pipe_stream_output_info so;
-  const uint semantic_names[] = { TGSI_SEMANTIC_POSITION };
+  static const enum tgsi_semantic semantic_names[] =
+ { TGSI_SEMANTIC_POSITION };
   const uint semantic_indices[] = { 0 };
 
   memset(&so, 0, sizeof(so));
@@ -356,8 +357,8 @@ static void *get_vs_passthrough_pos_generic(struct 
blitter_context *blitter)
struct pipe_context *pipe = ctx->base.pipe;
 
if (!ctx->vs) {
-  const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
-  TGSI_SEMANTIC_GENERIC };
+  static const enum tgsi_semantic semantic_names[] =
+ { TGSI_SEMANTIC_POSITION, TGSI_SEMANTIC_GENERIC };
   const uint semantic_indices[] = { 0, 0 };
   ctx->vs =
  util_make_vertex_passthrough_shader(pipe, 2, semantic_names,
@@ -372,7 +373,8 @@ static void *get_vs_passthrough_pos(struct blitter_context 
*blitter)
struct pipe_context *pipe = ctx->base.pipe;
 
if (!ctx->vs_nogeneric) {
-  const uint semantic_names[] = { TGSI_SEMANTIC_POSITION };
+  static const enum tgsi_semantic semantic_names[] =
+ { TGSI_SEMANTIC_POSITION };
   const uint semantic_indices[] = { 0 };
 
   ctx->vs_nogeneric =

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


Mesa (master): vbo: add a comment on vbo_draw_transform_feedback()

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b9ff185e41e2d310f70182fca06a9140a79e07ad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b9ff185e41e2d310f70182fca06a9140a79e07ad

Author: Brian Paul 
Date:   Wed Feb  7 16:12:35 2018 -0700

vbo: add a comment on vbo_draw_transform_feedback()

Reviewed-by: Mathias Fröhlich 
Reviewed-by: Roland Scheidegger 

---

 src/mesa/vbo/vbo_exec_array.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 9ce0aa38dc..25abe09559 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -1416,6 +1416,14 @@ vbo_exec_MultiDrawElementsBaseVertex(GLenum mode,
 }
 
 
+/**
+ * Draw a GL primitive using a vertex count obtained from transform feedback.
+ * \param mode  the type of GL primitive to draw
+ * \param obj  the transform feedback object to use
+ * \param stream  index of the transform feedback stream from which to
+ *get the primitive count.
+ * \param numInstances  number of instances to draw
+ */
 static void
 vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
 struct gl_transform_feedback_object *obj,

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


Mesa (master): gallium/util: trivial whitespace/formatting fixes in u_blit.c

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 93b3d381768b405e06f1327f03ee807696d9aab0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=93b3d381768b405e06f1327f03ee807696d9aab0

Author: Brian Paul 
Date:   Wed Feb  7 09:28:16 2018 -0700

gallium/util: trivial whitespace/formatting fixes in u_blit.c

Reviewed-by: Mathias Fröhlich 
Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/util/u_blit.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blit.c 
b/src/gallium/auxiliary/util/u_blit.c
index 4c85ef2a8c..d1571cd1f5 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -28,7 +28,7 @@
 /**
  * @file
  * Copy/blit pixel rect between surfaces
- *  
+ *
  * @author Brian Paul
  */
 
@@ -180,12 +180,12 @@ set_fragment_shader(struct blit_state *ctx,
   assert(stype == TGSI_RETURN_TYPE_FLOAT);
   idx = 3;
   if (!ctx->fs[pipe_tex][idx]) {
- enum tgsi_texture_type tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 
0);
+ enum tgsi_texture_type tgsi_tex =
+util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
  ctx->fs[pipe_tex][idx] =
 util_make_fragment_tex_shader_xrbias(ctx->pipe, tgsi_tex);
   }
}
-
else if (!ctx->fs[pipe_tex][idx]) {
   enum tgsi_texture_type tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
 
@@ -228,7 +228,7 @@ set_vertex_shader(struct blit_state *ctx)
  * Get offset of next free slot in vertex buffer for quad vertices.
  */
 static unsigned
-get_next_slot( struct blit_state *ctx )
+get_next_slot(struct blit_state *ctx)
 {
const unsigned max_slots = 4096 / sizeof ctx->vertices;
 
@@ -243,7 +243,7 @@ get_next_slot( struct blit_state *ctx )
  PIPE_USAGE_STREAM,
  max_slots * sizeof ctx->vertices);
}
-   
+
return ctx->vbuf_slot++ * sizeof ctx->vertices;
 }
 
@@ -298,14 +298,15 @@ setup_vertex_data_tex(struct blit_state *ctx,
if (src_target == PIPE_TEXTURE_CUBE ||
src_target == PIPE_TEXTURE_CUBE_ARRAY) {
   /* Map cubemap texture coordinates inplace. */
-  const unsigned stride = sizeof ctx->vertices[0] / sizeof 
ctx->vertices[0][0][0];
+  const unsigned stride =
+ sizeof ctx->vertices[0] / sizeof ctx->vertices[0][0][0];
   util_map_texcoords2d_onto_cubemap(src_face,
 &ctx->vertices[0][1][0], stride,
 &ctx->vertices[0][1][0], stride,
 TRUE);
}
 
-   offset = get_next_slot( ctx );
+   offset = get_next_slot(ctx);
 
if (ctx->vbuf) {
   pipe_buffer_write_nooverlap(ctx->pipe, ctx->vbuf,
@@ -536,8 +537,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
t0 = (float) srcY0;
t1 = (float) srcY1;
 
-   if(normalized)
-   {
+   if (normalized) {
   /* normalize according to the mipmap level's size */
   int level = src_sampler_view->u.tex.first_level;
   float w = (float) u_minify(tex->width0, level);

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


Mesa (master): tgsi: s/unsigned/enum pipe_shader_type/ in ureg code

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 0f40f4ffdae7b9cc5b9cb32a9373ab95ebee4383
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f40f4ffdae7b9cc5b9cb32a9373ab95ebee4383

Author: Brian Paul 
Date:   Wed Feb  7 18:18:39 2018 -0700

tgsi: s/unsigned/enum pipe_shader_type/ in ureg code

And add a default switch case to silence a compiler warning.

Reviewed-by: Mathias Fröhlich 
Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c | 9 ++---
 src/gallium/auxiliary/tgsi/tgsi_ureg.h | 5 +++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index b3f8b1e14e..b2cc45da63 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -107,7 +107,7 @@ struct hw_atomic_decl {
 
 struct ureg_program
 {
-   unsigned processor;
+   enum pipe_shader_type processor;
bool supports_any_inout_decl_range;
int next_shader_processor;
 
@@ -2070,6 +2070,8 @@ const struct tgsi_token *ureg_finalize( struct 
ureg_program *ureg )
PIPE_SHADER_FRAGMENT :
ureg->next_shader_processor);
   break;
+   default:
+  ; /* nothing */
}
 
emit_header( ureg );
@@ -2163,14 +2165,15 @@ void ureg_free_tokens( const struct tgsi_token *tokens )
 
 
 struct ureg_program *
-ureg_create(unsigned processor)
+ureg_create(enum pipe_shader_type processor)
 {
return ureg_create_with_screen(processor, NULL);
 }
 
 
 struct ureg_program *
-ureg_create_with_screen(unsigned processor, struct pipe_screen *screen)
+ureg_create_with_screen(enum pipe_shader_type processor,
+struct pipe_screen *screen)
 {
int i;
struct ureg_program *ureg = CALLOC_STRUCT( ureg_program );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 03496896aa..e8ebae9435 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -93,10 +93,11 @@ struct ureg_dst
 struct pipe_context;
 
 struct ureg_program *
-ureg_create(unsigned processor);
+ureg_create(enum pipe_shader_type processor);
 
 struct ureg_program *
-ureg_create_with_screen(unsigned processor, struct pipe_screen *screen);
+ureg_create_with_screen(enum pipe_shader_type processor,
+struct pipe_screen *screen);
 
 const struct tgsi_token *
 ureg_finalize( struct ureg_program * );

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


Mesa (master): st/mesa: rename some vars related to indirect draw count

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 5cf342704d4a481845f2f7c921dda5df5cf5a256
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5cf342704d4a481845f2f7c921dda5df5cf5a256

Author: Brian Paul 
Date:   Wed Jan 31 15:01:09 2018 -0700

st/mesa: rename some vars related to indirect draw count

'indirect_params' was a bit vague.  Use the names that we use in
gallium's pipe_draw_indirect_info.

Reviewed-by: Mathias Fröhlich 
Reviewed-by: Roland Scheidegger 

---

 src/mesa/state_tracker/st_draw.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 2fe7070bca..b95a2522b2 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -235,8 +235,8 @@ st_indirect_draw_vbo(struct gl_context *ctx,
  GLsizeiptr indirect_offset,
  unsigned draw_count,
  unsigned stride,
- struct gl_buffer_object *indirect_params,
- GLsizeiptr indirect_params_offset,
+ struct gl_buffer_object *indirect_draw_count,
+ GLsizeiptr indirect_draw_count_offset,
  const struct _mesa_index_buffer *ib)
 {
struct st_context *st = st_context(ctx);
@@ -283,7 +283,7 @@ st_indirect_draw_vbo(struct gl_context *ctx,
if (!st->has_multi_draw_indirect) {
   int i;
 
-  assert(!indirect_params);
+  assert(!indirect_draw_count);
   indirect.draw_count = 1;
   for (i = 0; i < draw_count; i++) {
  info.drawid = i;
@@ -293,9 +293,10 @@ st_indirect_draw_vbo(struct gl_context *ctx,
} else {
   indirect.draw_count = draw_count;
   indirect.stride = stride;
-  if (indirect_params) {
- indirect.indirect_draw_count = 
st_buffer_object(indirect_params)->buffer;
- indirect.indirect_draw_count_offset = indirect_params_offset;
+  if (indirect_draw_count) {
+ indirect.indirect_draw_count =
+st_buffer_object(indirect_draw_count)->buffer;
+ indirect.indirect_draw_count_offset = indirect_draw_count_offset;
   }
   cso_draw_vbo(st->cso_context, &info);
}

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


Mesa (master): st/mesa: s/unsigned/enum tgsi_semantic/ st_cb_drawpixels.c

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e55de6e20cb8854be0af8afd50eea12f84ff9d49
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e55de6e20cb8854be0af8afd50eea12f84ff9d49

Author: Brian Paul 
Date:   Wed Feb  7 16:12:59 2018 -0700

st/mesa: s/unsigned/enum tgsi_semantic/ st_cb_drawpixels.c

Reviewed-by: Mathias Fröhlich 
Reviewed-by: Roland Scheidegger 

---

 src/mesa/state_tracker/st_cb_drawpixels.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c 
b/src/mesa/state_tracker/st_cb_drawpixels.c
index 44f5b235c8..ddf6926332 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -196,7 +196,7 @@ static void *
 make_passthrough_vertex_shader(struct st_context *st, 
GLboolean passColor)
 {
-   const unsigned texcoord_semantic = st->needs_texcoord_semantic ?
+   const enum tgsi_semantic texcoord_semantic = st->needs_texcoord_semantic ?
   TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
 
if (!st->drawpix.vert_shaders[passColor]) {

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


Mesa (master): tgsi: s/unsigned/enum tgsi_semantic/ in ureg_DECL_output()

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4b0a45da25a5b49b927e6139528bbf74eec9a9ff
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b0a45da25a5b49b927e6139528bbf74eec9a9ff

Author: Brian Paul 
Date:   Thu Feb  8 09:54:52 2018 -0700

tgsi: s/unsigned/enum tgsi_semantic/ in ureg_DECL_output()

So the function matches the prototype.  Found with clang.
v2: fix copy&paste error

Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 40a047a255..41281dabc4 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -486,7 +486,7 @@ ureg_DECL_output_masked(struct ureg_program *ureg,
 
 struct ureg_dst 
 ureg_DECL_output(struct ureg_program *ureg,
- unsigned name,
+ enum tgsi_semantic name,
  unsigned index)
 {
return ureg_DECL_output_masked(ureg, name, index, TGSI_WRITEMASK_XYZW,

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


Mesa (master): gallium/util: silence clang warning in blitter code

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 11e92889aa0476ea39c5f0c46864d0960dc7354b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=11e92889aa0476ea39c5f0c46864d0960dc7354b

Author: Brian Paul 
Date:   Thu Feb  8 10:00:21 2018 -0700

gallium/util: silence clang warning in blitter code

Silence "warning: comparison of constant 4294967295 with expression
of type 'ubyte'".

Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/util/u_blitter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 63d1307b83..98c3ac5df3 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -659,7 +659,7 @@ void util_blitter_restore_fragment_states(struct 
blitter_context *blitter)
 
 static void blitter_check_saved_fb_state(MAYBE_UNUSED struct 
blitter_context_priv *ctx)
 {
-   assert(ctx->base.saved_fb_state.nr_cbufs != ~0u);
+   assert(ctx->base.saved_fb_state.nr_cbufs != (ubyte) ~0);
 }
 
 static void blitter_disable_render_cond(struct blitter_context_priv *ctx)

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


Mesa (master): cso: add a couple sanity check assertions in cso_draw_vbo()

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b03ade55b9fbb48b87123b2bd34a6c24ceb2b5b1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b03ade55b9fbb48b87123b2bd34a6c24ceb2b5b1

Author: Brian Paul 
Date:   Tue Feb  6 15:33:37 2018 -0700

cso: add a couple sanity check assertions in cso_draw_vbo()

Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/cso_cache/cso_context.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c 
b/src/gallium/auxiliary/cso_cache/cso_context.c
index dd9821e828..1b5d4b5598 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -1686,6 +1686,12 @@ cso_draw_vbo(struct cso_context *cso,
 {
struct u_vbuf *vbuf = cso->vbuf;
 
+   /* We can't have both indirect drawing and SO-vertex-count drawing */
+   assert(info->indirect == NULL || info->count_from_stream_output == NULL);
+
+   /* We can't have SO-vertex-count drawing with an index buffer */
+   assert(info->count_from_stream_output == NULL || info->index_size == 0);
+
if (vbuf) {
   u_vbuf_draw_vbo(vbuf, info);
} else {

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


Mesa (master): vbo: improve comments on vbo_draw_func()

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 5396f8546a559d3439f1099b14a566b12354f9b7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5396f8546a559d3439f1099b14a566b12354f9b7

Author: Brian Paul 
Date:   Tue Feb  6 15:35:30 2018 -0700

vbo: improve comments on vbo_draw_func()

And rename a parameter name.

Reviewed-by: Mathias Fröhlich 
Reviewed-by: Roland Scheidegger 

---

 src/mesa/vbo/vbo.h | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index a04f9b849c..d594ba8f6a 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -149,9 +149,10 @@ vbo_save_EndCallList(struct gl_context *ctx);
  * \param index_bounds_valid  are min_index and max_index valid?
  * \param min_index  lowest vertex index used
  * \param max_index  highest vertex index used
- * \param tfb_vertcount  describes TFB output, or NULL
- * \param stream  If called via DrawTransformFeedback, specifies the vertex
- *stream buffer from which to get the vertex count
+ * \param tfb_vertcount  if non-null, indicates which transform feedback
+ *   object has the vertex count.
+ * \param tfb_stream  If called via DrawTransformFeedbackStream, specifies the
+ *vertex stream buffer from which to get the vertex count.
  * \param indirect  If any prims are indirect, this specifies the buffer
  *  to find the "DrawArrays/ElementsIndirectCommand" data.
  *  This may be deprecated in the future
@@ -164,7 +165,7 @@ typedef void (*vbo_draw_func)(struct gl_context *ctx,
   GLuint min_index,
   GLuint max_index,
   struct gl_transform_feedback_object 
*tfb_vertcount,
-  unsigned stream,
+  unsigned tfb_stream,
   struct gl_buffer_object *indirect);
 
 

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


Mesa (master): tgsi: use TGSI_INTERPOLATE_x arguments instead of zeros in ureg code

2018-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d95c2d86cc095d73759b4db1b2689013af66f622
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d95c2d86cc095d73759b4db1b2689013af66f622

Author: Brian Paul 
Date:   Wed Feb  7 18:29:12 2018 -0700

tgsi: use TGSI_INTERPOLATE_x arguments instead of zeros in ureg code

TGSI_INTERPOLATE_CONSTANT and TGSI_INTERPOLATE_LOC_CENTER have the
value zero so there's no change in behavior.  It seems funny to
declare these fs input registers with constant interpolation.  But
it looks like ureg_DECL_input_layout() is not called anywhere and
ureg_DECL_input() is only called from
util_make_geometry_passthrough_shader().

Reviewed-by: Mathias Fröhlich 
Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index b2cc45da63..40a047a255 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -371,7 +371,8 @@ ureg_DECL_input_layout(struct ureg_program *ureg,
 unsigned array_size)
 {
return ureg_DECL_fs_input_cyl_centroid_layout(ureg,
-   semantic_name, semantic_index, 0, 0, 0,
+   semantic_name, semantic_index,
+   TGSI_INTERPOLATE_CONSTANT, 0, TGSI_INTERPOLATE_LOC_CENTER,
index, usage_mask, array_id, array_size);
 }
 
@@ -384,7 +385,9 @@ ureg_DECL_input(struct ureg_program *ureg,
 unsigned array_size)
 {
return ureg_DECL_fs_input_cyl_centroid(ureg, semantic_name, semantic_index,
-  0, 0, 0, array_id, array_size);
+  TGSI_INTERPOLATE_CONSTANT, 0,
+  TGSI_INTERPOLATE_LOC_CENTER,
+  array_id, array_size);
 }
 
 

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


Mesa (master): st/mesa: use TGSI enum types in st_glsl_to_tgsi.cpp

2018-02-07 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 9f9ce1625fb32ff0b9d5b1858aa5bb7b531ded0f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f9ce1625fb32ff0b9d5b1858aa5bb7b531ded0f

Author: Brian Paul 
Date:   Tue Feb  6 22:10:59 2018 -0700

st/mesa: use TGSI enum types in st_glsl_to_tgsi.cpp

Reviewed-by: Roland Scheidegger 

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index c92b1d9077..5e1674c915 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -191,7 +191,7 @@ public:
glsl_base_type sampler_types[PIPE_MAX_SAMPLERS];
enum tgsi_texture_type sampler_targets[PIPE_MAX_SAMPLERS];
int images_used;
-   int image_targets[PIPE_MAX_SHADER_IMAGES];
+   enum tgsi_texture_type image_targets[PIPE_MAX_SHADER_IMAGES];
enum pipe_format image_formats[PIPE_MAX_SHADER_IMAGES];
bool indirect_addr_consts;
int wpos_transform_const;
@@ -5863,7 +5863,7 @@ compile_tgsi_instruction(struct st_translate *t,
 
int num_dst;
int num_src;
-   unsigned tex_target = 0;
+   enum tgsi_texture_type tex_target;
 
num_dst = num_inst_dst_regs(inst);
num_src = num_inst_src_regs(inst);
@@ -6249,7 +6249,7 @@ sort_inout_decls_by_slot(struct inout_decl *decls,
std::sort(decls, decls + count, sorter);
 }
 
-static unsigned
+static enum tgsi_interpolate_mode
 st_translate_interp(enum glsl_interp_mode glsl_qual, GLuint varying)
 {
switch (glsl_qual) {
@@ -6367,15 +6367,15 @@ st_translate_program(
tgsi_usage_mask = TGSI_WRITEMASK_XYZW;
  }
 
- unsigned interp_mode = 0;
- unsigned interp_location = 0;
+ enum tgsi_interpolate_mode interp_mode = TGSI_INTERPOLATE_CONSTANT;
+ enum tgsi_interpolate_loc interp_location = 
TGSI_INTERPOLATE_LOC_CENTER;
  if (procType == PIPE_SHADER_FRAGMENT) {
 assert(interpMode);
 interp_mode = interpMode[slot] != TGSI_INTERPOLATE_COUNT ?
-   interpMode[slot] :
+   (enum tgsi_interpolate_mode) interpMode[slot] :
st_translate_interp(decl->interp, inputSlotToAttr[slot]);
 
-interp_location = decl->interp_loc;
+interp_location = (enum tgsi_interpolate_loc) decl->interp_loc;
  }
 
  src = ureg_DECL_fs_input_cyl_centroid_layout(ureg,

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


Mesa (master): gallium/util: replace unsigned with tgsi enum types

2018-02-07 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 15874338ff9ec4fe356c975351c1a0e7e82325fc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=15874338ff9ec4fe356c975351c1a0e7e82325fc

Author: Brian Paul 
Date:   Tue Feb  6 21:54:38 2018 -0700

gallium/util: replace unsigned with tgsi enum types

Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/util/u_simple_shaders.c | 36 ++-
 src/gallium/auxiliary/util/u_simple_shaders.h | 29 ++---
 2 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c 
b/src/gallium/auxiliary/util/u_simple_shaders.c
index 0b444045c4..bd5a97f7bf 100644
--- a/src/gallium/auxiliary/util/u_simple_shaders.c
+++ b/src/gallium/auxiliary/util/u_simple_shaders.c
@@ -202,7 +202,8 @@ void *util_make_layered_clear_geometry_shader(struct 
pipe_context *pipe)
 static void
 ureg_load_tex(struct ureg_program *ureg, struct ureg_dst out,
   struct ureg_src coord, struct ureg_src sampler,
-  unsigned tex_target, bool load_level_zero, bool use_txf)
+  enum tgsi_texture_type tex_target,
+  bool load_level_zero, bool use_txf)
 {
if (use_txf) {
   struct ureg_dst temp = ureg_DECL_temporary(ureg);
@@ -277,14 +278,14 @@ util_make_fragment_tex_shader_xrbias(struct pipe_context 
*pipe,
  *  MOV OUT[0], TEMP[0]
  *  END;
  *
- * \param tex_target  one of PIPE_TEXTURE_x
+ * \param tex_target  one of TGSI_TEXTURE_x
  * \parma interp_mode  either TGSI_INTERPOLATE_LINEAR or PERSPECTIVE
  * \param writemask  mask of TGSI_WRITEMASK_x
  */
 void *
 util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
-unsigned tex_target,
-unsigned interp_mode,
+enum tgsi_texture_type tex_target,
+enum tgsi_interpolate_mode interp_mode,
 unsigned writemask,
 enum tgsi_return_type stype,
 enum tgsi_return_type dtype,
@@ -357,11 +358,12 @@ util_make_fragment_tex_shader_writemask(struct 
pipe_context *pipe,
 /**
  * Make a simple fragment shader that sets the output color to a color
  * taken from a texture.
- * \param tex_target  one of PIPE_TEXTURE_x
+ * \param tex_target  one of TGSI_TEXTURE_x
  */
 void *
-util_make_fragment_tex_shader(struct pipe_context *pipe, unsigned tex_target,
-  unsigned interp_mode,
+util_make_fragment_tex_shader(struct pipe_context *pipe,
+  enum tgsi_texture_type tex_target,
+  enum tgsi_interpolate_mode interp_mode,
   enum tgsi_return_type stype,
   enum tgsi_return_type dtype,
   bool load_level_zero,
@@ -382,8 +384,8 @@ util_make_fragment_tex_shader(struct pipe_context *pipe, 
unsigned tex_target,
  */
 void *
 util_make_fragment_tex_shader_writedepth(struct pipe_context *pipe,
- unsigned tex_target,
- unsigned interp_mode,
+ enum tgsi_texture_type tex_target,
+ enum tgsi_interpolate_mode 
interp_mode,
  bool load_level_zero,
  bool use_txf)
 {
@@ -435,10 +437,10 @@ util_make_fragment_tex_shader_writedepth(struct 
pipe_context *pipe,
  */
 void *
 util_make_fragment_tex_shader_writedepthstencil(struct pipe_context *pipe,
-unsigned tex_target,
-unsigned interp_mode,
-bool load_level_zero,
-bool use_txf)
+ enum tgsi_texture_type tex_target,
+ enum tgsi_interpolate_mode 
interp_mode,
+ bool load_level_zero,
+ bool use_txf)
 {
struct ureg_program *ureg;
struct ureg_src depth_sampler, stencil_sampler;
@@ -499,10 +501,10 @@ util_make_fragment_tex_shader_writedepthstencil(struct 
pipe_context *pipe,
  */
 void *
 util_make_fragment_tex_shader_writestencil(struct pipe_context *pipe,
-   unsigned tex_target,
-   unsigned interp_mode,
-   bool load_level_zero,
-   bool use_txf)
+ enum tgsi_texture_type tex_target,
+ enum tgsi_interpolate_mode 
interp_mode

Mesa (master): tgsi: use TGSI enum types in ureg code

2018-02-07 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 0f7be4fc168b757a86159a5b1aa0ec5560bfe70d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f7be4fc168b757a86159a5b1aa0ec5560bfe70d

Author: Brian Paul 
Date:   Tue Feb  6 22:11:41 2018 -0700

tgsi: use TGSI enum types in ureg code

v2: fix enum tgsi_interpolate_mode/loc typo.

Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c | 62 ++
 src/gallium/auxiliary/tgsi/tgsi_ureg.h | 44 
 2 files changed, 55 insertions(+), 51 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 4f3ac97ad4..bb7da4b074 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -114,10 +114,10 @@ struct ureg_program
struct {
   unsigned semantic_name;
   unsigned semantic_index;
-  unsigned interp;
+  enum tgsi_interpolate_mode interp;
   unsigned char cylindrical_wrap;
   unsigned char usage_mask;
-  unsigned interp_location;
+  enum tgsi_interpolate_loc interp_location;
   unsigned first;
   unsigned last;
   unsigned array_id;
@@ -159,17 +159,17 @@ struct ureg_program
 
struct {
   unsigned index;
-  unsigned target;
-  unsigned return_type_x;
-  unsigned return_type_y;
-  unsigned return_type_z;
-  unsigned return_type_w;
+  enum tgsi_texture_type target;
+  enum tgsi_return_type return_type_x;
+  enum tgsi_return_type return_type_y;
+  enum tgsi_return_type return_type_z;
+  enum tgsi_return_type return_type_w;
} sampler_view[PIPE_MAX_SHADER_SAMPLER_VIEWS];
unsigned nr_sampler_views;
 
struct {
   unsigned index;
-  unsigned target;
+  enum tgsi_texture_type target;
   unsigned format;
   boolean wr;
   boolean raw;
@@ -283,9 +283,9 @@ struct ureg_src
 ureg_DECL_fs_input_cyl_centroid_layout(struct ureg_program *ureg,
unsigned semantic_name,
unsigned semantic_index,
-   unsigned interp_mode,
+   enum tgsi_interpolate_mode interp_mode,
unsigned cylindrical_wrap,
-   unsigned interp_location,
+   enum tgsi_interpolate_loc interp_location,
unsigned index,
unsigned usage_mask,
unsigned array_id,
@@ -336,14 +336,15 @@ struct ureg_src
 ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg,
unsigned semantic_name,
unsigned semantic_index,
-   unsigned interp_mode,
+   enum tgsi_interpolate_mode interp_mode,
unsigned cylindrical_wrap,
-   unsigned interp_location,
+   enum tgsi_interpolate_loc interp_location,
unsigned array_id,
unsigned array_size)
 {
return ureg_DECL_fs_input_cyl_centroid_layout(ureg,
- semantic_name, semantic_index, interp_mode, cylindrical_wrap, 
interp_location,
+ semantic_name, semantic_index, interp_mode,
+ cylindrical_wrap, interp_location,
  ureg->nr_input_regs, TGSI_WRITEMASK_XYZW, array_id, array_size);
 }
 
@@ -733,11 +734,11 @@ struct ureg_src ureg_DECL_sampler( struct ureg_program 
*ureg,
 struct ureg_src
 ureg_DECL_sampler_view(struct ureg_program *ureg,
unsigned index,
-   unsigned target,
-   unsigned return_type_x,
-   unsigned return_type_y,
-   unsigned return_type_z,
-   unsigned return_type_w)
+   enum tgsi_texture_type target,
+   enum tgsi_return_type return_type_x,
+   enum tgsi_return_type return_type_y,
+   enum tgsi_return_type return_type_z,
+   enum tgsi_return_type return_type_w)
 {
struct ureg_src reg = ureg_src_register(TGSI_FILE_SAMPLER_VIEW, index);
uint i;
@@ -768,7 +769,7 @@ ureg_DECL_sampler_view(struct ureg_program *ureg,
 struct ureg_src
 ureg_DECL_image(struct ureg_program *ureg,
 unsigned index,
-unsigned target,
+enum tgsi_texture_type target,
 unsigned format,
 boolean wr,
 boolean raw)
@@ -1326,7 +1327,8 @@ ureg_fixup_label(struct ureg_program *ureg,
 void
 ureg_emit_texture(struct ureg_program *ureg,
   unsigned extended_token,
-  unsigned target, unsigned return_type, unsigned num_offsets)
+  enum tgsi_texture_type target,
+  enum tgsi_return_type return_type, unsigned num_offsets)
 {
union tgsi_any_token *out, *insn;
 
@@ -1425,8 +1427,8 @@ ureg_tex_insn(struct ureg_prog

Mesa (master): st/mesa: use tgsi_semantic enum type

2018-02-07 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 174f3a4ab7ca331ac10e10938d958a84acd68dde
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=174f3a4ab7ca331ac10e10938d958a84acd68dde

Author: Brian Paul 
Date:   Tue Feb  6 22:16:41 2018 -0700

st/mesa: use tgsi_semantic enum type

Reviewed-by: Roland Scheidegger 

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 10 ++
 src/mesa/state_tracker/st_glsl_to_tgsi.h   |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 5e1674c915..39a81fad62 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5456,7 +5456,7 @@ struct st_translate {
 };
 
 /** Map Mesa's SYSTEM_VALUE_x to TGSI_SEMANTIC_x */
-unsigned
+enum tgsi_semantic
 _mesa_sysval_to_semantic(unsigned sysval)
 {
switch (sysval) {
@@ -6379,7 +6379,8 @@ st_translate_program(
  }
 
  src = ureg_DECL_fs_input_cyl_centroid_layout(ureg,
-  inputSemanticName[slot], inputSemanticIndex[slot],
+  (enum tgsi_semantic) inputSemanticName[slot],
+  inputSemanticIndex[slot],
   interp_mode, 0, interp_location, slot, tgsi_usage_mask,
   decl->array_id, decl->size);
 
@@ -6433,7 +6434,8 @@ st_translate_program(
  }
 
  dst = ureg_DECL_output_layout(ureg,
- outputSemanticName[slot], outputSemanticIndex[slot],
+ (enum tgsi_semantic) outputSemanticName[slot],
+ outputSemanticIndex[slot],
  decl->gs_out_streams,
  slot, tgsi_usage_mask, decl->array_id, decl->size);
 
@@ -6535,7 +6537,7 @@ st_translate_program(
 
   for (i = 0; sysInputs; i++) {
  if (sysInputs & (1 << i)) {
-unsigned semName = _mesa_sysval_to_semantic(i);
+enum tgsi_semantic semName = _mesa_sysval_to_semantic(i);
 
 t->systemValues[i] = ureg_DECL_system_value(ureg, semName, 0);
 
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.h 
b/src/mesa/state_tracker/st_glsl_to_tgsi.h
index 37dfdb3c14..f38d41d6c7 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.h
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.h
@@ -23,6 +23,7 @@
  */
 
 #include "pipe/p_defines.h"
+#include "pipe/p_shader_tokens.h"
 #include "main/mtypes.h"
 
 #ifdef __cplusplus
@@ -66,7 +67,7 @@ st_translate_stream_output_info2(struct 
gl_transform_feedback_info *info,
 const ubyte outputMapping[],
 struct pipe_stream_output_info *so);
 
-unsigned
+enum tgsi_semantic
 _mesa_sysval_to_semantic(unsigned sysval);
 
 #ifdef __cplusplus

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


Mesa (master): gallium/util: replace uint with tgsi enum types

2018-02-07 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6321b1bd4005fcd05b2f1e6d16a974dba97f9415
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6321b1bd4005fcd05b2f1e6d16a974dba97f9415

Author: Brian Paul 
Date:   Tue Feb  6 21:55:10 2018 -0700

gallium/util: replace uint with tgsi enum types

Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/util/u_blit.c | 9 +
 src/gallium/auxiliary/util/u_blit.h | 4 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blit.c 
b/src/gallium/auxiliary/util/u_blit.c
index de39422e32..4c85ef2a8c 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -187,7 +187,7 @@ set_fragment_shader(struct blit_state *ctx,
}
 
else if (!ctx->fs[pipe_tex][idx]) {
-  unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
+  enum tgsi_texture_type tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
 
   /* OpenGL does not allow blits from signed to unsigned integer
* or vice versa. */
@@ -259,7 +259,7 @@ get_next_slot( struct blit_state *ctx )
  */
 static unsigned
 setup_vertex_data_tex(struct blit_state *ctx,
-  unsigned src_target,
+  enum pipe_texture_target src_target,
   unsigned src_face,
   float x0, float y0, float x1, float y1,
   float s0, float t0, float s1, float t1,
@@ -380,7 +380,8 @@ util_blit_pixels(struct blit_state *ctx,
  struct pipe_surface *dst,
  int dstX0, int dstY0,
  int dstX1, int dstY1,
- MAYBE_UNUSED float z, uint filter,
+ MAYBE_UNUSED float z,
+ enum pipe_tex_filter filter,
  uint writemask)
 {
struct pipe_context *pipe = ctx->pipe;
@@ -514,7 +515,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
  struct pipe_surface *dst,
  int dstX0, int dstY0,
  int dstX1, int dstY1,
- float z, uint filter,
+ float z, enum pipe_tex_filter filter,
  boolean src_xrbias)
 {
boolean normalized = src_sampler_view->texture->target != PIPE_TEXTURE_RECT;
diff --git a/src/gallium/auxiliary/util/u_blit.h 
b/src/gallium/auxiliary/util/u_blit.h
index e2934d0983..085ea63570 100644
--- a/src/gallium/auxiliary/util/u_blit.h
+++ b/src/gallium/auxiliary/util/u_blit.h
@@ -60,7 +60,7 @@ util_blit_pixels(struct blit_state *ctx,
  struct pipe_surface *dst,
  int dstX0, int dstY0,
  int dstX1, int dstY1,
- float z, uint filter,
+ float z, enum pipe_tex_filter filter,
  uint writemask);
 
 extern void
@@ -72,7 +72,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
  struct pipe_surface *dst,
  int dstX0, int dstY0,
  int dstX1, int dstY1,
- float z, uint filter,
+ float z, enum pipe_tex_filter filter,
  boolean src_xrbias);
 
 #ifdef __cplusplus

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


Mesa (master): tgsi: use tgsi_semantic enum type in ureg code

2018-02-07 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b99cb13002e8ac19da2b7a1a5e9a36b35156e385
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b99cb13002e8ac19da2b7a1a5e9a36b35156e385

Author: Brian Paul 
Date:   Tue Feb  6 22:17:10 2018 -0700

tgsi: use tgsi_semantic enum type in ureg code

Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c | 24 
 src/gallium/auxiliary/tgsi/tgsi_ureg.h | 22 +++---
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index bb7da4b074..b3f8b1e14e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -112,7 +112,7 @@ struct ureg_program
int next_shader_processor;
 
struct {
-  unsigned semantic_name;
+  enum tgsi_semantic semantic_name;
   unsigned semantic_index;
   enum tgsi_interpolate_mode interp;
   unsigned char cylindrical_wrap;
@@ -127,13 +127,13 @@ struct ureg_program
unsigned vs_inputs[PIPE_MAX_ATTRIBS/32];
 
struct {
-  unsigned semantic_name;
+  enum tgsi_semantic semantic_name;
   unsigned semantic_index;
} system_value[UREG_MAX_SYSTEM_VALUE];
unsigned nr_system_values;
 
struct {
-  unsigned semantic_name;
+  enum tgsi_semantic semantic_name;
   unsigned semantic_index;
   unsigned streams;
   unsigned usage_mask; /* = TGSI_WRITEMASK_* */
@@ -281,7 +281,7 @@ ureg_property(struct ureg_program *ureg, unsigned name, 
unsigned value)
 
 struct ureg_src
 ureg_DECL_fs_input_cyl_centroid_layout(struct ureg_program *ureg,
-   unsigned semantic_name,
+   enum tgsi_semantic semantic_name,
unsigned semantic_index,
enum tgsi_interpolate_mode interp_mode,
unsigned cylindrical_wrap,
@@ -334,7 +334,7 @@ out:
 
 struct ureg_src
 ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg,
-   unsigned semantic_name,
+   enum tgsi_semantic semantic_name,
unsigned semantic_index,
enum tgsi_interpolate_mode interp_mode,
unsigned cylindrical_wrap,
@@ -363,7 +363,7 @@ ureg_DECL_vs_input( struct ureg_program *ureg,
 
 struct ureg_src
 ureg_DECL_input_layout(struct ureg_program *ureg,
-unsigned semantic_name,
+enum tgsi_semantic semantic_name,
 unsigned semantic_index,
 unsigned index,
 unsigned usage_mask,
@@ -378,7 +378,7 @@ ureg_DECL_input_layout(struct ureg_program *ureg,
 
 struct ureg_src
 ureg_DECL_input(struct ureg_program *ureg,
-unsigned semantic_name,
+enum tgsi_semantic semantic_name,
 unsigned semantic_index,
 unsigned array_id,
 unsigned array_size)
@@ -390,7 +390,7 @@ ureg_DECL_input(struct ureg_program *ureg,
 
 struct ureg_src
 ureg_DECL_system_value(struct ureg_program *ureg,
-   unsigned semantic_name,
+   enum tgsi_semantic semantic_name,
unsigned semantic_index)
 {
unsigned i;
@@ -418,7 +418,7 @@ out:
 
 struct ureg_dst
 ureg_DECL_output_layout(struct ureg_program *ureg,
-unsigned semantic_name,
+enum tgsi_semantic semantic_name,
 unsigned semantic_index,
 unsigned streams,
 unsigned index,
@@ -492,7 +492,7 @@ ureg_DECL_output(struct ureg_program *ureg,
 
 struct ureg_dst
 ureg_DECL_output_array(struct ureg_program *ureg,
-   unsigned semantic_name,
+   enum tgsi_semantic semantic_name,
unsigned semantic_index,
unsigned array_id,
unsigned array_size)
@@ -1505,7 +1505,7 @@ emit_decl_semantic(struct ureg_program *ureg,
unsigned file,
unsigned first,
unsigned last,
-   unsigned semantic_name,
+   enum tgsi_semantic semantic_name,
unsigned semantic_index,
unsigned streams,
unsigned usage_mask,
@@ -1574,7 +1574,7 @@ emit_decl_fs(struct ureg_program *ureg,
  unsigned file,
  unsigned first,
  unsigned last,
- unsigned semantic_name,
+ enum tgsi_semantic semantic_name,
  unsigned semantic_index,
  enum tgsi_interpolate_mode interpolate,
  unsigned cylindrical_wrap,
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 2bab23dc4f..03496896aa 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h

Mesa (master): mesa: rename gl_vertex_array_object::_VertexAttrib -> _VertexArray

2018-02-06 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e7a4536e648b37f10a4501f9d295be70b8900269
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7a4536e648b37f10a4501f9d295be70b8900269

Author: Brian Paul 
Date:   Mon Feb  5 09:33:58 2018 -0700

mesa: rename gl_vertex_array_object::_VertexAttrib -> _VertexArray

Since the type is gl_vertex_array.  Update comment to explain that
these arrays are only used by the VBO module.

Also rename some local variables in _mesa_update_vao_derived_arrays().

Reviewed-by: Mathias Fröhlich 

---

 src/mesa/main/arrayobj.c  | 13 ++---
 src/mesa/main/attrib.c|  2 +-
 src/mesa/main/mtypes.h|  4 ++--
 src/mesa/vbo/vbo_exec_array.c |  2 +-
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 360d097ec1..a6fa33c82c 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -283,8 +283,8 @@ unbind_array_object_vbos(struct gl_context *ctx, struct 
gl_vertex_array_object *
for (i = 0; i < ARRAY_SIZE(obj->BufferBinding); i++)
   _mesa_reference_buffer_object(ctx, &obj->BufferBinding[i].BufferObj, 
NULL);
 
-   for (i = 0; i < ARRAY_SIZE(obj->_VertexAttrib); i++)
-  _mesa_reference_buffer_object(ctx, &obj->_VertexAttrib[i].BufferObj, 
NULL);
+   for (i = 0; i < ARRAY_SIZE(obj->_VertexArray); i++)
+  _mesa_reference_buffer_object(ctx, &obj->_VertexArray[i].BufferObj, 
NULL);
 }
 
 
@@ -453,14 +453,13 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx,
 
while (arrays) {
   const int attrib = u_bit_scan(&arrays);
-  struct gl_vertex_array *client_array = &vao->_VertexAttrib[attrib];
-  const struct gl_array_attributes *attrib_array =
+  struct gl_vertex_array *array = &vao->_VertexArray[attrib];
+  const struct gl_array_attributes *attribs =
  &vao->VertexAttrib[attrib];
   const struct gl_vertex_buffer_binding *buffer_binding =
- &vao->BufferBinding[attrib_array->BufferBindingIndex];
+ &vao->BufferBinding[attribs->BufferBindingIndex];
 
-  _mesa_update_vertex_array(ctx, client_array, attrib_array,
-buffer_binding);
+  _mesa_update_vertex_array(ctx, array, attribs, buffer_binding);
}
 }
 
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index a9e4a11d7d..8ac5db062f 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1503,7 +1503,7 @@ copy_array_object(struct gl_context *ctx,
/* skip RefCount */
 
for (i = 0; i < ARRAY_SIZE(src->VertexAttrib); i++) {
-  _mesa_copy_vertex_array(ctx, &dest->_VertexAttrib[i], 
&src->_VertexAttrib[i]);
+  _mesa_copy_vertex_array(ctx, &dest->_VertexArray[i], 
&src->_VertexArray[i]);
   _mesa_copy_vertex_attrib_array(ctx, &dest->VertexAttrib[i], 
&src->VertexAttrib[i]);
   _mesa_copy_vertex_buffer_binding(ctx, &dest->BufferBinding[i], 
&src->BufferBinding[i]);
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b6d606386e..4d6b771411 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1603,9 +1603,9 @@ struct gl_vertex_array_object
 * Derived vertex attribute arrays
 *
 * This is a legacy data structure created from gl_array_attributes and
-* gl_vertex_buffer_binding, for compatibility with existing driver code.
+* gl_vertex_buffer_binding, only used by the VBO module at this time.
 */
-   struct gl_vertex_array _VertexAttrib[VERT_ATTRIB_MAX];
+   struct gl_vertex_array _VertexArray[VERT_ATTRIB_MAX];
 
/** Vertex attribute arrays */
struct gl_array_attributes VertexAttrib[VERT_ATTRIB_MAX];
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index b30e044a87..9ce0aa38dc 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -332,7 +332,7 @@ recalculate_input_bindings(struct gl_context *ctx)
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
const struct gl_vertex_array_object *vao = ctx->Array.VAO;
-   const struct gl_vertex_array *vertexAttrib = vao->_VertexAttrib;
+   const struct gl_vertex_array *vertexAttrib = vao->_VertexArray;
const struct gl_vertex_array **inputs = &exec->array.inputs[0];
 
/* May shuffle the position and generic0 bits around */

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


Mesa (master): st/mesa: refactor st_bufferobj_map_range()

2018-02-06 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1852a2e1a2113b69cf4662acd7533da144837084
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1852a2e1a2113b69cf4662acd7533da144837084

Author: Brian Paul 
Date:   Fri Feb  2 08:54:19 2018 -0700

st/mesa: refactor st_bufferobj_map_range()

Use a new helper function, st_access_flags_to_transfer_flags(), to
convert the GL_MAP_x flags to PIPE_TRANSFER_x flags.

We'll be able to use this function in a couple other places.

Reviewed-by: Marek Olšák 

---

 src/mesa/state_tracker/st_cb_bufferobjects.c | 38 
 src/mesa/state_tracker/st_cb_bufferobjects.h |  4 +++
 2 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c 
b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 6b64ba132c..044916b4dc 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -427,17 +427,13 @@ st_bufferobj_invalidate(struct gl_context *ctx,
 
 
 /**
- * Called via glMapBufferRange().
+ * Convert GLbitfield of GL_MAP_x flags to gallium pipe_transfer_usage flags.
+ * \param wholeBuffer  is the whole buffer being mapped?
  */
-static void *
-st_bufferobj_map_range(struct gl_context *ctx,
-   GLintptr offset, GLsizeiptr length, GLbitfield access,
-   struct gl_buffer_object *obj,
-   gl_map_buffer_index index)
+enum pipe_transfer_usage
+st_access_flags_to_transfer_flags(GLbitfield access, bool wholeBuffer)
 {
-   struct pipe_context *pipe = st_context(ctx)->pipe;
-   struct st_buffer_object *st_obj = st_buffer_object(obj);
-   enum pipe_transfer_usage flags = 0x0;
+   enum pipe_transfer_usage flags = 0;
 
if (access & GL_MAP_WRITE_BIT)
   flags |= PIPE_TRANSFER_WRITE;
@@ -452,7 +448,7 @@ st_bufferobj_map_range(struct gl_context *ctx,
   flags |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
}
else if (access & GL_MAP_INVALIDATE_RANGE_BIT) {
-  if (offset == 0 && length == obj->Size)
+  if (wholeBuffer)
  flags |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
   else
  flags |= PIPE_TRANSFER_DISCARD_RANGE;
@@ -473,15 +469,35 @@ st_bufferobj_map_range(struct gl_context *ctx,
if (access & MESA_MAP_NOWAIT_BIT)
   flags |= PIPE_TRANSFER_DONTBLOCK;
 
+   return flags;
+}
+
+
+/**
+ * Called via glMapBufferRange().
+ */
+static void *
+st_bufferobj_map_range(struct gl_context *ctx,
+   GLintptr offset, GLsizeiptr length, GLbitfield access,
+   struct gl_buffer_object *obj,
+   gl_map_buffer_index index)
+{
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+
assert(offset >= 0);
assert(length >= 0);
assert(offset < obj->Size);
assert(offset + length <= obj->Size);
 
+   const enum pipe_transfer_usage transfer_flags =
+  st_access_flags_to_transfer_flags(access,
+offset == 0 && length == obj->Size);
+
obj->Mappings[index].Pointer = pipe_buffer_map_range(pipe,
 st_obj->buffer,
 offset, length,
-flags,
+transfer_flags,
 
&st_obj->transfer[index]);
if (obj->Mappings[index].Pointer) {
   obj->Mappings[index].Offset = offset;
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.h 
b/src/mesa/state_tracker/st_cb_bufferobjects.h
index ea77c58f5e..534506a62b 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.h
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.h
@@ -55,6 +55,10 @@ st_buffer_object(struct gl_buffer_object *obj)
 }
 
 
+enum pipe_transfer_usage
+st_access_flags_to_transfer_flags(GLbitfield access, bool wholeBuffer);
+
+
 extern void
 st_init_bufferobject_functions(struct pipe_screen *screen,
struct dd_function_table *functions);

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


Mesa (master): mesa: minor whitespace fixes, line wrapping in texcompress.c

2018-02-06 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d9ab39ea6531028e0558356c8ccf530719fcd2b1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d9ab39ea6531028e0558356c8ccf530719fcd2b1

Author: Brian Paul 
Date:   Tue Feb  6 15:12:58 2018 -0700

mesa: minor whitespace fixes, line wrapping in texcompress.c

Reviewed-by: Eric Engestrom 

---

 src/mesa/main/texcompress.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 1cc13a50ce..1c128e42c2 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -361,25 +361,26 @@ _mesa_get_compressed_formats(struct gl_context *ctx, 
GLint *formats)
 *"Interactions with OpenGL 4.2
 *
 *OpenGL 4.2 supports the feature that compressed textures can be
-*compressed online, by passing the compressed texture format enum 
as
-*the internal format when uploading a texture using TexImage1D,
+*compressed online, by passing the compressed texture format enum
+*as the internal format when uploading a texture using TexImage1D,
 *TexImage2D or TexImage3D (see Section 3.9.3, Texture Image
 *Specification, subsection Encoding of Special Internal Formats).
 *
-*Due to the complexity of the ASTC compression algorithm, it is not
-*usually suitable for online use, and therefore ASTC support will 
be
-*limited to pre-compressed textures only. Where on-device 
compression
-*is required, a domain-specific limited compressor will typically
-*be used, and this is therefore not suitable for implementation in
-*the driver.
+*Due to the complexity of the ASTC compression algorithm, it is
+*not usually suitable for online use, and therefore ASTC support
+*will be limited to pre-compressed textures only. Where on-device
+*compression is required, a domain-specific limited compressor
+*will typically be used, and this is therefore not suitable for
+*implementation in the driver.
 *
 *In particular, the ASTC format specifiers will not be added to
 *Table 3.14, and thus will not be accepted by the TexImage*D
 *functions, and will not be returned by the (already deprecated)
 *COMPRESSED_TEXTURE_FORMATS query."
 *
-* The ES and the desktop specs diverge here. In OpenGL ES, the 
COMPRESSED_TEXTURE_FORMATS
-* query returns the set of supported specific compressed formats.
+* The ES and the desktop specs diverge here. In OpenGL ES, the
+* COMPRESSED_TEXTURE_FORMATS query returns the set of supported specific
+* compressed formats.
 */
if (ctx->API == API_OPENGLES2 &&
ctx->Extensions.KHR_texture_compression_astc_ldr) {
@@ -642,7 +643,8 @@ _mesa_glenum_to_compressed_format(GLenum format)
  * internal format unchanged.
  */
 GLenum
-_mesa_compressed_format_to_glenum(struct gl_context *ctx, mesa_format 
mesaFormat)
+_mesa_compressed_format_to_glenum(struct gl_context *ctx,
+  mesa_format mesaFormat)
 {
switch (mesaFormat) {
case MESA_FORMAT_RGB_FXT1:
@@ -900,7 +902,7 @@ _mesa_decompress_image(mesa_format format, GLuint width, 
GLuint height,
   _mesa_problem(NULL, "Unexpected format in _mesa_decompress_image()");
   return;
}
- 
+
stride = srcRowStride * bh / bytes;
 
for (j = 0; j < height; j++) {

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


Mesa (master): st/mesa: refactor bufferobj_data()

2018-02-06 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 8a32dd2ec9cd57bddef306fe9728ae0343d072f2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a32dd2ec9cd57bddef306fe9728ae0343d072f2

Author: Brian Paul 
Date:   Fri Feb  2 08:38:50 2018 -0700

st/mesa: refactor bufferobj_data()

Split out some of the code into three new helper functions:
buffer_target_to_bind_flags(), storage_flags_to_buffer_flags(),
buffer_usage() to make the code more managable.

Reviewed-by: Marek Olšák 

---

 src/mesa/state_tracker/st_cb_bufferobjects.c | 191 +++
 1 file changed, 104 insertions(+), 87 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c 
b/src/mesa/state_tracker/st_cb_bufferobjects.c
index a9104a9009..6b64ba132c 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -164,107 +164,84 @@ st_bufferobj_get_subdata(struct gl_context *ctx,
 offset, size, data);
 }
 
-static ALWAYS_INLINE GLboolean
-bufferobj_data(struct gl_context *ctx,
-   GLenum target,
-   GLsizeiptrARB size,
-   const void *data,
-   struct gl_memory_object *memObj,
-   GLuint64 offset,
-   GLenum usage,
-   GLbitfield storageFlags,
-   struct gl_buffer_object *obj)
-{
-   struct st_context *st = st_context(ctx);
-   struct pipe_context *pipe = st->pipe;
-   struct pipe_screen *screen = pipe->screen;
-   struct st_buffer_object *st_obj = st_buffer_object(obj);
-   struct st_memory_object *st_mem_obj = st_memory_object(memObj);
-   unsigned bind, pipe_usage, pipe_flags = 0;
-
-   if (target != GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD &&
-   size && st_obj->buffer &&
-   st_obj->Base.Size == size &&
-   st_obj->Base.Usage == usage &&
-   st_obj->Base.StorageFlags == storageFlags) {
-  if (data) {
- /* Just discard the old contents and write new data.
-  * This should be the same as creating a new buffer, but we avoid
-  * a lot of validation in Mesa.
-  */
- pipe->buffer_subdata(pipe, st_obj->buffer,
-  PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE,
-  0, size, data);
- return GL_TRUE;
-  } else if (screen->get_param(screen, PIPE_CAP_INVALIDATE_BUFFER)) {
- pipe->invalidate_resource(pipe, st_obj->buffer);
- return GL_TRUE;
-  }
-   }
-
-   st_obj->Base.Size = size;
-   st_obj->Base.Usage = usage;
-   st_obj->Base.StorageFlags = storageFlags;
 
+/**
+ * Return bitmask of PIPE_BIND_x flags corresponding a GL buffer target.
+ */
+static unsigned
+buffer_target_to_bind_flags(GLenum target)
+{
switch (target) {
case GL_PIXEL_PACK_BUFFER_ARB:
case GL_PIXEL_UNPACK_BUFFER_ARB:
-  bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
-  break;
+  return PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
case GL_ARRAY_BUFFER_ARB:
-  bind = PIPE_BIND_VERTEX_BUFFER;
-  break;
+  return PIPE_BIND_VERTEX_BUFFER;
case GL_ELEMENT_ARRAY_BUFFER_ARB:
-  bind = PIPE_BIND_INDEX_BUFFER;
-  break;
+  return PIPE_BIND_INDEX_BUFFER;
case GL_TEXTURE_BUFFER:
-  bind = PIPE_BIND_SAMPLER_VIEW;
-  break;
+  return PIPE_BIND_SAMPLER_VIEW;
case GL_TRANSFORM_FEEDBACK_BUFFER:
-  bind = PIPE_BIND_STREAM_OUTPUT;
-  break;
+  return PIPE_BIND_STREAM_OUTPUT;
case GL_UNIFORM_BUFFER:
-  bind = PIPE_BIND_CONSTANT_BUFFER;
-  break;
+  return PIPE_BIND_CONSTANT_BUFFER;
case GL_DRAW_INDIRECT_BUFFER:
case GL_PARAMETER_BUFFER_ARB:
-  bind = PIPE_BIND_COMMAND_ARGS_BUFFER;
-  break;
+  return PIPE_BIND_COMMAND_ARGS_BUFFER;
case GL_ATOMIC_COUNTER_BUFFER:
case GL_SHADER_STORAGE_BUFFER:
-  bind = PIPE_BIND_SHADER_BUFFER;
-  break;
+  return PIPE_BIND_SHADER_BUFFER;
case GL_QUERY_BUFFER:
-  bind = PIPE_BIND_QUERY_BUFFER;
-  break;
+  return PIPE_BIND_QUERY_BUFFER;
default:
-  bind = 0;
+  return 0;
}
+}
 
-   /* Set usage. */
-   if (st_obj->Base.Immutable) {
+
+/**
+ * Return bitmask of PIPE_RESOURCE_x flags corresponding to GL_MAP_x flags.
+ */
+static unsigned
+storage_flags_to_buffer_flags(GLbitfield storageFlags)
+{
+   unsigned flags = 0;
+   if (storageFlags & GL_MAP_PERSISTENT_BIT)
+  flags |= PIPE_RESOURCE_FLAG_MAP_PERSISTENT;
+   if (storageFlags & GL_MAP_COHERENT_BIT)
+  flags |= PIPE_RESOURCE_FLAG_MAP_COHERENT;
+   if (storageFlags & GL_SPARSE_STORAGE_BIT_ARB)
+  flags |= PIPE_RESOURCE_FLAG_SPARSE;
+   return flags;
+}
+
+
+/**
+ * From a buffer object's target, immutability flag, storage flags and
+ * usage hint, return a pipe_resource_usage value (PIPE_USAGE_DYNAMIC,
+ * STREAM, etc).
+ */
+static const enum pipe_resource_usage
+buffer_usage(GLenum 

Mesa (master): mesa: simplify _mesa_get_compressed_formats()

2018-02-06 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b38196b4522efef9cb2b0f5266af9960547046b9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b38196b4522efef9cb2b0f5266af9960547046b9

Author: Brian Paul 
Date:   Tue Feb  6 09:55:13 2018 -0700

mesa: simplify _mesa_get_compressed_formats()

Instead of testing for formats==NULL everywhere, just point formats at
a dummy array which will be discarded.

Reviewed-by: Eric Engestrom 

---

 src/mesa/main/texcompress.c | 200 ++--
 1 file changed, 83 insertions(+), 117 deletions(-)

diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 15970a75c0..1cc13a50ce 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -263,27 +263,23 @@ _mesa_gl_compressed_format_base_format(GLenum format)
 GLuint
 _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
 {
+   GLint discard_formats[100];
GLuint n = 0;
+
+   if (!formats) {
+  formats = discard_formats;
+   }
+
if (_mesa_is_desktop_gl(ctx) &&
ctx->Extensions.TDFX_texture_compression_FXT1) {
-  if (formats) {
- formats[n++] = GL_COMPRESSED_RGB_FXT1_3DFX;
- formats[n++] = GL_COMPRESSED_RGBA_FXT1_3DFX;
-  }
-  else {
- n += 2;
-  }
+  formats[n++] = GL_COMPRESSED_RGB_FXT1_3DFX;
+  formats[n++] = GL_COMPRESSED_RGBA_FXT1_3DFX;
}
 
if (ctx->Extensions.EXT_texture_compression_s3tc) {
-  if (formats) {
- formats[n++] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
- formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
- formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
-  }
-  else {
- n += 3;
-  }
+  formats[n++] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
+  formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
+  formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
 
   /* The ES and desktop GL specs diverge here.
*
@@ -315,11 +311,7 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint 
*formats)
* Note that the addition is only to the OpenGL ES specification!
*/
   if (_mesa_is_gles(ctx)) {
- if (formats) {
-formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- } else {
-n += 1;
- }
+ formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
   }
}
 
@@ -332,54 +324,36 @@ _mesa_get_compressed_formats(struct gl_context *ctx, 
GLint *formats)
 */
if (_mesa_is_gles(ctx)
&& ctx->Extensions.OES_compressed_ETC1_RGB8_texture) {
-  if (formats) {
- formats[n++] = GL_ETC1_RGB8_OES;
-  }
-  else {
- n += 1;
-  }
+  formats[n++] = GL_ETC1_RGB8_OES;
}
 
if (ctx->API == API_OPENGLES) {
-  if (formats) {
-formats[n++] = GL_PALETTE4_RGB8_OES;
-formats[n++] = GL_PALETTE4_RGBA8_OES;
-formats[n++] = GL_PALETTE4_R5_G6_B5_OES;
-formats[n++] = GL_PALETTE4_RGBA4_OES;
-formats[n++] = GL_PALETTE4_RGB5_A1_OES;
-formats[n++] = GL_PALETTE8_RGB8_OES;
-formats[n++] = GL_PALETTE8_RGBA8_OES;
-formats[n++] = GL_PALETTE8_R5_G6_B5_OES;
-formats[n++] = GL_PALETTE8_RGBA4_OES;
-formats[n++] = GL_PALETTE8_RGB5_A1_OES;
-  }
-  else {
-n += 10;
-  }
+  formats[n++] = GL_PALETTE4_RGB8_OES;
+  formats[n++] = GL_PALETTE4_RGBA8_OES;
+  formats[n++] = GL_PALETTE4_R5_G6_B5_OES;
+  formats[n++] = GL_PALETTE4_RGBA4_OES;
+  formats[n++] = GL_PALETTE4_RGB5_A1_OES;
+  formats[n++] = GL_PALETTE8_RGB8_OES;
+  formats[n++] = GL_PALETTE8_RGBA8_OES;
+  formats[n++] = GL_PALETTE8_R5_G6_B5_OES;
+  formats[n++] = GL_PALETTE8_RGBA4_OES;
+  formats[n++] = GL_PALETTE8_RGB5_A1_OES;
}
 
if (_mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility) {
-  if (formats) {
- formats[n++] = GL_COMPRESSED_RGB8_ETC2;
- formats[n++] = GL_COMPRESSED_RGBA8_ETC2_EAC;
- formats[n++] = GL_COMPRESSED_R11_EAC;
- formats[n++] = GL_COMPRESSED_RG11_EAC;
- formats[n++] = GL_COMPRESSED_SIGNED_R11_EAC;
- formats[n++] = GL_COMPRESSED_SIGNED_RG11_EAC;
- formats[n++] = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
-  } else {
- n += 7;
-  }
+  formats[n++] = GL_COMPRESSED_RGB8_ETC2;
+  formats[n++] = GL_COMPRESSED_RGBA8_ETC2_EAC;
+  formats[n++] = GL_COMPRESSED_R11_EAC;
+  formats[n++] = GL_COMPRESSED_RG11_EAC;
+  formats[n++] = GL_COMPRESSED_SIGNED_R11_EAC;
+  formats[n++] = GL_COMPRESSED_SIGNED_RG11_EAC;
+  formats[n++] = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
}
 
if (_mesa_is_gles3(ctx)) {
-  if (formats) {
- formats[n++] = GL_COMPRESSED_SRGB8_ETC2;
- formats[n++] = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
- formats[n++] = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
-  } else {
- n += 3;
-  }
+  formats[n++] = GL_COMPRESS

Mesa (master): util: remove redundant check for the __clang__ macro

2018-02-06 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d919ff0f279b6007809220dc43af26fc25435356
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d919ff0f279b6007809220dc43af26fc25435356

Author: Vlad Golovkin 
Date:   Tue Feb  6 06:48:00 2018 -0700

util: remove redundant check for the __clang__ macro

Clang defines __GNUC__ macro, so one doesn't need to check __clang__
macro in this particular case.

v2: added comment as per Brian Paul's suggestion

Reviewed-by: Brian Paul 

---

 src/util/macros.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/macros.h b/src/util/macros.h
index 432d513930..e3c785af50 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -137,8 +137,9 @@ do {   \
 #endif
 
 /* Forced function inlining */
+/* Note: Clang also sets __GNUC__ (see other cases below) */
 #ifndef ALWAYS_INLINE
-#  if defined(__GNUC__) || defined(__clang__)
+#  if defined(__GNUC__)
 #define ALWAYS_INLINE inline __attribute__((always_inline))
 #  elif defined(_MSC_VER)
 #define ALWAYS_INLINE __forceinline

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


Mesa (master): st/mesa: use st_access_flags_to_transfer_flags() helper in more places

2018-02-06 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 77bc74e674e39a65b79b804367e97d567963bb43
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77bc74e674e39a65b79b804367e97d567963bb43

Author: Brian Paul 
Date:   Fri Feb  2 09:21:44 2018 -0700

st/mesa: use st_access_flags_to_transfer_flags() helper in more places

Reviewed-by: Marek Olšák 

---

 src/mesa/state_tracker/st_cb_fbo.c | 18 +-
 src/mesa/state_tracker/st_cb_texture.c | 17 -
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index 3a5c03c335..0800f5b3d2 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -47,6 +47,7 @@
 #include "pipe/p_screen.h"
 #include "st_atom.h"
 #include "st_context.h"
+#include "st_cb_bufferobjects.h"
 #include "st_cb_fbo.h"
 #include "st_cb_flush.h"
 #include "st_cb_texture.h"
@@ -780,7 +781,6 @@ st_MapRenderbuffer(struct gl_context *ctx,
struct st_renderbuffer *strb = st_renderbuffer(rb);
struct pipe_context *pipe = st->pipe;
const GLboolean invert = rb->Name == 0;
-   unsigned usage;
GLuint y2;
GLubyte *map;
 
@@ -800,13 +800,13 @@ st_MapRenderbuffer(struct gl_context *ctx,
   return;
}
 
-   usage = 0x0;
-   if (mode & GL_MAP_READ_BIT)
-  usage |= PIPE_TRANSFER_READ;
-   if (mode & GL_MAP_WRITE_BIT)
-  usage |= PIPE_TRANSFER_WRITE;
-   if (mode & GL_MAP_INVALIDATE_RANGE_BIT)
-  usage |= PIPE_TRANSFER_DISCARD_RANGE;
+   /* Check for unexpected flags */
+   assert((mode & ~(GL_MAP_READ_BIT |
+GL_MAP_WRITE_BIT |
+GL_MAP_INVALIDATE_RANGE_BIT)) == 0);
+
+   const enum pipe_transfer_usage transfer_flags =
+  st_access_flags_to_transfer_flags(mode, false);
 
/* Note: y=0=bottom of buffer while y2=0=top of buffer.
 * 'invert' will be true for window-system buffers and false for
@@ -821,7 +821,7 @@ st_MapRenderbuffer(struct gl_context *ctx,
 strb->texture,
 strb->surface->u.tex.level,
 strb->surface->u.tex.first_layer,
-usage, x, y2, w, h, &strb->transfer);
+transfer_flags, x, y2, w, h, &strb->transfer);
if (map) {
   if (invert) {
  *rowStrideOut = -(int) strb->transfer->stride;
diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index 98f2443bb3..6345ead639 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -254,19 +254,18 @@ st_MapTextureImage(struct gl_context *ctx,
 {
struct st_context *st = st_context(ctx);
struct st_texture_image *stImage = st_texture_image(texImage);
-   unsigned pipeMode;
GLubyte *map;
struct pipe_transfer *transfer;
 
-   pipeMode = 0x0;
-   if (mode & GL_MAP_READ_BIT)
-  pipeMode |= PIPE_TRANSFER_READ;
-   if (mode & GL_MAP_WRITE_BIT)
-  pipeMode |= PIPE_TRANSFER_WRITE;
-   if (mode & GL_MAP_INVALIDATE_RANGE_BIT)
-  pipeMode |= PIPE_TRANSFER_DISCARD_RANGE;
+   /* Check for unexpected flags */
+   assert((mode & ~(GL_MAP_READ_BIT |
+GL_MAP_WRITE_BIT |
+GL_MAP_INVALIDATE_RANGE_BIT)) == 0);
 
-   map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1,
+   const enum pipe_transfer_usage transfer_flags =
+  st_access_flags_to_transfer_flags(mode, false);
+
+   map = st_texture_image_map(st, stImage, transfer_flags, x, y, slice, w, h, 
1,
   &transfer);
if (map) {
   if (st_etc_fallback(st, texImage)) {

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


Mesa (master): gallivm/llvmpipe: add const qualifiers on sampler variables

2018-02-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 7a044ef68b84ab850a2299462e03aedf94a3db02
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a044ef68b84ab850a2299462e03aedf94a3db02

Author: Brian Paul 
Date:   Thu Feb  1 13:17:08 2018 -0700

gallivm/llvmpipe: add const qualifiers on sampler variables

Once a lp_build_sampler_soa or lp_build_sampler_aos object is created,
it should never be modified.  Found by inspection.

Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/draw/draw_llvm.c  | 2 +-
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 8 
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c | 2 +-
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 2 +-
 src/gallium/drivers/llvmpipe/lp_state_fs.c  | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c 
b/src/gallium/auxiliary/draw/draw_llvm.c
index 8de29ea1fd..69c1080375 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -606,7 +606,7 @@ generate_vs(struct draw_llvm_variant *variant,
 const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS],
 const struct lp_bld_tgsi_system_values *system_values,
 LLVMValueRef context_ptr,
-struct lp_build_sampler_soa *draw_sampler,
+const struct lp_build_sampler_soa *draw_sampler,
 boolean clamp_vertex_color)
 {
struct draw_llvm *llvm = variant->llvm;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index a50781..309ece88df 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -201,7 +201,7 @@ struct lp_build_sampler_soa
 struct lp_build_sampler_aos
 {
LLVMValueRef
-   (*emit_fetch_texel)( struct lp_build_sampler_aos *sampler,
+   (*emit_fetch_texel)( const struct lp_build_sampler_aos *sampler,
 struct lp_build_context *bld,
 unsigned target, /* TGSI_TEXTURE_* */
 unsigned unit,
@@ -228,7 +228,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
   LLVMValueRef (*outputs)[4],
   LLVMValueRef context_ptr,
   LLVMValueRef thread_data_ptr,
-  struct lp_build_sampler_soa *sampler,
+  const struct lp_build_sampler_soa *sampler,
   const struct tgsi_shader_info *info,
   const struct lp_build_tgsi_gs_iface *gs_iface);
 
@@ -241,7 +241,7 @@ lp_build_tgsi_aos(struct gallivm_state *gallivm,
   LLVMValueRef consts_ptr,
   const LLVMValueRef *inputs,
   LLVMValueRef *outputs,
-  struct lp_build_sampler_aos *sampler,
+  const struct lp_build_sampler_aos *sampler,
   const struct tgsi_shader_info *info);
 
 
@@ -545,7 +545,7 @@ struct lp_build_tgsi_aos_context
const LLVMValueRef *inputs;
LLVMValueRef *outputs;
 
-   struct lp_build_sampler_aos *sampler;
+   const struct lp_build_sampler_aos *sampler;
 
struct tgsi_declaration_sampler_view sv[PIPE_MAX_SHADER_SAMPLER_VIEWS];
 
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
index 2529c6a8bf..85b2e8a207 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
@@ -862,7 +862,7 @@ lp_build_tgsi_aos(struct gallivm_state *gallivm,
   LLVMValueRef consts_ptr,
   const LLVMValueRef *inputs,
   LLVMValueRef *outputs,
-  struct lp_build_sampler_aos *sampler,
+  const struct lp_build_sampler_aos *sampler,
   const struct tgsi_shader_info *info)
 {
struct lp_build_tgsi_aos_context bld;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 97efc3a399..fad74c6801 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -3780,7 +3780,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
   LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS],
   LLVMValueRef context_ptr,
   LLVMValueRef thread_data_ptr,
-  struct lp_build_sampler_soa *sampler,
+  const struct lp_build_sampler_soa *sampler,
   const struct tgsi_shader_info *info,
   const struct lp_build_tgsi_gs_iface *gs_iface)
 {
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 0daf7aecf6..603fd84f6b 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -299,7 +299,7 @@ generate_fs_loop(struct gallivm_state *gallivm,
  LLVMValueRef context_ptr,
  LLVMValue

Mesa (master): vbo: s/drawcount/drawcount_offset

2018-02-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c7bf05c833e488b3c8b598221910d52abdd8762f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7bf05c833e488b3c8b598221910d52abdd8762f

Author: Brian Paul 
Date:   Wed Jan 31 16:11:12 2018 -0700

vbo: s/drawcount/drawcount_offset

This parameter (from the glMultiDrawArraysIndirectCountARB function)
is poorly named.  It's an offset into the buffer which contains the
number of primitives to draw.

Reviewed-by: Marek Olšák 
Reviewed-by: Mathias Fröhlich 

---

 src/mesa/vbo/vbo_exec_array.c | 28 
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 1d2f806cd5..fc0d489065 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -1803,7 +1803,7 @@ static void
 vbo_validated_multidrawarraysindirectcount(struct gl_context *ctx,
GLenum mode,
GLintptr indirect,
-   GLintptr drawcount,
+   GLintptr drawcount_offset,
GLsizei maxdrawcount,
GLsizei stride)
 {
@@ -1818,7 +1818,7 @@ vbo_validated_multidrawarraysindirectcount(struct 
gl_context *ctx,
vbo->draw_indirect_prims(ctx, mode,
 ctx->DrawIndirectBuffer, offset,
 maxdrawcount, stride,
-ctx->ParameterBuffer, drawcount, NULL);
+ctx->ParameterBuffer, drawcount_offset, NULL);
 
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
   _mesa_flush(ctx);
@@ -1829,7 +1829,7 @@ static void
 vbo_validated_multidrawelementsindirectcount(struct gl_context *ctx,
  GLenum mode, GLenum type,
  GLintptr indirect,
- GLintptr drawcount,
+ GLintptr drawcount_offset,
  GLsizei maxdrawcount,
  GLsizei stride)
 {
@@ -1852,7 +1852,7 @@ vbo_validated_multidrawelementsindirectcount(struct 
gl_context *ctx,
vbo->draw_indirect_prims(ctx, mode,
 ctx->DrawIndirectBuffer, offset,
 maxdrawcount, stride,
-ctx->ParameterBuffer, drawcount, &ib);
+ctx->ParameterBuffer, drawcount_offset, &ib);
 
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
   _mesa_flush(ctx);
@@ -1861,7 +1861,7 @@ vbo_validated_multidrawelementsindirectcount(struct 
gl_context *ctx,
 
 static void GLAPIENTRY
 vbo_exec_MultiDrawArraysIndirectCount(GLenum mode, GLintptr indirect,
-  GLintptr drawcount,
+  GLintptr drawcount_offset,
   GLsizei maxdrawcount, GLsizei stride)
 {
GET_CURRENT_CONTEXT(ctx);
@@ -1870,7 +1870,7 @@ vbo_exec_MultiDrawArraysIndirectCount(GLenum mode, 
GLintptr indirect,
   _mesa_debug(ctx, "glMultiDrawArraysIndirectCountARB"
   "(%s, %lx, %lx, %i, %i)\n",
   _mesa_enum_to_string(mode),
-  (unsigned long) indirect, (unsigned long) drawcount,
+  (unsigned long) indirect, (unsigned long) drawcount_offset,
   maxdrawcount, stride);
 
/* If  is zero, the array elements are treated as tightly packed. */
@@ -1884,7 +1884,8 @@ vbo_exec_MultiDrawArraysIndirectCount(GLenum mode, 
GLintptr indirect,
  _mesa_update_state(ctx);
} else {
   if (!_mesa_validate_MultiDrawArraysIndirectCount(ctx, mode,
-   indirect, drawcount,
+   indirect,
+   drawcount_offset,
maxdrawcount, stride))
  return;
}
@@ -1892,14 +1893,16 @@ vbo_exec_MultiDrawArraysIndirectCount(GLenum mode, 
GLintptr indirect,
if (skip_validated_draw(ctx))
   return;
 
-   vbo_validated_multidrawarraysindirectcount(ctx, mode, indirect, drawcount,
+   vbo_validated_multidrawarraysindirectcount(ctx, mode, indirect,
+  drawcount_offset,
   maxdrawcount, stride);
 }
 
 
 static void GLAPIENTRY
 vbo_exec_MultiDrawElementsIndirectCount(GLenum mode, GLenum type,
-GLintptr indirect, GLintptr drawcount,
+GLintptr indirect,
+GLintptr drawcount_offset,
 

Mesa (master): svga: clean up retry_draw_range_elements(), retry_draw_arrays()

2018-02-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 7a1401938b3514a95ffbdb2ec70987138ccabc3a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a1401938b3514a95ffbdb2ec70987138ccabc3a

Author: Brian Paul 
Date:   Wed Jan 31 20:18:52 2018 -0700

svga: clean up retry_draw_range_elements(), retry_draw_arrays()

Get rid of a bunch of goto spaghetti.  Remove unneeded do_retry parameter.
No Piglit changes.  Also tested w/ Google Earth and other apps.

Reviewed-by: Neha Bhende 

---

 src/gallium/drivers/svga/svga_pipe_draw.c | 81 +++
 1 file changed, 27 insertions(+), 54 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c 
b/src/gallium/drivers/svga/svga_pipe_draw.c
index 5fa562b08e..42525c3153 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -65,19 +65,14 @@ retry_draw_range_elements( struct svga_context *svga,
unsigned start,
unsigned count,
unsigned start_instance,
-   unsigned instance_count,
-   boolean do_retry )
+   unsigned instance_count)
 {
-   enum pipe_error ret = PIPE_OK;
+   enum pipe_error ret;
 
SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_DRAWELEMENTS);
 
svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
 
-   ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
-   if (ret != PIPE_OK)
-  goto retry;
-
/** determine if flatshade is to be used after svga_update_state()
 *  in case the fragment shader is changed.
 */
@@ -86,29 +81,21 @@ retry_draw_range_elements( struct svga_context *svga,
 is_using_flat_shading(svga),
 svga->curr.rast->templ.flatshade_first);
 
-   ret = svga_hwtnl_draw_range_elements( svga->hwtnl,
- index_buffer, index_size, index_bias,
- min_index, max_index,
- prim, start, count,
- start_instance, instance_count);
-   if (ret != PIPE_OK)
-  goto retry;
-
-   goto done;
-
-retry:
-   svga_context_flush( svga, NULL );
-
-   if (do_retry)
-   {
-  ret = retry_draw_range_elements(svga,
-  index_buffer, index_size, index_bias,
-  min_index, max_index,
-  prim, start, count,
-  start_instance, instance_count, FALSE);
+   for (unsigned try = 0; try < 2; try++) {
+  ret = svga_update_state(svga, SVGA_STATE_HW_DRAW);
+  if (ret == PIPE_OK) {
+ ret = svga_hwtnl_draw_range_elements(svga->hwtnl,
+  index_buffer, index_size,
+  index_bias,
+  min_index, max_index,
+  prim, start, count,
+  start_instance, instance_count);
+ if (ret == PIPE_OK)
+break;
+  }
+  svga_context_flush(svga, NULL);
}
 
-done:
SVGA_STATS_TIME_POP(svga_sws(svga));
return ret;
 }
@@ -117,8 +104,7 @@ done:
 static enum pipe_error
 retry_draw_arrays( struct svga_context *svga,
enum pipe_prim_type prim, unsigned start, unsigned count,
-   unsigned start_instance, unsigned instance_count,
-   boolean do_retry )
+   unsigned start_instance, unsigned instance_count)
 {
enum pipe_error ret;
 
@@ -126,10 +112,6 @@ retry_draw_arrays( struct svga_context *svga,
 
svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
 
-   ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
-   if (ret != PIPE_OK)
-  goto retry;
-
/** determine if flatshade is to be used after svga_update_state()
 *  in case the fragment shader is changed.
 */
@@ -138,24 +120,17 @@ retry_draw_arrays( struct svga_context *svga,
 is_using_flat_shading(svga),
 svga->curr.rast->templ.flatshade_first);
 
-   ret = svga_hwtnl_draw_arrays(svga->hwtnl, prim, start, count,
-start_instance, instance_count);
-   if (ret != PIPE_OK)
-  goto retry;
-
-   goto done;
-
-retry:
-   if (ret == PIPE_ERROR_OUT_OF_MEMORY && do_retry)
-   {
-  svga_context_flush( svga, NULL );
-
-  ret = retry_draw_arrays(svga, prim, start, count,
-  start_instance, instance_count,
-  FALSE);
+   for (unsigned try = 0; try < 2; try++) {
+  ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
+  if (ret == PIPE_OK) {
+ ret = s

Mesa (master): vbo: use vbo local var for draw call in vbo_save_playback_vertex_list()

2018-02-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b0a2f38db9ec08b79362fb255097423ac5637eea
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b0a2f38db9ec08b79362fb255097423ac5637eea

Author: Brian Paul 
Date:   Wed Jan 31 14:05:46 2018 -0700

vbo: use vbo local var for draw call in vbo_save_playback_vertex_list()

Reviewed-by: Marek Olšák 
Reviewed-by: Mathias Fröhlich 

---

 src/mesa/vbo/vbo_save_draw.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index fd0ccc1230..cf824c66b0 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -332,13 +332,13 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, 
void *data)
   if (node->vertex_count > 0) {
  GLuint min_index = node->start_vertex;
  GLuint max_index = min_index + node->vertex_count - 1;
- vbo_context(ctx)->draw_prims(ctx,
-  node->prims,
-  node->prim_count,
-  NULL,
-  GL_TRUE,
-  min_index, max_index,
-  NULL, 0, NULL);
+ vbo->draw_prims(ctx,
+ node->prims,
+ node->prim_count,
+ NULL,
+ GL_TRUE,
+ min_index, max_index,
+ NULL, 0, NULL);
   }
}
 

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


Mesa (master): svga: whitespace/formatting fixes in svga_pipe_draw.c

2018-02-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: fa98730bf32501d7d7299d6c7264b06cf417e727
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa98730bf32501d7d7299d6c7264b06cf417e727

Author: Brian Paul 
Date:   Wed Jan 31 20:33:29 2018 -0700

svga: whitespace/formatting fixes in svga_pipe_draw.c

Reviewed-by: Neha Bhende 

---

 src/gallium/drivers/svga/svga_pipe_draw.c | 67 ---
 1 file changed, 34 insertions(+), 33 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c 
b/src/gallium/drivers/svga/svga_pipe_draw.c
index 42525c3153..8cd7ab00b5 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -55,17 +55,17 @@ is_using_flat_shading(const struct svga_context *svga)
 
 
 static enum pipe_error
-retry_draw_range_elements( struct svga_context *svga,
-   struct pipe_resource *index_buffer,
-   unsigned index_size,
-   int index_bias,
-   unsigned min_index,
-   unsigned max_index,
-   enum pipe_prim_type prim,
-   unsigned start,
-   unsigned count,
-   unsigned start_instance,
-   unsigned instance_count)
+retry_draw_range_elements(struct svga_context *svga,
+  struct pipe_resource *index_buffer,
+  unsigned index_size,
+  int index_bias,
+  unsigned min_index,
+  unsigned max_index,
+  enum pipe_prim_type prim,
+  unsigned start,
+  unsigned count,
+  unsigned start_instance,
+  unsigned instance_count)
 {
enum pipe_error ret;
 
@@ -102,9 +102,9 @@ retry_draw_range_elements( struct svga_context *svga,
 
 
 static enum pipe_error
-retry_draw_arrays( struct svga_context *svga,
-   enum pipe_prim_type prim, unsigned start, unsigned count,
-   unsigned start_instance, unsigned instance_count)
+retry_draw_arrays(struct svga_context *svga,
+  enum pipe_prim_type prim, unsigned start, unsigned count,
+  unsigned start_instance, unsigned instance_count)
 {
enum pipe_error ret;
 
@@ -121,7 +121,7 @@ retry_draw_arrays( struct svga_context *svga,
 svga->curr.rast->templ.flatshade_first);
 
for (unsigned try = 0; try < 2; try++) {
-  ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
+  ret = svga_update_state(svga, SVGA_STATE_HW_DRAW);
   if (ret == PIPE_OK) {
  ret = svga_hwtnl_draw_arrays(svga->hwtnl, prim, start, count,
   start_instance, instance_count);
@@ -165,8 +165,8 @@ need_fallback_prim_restart(const struct svga_context *svga,
 static void
 svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
 {
-   struct svga_context *svga = svga_context( pipe );
-   enum pipe_prim_type reduced_prim = u_reduced_prim( info->mode );
+   struct svga_context *svga = svga_context(pipe);
+   enum pipe_prim_type reduced_prim = u_reduced_prim(info->mode);
unsigned count = info->count;
enum pipe_error ret = 0;
boolean needed_swtnl;
@@ -210,12 +210,12 @@ svga_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
   goto done;
}
 
-   if (!u_trim_pipe_prim( info->mode, &count ))
+   if (!u_trim_pipe_prim(info->mode, &count))
   goto done;
 
needed_swtnl = svga->state.sw.need_swtnl;
 
-   svga_update_state_retry( svga, SVGA_STATE_NEED_SWTNL );
+   svga_update_state_retry(svga, SVGA_STATE_NEED_SWTNL);
 
if (svga->state.sw.need_swtnl) {
   svga->hud.num_fallbacks++;  /* for SVGA_QUERY_NUM_FALLBACKS */
@@ -232,7 +232,7 @@ svga_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
   }
 
   /* Avoid leaking the previous hwtnl bias to swtnl */
-  svga_hwtnl_set_index_bias( svga->hwtnl, 0 );
+  svga_hwtnl_set_index_bias(svga->hwtnl, 0);
   ret = svga_swtnl_draw_vbo(svga, info, indexbuf, index_offset);
}
else {
@@ -242,17 +242,17 @@ svga_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
  assert(index_offset % info->index_size == 0);
  offset = index_offset / info->index_size;
 
- ret = retry_draw_range_elements( svga,
-  indexbuf,
-  info->index_size,
-  info->index_bias,
-  info->min_index,
-  info->max_index,
-  info-&g

Mesa (master): svga: remove unneeded #includes in svga_pipe_draw.c

2018-02-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 84c36418646ae57f88e501efc23c4d7df921c197
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=84c36418646ae57f88e501efc23c4d7df921c197

Author: Brian Paul 
Date:   Wed Jan 31 20:36:35 2018 -0700

svga: remove unneeded #includes in svga_pipe_draw.c

Reviewed-by: Neha Bhende 

---

 src/gallium/drivers/svga/svga_pipe_draw.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c 
b/src/gallium/drivers/svga/svga_pipe_draw.c
index 8cd7ab00b5..ee4a1057ad 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -24,21 +24,14 @@
  **/
 
 
-#include "util/u_format.h"
 #include "util/u_helpers.h"
 #include "util/u_inlines.h"
 #include "util/u_prim.h"
 #include "util/u_prim_restart.h"
-#include "util/u_upload_mgr.h"
-#include "indices/u_indices.h"
 
-#include "svga_hw_reg.h"
-#include "svga_cmd.h"
 #include "svga_context.h"
-#include "svga_screen.h"
 #include "svga_draw.h"
 #include "svga_shader.h"
-#include "svga_state.h"
 #include "svga_surface.h"
 #include "svga_swtnl.h"
 #include "svga_debug.h"

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


Mesa (master): svga: remove unused min/max_index params to draw_vgpu10()

2018-02-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c7442895526a8c3e41eaf985827c66907d9e8ad6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7442895526a8c3e41eaf985827c66907d9e8ad6

Author: Brian Paul 
Date:   Wed Jan 31 16:10:39 2018 -0700

svga: remove unused min/max_index params to draw_vgpu10()

Reviewed-by: Neha Bhende 

---

 src/gallium/drivers/svga/svga_draw.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_draw.c 
b/src/gallium/drivers/svga/svga_draw.c
index 5771903955..649bc228c0 100644
--- a/src/gallium/drivers/svga/svga_draw.c
+++ b/src/gallium/drivers/svga/svga_draw.c
@@ -511,8 +511,7 @@ static enum pipe_error
 draw_vgpu10(struct svga_hwtnl *hwtnl,
 const SVGA3dPrimitiveRange *range,
 unsigned vcount,
-unsigned min_index,
-unsigned max_index, struct pipe_resource *ib,
+struct pipe_resource *ib,
 unsigned start_instance, unsigned instance_count)
 {
struct svga_context *svga = hwtnl->svga;
@@ -1024,11 +1023,11 @@ svga_hwtnl_prim(struct svga_hwtnl *hwtnl,
 
if (svga_have_vgpu10(hwtnl->svga)) {
   /* draw immediately */
-  ret = draw_vgpu10(hwtnl, range, vcount, min_index, max_index, ib,
+  ret = draw_vgpu10(hwtnl, range, vcount, ib,
 start_instance, instance_count);
   if (ret != PIPE_OK) {
  svga_context_flush(hwtnl->svga, NULL);
- ret = draw_vgpu10(hwtnl, range, vcount, min_index, max_index, ib,
+ ret = draw_vgpu10(hwtnl, range, vcount, ib,
start_instance, instance_count);
  assert(ret == PIPE_OK);
   }

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


Mesa (master): vbo: add comments on the VBO draw function typedefs

2018-02-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1b7ad3ae974a8436edcbefcd5a52faa43c73ea8c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b7ad3ae974a8436edcbefcd5a52faa43c73ea8c

Author: Brian Paul 
Date:   Wed Jan 31 16:15:53 2018 -0700

vbo: add comments on the VBO draw function typedefs

And rename indirect_params -> indirect_draw_count_buffer and
indirect_params_offset -> indirect_draw_count_offset to be more
specific.

Reviewed-by: Marek Olšák 
Reviewed-by: Mathias Fröhlich 

---

 src/mesa/vbo/vbo.h | 57 --
 1 file changed, 55 insertions(+), 2 deletions(-)

diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index 164477f3ac..6ae6991cad 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -119,6 +119,43 @@ void
 vbo_save_EndCallList(struct gl_context *ctx);
 
 
+/**
+ * For indirect array drawing:
+ *
+ *typedef struct {
+ *   GLuint count;
+ *   GLuint primCount;
+ *   GLuint first;
+ *   GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
+ *} DrawArraysIndirectCommand;
+ *
+ * For indirect indexed drawing:
+ *
+ *typedef struct {
+ *   GLuint count;
+ *   GLuint primCount;
+ *   GLuint firstIndex;
+ *   GLint  baseVertex;
+ *   GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
+ *} DrawElementsIndirectCommand;
+ */
+
+
+/**
+ * Draw a number of primitives.
+ * \param prims  array [nr_prims] describing what to draw (prim type,
+ *   vertex count, first index, instance count, etc).
+ * \param ib  index buffer for indexed drawing, NULL for array drawing
+ * \param index_bounds_valid  are min_index and max_index valid?
+ * \param min_index  lowest vertex index used
+ * \param max_index  highest vertex index used
+ * \param tfb_vertcount  describes TFB output, or NULL
+ * \param stream  If called via DrawTransformFeedback, specifies the vertex
+ *stream buffer from which to get the vertex count
+ * \param indirect  If any prims are indirect, this specifies the buffer
+ *  to find the "DrawArrays/ElementsIndirectCommand" data.
+ *  This may be deprecated in the future
+ */
 typedef void (*vbo_draw_func)(struct gl_context *ctx,
   const struct _mesa_prim *prims,
   GLuint nr_prims,
@@ -131,6 +168,22 @@ typedef void (*vbo_draw_func)(struct gl_context *ctx,
   struct gl_buffer_object *indirect);
 
 
+/**
+ * Draw a primitive, getting the vertex count, instance count, start
+ * vertex, etc. from a buffer object.
+ * \param mode  GL_POINTS, GL_LINES, GL_TRIANGLE_STRIP, etc.
+ * \param indirect_data  buffer to get "DrawArrays/ElementsIndirectCommand" 
data
+ * \param indirect_offset  offset of first primitive in indrect_data buffer
+ * \param draw_count  number of primitives to draw
+ * \param stride  stride, in bytes, between 
"DrawArrays/ElementsIndirectCommand"
+ *objects
+ * \param indirect_draw_count_buffer  if non-NULL specifies a buffer to get the
+ *real draw_count value.  Used for
+ *GL_ARB_indirect_parameters.
+ * \param indirect_draw_count_offset  offset to the draw_count value in
+ *indirect_draw_count_buffer
+ * \param ib  index buffer for indexed drawing, NULL otherwise.
+ */
 typedef void (*vbo_indirect_draw_func)(
struct gl_context *ctx,
GLuint mode,
@@ -138,8 +191,8 @@ typedef void (*vbo_indirect_draw_func)(
GLsizeiptr indirect_offset,
unsigned draw_count,
unsigned stride,
-   struct gl_buffer_object *indirect_params,
-   GLsizeiptr indirect_params_offset,
+   struct gl_buffer_object *indirect_draw_count_buffer,
+   GLsizeiptr indirect_draw_count_offset,
const struct _mesa_index_buffer *ib);
 
 

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


Mesa (master): vbo: change an argument in vbo_draw_indirect_prims()

2018-02-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1bdbeae17ce62f52b0ac19960c71078dff7a2da2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1bdbeae17ce62f52b0ac19960c71078dff7a2da2

Author: Brian Paul 
Date:   Wed Jan 31 16:19:07 2018 -0700

vbo: change an argument in vbo_draw_indirect_prims()

In vbo_draw_indirect_prims() pass the 'indirect_data' argument to
vbo->draw_prims().  All the callers are passing ctx->DrawIndirectBuffer
so this should be no functional change.  Add a (temporary) assertion to
be sure.

Reviewed-by: Marek Olšák 
Reviewed-by: Mathias Fröhlich 

---

 src/mesa/vbo/vbo_context.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index f516c67843..3f55e27f9b 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -140,15 +140,19 @@ init_mat_currval(struct gl_context *ctx)
}
 }
 
+
+/**
+ * Fallback for when a driver does not call vbo_set_indirect_draw_func().
+ */
 static void
 vbo_draw_indirect_prims(struct gl_context *ctx,
 GLuint mode,
-struct gl_buffer_object *indirect_data,
+struct gl_buffer_object *indirect_buffer,
 GLsizeiptr indirect_offset,
 unsigned draw_count,
 unsigned stride,
-struct gl_buffer_object *indirect_params,
-GLsizeiptr indirect_params_offset,
+struct gl_buffer_object *indirect_draw_count_buffer,
+GLsizeiptr indirect_draw_count_offset,
 const struct _mesa_index_buffer *ib)
 {
struct vbo_context *vbo = vbo_context(ctx);
@@ -160,7 +164,7 @@ vbo_draw_indirect_prims(struct gl_context *ctx,
   _mesa_error(ctx, GL_OUT_OF_MEMORY, "gl%sDraw%sIndirect%s",
   (draw_count > 1) ? "Multi" : "",
   ib ? "Elements" : "Arrays",
-  indirect_params ? "CountARB" : "");
+  indirect_buffer ? "CountARB" : "");
   return;
}
 
@@ -174,10 +178,13 @@ vbo_draw_indirect_prims(struct gl_context *ctx,
   prim[i].draw_id = i;
}
 
+   /* This should always be true at this time */
+   assert(indirect_buffer == ctx->DrawIndirectBuffer);
+
vbo->draw_prims(ctx, prim, draw_count,
ib, false, 0, ~0,
NULL, 0,
-   ctx->DrawIndirectBuffer);
+   indirect_buffer);
 
free(prim);
 }

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


  1   2   3   4   5   6   7   8   9   10   >