[Mesa-dev] R: [PATCH 1/2] meson: require libdrm for gallium svga or virgl

2019-07-18 Thread Francesco Ansanelli
Dear Alyssa,

Sorry the bothering..

Your patch also added the check for freedreno, but it is not mentioned in
the commit message.
Is it actually what you wanted?

Cheers,
Francesco
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH v2 00/29] do not allow invalid texture-format enums

2018-11-30 Thread Francesco Ansanelli
Il giorno ven 30 nov 2018, 12:26 Erik Faye-Lund <
erik.faye-l...@collabora.com> ha scritto:

> On Fri, 2018-11-23 at 11:53 +0100, Erik Faye-Lund wrote:
> > OK, so here's a v2 of this series. These are the changes since v1:
> > - Removed double-semicolons in patch #25
> > - Removed default-case and questionable comment in patch #25
> > - Dropped patch #30, as it would regress functionality on two drivers
> >
> > Please review :)
>
> Ping? Any takers?
>
I read all the patches and didn't spot anything wrong, but please don't
consider this a proper review.

>
> > Erik Faye-Lund (29):
> >   mesa/main: make _mesa_has_tessellation return bool
> >   mesa/main: rename format-check function
> >   mesa/main: clean up S3_s3tc check
> >   mesa/main: clean up OES_texture_float_linear check
> >   mesa/main: clean up ES2_compatibility check
> >   mesa/main: clean up integer texture check
> >   mesa/main: use _mesa_has_FOO_bar for compressed format checks
> >   mesa/main: do not allow s3tc enums on gles1
> >   mesa/main: do not allow etc2 enums on gles1
> >   mesa/main: do not allow astc enums on gles1
> >   mesa/main: do not allow depth-texture enums on gles1
> >   mesa/main: do not allow stencil-texture enums on gles1
> >   mesa/main: do not allow ARB_texture_rgb10_a2ui enums before gles3
> >   mesa/main: do not allow integer-texture enums before gles3
> >   mesa/main: do not allow ARB_depth_buffer_float enums before gles3
> >   mesa/main: do not allow EXT_packed_float enums before gles3
> >   mesa/main: do not allow rg-textures enums before gles3
> >   mesa/main: do not allow EXT_texture_shared_exponent enums before
> > gles3
> >   mesa/main: do not allow MESA_ycbcr_texture enums on gles
> >   mesa/main: do not allow type_2_10_10_10_REV enums before gles3
> >   mesa/main: do not allow floating-point texture enums on gles1
> >   mesa/main: do not allow snorm-texture enums before gles3
> >   mesa/main: do not allow sRGB texture enums before gles3
> >   mesa/main: do not allow EXT_texture_sRGB_R8 enums before gles3
> >   mesa/main: split float-texture support checking in two
> >   mesa/main: require EXT_texture_type_2_10_10_10_REV for gles3
> >   mesa/main: require EXT_texture_sRGB for gles3
> >   mesa/st: do not probe for the same texture-formats twice
> >   mesa/main: do not require float-texture filtering for es3
> >
> >  src/mesa/main/context.h|  59 ++-
> >  src/mesa/main/glformats.c  | 221 +
> > 
> >  src/mesa/main/glformats.h  |   6 +-
> >  src/mesa/main/teximage.c   |   4 +-
> >  src/mesa/main/version.c|   8 +-
> >  src/mesa/state_tracker/st_extensions.c |   8 +-
> >  6 files changed, 184 insertions(+), 122 deletions(-)
> >
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/9] freedreno/ir3: resync instr-a3xx.h/disasm-a3xx.c

2017-04-19 Thread Francesco Ansanelli
2017-04-19 0:15 GMT+02:00 Rob Clark :

> Sync to the same files from freedreno.git to correct decoding of ldgb/
> stgb instructions.
>
> Signed-off-by: Rob Clark 
> ---
>  src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c |  2 +-
>  src/gallium/drivers/freedreno/disasm.h   |  3 +
>  src/gallium/drivers/freedreno/ir3/disasm-a3xx.c  | 83
> +---
>  src/gallium/drivers/freedreno/ir3/instr-a3xx.h   | 77
> --
>  src/gallium/drivers/freedreno/ir3/ir3.h  |  2 +-
>  src/gallium/drivers/freedreno/ir3/ir3_nir.c  |  4 +-
>  src/gallium/drivers/freedreno/ir3/ir3_shader.c   | 10 ++-
>  7 files changed, 161 insertions(+), 20 deletions(-)
>
> diff --git a/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c
> b/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c
> index fc309e8..c380450 100644
> --- a/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c
> +++ b/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c
> @@ -111,7 +111,7 @@ static void print_export_comment(uint32_t num, enum
> shader_t type)
> case 0:  name = "gl_FragColor"; break;
> }
> break;
> -   case SHADER_COMPUTE:
> +   default:
> unreachable("not reached");
> }
> /* if we had a symbol table here, we could look
> diff --git a/src/gallium/drivers/freedreno/disasm.h b/src/gallium/drivers/
> freedreno/disasm.h
> index e81dd1c..bac1215 100644
> --- a/src/gallium/drivers/freedreno/disasm.h
> +++ b/src/gallium/drivers/freedreno/disasm.h
> @@ -26,6 +26,9 @@
>
>  enum shader_t {
> SHADER_VERTEX,
> +   SHADER_TCS,
> +   SHADER_TES,
> +   SHADER_GEOM,
> SHADER_FRAGMENT,
> SHADER_COMPUTE,
>  };
> diff --git a/src/gallium/drivers/freedreno/ir3/disasm-a3xx.c
> b/src/gallium/drivers/freedreno/ir3/disasm-a3xx.c
> index e29d156..4685ed6 100644
> --- a/src/gallium/drivers/freedreno/ir3/disasm-a3xx.c
> +++ b/src/gallium/drivers/freedreno/ir3/disasm-a3xx.c
> @@ -159,16 +159,16 @@ static void print_instr_cat0(instr_t *instr)
> break;
> case OPC_BR:
> printf(" %sp0.%c, #%d", cat0->inv ? "!" : "",
> -   component[cat0->comp], cat0->a3xx.immed);
> +   component[cat0->comp], cat0->a5xx.immed);
> break;
> case OPC_JUMP:
> case OPC_CALL:
> -   printf(" #%d", cat0->a3xx.immed);
> +   printf(" #%d", cat0->a5xx.immed);
> break;
> }
>
> -   if ((debug & PRINT_VERBOSE) && (cat0->a3xx.dummy1|cat0->
> dummy2|cat0->dummy3|cat0->dummy4))
> -   printf("\t{0: %x,%x,%x,%x}", cat0->a3xx.dummy1,
> cat0->dummy2, cat0->dummy3, cat0->dummy4);
> +   if ((debug & PRINT_VERBOSE) && (cat0->dummy2|cat0->dummy3|
> cat0->dummy4))
> +   printf("\t{0: %x,%x,%x}", cat0->dummy2, cat0->dummy3,
> cat0->dummy4);
>  }
>
>  static void print_instr_cat1(instr_t *instr)
> @@ -506,7 +506,6 @@ static void print_instr_cat6(instr_t *instr)
> case OPC_STP:
> case OPC_STI:
> case OPC_STLW:
> -   case OPC_STGB_4D_4:
> case OPC_STIB:
> dst.full  = true;
> src1.full = type_size(cat6->type) == 32;
> @@ -523,6 +522,18 @@ static void print_instr_cat6(instr_t *instr)
> case OPC_PREFETCH:
> case OPC_RESINFO:
> break;
> +   case OPC_LDGB:
> +   printf(".%s", cat6->ldgb.typed ? "typed" : "untyped");
> +   printf(".%dd", cat6->ldgb.d + 1);
> +   printf(".%s", type[cat6->type]);
> +   printf(".%d", cat6->ldgb.type_size + 1);
> +   break;
> +   case OPC_STGB:
> +   printf(".%s", cat6->stgb.typed ? "typed" : "untyped");
> +   printf(".%dd", cat6->stgb.d + 1);
> +   printf(".%s", type[cat6->type]);
> +   printf(".%d", cat6->stgb.type_size + 1);
> +   break;
> case OPC_ATOMIC_ADD:
> case OPC_ATOMIC_SUB:
> case OPC_ATOMIC_XCHG:
> @@ -558,6 +569,7 @@ static void print_instr_cat6(instr_t *instr)
> break;
>
> case OPC_LDG:
> +   case OPC_LDC:
> ss = 'g';
> break;
> case OPC_LDP:
> @@ -589,6 +601,61 @@ static void print_instr_cat6(instr_t *instr)
> break;
> }
>
> +   if (_OPC(6, cat6->opc) == OPC_STGB) {
> +   struct reginfo src3;
> +
> +   memset(&src3, 0, sizeof(src3));
> +
> +   src1.reg = (reg_t)(cat6->stgb.src1);
> +   src2.reg = (reg_t)(cat6->stgb.src2);
> +   src2.im  = cat6->stgb.src2_im;
> +   src3.reg = (reg_t)(cat6->stgb.src3);
> +   src3.im  = cat6->stgb.src3_im;
> +   src3.full = true;
> +
> +   printf("g[%u], ", cat6->stgb.dst_ssbo);
> +   print_src(&src1);
> +   printf(", ");
> +   

Re: [Mesa-dev] [PATCH 3/3] mesa: implement GL_OES_texture_view (V2)

2016-08-30 Thread Francesco Ansanelli
Hi,

I sent this series to have some feedback (rfc prefix failed) and the
comment will be addressed as soon as the tests are done.
I started checking the piglit part that you suggested in a previous mail..

I'll ask you also about them if I don't bother too much :)

Il 31 ago 2016 01:44, "Ilia Mirkin"  ha scritto:

> On Mon, Aug 29, 2016 at 1:25 AM, Francesco Ansanelli
>  wrote:
> > XXX still need to figure how to treat the removed VIEW_CLASS*
> > and formats.
>
> Can you elaborate what this comment means?
>
> You definitely need to add piglit tests for testing ETC2 stuff - it's
> not supported in hardware for most desktop hw, and so a fallback
> method is used. I think that's the main thing this patchset is waiting
> on...
>
>   -ilia
>
> >
> > V2: drop the oes suffix in messages
> > (Ilia Mirkin)
> >
> > Signed-off-by: Francesco Ansanelli 
> > ---
> >  src/mesa/main/textureview.c |   11 +++
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
> > index ed66c17..36663cc 100644
> > --- a/src/mesa/main/textureview.c
> > +++ b/src/mesa/main/textureview.c
> > @@ -387,8 +387,10 @@ target_valid(struct gl_context *ctx, GLenum
> origTarget, GLenum newTarget)
> > switch (origTarget) {
> > case GL_TEXTURE_1D:
> > case GL_TEXTURE_1D_ARRAY:
> > -  RETURN_IF_SUPPORTED(TEXTURE_1D);
> > -  RETURN_IF_SUPPORTED(TEXTURE_1D_ARRAY);
> > +  if (!_mesa_is_gles3(ctx)) {
> > + RETURN_IF_SUPPORTED(TEXTURE_1D);
> > + RETURN_IF_SUPPORTED(TEXTURE_1D_ARRAY);
> > +  }
> >break;
> > case GL_TEXTURE_2D:
> >RETURN_IF_SUPPORTED(TEXTURE_2D);
> > @@ -398,7 +400,8 @@ target_valid(struct gl_context *ctx, GLenum
> origTarget, GLenum newTarget)
> >RETURN_IF_SUPPORTED(TEXTURE_3D);
> >break;
> > case GL_TEXTURE_RECTANGLE:
> > -  RETURN_IF_SUPPORTED(TEXTURE_RECTANGLE);
> > +  if (!_mesa_is_gles3(ctx))
> > + RETURN_IF_SUPPORTED(TEXTURE_RECTANGLE);
> >break;
> > case GL_TEXTURE_CUBE_MAP:
> > case GL_TEXTURE_2D_ARRAY:
> > @@ -514,7 +517,7 @@ _mesa_set_texture_view_state(struct gl_context *ctx,
> >  }
> >
> >  /**
> > - * glTextureView (ARB_texture_view)
> > + * glTextureView (ARB_texture_view / OES_texture_view)
> >   * If an error is found, record it with _mesa_error()
> >   * \return none.
> >   */
> > --
> > 1.7.9.5
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] mesa: Add and use _mesa_has_texture_view helper(v2)

2016-08-30 Thread Francesco Ansanelli
Hi,

to switch to the macro would mean to check also the version. I'd prefer to
keep the original behaviour but, if it's necessary I'll change it..

Francesco

Il 31 ago 2016 01:39, "Ilia Mirkin"  ha scritto:

On Mon, Aug 29, 2016 at 1:25 AM, Francesco Ansanelli
 wrote:
> V2:use the same tokens of the desktop version
>   (Ilia Mirkin, Chris Forbes)
>
> Signed-off-by: Francesco Ansanelli 
> ---
>  src/mesa/main/context.h  |7 +++
>  src/mesa/main/texparam.c |   22 ++
>  2 files changed, 17 insertions(+), 12 deletions(-)
>
> diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
> index 4cd149d..bdf4414 100644
> --- a/src/mesa/main/context.h
> +++ b/src/mesa/main/context.h
> @@ -358,6 +358,13 @@ _mesa_has_texture_cube_map_array(const struct
gl_context *ctx)
>_mesa_has_OES_texture_cube_map_array(ctx);
>  }
>
> +static inline bool
> +_mesa_has_texture_view(const struct gl_context *ctx)
> +{
> +   return _mesa_has_OES_texture_view(ctx) ||
> +  (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view);

I think you just want || _mesa_has_ARB_texture_view(ctx).

> +}
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
> index bdd3fcb..2c99804 100644
> --- a/src/mesa/main/texparam.c
> +++ b/src/mesa/main/texparam.c
> @@ -1929,33 +1929,32 @@ get_tex_parameterfv(struct gl_context *ctx,
>   break;
>
>case GL_TEXTURE_IMMUTABLE_LEVELS:
> - if (_mesa_is_gles3(ctx) ||
> - (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_
view))
> + if (_mesa_is_gles3(ctx) || _mesa_has_texture_view(ctx))
>  *params = (GLfloat) obj->ImmutableLevels;
>   else
>  goto invalid_pname;
>   break;
>
>case GL_TEXTURE_VIEW_MIN_LEVEL:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
>  goto invalid_pname;
>   *params = (GLfloat) obj->MinLevel;
>   break;
>
>case GL_TEXTURE_VIEW_NUM_LEVELS:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
>  goto invalid_pname;
>   *params = (GLfloat) obj->NumLevels;
>   break;
>
>case GL_TEXTURE_VIEW_MIN_LAYER:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
>  goto invalid_pname;
>   *params = (GLfloat) obj->MinLayer;
>   break;
>
>case GL_TEXTURE_VIEW_NUM_LAYERS:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
>  goto invalid_pname;
>   *params = (GLfloat) obj->NumLayers;
>   break;
> @@ -2161,33 +2160,32 @@ get_tex_parameteriv(struct gl_context *ctx,
>   break;
>
>case GL_TEXTURE_IMMUTABLE_LEVELS:
> - if (_mesa_is_gles3(ctx) ||
> - (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_
view))
> + if (_mesa_is_gles3(ctx) || _mesa_has_texture_view(ctx))
>  *params = obj->ImmutableLevels;
>   else
>  goto invalid_pname;
>   break;
>
>case GL_TEXTURE_VIEW_MIN_LEVEL:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
>  goto invalid_pname;
>   *params = (GLint) obj->MinLevel;
>   break;
>
>case GL_TEXTURE_VIEW_NUM_LEVELS:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
>  goto invalid_pname;
>   *params = (GLint) obj->NumLevels;
>   break;
>
>case GL_TEXTURE_VIEW_MIN_LAYER:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
>  goto invalid_pname;
>   *params = (GLint) obj->MinLayer;
>   break;
>
>case GL_TEXTURE_VIEW_NUM_LAYERS:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
>  goto invalid_pname;
>   *params = (GLint) obj->NumLayers;
>   break;
> --
> 1.7.9.5
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] mesa: Handle OES_texture_view tokens

2016-08-28 Thread Francesco Ansanelli
I dropped this patch and replaced with another one.

Thanks
Francesco

2016-08-28 22:38 GMT+02:00 Chris Forbes :

> This patch isn't right. These enum values are the same as the desktop
> version, so your new cases will never actually be used.
>
> On Mon, Aug 29, 2016 at 2:24 AM, Francesco Ansanelli 
> wrote:
>
>> Signed-off-by: Francesco Ansanelli 
>> ---
>>  src/mesa/main/texparam.c |   48 ++
>> 
>>  1 file changed, 48 insertions(+)
>>
>> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
>> index bdd3fcb..4dd97b1 100644
>> --- a/src/mesa/main/texparam.c
>> +++ b/src/mesa/main/texparam.c
>> @@ -1960,6 +1960,30 @@ get_tex_parameterfv(struct gl_context *ctx,
>>   *params = (GLfloat) obj->NumLayers;
>>   break;
>>
>> +  case GL_TEXTURE_VIEW_MIN_LEVEL_OES:
>> + if (!ctx->Extensions.OES_texture_view)
>> +goto invalid_pname;
>> + *params = (GLfloat) obj->MinLevel;
>> + break;
>> +
>> +  case GL_TEXTURE_VIEW_NUM_LEVELS_OES:
>> + if (!ctx->Extensions.OES_texture_view)
>> +goto invalid_pname;
>> + *params = (GLfloat) obj->NumLevels;
>> + break;
>> +
>> +  case GL_TEXTURE_VIEW_MIN_LAYER_OES:
>> + if (!ctx->Extensions.OES_texture_view)
>> +goto invalid_pname;
>> + *params = (GLfloat) obj->MinLayer;
>> + break;
>> +
>> +  case GL_TEXTURE_VIEW_NUM_LAYERS_OES:
>> + if (!ctx->Extensions.OES_texture_view)
>> +goto invalid_pname;
>> + *params = (GLfloat) obj->NumLayers;
>> + break;
>> +
>>case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
>>   if (!_mesa_is_gles(ctx) || !ctx->Extensions.OES_EGL_image
>> _external)
>>  goto invalid_pname;
>> @@ -2192,6 +2216,30 @@ get_tex_parameteriv(struct gl_context *ctx,
>>   *params = (GLint) obj->NumLayers;
>>   break;
>>
>> +  case GL_TEXTURE_VIEW_MIN_LEVEL_OES:
>> + if (!ctx->Extensions.OES_texture_view)
>> +goto invalid_pname;
>> + *params = (GLint) obj->MinLevel;
>> + break;
>> +
>> +  case GL_TEXTURE_VIEW_NUM_LEVELS_OES:
>> + if (!ctx->Extensions.OES_texture_view)
>> +goto invalid_pname;
>> + *params = (GLint) obj->NumLevels;
>> + break;
>> +
>> +  case GL_TEXTURE_VIEW_MIN_LAYER_OES:
>> + if (!ctx->Extensions.OES_texture_view)
>> +goto invalid_pname;
>> + *params = (GLint) obj->MinLayer;
>> + break;
>> +
>> +  case GL_TEXTURE_VIEW_NUM_LAYERS_OES:
>> + if (!ctx->Extensions.OES_texture_view)
>> +goto invalid_pname;
>> + *params = (GLint) obj->NumLayers;
>> + break;
>> +
>>case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
>>   if (!_mesa_is_gles(ctx) || !ctx->Extensions.OES_EGL_image
>> _external)
>>  goto invalid_pname;
>> --
>> 1.7.9.5
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] GL_OES_texture_view RFC

2016-08-28 Thread Francesco Ansanelli
Thanks for your feedback.
I've addressed your concerns in the version 2 of patches.

Francesco

2016-08-28 16:42 GMT+02:00 Ilia Mirkin :

> The most important part of this exercise is to get tests up and running.
> Unfortunately there are none in dEQP. I think the simplest path would be to
> get the existing ones to build as gles31 as well as GL. Check the blend
> func extended tests to see how that is done.
>
> Overall feedback:
> - are you sure the oes tokens are different than desktop? Normally they're
> the same.
> - imho it's not really important to have the oes suffix in messages.
>
> On Aug 28, 2016 10:31 AM, "Francesco Ansanelli" 
> wrote:
>
>> Hi list,
>>
>> I tried to figure how this extension could be hooked-up.
>>
>> I fear last patch is a bit an hack because we may want to add also the
>> EXT one... But this could be figured later.
>>
>> In any case, please review.
>>
>> Cheers,
>> Francesco
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] glapi: add GL_OES_texture_view

2016-08-28 Thread Francesco Ansanelli
Signed-off-by: Francesco Ansanelli 
---
 src/mapi/glapi/gen/es_EXT.xml   |   15 +++
 src/mesa/main/extensions_table.h|1 +
 src/mesa/main/mtypes.h  |1 +
 src/mesa/main/tests/dispatch_sanity.cpp |3 +++
 4 files changed, 20 insertions(+)

diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index 6f2d643..f2570e5 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -1112,6 +1112,21 @@
 
 
 
+
+
+   
+  
+  
+  
+  
+  
+  
+  
+  
+   
+
+
+
 
 
 https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/3] mesa: implement GL_OES_texture_view (V2)

2016-08-28 Thread Francesco Ansanelli
XXX still need to figure how to treat the removed VIEW_CLASS*
and formats.

V2: drop the oes suffix in messages
(Ilia Mirkin)

Signed-off-by: Francesco Ansanelli 
---
 src/mesa/main/textureview.c |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index ed66c17..36663cc 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -387,8 +387,10 @@ target_valid(struct gl_context *ctx, GLenum origTarget, 
GLenum newTarget)
switch (origTarget) {
case GL_TEXTURE_1D:
case GL_TEXTURE_1D_ARRAY:
-  RETURN_IF_SUPPORTED(TEXTURE_1D);
-  RETURN_IF_SUPPORTED(TEXTURE_1D_ARRAY);
+  if (!_mesa_is_gles3(ctx)) {
+ RETURN_IF_SUPPORTED(TEXTURE_1D);
+ RETURN_IF_SUPPORTED(TEXTURE_1D_ARRAY);
+  }
   break;
case GL_TEXTURE_2D:
   RETURN_IF_SUPPORTED(TEXTURE_2D);
@@ -398,7 +400,8 @@ target_valid(struct gl_context *ctx, GLenum origTarget, 
GLenum newTarget)
   RETURN_IF_SUPPORTED(TEXTURE_3D);
   break;
case GL_TEXTURE_RECTANGLE:
-  RETURN_IF_SUPPORTED(TEXTURE_RECTANGLE);
+  if (!_mesa_is_gles3(ctx))
+ RETURN_IF_SUPPORTED(TEXTURE_RECTANGLE);
   break;
case GL_TEXTURE_CUBE_MAP:
case GL_TEXTURE_2D_ARRAY:
@@ -514,7 +517,7 @@ _mesa_set_texture_view_state(struct gl_context *ctx,
 }
 
 /**
- * glTextureView (ARB_texture_view)
+ * glTextureView (ARB_texture_view / OES_texture_view)
  * If an error is found, record it with _mesa_error()
  * \return none.
  */
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 2/3] mesa: Add and use _mesa_has_texture_view helper(v2)

2016-08-28 Thread Francesco Ansanelli
V2:use the same tokens of the desktop version
  (Ilia Mirkin, Chris Forbes)

Signed-off-by: Francesco Ansanelli 
---
 src/mesa/main/context.h  |7 +++
 src/mesa/main/texparam.c |   22 ++
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 4cd149d..bdf4414 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -358,6 +358,13 @@ _mesa_has_texture_cube_map_array(const struct gl_context 
*ctx)
   _mesa_has_OES_texture_cube_map_array(ctx);
 }
 
+static inline bool
+_mesa_has_texture_view(const struct gl_context *ctx)
+{
+   return _mesa_has_OES_texture_view(ctx) ||
+  (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index bdd3fcb..2c99804 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1929,33 +1929,32 @@ get_tex_parameterfv(struct gl_context *ctx,
  break;
 
   case GL_TEXTURE_IMMUTABLE_LEVELS:
- if (_mesa_is_gles3(ctx) ||
- (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
+ if (_mesa_is_gles3(ctx) || _mesa_has_texture_view(ctx))
 *params = (GLfloat) obj->ImmutableLevels;
  else
 goto invalid_pname;
  break;
 
   case GL_TEXTURE_VIEW_MIN_LEVEL:
- if (!ctx->Extensions.ARB_texture_view)
+ if (!_mesa_has_texture_view(ctx))
 goto invalid_pname;
  *params = (GLfloat) obj->MinLevel;
  break;
 
   case GL_TEXTURE_VIEW_NUM_LEVELS:
- if (!ctx->Extensions.ARB_texture_view)
+ if (!_mesa_has_texture_view(ctx))
 goto invalid_pname;
  *params = (GLfloat) obj->NumLevels;
  break;
 
   case GL_TEXTURE_VIEW_MIN_LAYER:
- if (!ctx->Extensions.ARB_texture_view)
+ if (!_mesa_has_texture_view(ctx))
 goto invalid_pname;
  *params = (GLfloat) obj->MinLayer;
  break;
 
   case GL_TEXTURE_VIEW_NUM_LAYERS:
- if (!ctx->Extensions.ARB_texture_view)
+ if (!_mesa_has_texture_view(ctx))
 goto invalid_pname;
  *params = (GLfloat) obj->NumLayers;
  break;
@@ -2161,33 +2160,32 @@ get_tex_parameteriv(struct gl_context *ctx,
  break;
 
   case GL_TEXTURE_IMMUTABLE_LEVELS:
- if (_mesa_is_gles3(ctx) ||
- (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
+ if (_mesa_is_gles3(ctx) || _mesa_has_texture_view(ctx))
 *params = obj->ImmutableLevels;
  else
 goto invalid_pname;
  break;
 
   case GL_TEXTURE_VIEW_MIN_LEVEL:
- if (!ctx->Extensions.ARB_texture_view)
+ if (!_mesa_has_texture_view(ctx))
 goto invalid_pname;
  *params = (GLint) obj->MinLevel;
  break;
 
   case GL_TEXTURE_VIEW_NUM_LEVELS:
- if (!ctx->Extensions.ARB_texture_view)
+ if (!_mesa_has_texture_view(ctx))
 goto invalid_pname;
  *params = (GLint) obj->NumLevels;
  break;
 
   case GL_TEXTURE_VIEW_MIN_LAYER:
- if (!ctx->Extensions.ARB_texture_view)
+ if (!_mesa_has_texture_view(ctx))
 goto invalid_pname;
  *params = (GLint) obj->MinLayer;
  break;
 
   case GL_TEXTURE_VIEW_NUM_LAYERS:
- if (!ctx->Extensions.ARB_texture_view)
+ if (!_mesa_has_texture_view(ctx))
 goto invalid_pname;
  *params = (GLint) obj->NumLayers;
  break;
-- 
1.7.9.5

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


[Mesa-dev] GL_OES_texture_view RFC

2016-08-28 Thread Francesco Ansanelli
Hi list,

I tried to figure how this extension could be hooked-up.

I fear last patch is a bit an hack because we may want to add also the EXT
one... But this could be figured later.

In any case, please review.

Cheers,
Francesco
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/3] mesa: implement GL_OES_texture_view

2016-08-28 Thread Francesco Ansanelli
XXX still need to figure how to treat the removed VIEW_CLASS*
and formats.

Signed-off-by: Francesco Ansanelli 
---
 src/mesa/main/textureview.c |   69 +--
 1 file changed, 41 insertions(+), 28 deletions(-)

diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index ed66c17..1a65923 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -387,8 +387,10 @@ target_valid(struct gl_context *ctx, GLenum origTarget, 
GLenum newTarget)
switch (origTarget) {
case GL_TEXTURE_1D:
case GL_TEXTURE_1D_ARRAY:
-  RETURN_IF_SUPPORTED(TEXTURE_1D);
-  RETURN_IF_SUPPORTED(TEXTURE_1D_ARRAY);
+  if (!_mesa_is_gles3(ctx)) {
+ RETURN_IF_SUPPORTED(TEXTURE_1D);
+ RETURN_IF_SUPPORTED(TEXTURE_1D_ARRAY);
+  }
   break;
case GL_TEXTURE_2D:
   RETURN_IF_SUPPORTED(TEXTURE_2D);
@@ -398,7 +400,8 @@ target_valid(struct gl_context *ctx, GLenum origTarget, 
GLenum newTarget)
   RETURN_IF_SUPPORTED(TEXTURE_3D);
   break;
case GL_TEXTURE_RECTANGLE:
-  RETURN_IF_SUPPORTED(TEXTURE_RECTANGLE);
+  if (!_mesa_is_gles3(ctx))
+ RETURN_IF_SUPPORTED(TEXTURE_RECTANGLE);
   break;
case GL_TEXTURE_CUBE_MAP:
case GL_TEXTURE_2D_ARRAY:
@@ -415,7 +418,8 @@ target_valid(struct gl_context *ctx, GLenum origTarget, 
GLenum newTarget)
   break;
}
_mesa_error(ctx, GL_INVALID_OPERATION,
-   "glTextureView(illegal target=%s)",
+   "glTextureView%s(illegal target=%s)",
+   _mesa_is_gles3(ctx) ? "OES" : "",
_mesa_enum_to_string(newTarget));
return false;
 }
@@ -514,7 +518,7 @@ _mesa_set_texture_view_state(struct gl_context *ctx,
 }
 
 /**
- * glTextureView (ARB_texture_view)
+ * glTextureView (ARB_texture_view / OES_texture_view)
  * If an error is found, record it with _mesa_error()
  * \return none.
  */
@@ -537,14 +541,15 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint 
origtexture,
GET_CURRENT_CONTEXT(ctx);
 
if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE))
-  _mesa_debug(ctx, "glTextureView %d %s %d %s %d %d %d %d\n",
+  _mesa_debug(ctx, "glTextureView%s %d %s %d %s %d %d %d %d\n",
+  _mesa_is_gles3(ctx) ? "OES" : "",
   texture, _mesa_enum_to_string(target), origtexture,
   _mesa_enum_to_string(internalformat),
   minlevel, numlevels, minlayer, numlayers);
 
if (origtexture == 0) {
-  _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView(origtexture = %u)",
-  origtexture);
+  _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView%s(origtexture = %u)",
+  _mesa_is_gles3(ctx) ? "OES" : "", origtexture);
   return;
}
 
@@ -555,8 +560,8 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint 
origtexture,
 * is generated.
 */
if (!origTexObj) {
-  _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView(origtexture = %u)",
-  origtexture);
+  _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView%s(origtexture = %u)",
+  _mesa_is_gles3(ctx) ? "OES" : "", origtexture);
   return;
}
 
@@ -565,13 +570,15 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint 
origtexture,
 */
if (!origTexObj->Immutable) {
   _mesa_error(ctx, GL_INVALID_OPERATION,
-  "glTextureView(origtexture not immutable)");
+  "glTextureView%s(origtexture not immutable)",
+  _mesa_is_gles3(ctx) ? "OES" : "");
   return;
}
 
/* If  is 0, INVALID_VALUE is generated. */
if (texture == 0) {
-  _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView(texture = 0)");
+  _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView%s(texture = 0)",
+  _mesa_is_gles3(ctx) ? "OES" : "");
   return;
}
 
@@ -581,7 +588,8 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint 
origtexture,
texObj = _mesa_lookup_texture(ctx, texture);
if (texObj == NULL) {
   _mesa_error(ctx, GL_INVALID_OPERATION,
-  "glTextureView(texture = %u non-gen name)", texture);
+  "glTextureView%s(texture = %u non-gen name)",
+  _mesa_is_gles3(ctx) ? "OES" : "", texture);
   return;
}
 
@@ -590,7 +598,8 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint 
origtexture,
 */
if (texObj->Target) {
   _mesa_error(ctx, GL_INVALID_OPERATION,
-  "glTextureView(texture = %u already bound)", texture);
+  "glTextureView%s(texture = %u already bound)",
+  _mesa_is_gles3(ctx) ?

[Mesa-dev] [PATCH 1/3] glapi: add GL_OES_texture_view

2016-08-28 Thread Francesco Ansanelli
Signed-off-by: Francesco Ansanelli 
---
 src/mapi/glapi/gen/es_EXT.xml   |   15 +++
 src/mesa/main/extensions_table.h|1 +
 src/mesa/main/mtypes.h  |1 +
 src/mesa/main/tests/dispatch_sanity.cpp |3 +++
 4 files changed, 20 insertions(+)

diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index 6f2d643..f2570e5 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -1112,6 +1112,21 @@
 
 
 
+
+
+   
+  
+  
+  
+  
+  
+  
+  
+  
+   
+
+
+
 
 
 https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] mesa: Handle OES_texture_view tokens

2016-08-28 Thread Francesco Ansanelli
Signed-off-by: Francesco Ansanelli 
---
 src/mesa/main/texparam.c |   48 ++
 1 file changed, 48 insertions(+)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index bdd3fcb..4dd97b1 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1960,6 +1960,30 @@ get_tex_parameterfv(struct gl_context *ctx,
  *params = (GLfloat) obj->NumLayers;
  break;
 
+  case GL_TEXTURE_VIEW_MIN_LEVEL_OES:
+ if (!ctx->Extensions.OES_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj->MinLevel;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LEVELS_OES:
+ if (!ctx->Extensions.OES_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj->NumLevels;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LAYER_OES:
+ if (!ctx->Extensions.OES_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj->MinLayer;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LAYERS_OES:
+ if (!ctx->Extensions.OES_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj->NumLayers;
+ break;
+
   case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
  if (!_mesa_is_gles(ctx) || !ctx->Extensions.OES_EGL_image_external)
 goto invalid_pname;
@@ -2192,6 +2216,30 @@ get_tex_parameteriv(struct gl_context *ctx,
  *params = (GLint) obj->NumLayers;
  break;
 
+  case GL_TEXTURE_VIEW_MIN_LEVEL_OES:
+ if (!ctx->Extensions.OES_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj->MinLevel;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LEVELS_OES:
+ if (!ctx->Extensions.OES_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj->NumLevels;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LAYER_OES:
+ if (!ctx->Extensions.OES_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj->MinLayer;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LAYERS_OES:
+ if (!ctx->Extensions.OES_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj->NumLayers;
+ break;
+
   case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
  if (!_mesa_is_gles(ctx) || !ctx->Extensions.OES_EGL_image_external)
 goto invalid_pname;
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] mesa/main: missing return in a non-void function

2016-08-25 Thread Francesco Ansanelli
Signed-off-by: Francesco Ansanelli 
---
 src/mesa/main/program_resource.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c
index 6ddbdad..51dbe95 100644
--- a/src/mesa/main/program_resource.c
+++ b/src/mesa/main/program_resource.c
@@ -105,6 +105,7 @@ stage_from_program_interface(GLenum programInterface)
   return MESA_SHADER_COMPUTE;
default:
   assert(!"unexpected programInterface value");
+  return -1;
}
 }
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] mesa/st: use llabs instead of abs for long args (v2)

2016-08-16 Thread Francesco Ansanelli
v2: long has 32bit on Windows (Marek)
Signed-off-by: Francesco Ansanelli 
---
 src/mesa/state_tracker/st_atom_array.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_atom_array.c 
b/src/mesa/state_tracker/st_atom_array.c
index dcead27..1c2cfa7 100644
--- a/src/mesa/state_tracker/st_atom_array.c
+++ b/src/mesa/state_tracker/st_atom_array.c
@@ -363,7 +363,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
  if (bufObj != firstBufObj)
 return GL_FALSE; /* arrays in different VBOs */
 
- if (abs(array->Ptr - firstPtr) > firstStride)
+ if (llabs(array->Ptr - firstPtr) > firstStride)
 return GL_FALSE; /* arrays start too far apart */
 
  if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer)
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] mesa/st: use labs instead of abs for long args Signed-off-by: Francesco Ansanelli

2016-08-16 Thread Francesco Ansanelli
---
 src/mesa/state_tracker/st_atom_array.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_atom_array.c 
b/src/mesa/state_tracker/st_atom_array.c
index dcead27..70247b9 100644
--- a/src/mesa/state_tracker/st_atom_array.c
+++ b/src/mesa/state_tracker/st_atom_array.c
@@ -363,7 +363,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
  if (bufObj != firstBufObj)
 return GL_FALSE; /* arrays in different VBOs */
 
- if (abs(array->Ptr - firstPtr) > firstStride)
+ if (labs(array->Ptr - firstPtr) > firstStride)
 return GL_FALSE; /* arrays start too far apart */
 
  if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer)
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] freedreno/a2xx: add missing casts to silence notices

2016-08-09 Thread Francesco Ansanelli
Signed-off-by: Francesco Ansanelli 
---
 src/gallium/drivers/freedreno/a2xx/ir-a2xx.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c 
b/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c
index 2b62b3a..163c282 100644
--- a/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c
+++ b/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c
@@ -403,7 +403,7 @@ static int instr_emit_alu(struct ir2_instruction *instr, 
uint32_t *dwords,
assert((src2_reg->flags & IR2_REG_EXPORT) == 0);
assert(!src2_reg->swizzle || (strlen(src2_reg->swizzle) == 4));
 
-   if (instr->alu.vector_opc == ~0) {
+   if (instr->alu.vector_opc == (instr_vector_opc_t)~0) {
alu->vector_opc  = MAXv;
alu->vector_write_mask   = 0;
} else {
@@ -431,7 +431,7 @@ static int instr_emit_alu(struct ir2_instruction *instr, 
uint32_t *dwords,
alu->vector_clamp= instr->alu.vector_clamp;
alu->scalar_clamp= instr->alu.scalar_clamp;
 
-   if (instr->alu.scalar_opc != ~0) {
+   if (instr->alu.scalar_opc != (instr_scalar_opc_t)~0) {
struct ir2_register *sdst_reg = instr->regs[reg++];
 
reg_update_stats(sdst_reg, info, true);
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH 1/3] freedreno/a2xx: fix comparison out of range warnings

2016-08-06 Thread Francesco Ansanelli
Hello,

I did more tests... and I didn't experience any error.
I attach last version of the script.

Cheers,
Francesco

2016-08-04 19:50 GMT+02:00 Francesco Ansanelli :

> Hi Eric,
>
> after your question:
>
> [snip]
> I expect, with enums having varying size, that this cast will
> not always work.
> [snip]
>
> I started a script for testing with variable enum sizes and compilers...
> If does makes sense to you, I'll try to loop from 1 to n (suggestions?)
> and build with gcc and clang (and others?) to find the case you're taking
> about.
> I'm also thinking about a negative test...
> What do you think?
>
> Cheers,
> Francesco
>
> 2016-08-01 14:10 GMT+02:00 Eric Engestrom :
>
>> On Sat, Jul 30, 2016 at 09:49:57AM +0200, Francesco Ansanelli wrote:
>> > Signed-off-by: Francesco Ansanelli 
>> > ---
>> >  src/gallium/drivers/freedreno/a2xx/fd2_screen.c |8 
>> >  1 file changed, 4 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
>> b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
>> > index fe4849b..007b9e6 100644
>> > --- a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
>> > +++ b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
>> > @@ -61,7 +61,7 @@ fd2_screen_is_format_supported(struct pipe_screen
>> *pscreen,
>> >
>> >   if ((usage & (PIPE_BIND_SAMPLER_VIEW |
>> >   PIPE_BIND_VERTEX_BUFFER)) &&
>> > - (fd2_pipe2surface(format) != ~0u)) {
>> > + (fd2_pipe2surface(format) != (enum
>> a2xx_sq_surfaceformat)~0)) {
>>
>> You said the compiler warning goes away, but is the condition guaranteed
>> to hit? I expect, with enums having varying size, that this cast will
>> not always work. I agree with Rob Herring, adding the error value to the
>> enum is better.
>>
>> >   retval |= usage & (PIPE_BIND_SAMPLER_VIEW |
>> >   PIPE_BIND_VERTEX_BUFFER);
>> >   }
>> > @@ -70,7 +70,7 @@ fd2_screen_is_format_supported(struct pipe_screen
>> *pscreen,
>> >   PIPE_BIND_DISPLAY_TARGET |
>> >   PIPE_BIND_SCANOUT |
>> >   PIPE_BIND_SHARED)) &&
>> > - (fd2_pipe2color(format) != ~0u)) {
>> > + (fd2_pipe2color(format) != (enum
>> a2xx_colorformatx)~0)) {
>> >   retval |= usage & (PIPE_BIND_RENDER_TARGET |
>> >   PIPE_BIND_DISPLAY_TARGET |
>> >   PIPE_BIND_SCANOUT |
>> > @@ -78,12 +78,12 @@ fd2_screen_is_format_supported(struct pipe_screen
>> *pscreen,
>> >   }
>> >
>> >   if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
>> > - (fd_pipe2depth(format) != ~0u)) {
>> > + (fd_pipe2depth(format) != (enum
>> adreno_rb_depth_format)~0)) {
>> >   retval |= PIPE_BIND_DEPTH_STENCIL;
>> >   }
>> >
>> >   if ((usage & PIPE_BIND_INDEX_BUFFER) &&
>> > - (fd_pipe2index(format) != ~0u)) {
>> > + (fd_pipe2index(format) != (enum
>> pc_di_index_size)~0)) {
>> >   retval |= PIPE_BIND_INDEX_BUFFER;
>> >   }
>> >
>> > --
>> > 1.7.9.5
>> >
>> > ___
>> > mesa-dev mailing list
>> > mesa-dev@lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>
>
from subprocess import call

def main():
  tests = 10;
  for e in range(1, tests + 1):
for c in ['clang', 'gcc']:
  testEnums(e, c)

def testEnums(enums, compiler):
  out_file = open("gen.c","w")
  out_file.write('#include \n\n')
  out_file.write('enum E\n')
  out_file.write('{\n')

  for enum in range(0, enums):
out_file.write('   e{}'.format(enum))
if enum + 1 != enums:
  out_file.write(',')
out_file.write('\n')

  out_file.write('};\n\n')
  out_file.write('enum E\n')
  out_file.write('test()\n')
  out_file.write('{\n')
  out_file.write('  return ~0;\n')
  out_file.write('}\n\n')
  out_file.write('enum E\n')
  out_file.write('testNeg()\n')
  out_file.write('{\n')
  out_file.write('  return e{};\n'.format(enum))
  out_file.write('}\n\n')
  out_file.write('int\n')
  out_file.write('main()\n')
  out_file.write('{\n')
  out_file.write('  if (test() == (enum E)~0 && testNeg() != (enum E)~0)\n')
  out_file.write('printf("Success\\n");\n')
  out_file.write('  else\n')
  out_file.write('printf("Error\\n");\n\n')
  out_file.write('  return 0;\n')
  out_file.write('}\n')
  out_file.close()

#  call(["cat", "gen.c"]);
  call([compiler, "-Wall", "-Wextra", "gen.c", "-o", "genc"]);
  print('enums:{}, compiler:{}, result:'.format(enums, compiler));
  call(["./genc"]);

if __name__ == '__main__':
  main()
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] freedreno/a2xx: fix comparison out of range warnings

2016-08-04 Thread Francesco Ansanelli
Hi Eric,

after your question:

[snip]
I expect, with enums having varying size, that this cast will
not always work.
[snip]

I started a script for testing with variable enum sizes and compilers...
If does makes sense to you, I'll try to loop from 1 to n (suggestions?) and
build with gcc and clang (and others?) to find the case you're taking about.
I'm also thinking about a negative test...
What do you think?

Cheers,
Francesco

2016-08-01 14:10 GMT+02:00 Eric Engestrom :

> On Sat, Jul 30, 2016 at 09:49:57AM +0200, Francesco Ansanelli wrote:
> > Signed-off-by: Francesco Ansanelli 
> > ---
> >  src/gallium/drivers/freedreno/a2xx/fd2_screen.c |8 
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> > index fe4849b..007b9e6 100644
> > --- a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> > +++ b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> > @@ -61,7 +61,7 @@ fd2_screen_is_format_supported(struct pipe_screen
> *pscreen,
> >
> >   if ((usage & (PIPE_BIND_SAMPLER_VIEW |
> >   PIPE_BIND_VERTEX_BUFFER)) &&
> > - (fd2_pipe2surface(format) != ~0u)) {
> > + (fd2_pipe2surface(format) != (enum
> a2xx_sq_surfaceformat)~0)) {
>
> You said the compiler warning goes away, but is the condition guaranteed
> to hit? I expect, with enums having varying size, that this cast will
> not always work. I agree with Rob Herring, adding the error value to the
> enum is better.
>
> >   retval |= usage & (PIPE_BIND_SAMPLER_VIEW |
> >   PIPE_BIND_VERTEX_BUFFER);
> >   }
> > @@ -70,7 +70,7 @@ fd2_screen_is_format_supported(struct pipe_screen
> *pscreen,
> >   PIPE_BIND_DISPLAY_TARGET |
> >   PIPE_BIND_SCANOUT |
> >   PIPE_BIND_SHARED)) &&
> > - (fd2_pipe2color(format) != ~0u)) {
> > + (fd2_pipe2color(format) != (enum
> a2xx_colorformatx)~0)) {
> >   retval |= usage & (PIPE_BIND_RENDER_TARGET |
> >   PIPE_BIND_DISPLAY_TARGET |
> >   PIPE_BIND_SCANOUT |
> > @@ -78,12 +78,12 @@ fd2_screen_is_format_supported(struct pipe_screen
> *pscreen,
> >   }
> >
> >   if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
> > - (fd_pipe2depth(format) != ~0u)) {
> > + (fd_pipe2depth(format) != (enum
> adreno_rb_depth_format)~0)) {
> >   retval |= PIPE_BIND_DEPTH_STENCIL;
> >   }
> >
> >   if ((usage & PIPE_BIND_INDEX_BUFFER) &&
> > - (fd_pipe2index(format) != ~0u)) {
> > + (fd_pipe2index(format) != (enum
> pc_di_index_size)~0)) {
> >   retval |= PIPE_BIND_INDEX_BUFFER;
> >   }
> >
> > --
> > 1.7.9.5
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
from subprocess import call

def main():
  lastEnum = 1
  compiler = 'clang'

  out_file = open("gen.c","w")
  out_file.write('#include \n\n')
  out_file.write('enum E\n')
  out_file.write('{\n')

  for enum in range(0, lastEnum):
out_file.write('   e{enum}'.format(enum=enum))
if enum + 1 != lastEnum:
  out_file.write(',')
out_file.write('\n')

  out_file.write('};\n\n')
  out_file.write('enum E\n')
  out_file.write('test()\n')
  out_file.write('{\n')
  out_file.write('  return ~0;\n')
  out_file.write('}\n\n')
  out_file.write('int\n')
  out_file.write('main()\n')
  out_file.write('{\n')
  out_file.write('  if (test() == (enum E)~0)\n')
  out_file.write('printf("Success\\n");\n')
  out_file.write('  else\n')
  out_file.write('printf("Error\\n");\n\n')
  out_file.write('  return 0;\n')
  out_file.write('}\n')
  out_file.close()

  call(["cat", "gen.c"]);
  call([compiler, "-Wall", "-Wextra", "gen.c", "-o", "genc"]);
  call(["./genc"]);

if __name__ == '__main__':
  main()
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/3] freedreno/a4xx: fix comparison out of range warnings

2016-07-30 Thread Francesco Ansanelli
Signed-off-by: Francesco Ansanelli 
---
 src/gallium/drivers/freedreno/a4xx/fd4_screen.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c 
b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
index 57fecf1..aa60658 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
@@ -52,14 +52,14 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
}
 
if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
-   (fd4_pipe2vtx(format) != ~0u)) {
+   (fd4_pipe2vtx(format) != (enum a4xx_vtx_fmt)~0)) {
retval |= PIPE_BIND_VERTEX_BUFFER;
}
 
if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
(target == PIPE_BUFFER ||
 util_format_get_blocksize(format) != 12) &&
-   (fd4_pipe2tex(format) != ~0u)) {
+   (fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0)) {
retval |= PIPE_BIND_SAMPLER_VIEW;
}
 
@@ -67,8 +67,8 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) &&
-   (fd4_pipe2color(format) != ~0u) &&
-   (fd4_pipe2tex(format) != ~0u)) {
+   (fd4_pipe2color(format) != (enum a4xx_color_fmt)~0) &&
+   (fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0)) {
retval |= usage & (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
@@ -76,13 +76,13 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
}
 
if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
-   (fd4_pipe2depth(format) != ~0u) &&
-   (fd4_pipe2tex(format) != ~0u)) {
+   (fd4_pipe2depth(format) != (enum a4xx_depth_format)~0) 
&&
+   (fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0)) {
retval |= PIPE_BIND_DEPTH_STENCIL;
}
 
if ((usage & PIPE_BIND_INDEX_BUFFER) &&
-   (fd_pipe2index(format) != ~0u)) {
+   (fd_pipe2index(format) != (enum pc_di_index_size)~0)) {
retval |= PIPE_BIND_INDEX_BUFFER;
}
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 2/3] freedreno/a3xx: fix comparison out of range warnings

2016-07-30 Thread Francesco Ansanelli
Signed-off-by: Francesco Ansanelli 
---
 src/gallium/drivers/freedreno/a3xx/fd3_screen.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c 
b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
index 013b0ca..52a284e 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
@@ -52,12 +52,12 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen,
}
 
if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
-   (fd3_pipe2vtx(format) != ~0u)) {
+   (fd3_pipe2vtx(format) != (enum a3xx_vtx_fmt)~0)) {
retval |= PIPE_BIND_VERTEX_BUFFER;
}
 
if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
-   (fd3_pipe2tex(format) != ~0u)) {
+   (fd3_pipe2tex(format) != (enum a3xx_tex_fmt)~0)) {
retval |= PIPE_BIND_SAMPLER_VIEW;
}
 
@@ -66,8 +66,8 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen,
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED |
PIPE_BIND_BLENDABLE)) &&
-   (fd3_pipe2color(format) != ~0u) &&
-   (fd3_pipe2tex(format) != ~0u)) {
+   (fd3_pipe2color(format) != (enum a3xx_color_fmt)~0) &&
+   (fd3_pipe2tex(format) != (enum a3xx_tex_fmt)~0)) {
retval |= usage & (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
@@ -77,13 +77,13 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen,
}
 
if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
-   (fd_pipe2depth(format) != ~0u) &&
-   (fd3_pipe2tex(format) != ~0u)) {
+   (fd_pipe2depth(format) != (enum 
adreno_rb_depth_format)~0) &&
+   (fd3_pipe2tex(format) != (enum a3xx_tex_fmt)~0)) {
retval |= PIPE_BIND_DEPTH_STENCIL;
}
 
if ((usage & PIPE_BIND_INDEX_BUFFER) &&
-   (fd_pipe2index(format) != ~0u)) {
+   (fd_pipe2index(format) != (enum pc_di_index_size)~0)) {
retval |= PIPE_BIND_INDEX_BUFFER;
}
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 1/3] freedreno/a2xx: fix comparison out of range warnings

2016-07-30 Thread Francesco Ansanelli
Signed-off-by: Francesco Ansanelli 
---
 src/gallium/drivers/freedreno/a2xx/fd2_screen.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c 
b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
index fe4849b..007b9e6 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
@@ -61,7 +61,7 @@ fd2_screen_is_format_supported(struct pipe_screen *pscreen,
 
if ((usage & (PIPE_BIND_SAMPLER_VIEW |
PIPE_BIND_VERTEX_BUFFER)) &&
-   (fd2_pipe2surface(format) != ~0u)) {
+   (fd2_pipe2surface(format) != (enum 
a2xx_sq_surfaceformat)~0)) {
retval |= usage & (PIPE_BIND_SAMPLER_VIEW |
PIPE_BIND_VERTEX_BUFFER);
}
@@ -70,7 +70,7 @@ fd2_screen_is_format_supported(struct pipe_screen *pscreen,
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) &&
-   (fd2_pipe2color(format) != ~0u)) {
+   (fd2_pipe2color(format) != (enum a2xx_colorformatx)~0)) 
{
retval |= usage & (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
@@ -78,12 +78,12 @@ fd2_screen_is_format_supported(struct pipe_screen *pscreen,
}
 
if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
-   (fd_pipe2depth(format) != ~0u)) {
+   (fd_pipe2depth(format) != (enum 
adreno_rb_depth_format)~0)) {
retval |= PIPE_BIND_DEPTH_STENCIL;
}
 
if ((usage & PIPE_BIND_INDEX_BUFFER) &&
-   (fd_pipe2index(format) != ~0u)) {
+   (fd_pipe2index(format) != (enum pc_di_index_size)~0)) {
retval |= PIPE_BIND_INDEX_BUFFER;
}
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] freedreno/ir3: init ir3_shader_key with memset()

2016-07-29 Thread Francesco Ansanelli
To silence missing initializers warning
Signed-off-by: Francesco Ansanelli 
---
 src/gallium/drivers/freedreno/ir3/ir3_shader.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c 
b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
index 5d57c0b..5c73696 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
@@ -309,7 +309,8 @@ ir3_shader_create(struct ir3_compiler *compiler,
 * (as otherwise nothing will trigger the shader to be
 * actually compiled)
 */
-   static struct ir3_shader_key key = {{0}};
+   static struct ir3_shader_key key;
+   memset(&key, 0, sizeof(key));
ir3_shader_variant(shader, key, debug);
}
return shader;
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH 1/3] freedreno/a2xx: Fix sign compare warnings

2016-07-28 Thread Francesco Ansanelli
Before my patch, gcc warned about:

src/gallium/drivers/freedreno/a2xx/fd2_screen.c:64:30: warning: comparison
between signed and unsigned integer expressions [-Wsign-compare]

The change suggested:

  (fd2_pipe2surface(format) != (enum a2xx_sq_surfaceformat)~0)) {

makes both compiler happy.
Cheers,
Francesco

2016-07-29 2:20 GMT+02:00 Rob Herring :

> On Thu, Jul 28, 2016 at 6:55 PM, Rob Clark  wrote:
> > On Thu, Jul 28, 2016 at 6:36 PM, Rob Herring  wrote:
> >> On Thu, Jun 30, 2016 at 12:16 PM, Francesco Ansanelli
> >>  wrote:
> >>> ---
> >>>  src/gallium/drivers/freedreno/a2xx/fd2_screen.c |8 
> >>>  1 file changed, 4 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> >>> index c2baa6f..fe4849b 100644
> >>> --- a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> >>> +++ b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
> >>> @@ -61,7 +61,7 @@ fd2_screen_is_format_supported(struct pipe_screen
> *pscreen,
> >>>
> >>> if ((usage & (PIPE_BIND_SAMPLER_VIEW |
> >>> PIPE_BIND_VERTEX_BUFFER)) &&
> >>> -   (fd2_pipe2surface(format) != ~0)) {
> >>> +   (fd2_pipe2surface(format) != ~0u)) {
> >>
> >> FYI, all these still warn with LLVM, but now the warning is about
> >> being out of range:
> >>
> >> external/mesa3d/src/gallium/drivers/freedreno/a2xx/fd2_screen.c:64:30:
> >> warning: comparison of constant 4294967295 with expression of type
> >> 'enum a2xx_sq_surfaceformat' is always true
> >> [-Wtautological-constant-out-of-range-compare]
> >> (fd2_pipe2surface(format) != ~0u)) {
> >>   ^  ~~~
> >
> > bleh.. I guess it depends on whether enums are signed or unsigned?
> >
> > maybe (enum a2xx_sq_surfaceformat)~0 then?
>
> Or add the error value to the enums.
>
> Rob
>
> P.S. This is why I hate enums.
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] freedreno/ir3: Add missing braces in initializer

2016-07-28 Thread Francesco Ansanelli
I did a test with:

static struct ir3_shader_key key;
memset(&key, 0, sizeof(key));

both gcc and clang seems happy with it.
Let me know if you want me to send a patch.


2016-07-29 1:53 GMT+02:00 Rob Clark :

> On Thu, Jul 28, 2016 at 6:44 PM, Rob Herring  wrote:
> > On Thu, Jul 28, 2016 at 1:07 PM, Rob Clark  wrote:
> >> tbh, I haven't used anything as ancient as 4.6 in a while.. these days
> >> I'm using 6.1 and even with 5.x I don't remember seeing that warning.
> >
> > FWIW, clang 3.8 throws the warning too.
> >
>
> I think that since it is only that one spot (which, btw, is only hit
> w/ FD_MESA_DEBUG=shaderdb, ie. only for running shaderdb tests), we
> could also go old-school and just memset() it..
>
> BR,
> -R
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] freedreno/ir3: Add missing braces in initializer

2016-07-28 Thread Francesco Ansanelli
Hi,

with my version of the compiler:

gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

and original code ({0}) I get:

src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: missing
braces around initializer [-Wmissing-braces]
src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: (near
initialization for ‘key.’) [-Wmissing-braces]
src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: missing
initializer [-Wmissing-field-initializers]
src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: (near
initialization for ‘key...has_per_samp’)
[-Wmissing-field-initializers]
src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: missing
initializer [-Wmissing-field-initializers]
src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: (near
initialization for ‘key.vsaturate_s’) [-Wmissing-field-initializers]

with the change suggested by Eric ({{{0}}}) I get:

src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: missing
initializer [-Wmissing-field-initializers]
src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: (near
initialization for ‘key...has_per_samp’)
[-Wmissing-field-initializers]
src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: missing
initializer [-Wmissing-field-initializers]
src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: (near
initialization for ‘key.vsaturate_s’) [-Wmissing-field-initializers]

With my latest suggestion no warnings on that row, neither from clang:

Ubuntu clang version 3.4-1ubuntu3~precise2 (tags/RELEASE_34/final) (based
on LLVM 3.4)

Up to you how to proceed..

Cheers
Francesco


2016-07-28 12:54 GMT+02:00 Rob Clark :

> On Thu, Jul 28, 2016 at 6:31 AM, Emil Velikov 
> wrote:
> > On 28 July 2016 at 09:21, Eric Engestrom 
> wrote:
> >> On Wed, Jul 27, 2016 at 07:37:56PM +0200, Francesco Ansanelli wrote:
> >>> Hello,
> >>>
> >>> unluckily this didn't fix the warning...
> >>> I've done some more compile testing and found this solution:
> >>>
> >>> - static struct ir3_shader_key key = {{0}};
> >>> +static struct ir3_shader_key key = {{{0, 0, 0, 0, 0, 0, 0, 0}}, 0, 0,
> 0,
> >>> 0, 0, 0, 0, 0};
> >>
> >> So there are 3 levels of structs? The proper fix IMHO should then be
> >> {{{0}}}, as the rest of the 0's are implied.
> >> Can you test if that fixes it?
> >>
> > The original code is perfect (follows the spec) as-is. There's been a
> > number of gcc bugs on the topic, hence why sometimes people prefer
> > memset.
> > Which one people will opt for is quite subjective but I'd rather leave
> > the call to Rob.
>
> I'm leaning towards just going back to {0}, since at least gcc (at
> least modern versions) didn't seem to complain about that, but do
> complain about {{0}}
>
> BR,
> -R
>
> > -Emil
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] freedreno/ir3: Add missing braces in initializer

2016-07-27 Thread Francesco Ansanelli
Hello,

unluckily this didn't fix the warning...
I've done some more compile testing and found this solution:

- static struct ir3_shader_key key = {{0}};
+static struct ir3_shader_key key = {{{0, 0, 0, 0, 0, 0, 0, 0}}, 0, 0, 0,
0, 0, 0, 0, 0};

is this correct? Should I send a new patch?

Cheers,
Francesco

2016-07-20 9:49 GMT+02:00 Francesco Ansanelli :

> ---
>  src/gallium/drivers/freedreno/ir3/ir3_shader.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c
> b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
> index 9f39f9f..5d57c0b 100644
> --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c
> +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
> @@ -309,7 +309,7 @@ ir3_shader_create(struct ir3_compiler *compiler,
>  * (as otherwise nothing will trigger the shader to be
>  * actually compiled)
>  */
> -   static struct ir3_shader_key key = {0};
> +   static struct ir3_shader_key key = {{0}};
> ir3_shader_variant(shader, key, debug);
> }
> return shader;
> --
> 1.7.9.5
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] freedreno/a2xx: silence missing case 'SHADER_COMPUTE' warning (v2)

2016-07-21 Thread Francesco Ansanelli
v2: no need for break after an unreachable (Matt Turner)
Signed-off-by: Francesco Ansanelli 
---
 src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c 
b/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c
index f00d5d4..fc309e8 100644
--- a/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c
+++ b/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c
@@ -111,6 +111,8 @@ static void print_export_comment(uint32_t num, enum 
shader_t type)
case 0:  name = "gl_FragColor"; break;
}
break;
+   case SHADER_COMPUTE:
+   unreachable("not reached");
}
/* if we had a symbol table here, we could look
 * up the name of the varying..
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 3/4] freedreno/ir3: Add missing braces in initializer

2016-07-20 Thread Francesco Ansanelli
---
 src/gallium/drivers/freedreno/ir3/ir3_shader.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c 
b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
index 9f39f9f..5d57c0b 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
@@ -309,7 +309,7 @@ ir3_shader_create(struct ir3_compiler *compiler,
 * (as otherwise nothing will trigger the shader to be
 * actually compiled)
 */
-   static struct ir3_shader_key key = {0};
+   static struct ir3_shader_key key = {{0}};
ir3_shader_variant(shader, key, debug);
}
return shader;
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 4/4] mesa/st: Add missing braces in initializer

2016-07-20 Thread Francesco Ansanelli
---
 src/mesa/state_tracker/st_glsl_to_nir.cpp |2 +-
 src/mesa/state_tracker/st_program.c   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp 
b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 73a692a..6470fae 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -234,7 +234,7 @@ st_glsl_to_nir(struct st_context *st, struct gl_program 
*prog,
   static const gl_state_index wposTransformState[STATE_LENGTH] = {
  STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM
   };
-  nir_lower_wpos_ytransform_options wpos_options = {0};
+  nir_lower_wpos_ytransform_options wpos_options = {{0}};
   struct pipe_screen *pscreen = st->pipe->screen;
 
   memcpy(wpos_options.state_tokens, wposTransformState,
diff --git a/src/mesa/state_tracker/st_program.c 
b/src/mesa/state_tracker/st_program.c
index 57b0935..4960853 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -954,7 +954,7 @@ st_create_fp_variant(struct st_context *st,
 
   /* glDrawPixels (color only) */
   if (key->drawpixels) {
- nir_lower_drawpixels_options options = {0};
+ nir_lower_drawpixels_options options = {{0}};
  unsigned samplers_used = stfp->Base.Base.SamplersUsed;
 
  /* Find the first unused slot. */
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 2/4] i965: Add missing braces in initializer

2016-07-20 Thread Francesco Ansanelli
---
 .../drivers/dri/i965/brw_fs_vector_splitting.cpp   |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
index 5c05586..0e16415 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
@@ -373,7 +373,7 @@ brw_do_vector_splitting(exec_list *instructions)
  ralloc_free(name);
 
  if (entry->var->constant_initializer) {
-ir_constant_data data = {0};
+ir_constant_data data = {{0}};
 assert(entry->var->data.has_initializer);
 if (entry->var->type->is_double()) {
data.d[0] = entry->var->constant_initializer->value.d[i];
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 1/4] glsl: Add missing braces in initializer

2016-07-20 Thread Francesco Ansanelli
---
 src/compiler/glsl/ast_to_hir.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 8ddc084..b82e693 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -4700,7 +4700,7 @@ ast_declarator_list::hir(exec_list *instructions,
   if ((var->data.mode == ir_var_auto || var->data.mode == ir_var_temporary)
   && (var->type->is_numeric() || var->type->is_boolean())
   && state->zero_init) {
- const ir_constant_data data = {0};
+ const ir_constant_data data = {{0}};
  var->data.has_initializer = true;
  var->constant_initializer = new(var) ir_constant(var->type, &data);
   }
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] freedreno/a2xx: silence missing case 'SHADER_COMPUTE' warning

2016-07-19 Thread Francesco Ansanelli
---
 src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c 
b/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c
index f00d5d4..54b3514 100644
--- a/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c
+++ b/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c
@@ -111,6 +111,9 @@ static void print_export_comment(uint32_t num, enum 
shader_t type)
case 0:  name = "gl_FragColor"; break;
}
break;
+   case SHADER_COMPUTE:
+   unreachable("not reached");
+   break;
}
/* if we had a symbol table here, we could look
 * up the name of the varying..
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH 1/3] freedreno/a2xx: Fix sign compare warnings

2016-07-13 Thread Francesco Ansanelli
Yes, please.

Cheers,
Francesco
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i915: fix implicit truncation from 'int' to bitfield

2016-07-11 Thread Francesco Ansanelli
---
 src/gallium/drivers/i915/i915_context.c |6 +++---
 src/gallium/drivers/i915/i915_flush.c   |6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_context.c 
b/src/gallium/drivers/i915/i915_context.c
index 82798bb..d7cdfd9 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -216,9 +216,9 @@ i915_create_context(struct pipe_screen *screen, void *priv, 
unsigned flags)
 
i915->dirty = ~0;
i915->hardware_dirty = ~0;
-   i915->immediate_dirty = ~0;
-   i915->dynamic_dirty = ~0;
-   i915->static_dirty = ~0;
+   i915->immediate_dirty |= ~0;
+   i915->dynamic_dirty |= ~0;
+   i915->static_dirty |= ~0;
i915->flush_dirty = 0;
 
return &i915->base;
diff --git a/src/gallium/drivers/i915/i915_flush.c 
b/src/gallium/drivers/i915/i915_flush.c
index 6311c00..db05f97 100644
--- a/src/gallium/drivers/i915/i915_flush.c
+++ b/src/gallium/drivers/i915/i915_flush.c
@@ -81,9 +81,9 @@ void i915_flush(struct i915_context *i915,
batch->iws->batchbuffer_flush(batch, fence, flags);
i915->vbo_flushed = 1;
i915->hardware_dirty = ~0;
-   i915->immediate_dirty = ~0;
-   i915->dynamic_dirty = ~0;
-   i915->static_dirty = ~0;
+   i915->immediate_dirty |= ~0;
+   i915->dynamic_dirty |= ~0;
+   i915->static_dirty |= ~0;
/* kernel emits flushes in between batchbuffers */
i915->flush_dirty = 0;
i915->fired_vertices += i915->queued_vertices;
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] i965: fix ignored qualifiers warning

2016-07-09 Thread Francesco Ansanelli
---
 src/mesa/drivers/dri/i965/gen6_queryobj.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c 
b/src/mesa/drivers/dri/i965/gen6_queryobj.c
index 96db5e9..95a5c56 100644
--- a/src/mesa/drivers/dri/i965/gen6_queryobj.c
+++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c
@@ -99,7 +99,7 @@ write_xfb_primitives_written(struct brw_context *brw,
}
 }
 
-static inline const int
+static inline int
 pipeline_target_to_index(int target)
 {
if (target == GL_GEOMETRY_SHADER_INVOCATIONS)
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH] mesa/main: handle gl_buffer_index correctly

2016-07-05 Thread Francesco Ansanelli
ping?

This patch put away the compiler warning:
"comparison of constant -1 with expression of type 'gl_buffer_index' is
always false"




2016-06-28 19:31 GMT+02:00 Francesco Ansanelli :

> ---
>  src/mesa/main/buffers.c |   10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
> index e8aedde..3ff6061 100644
> --- a/src/mesa/main/buffers.c
> +++ b/src/mesa/main/buffers.c
> @@ -170,7 +170,7 @@ draw_buffer_enum_to_bitmask(const struct gl_context
> *ctx, GLenum buffer)
>   * Helper routine used by glReadBuffer.
>   * Given a GLenum naming a color buffer, return the index of the
> corresponding
>   * renderbuffer (a BUFFER_* value).
> - * return -1 for an invalid buffer.
> + * return ~0 for an invalid buffer.
>   */
>  static gl_buffer_index
>  read_buffer_enum_to_index(GLenum buffer)
> @@ -197,7 +197,7 @@ read_buffer_enum_to_index(GLenum buffer)
>case GL_AUX1:
>case GL_AUX2:
>case GL_AUX3:
> - return BUFFER_COUNT; /* invalid, but not -1 */
> + return BUFFER_COUNT; /* invalid, but not ~0 */
>case GL_COLOR_ATTACHMENT0_EXT:
>   return BUFFER_COLOR0;
>case GL_COLOR_ATTACHMENT1_EXT:
> @@ -219,7 +219,7 @@ read_buffer_enum_to_index(GLenum buffer)
>   if (buffer >= GL_COLOR_ATTACHMENT8 && buffer <=
> GL_COLOR_ATTACHMENT31)
>  return BUFFER_COUNT;
>   /* error */
> - return -1;
> + return ~0;
> }
>  }
>
> @@ -722,11 +722,11 @@ read_buffer(struct gl_context *ctx, struct
> gl_framebuffer *fb,
> else {
>/* general case / window-system framebuffer */
>if (_mesa_is_gles3(ctx) && !is_legal_es3_readbuffer_enum(buffer))
> - srcBuffer = -1;
> + srcBuffer = ~0;
>else
>   srcBuffer = read_buffer_enum_to_index(buffer);
>
> -  if (srcBuffer == -1) {
> +  if (srcBuffer == ~0u) {
>   _mesa_error(ctx, GL_INVALID_ENUM,
>   "%s(invalid buffer %s)", caller,
>   _mesa_enum_to_string(buffer));
> --
> 1.7.9.5
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] freedreno/a3xx: Fix sign compare warnings

2016-06-30 Thread Francesco Ansanelli
---
 src/gallium/drivers/freedreno/a3xx/fd3_screen.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c 
b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
index 4aea2fe..013b0ca 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c
@@ -52,12 +52,12 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen,
}
 
if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
-   (fd3_pipe2vtx(format) != ~0)) {
+   (fd3_pipe2vtx(format) != ~0u)) {
retval |= PIPE_BIND_VERTEX_BUFFER;
}
 
if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
-   (fd3_pipe2tex(format) != ~0)) {
+   (fd3_pipe2tex(format) != ~0u)) {
retval |= PIPE_BIND_SAMPLER_VIEW;
}
 
@@ -66,8 +66,8 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen,
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED |
PIPE_BIND_BLENDABLE)) &&
-   (fd3_pipe2color(format) != ~0) &&
-   (fd3_pipe2tex(format) != ~0)) {
+   (fd3_pipe2color(format) != ~0u) &&
+   (fd3_pipe2tex(format) != ~0u)) {
retval |= usage & (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
@@ -77,13 +77,13 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen,
}
 
if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
-   (fd_pipe2depth(format) != ~0) &&
-   (fd3_pipe2tex(format) != ~0)) {
+   (fd_pipe2depth(format) != ~0u) &&
+   (fd3_pipe2tex(format) != ~0u)) {
retval |= PIPE_BIND_DEPTH_STENCIL;
}
 
if ((usage & PIPE_BIND_INDEX_BUFFER) &&
-   (fd_pipe2index(format) != ~0)) {
+   (fd_pipe2index(format) != ~0u)) {
retval |= PIPE_BIND_INDEX_BUFFER;
}
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 1/3] freedreno/a2xx: Fix sign compare warnings

2016-06-30 Thread Francesco Ansanelli
---
 src/gallium/drivers/freedreno/a2xx/fd2_screen.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c 
b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
index c2baa6f..fe4849b 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c
@@ -61,7 +61,7 @@ fd2_screen_is_format_supported(struct pipe_screen *pscreen,
 
if ((usage & (PIPE_BIND_SAMPLER_VIEW |
PIPE_BIND_VERTEX_BUFFER)) &&
-   (fd2_pipe2surface(format) != ~0)) {
+   (fd2_pipe2surface(format) != ~0u)) {
retval |= usage & (PIPE_BIND_SAMPLER_VIEW |
PIPE_BIND_VERTEX_BUFFER);
}
@@ -70,7 +70,7 @@ fd2_screen_is_format_supported(struct pipe_screen *pscreen,
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) &&
-   (fd2_pipe2color(format) != ~0)) {
+   (fd2_pipe2color(format) != ~0u)) {
retval |= usage & (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
@@ -78,12 +78,12 @@ fd2_screen_is_format_supported(struct pipe_screen *pscreen,
}
 
if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
-   (fd_pipe2depth(format) != ~0)) {
+   (fd_pipe2depth(format) != ~0u)) {
retval |= PIPE_BIND_DEPTH_STENCIL;
}
 
if ((usage & PIPE_BIND_INDEX_BUFFER) &&
-   (fd_pipe2index(format) != ~0)) {
+   (fd_pipe2index(format) != ~0u)) {
retval |= PIPE_BIND_INDEX_BUFFER;
}
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 3/3] freedreno/a4xx: Fix sign compare warnings

2016-06-30 Thread Francesco Ansanelli
---
 src/gallium/drivers/freedreno/a4xx/fd4_screen.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c 
b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
index c193f36..57fecf1 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
@@ -52,14 +52,14 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
}
 
if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
-   (fd4_pipe2vtx(format) != ~0)) {
+   (fd4_pipe2vtx(format) != ~0u)) {
retval |= PIPE_BIND_VERTEX_BUFFER;
}
 
if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
(target == PIPE_BUFFER ||
 util_format_get_blocksize(format) != 12) &&
-   (fd4_pipe2tex(format) != ~0)) {
+   (fd4_pipe2tex(format) != ~0u)) {
retval |= PIPE_BIND_SAMPLER_VIEW;
}
 
@@ -67,8 +67,8 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) &&
-   (fd4_pipe2color(format) != ~0) &&
-   (fd4_pipe2tex(format) != ~0)) {
+   (fd4_pipe2color(format) != ~0u) &&
+   (fd4_pipe2tex(format) != ~0u)) {
retval |= usage & (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
@@ -76,13 +76,13 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
}
 
if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
-   (fd4_pipe2depth(format) != ~0) &&
-   (fd4_pipe2tex(format) != ~0)) {
+   (fd4_pipe2depth(format) != ~0u) &&
+   (fd4_pipe2tex(format) != ~0u)) {
retval |= PIPE_BIND_DEPTH_STENCIL;
}
 
if ((usage & PIPE_BIND_INDEX_BUFFER) &&
-   (fd_pipe2index(format) != ~0)) {
+   (fd_pipe2index(format) != ~0u)) {
retval |= PIPE_BIND_INDEX_BUFFER;
}
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] mesa/main: handle gl_buffer_index correctly

2016-06-28 Thread Francesco Ansanelli
---
 src/mesa/main/buffers.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index e8aedde..3ff6061 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -170,7 +170,7 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, 
GLenum buffer)
  * Helper routine used by glReadBuffer.
  * Given a GLenum naming a color buffer, return the index of the corresponding
  * renderbuffer (a BUFFER_* value).
- * return -1 for an invalid buffer.
+ * return ~0 for an invalid buffer.
  */
 static gl_buffer_index
 read_buffer_enum_to_index(GLenum buffer)
@@ -197,7 +197,7 @@ read_buffer_enum_to_index(GLenum buffer)
   case GL_AUX1:
   case GL_AUX2:
   case GL_AUX3:
- return BUFFER_COUNT; /* invalid, but not -1 */
+ return BUFFER_COUNT; /* invalid, but not ~0 */
   case GL_COLOR_ATTACHMENT0_EXT:
  return BUFFER_COLOR0;
   case GL_COLOR_ATTACHMENT1_EXT:
@@ -219,7 +219,7 @@ read_buffer_enum_to_index(GLenum buffer)
  if (buffer >= GL_COLOR_ATTACHMENT8 && buffer <= GL_COLOR_ATTACHMENT31)
 return BUFFER_COUNT;
  /* error */
- return -1;
+ return ~0;
}
 }
 
@@ -722,11 +722,11 @@ read_buffer(struct gl_context *ctx, struct gl_framebuffer 
*fb,
else {
   /* general case / window-system framebuffer */
   if (_mesa_is_gles3(ctx) && !is_legal_es3_readbuffer_enum(buffer))
- srcBuffer = -1;
+ srcBuffer = ~0;
   else
  srcBuffer = read_buffer_enum_to_index(buffer);
 
-  if (srcBuffer == -1) {
+  if (srcBuffer == ~0u) {
  _mesa_error(ctx, GL_INVALID_ENUM,
  "%s(invalid buffer %s)", caller,
  _mesa_enum_to_string(buffer));
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] st/mesa: handle negative _ColorDrawBufferIndexes values correctly

2016-06-23 Thread Francesco Ansanelli
---
 src/mesa/state_tracker/st_cb_fbo.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index a53b95a..950ec3e 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -704,7 +704,7 @@ st_DrawBuffers(struct gl_context *ctx, GLsizei count, const 
GLenum *buffers)
 
/* add the renderbuffers on demand */
for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
-  gl_buffer_index idx = fb->_ColorDrawBufferIndexes[i];
+  GLint idx = fb->_ColorDrawBufferIndexes[i];
 
   if (idx >= 0) {
  st_manager_add_color_renderbuffer(st, fb, idx);
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH] st/mesa: Remove tautological check (v2)

2016-06-17 Thread Francesco Ansanelli
Hi Erik,
Thanks for your feedback.
Can you suggest a better subject?
After some thinking, should I cast gl_buffer_index before calling the
function?
Thanks
Francesco
Il 17 giu 2016 12:39, "Erik Faye-Lund"  ha scritto:

> Now the subject no longer makes any sense.
>
> On Thu, Jun 16, 2016 at 7:02 AM,   wrote:
> > From: Francesco Ansanelli 
> >
> > ---
> >  src/mesa/state_tracker/st_cb_fbo.c |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/mesa/state_tracker/st_cb_fbo.c
> b/src/mesa/state_tracker/st_cb_fbo.c
> > index a53b95a..950ec3e 100644
> > --- a/src/mesa/state_tracker/st_cb_fbo.c
> > +++ b/src/mesa/state_tracker/st_cb_fbo.c
> > @@ -704,7 +704,7 @@ st_DrawBuffers(struct gl_context *ctx, GLsizei
> count, const GLenum *buffers)
> >
> > /* add the renderbuffers on demand */
> > for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
> > -  gl_buffer_index idx = fb->_ColorDrawBufferIndexes[i];
> > +  GLint idx = fb->_ColorDrawBufferIndexes[i];
> >
> >if (idx >= 0) {
> >   st_manager_add_color_renderbuffer(st, fb, idx);
> > --
> > 1.7.9.5
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev