Re: [Mesa-dev] [PATCH] glsl/glcpp: allow undefining __VERSION__ and GL_

2015-08-26 Thread Dave Airlie
On 26 August 2015 at 16:55, Dave Airlie  wrote:
> On 26 August 2015 at 16:48, Ilia Mirkin  wrote:
>> On Wed, Aug 26, 2015 at 2:38 AM, Dave Airlie  wrote:
>>> From: Dave Airlie 
>>>
>>> GL33-CTS.shaders.preprocessor.definitions.*
>>> has 4 tests the undefine these,
>>>
>>> I can't find anything in the spec saying that isn't correct.
>>>
>>> Signed-off-by: Dave Airlie 
>>> ---
>>>  src/glsl/glcpp/glcpp-parse.y | 4 +---
>>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
>>> index 18e50af..77010b4 100644
>>> --- a/src/glsl/glcpp/glcpp-parse.y
>>> +++ b/src/glsl/glcpp/glcpp-parse.y
>>> @@ -289,9 +289,7 @@ control_line_success:
>>> } IDENTIFIER NEWLINE {
>>> macro_t *macro;
>>> if (strcmp("__LINE__", $4) == 0
>>> -   || strcmp("__FILE__", $4) == 0
>>> -   || strcmp("__VERSION__", $4) == 0
>>> -   || strncmp("GL_", $4, 3) == 0)
>>
>> From GLSL 4.50 page 12, section 3.3:
>>
>> All macro
>> names prefixed with “GL_” (“GL” followed by a single underscore) are
>> also reserved, and defining such a
>> name results in a compile-time error. That said I don't see anything
>> about redefining __FILE__.
>
> Okay that must be new language brought it at some point, at least 4.2
> has older language
> which means it should be conditional on #version on whether GL_ can be done.
>
> uggh, maybe I can try again :-)

Ah it's all a mess, I'll run away and put the tests on the need work list.

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


Re: [Mesa-dev] [PATCH] glsl/glcpp: allow undefining __VERSION__ and GL_

2015-08-26 Thread Ilia Mirkin
Looks like the change happened as of 4.40. I checked as far back as
GLSL 1.50, and it was the older "you can do whatever" wording
everywhere there:

"""
All macro names containing two consecutive underscores ( __ ) are
reserved for future use as predefined
macro names. All macro names prefixed with “GL_” (“GL” followed by a
single underscore) are also
reserved
"""

It never says it's an error to use these. Oh well.

  -ilia

On Wed, Aug 26, 2015 at 3:01 AM, Dave Airlie  wrote:
> On 26 August 2015 at 16:55, Dave Airlie  wrote:
>> On 26 August 2015 at 16:48, Ilia Mirkin  wrote:
>>> On Wed, Aug 26, 2015 at 2:38 AM, Dave Airlie  wrote:
 From: Dave Airlie 

 GL33-CTS.shaders.preprocessor.definitions.*
 has 4 tests the undefine these,

 I can't find anything in the spec saying that isn't correct.

 Signed-off-by: Dave Airlie 
 ---
  src/glsl/glcpp/glcpp-parse.y | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

 diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
 index 18e50af..77010b4 100644
 --- a/src/glsl/glcpp/glcpp-parse.y
 +++ b/src/glsl/glcpp/glcpp-parse.y
 @@ -289,9 +289,7 @@ control_line_success:
 } IDENTIFIER NEWLINE {
 macro_t *macro;
 if (strcmp("__LINE__", $4) == 0
 -   || strcmp("__FILE__", $4) == 0
 -   || strcmp("__VERSION__", $4) == 0
 -   || strncmp("GL_", $4, 3) == 0)
>>>
>>> From GLSL 4.50 page 12, section 3.3:
>>>
>>> All macro
>>> names prefixed with “GL_” (“GL” followed by a single underscore) are
>>> also reserved, and defining such a
>>> name results in a compile-time error. That said I don't see anything
>>> about redefining __FILE__.
>>
>> Okay that must be new language brought it at some point, at least 4.2
>> has older language
>> which means it should be conditional on #version on whether GL_ can be done.
>>
>> uggh, maybe I can try again :-)
>
> Ah it's all a mess, I'll run away and put the tests on the need work list.
>
> Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v4 (part2) 53/59] glapi: add ARB_shader_storage_block_buffer_object

2015-08-26 Thread Samuel Iglesias Gonsálvez


On 25/08/15 12:46, Emil Velikov wrote:
> On 25 August 2015 at 06:42, Samuel Iglesias Gonsálvez
>  wrote:
>> On 24/08/15 16:10, Emil Velikov wrote:
>>> Hi Samuel, Iago,
>>>
>>> On 05/08/15 09:30, Iago Toral Quiroga wrote:
 From: Samuel Iglesias Gonsalvez 

 v2:
 - Add ShaderStorageBlockBinding to static_data.py

>>> Why (see comment below) ?
>>>
>>>
>>> v4:
>>>  - Ship ARB_shader_storage_buffer_object.xml in the tarball.
>>>
>>> Seems like other patches are also missing v4 revision history :|
>>>
>>
>> We usually send a new version of the patch series when we have not
>> received more reviews for several days/weeks
> How about pinging individual patches (or a list in the series cover letter) ?
> 
>> and we have enough number
>> of changes in different patches (because of reviews and/or major changes
>> in master that invalidate our code).
>>
> Just do a follow up revision of the said patch(es) ?
> 
>> For that reason, some of our patches don't have new comments in the
>> revision history.
>>
> Afaics not even one patch in v4 does has revision history. Please don't do 
> that.
> 
> Another thing you can try is gradually sending patches rather than
> accumulating X months of work. This way the reviewer(s) will do
> (almost) all it in one go.
> 

Yeah, you are right. We are going to take it into account for future
submissions. Thanks for the advices!

>>>
 --- a/src/mapi/glapi/gen/static_data.py
 +++ b/src/mapi/glapi/gen/static_data.py
 @@ -1305,6 +1305,7 @@ functions = [
 "ShaderBinary",
 "ShaderSource",
 "ShaderSourceARB",
 +   "ShaderStorageBlockBinding",
>>> This list is for functions exported by libGL.so, which imho should not
>>> change (ever). If there is there a program that depends on this static
>>> symbol (and the binary drivers expose it), it should be noted in the
>>> commit message.
>>>
>>
>> This is a new function defined by ARB_shader_storage_buffer_object
>> specification [0].
>>
> The spec does not say that the function should be statically available
> (via libGL.so). The OpenGL ABI has some information as to which
> functions should be available statically/dynamically [1]
> 
> [1] https://www.opengl.org/registry/ABI/
> 
>> I have a test program that uses that function. If I remove the
>> static_data.py definition, I hit this linker error:
>>
>> : undefined reference to `glShaderStorageBlockBinding'
>>
> Sounds like a bug in the app. As mentioned by Ian, use libepoxy or
> alike which will fetch all the symbols using the appropriate method.
> 
>> So following what how other functions are defined, I added it to
>> static_data.py.
> git log shows that the list of functions hasn't changed since day one,
> while at the same time other extensions were added/enabled in mesa.
> 
> Hope this answers things from a different angle rather then flocking
> up a dead horse :)
> 

Thank you very much for this explanation and for the link!

Sam

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


Re: [Mesa-dev] [PATCH] glsl/glcpp: allow undefining __VERSION__ and GL_

2015-08-26 Thread Kenneth Graunke
On Wednesday, August 26, 2015 04:55:32 PM Dave Airlie wrote:
> On 26 August 2015 at 16:48, Ilia Mirkin  wrote:
> > On Wed, Aug 26, 2015 at 2:38 AM, Dave Airlie  wrote:
> >> From: Dave Airlie 
> >>
> >> GL33-CTS.shaders.preprocessor.definitions.*
> >> has 4 tests the undefine these,
> >>
> >> I can't find anything in the spec saying that isn't correct.
> >>
> >> Signed-off-by: Dave Airlie 
> >> ---
> >>  src/glsl/glcpp/glcpp-parse.y | 4 +---
> >>  1 file changed, 1 insertion(+), 3 deletions(-)
> >>
> >> diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
> >> index 18e50af..77010b4 100644
> >> --- a/src/glsl/glcpp/glcpp-parse.y
> >> +++ b/src/glsl/glcpp/glcpp-parse.y
> >> @@ -289,9 +289,7 @@ control_line_success:
> >> } IDENTIFIER NEWLINE {
> >> macro_t *macro;
> >> if (strcmp("__LINE__", $4) == 0
> >> -   || strcmp("__FILE__", $4) == 0
> >> -   || strcmp("__VERSION__", $4) == 0
> >> -   || strncmp("GL_", $4, 3) == 0)
> >
> > From GLSL 4.50 page 12, section 3.3:
> >
> > All macro
> > names prefixed with “GL_” (“GL” followed by a single underscore) are
> > also reserved, and defining such a
> > name results in a compile-time error. That said I don't see anything
> > about redefining __FILE__.
> 
> Okay that must be new language brought it at some point, at least 4.2
> has older language
> which means it should be conditional on #version on whether GL_ can be done.
> 
> uggh, maybe I can try again :-)
> 
> Dave.

FWIW, a lot of the preprocessor changes are more-or-less clarifications
of ill-defined behavior, rather than intentional changes.  So, you might
be able to argue that the newer behavior is "right" and should be done
everywhere, rather than trying to predicate things on a #version.


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


Re: [Mesa-dev] [PATCH 5/6] mesa: enable enums for OES_texture_storage_multisample_2d_array

2015-08-26 Thread Tapani Pälli

On 08/26/2015 08:26 AM, Ilia Mirkin wrote:

On Wed, Aug 26, 2015 at 1:19 AM, Tapani Pälli  wrote:

On 08/24/2015 04:18 PM, Ilia Mirkin wrote:

On Fri, Aug 21, 2015 at 3:22 AM, Tapani Pälli 
wrote:

Signed-off-by: Tapani Pälli 
---
   src/mesa/main/get_hash_params.py | 6 +++---
   src/mesa/main/texobj.c   | 6 --
   src/mesa/main/texparam.c | 2 +-
   3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/get_hash_params.py
b/src/mesa/main/get_hash_params.py
index 517c391..c06e9b1 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -434,6 +434,9 @@ descriptor=[
 [ "SAMPLE_MASK", "CONTEXT_BOOL(Multisample.SampleMask),
extra_ARB_texture_multisample_es31" ],
 [ "MAX_SAMPLE_MASK_WORDS", "CONST(1),
extra_ARB_texture_multisample_es31" ],

+# GL_ARB_texture_multisample / ES 3.1 with
GL_OES_texture_storage_multisample_2d_array
+  [ "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "LOC_CUSTOM, TYPE_INT,
TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, extra_ARB_texture_multisample_es31" ],

What does the _es31 add? Should be removed, I think. Should be done in
a cleanup patch later though. Looks like I wasn't looking carefully
enough at what was going on the list and this managed to sneak
through... same goes for most (but probably not all) of the _es31
things.


I think using the _es31 is technically the best solution leaving no gaps or
'hidden features' where we enable some GLES functionality through desktop
extension. I think we already went through this discussion.

Yeah, and I pointed this same thing out then too, and was ignored I believe.


Not ignored, Ian stated that we have to see case by case and most of the 
cases I've seen require checks. We should not be able to query this enum 
using GLES 3.0. Doing the '_es31 way' we make sure that these exist only 
for 3.1. We changed to this model when somebody pointed out that in 
earlier model we exposed enums for GLES 2.0 apps.



For extensions
string enable, I think it's feasible to use desktop feature enables but
anywhere else in the code it hides things from the reader.

I must be missing something. Can you describe to me a scenario under
which the _es31 thing makes *any* change to the code paths executed?
The only one I can imagine is with a driver that doesn't set
Extensions.ARB_texture_multisample, but a user has force-enabled ES3.1
via override flags. I don't think that this is a case worth worrying
about.

In fact I've sent a patch to remove all the _es31 things (except for
ARB_cs, where it's an actual scenario).


OK. Maybe we've been too protective then if it works and I don't think 
we have any 'negative tests' to for example use ES 3.1 enums in a GLES 
2.0 context. Program would need to strange anyway to either include ES 
3.1 headers or use hardcoded values in the calls. I don't have a strong 
opinion, I'm somewhat disappointed that we are changing this once again. 
Remember, first we did this loosely by exposing the enums for anyone. 
Then we made more strict check by adding _es31 so that we would not 
expose enums in wrong contexts and now we are back again giving them for 
everyone?



+
   # GL_ARB_texture_gather / GLES 3.1
 [ "MIN_PROGRAM_TEXTURE_GATHER_OFFSET",
"CONTEXT_INT(Const.MinProgramTextureGatherOffset),
extra_ARB_texture_gather_es31"],
 [ "MAX_PROGRAM_TEXTURE_GATHER_OFFSET",
"CONTEXT_INT(Const.MaxProgramTextureGatherOffset),
extra_ARB_texture_gather_es31"],
@@ -740,9 +743,6 @@ descriptor=[
 [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0,
extra_texture_buffer_object" ],
 [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0,
extra_texture_buffer_object" ],

-# GL_ARB_texture_multisample / GL 3.2
-  [ "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "LOC_CUSTOM, TYPE_INT,
TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, extra_ARB_texture_multisample" ],
-
   # GL 3.0
 [ "CONTEXT_FLAGS", "CONTEXT_INT(Const.ContextFlags),
extra_version_30" ],

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 395e4d3..a3f44c9 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -217,7 +217,8 @@ _mesa_get_current_tex_object(struct gl_context *ctx,
GLenum target)
return ctx->Extensions.ARB_texture_multisample
   ? ctx->Texture.ProxyTex[TEXTURE_2D_MULTISAMPLE_INDEX] :
NULL;
 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
- return ctx->Extensions.ARB_texture_multisample
+ return (ctx->Extensions.ARB_texture_multisample ||
+
ctx->Extensions.OES_texture_storage_multisample_2d_array)

And then you don't have to touch this (if you don't add the extra enable)


This is used in such a lot of places that I'll need to then add is_gles31()
though. One should not be able to get this using bare gles 2.0.

errr... how does the context affect what's in Extensions.*? [hint, it
doesn't... if you need those checks now, you also needed them before]


Ah right, it affects only the extensions string. Then the context 
version check has probably

[Mesa-dev] [PATCH] i965: Rename INTEL_DEBUG=vec4vs to INTEL_DEBUG=vec4.

2015-08-26 Thread Kenneth Graunke
driParseDebugString() doesn't have actual code to parse comma separated
lists (or any other supported options?); instead it dumbly uses strstr().

This means that INTEL_DEBUG="vec4vs" will trigger both DEBUG_VEC4VS and
DEBUG_VS, as "vs" is also a substring.

We should probably improve the driconf parsing, but for now, just rename
the option so it's usable in the meantime.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/intel_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_debug.c 
b/src/mesa/drivers/dri/i965/intel_debug.c
index a077731..b3b3c21 100644
--- a/src/mesa/drivers/dri/i965/intel_debug.c
+++ b/src/mesa/drivers/dri/i965/intel_debug.c
@@ -68,7 +68,7 @@ static const struct dri_debug_control debug_control[] = {
{ "optimizer",   DEBUG_OPTIMIZER },
{ "ann", DEBUG_ANNOTATION },
{ "no8", DEBUG_NO8 },
-   { "vec4vs",  DEBUG_VEC4VS },
+   { "vec4",DEBUG_VEC4VS },
{ "spill",   DEBUG_SPILL },
{ "cs",  DEBUG_CS },
{ NULL,0 }
-- 
2.5.0

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


Re: [Mesa-dev] [PATCH 2/4] r600g: Move geometry properties state from shader to selector

2015-08-26 Thread Marek Olšák
On Tue, Aug 25, 2015 at 1:56 PM, Edward O'Callaghan
 wrote:
> From: Edward O'Callaghan 
>
> Signed-off-by: Edward O'Callaghan 
> ---
>  src/gallium/drivers/r600/evergreen_state.c   | 16 
>  src/gallium/drivers/r600/r600_pipe.h |  5 +
>  src/gallium/drivers/r600/r600_shader.c   |  6 +++---
>  src/gallium/drivers/r600/r600_shader.h   |  4 
>  src/gallium/drivers/r600/r600_state.c| 12 ++--
>  src/gallium/drivers/r600/r600_state_common.c |  2 +-
>  6 files changed, 23 insertions(+), 22 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/evergreen_state.c 
> b/src/gallium/drivers/r600/evergreen_state.c
> index 6a91d47..d2c6ce3 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -2143,11 +2143,11 @@ static void evergreen_emit_shader_stages(struct 
> r600_context *rctx, struct r600_
> if (state->geom_enable) {
> uint32_t cut_val;
>
> -   if (rctx->gs_shader->current->shader.gs_max_out_vertices <= 
> 128)
> +   if (rctx->gs_shader->current->selector->gs_max_out_vertices 
> <= 128)

You can do just:
gs_shader->gs_max_out_vertices

> cut_val = V_028A40_GS_CUT_128;
> -   else if (rctx->gs_shader->current->shader.gs_max_out_vertices 
> <= 256)
> +   else if 
> (rctx->gs_shader->current->selector->gs_max_out_vertices <= 256)

same here

> cut_val = V_028A40_GS_CUT_256;
> -   else if (rctx->gs_shader->current->shader.gs_max_out_vertices 
> <= 512)
> +   else if 
> (rctx->gs_shader->current->selector->gs_max_out_vertices <= 512)

same nere

> cut_val = V_028A40_GS_CUT_512;
> else
> cut_val = V_028A40_GS_CUT_1024;
> @@ -3013,7 +3013,7 @@ void evergreen_update_gs_state(struct pipe_context 
> *ctx, struct r600_pipe_shader
> struct r600_shader *rshader = &shader->shader;
> struct r600_shader *cp_shader = &shader->gs_copy_shader->shader;
> unsigned gsvs_itemsize =
> -   (cp_shader->ring_item_size * 
> rshader->gs_max_out_vertices) >> 2;
> +   (cp_shader->ring_item_size * 
> shader->selector->gs_max_out_vertices) >> 2;
>
> r600_init_command_buffer(cb, 64);
>
> @@ -3022,14 +3022,14 @@ void evergreen_update_gs_state(struct pipe_context 
> *ctx, struct r600_pipe_shader
> r600_store_context_reg(cb, R_028AB8_VGT_VTX_CNT_EN, 1);
>
> r600_store_context_reg(cb, R_028B38_VGT_GS_MAX_VERT_OUT,
> -  
> S_028B38_MAX_VERT_OUT(rshader->gs_max_out_vertices));
> +  
> S_028B38_MAX_VERT_OUT(shader->selector->gs_max_out_vertices));
> r600_store_context_reg(cb, R_028A6C_VGT_GS_OUT_PRIM_TYPE,
> -  
> r600_conv_prim_to_gs_out(rshader->gs_output_prim));
> +  
> r600_conv_prim_to_gs_out(shader->selector->gs_output_prim));
>
> if (rctx->screen->b.info.drm_minor >= 35) {
> r600_store_context_reg(cb, R_028B90_VGT_GS_INSTANCE_CNT,
> -   
> S_028B90_CNT(MIN2(rshader->gs_num_invocations, 127)) |
> -   S_028B90_ENABLE(rshader->gs_num_invocations > 
> 0));
> +   
> S_028B90_CNT(MIN2(shader->selector->gs_num_invocations, 127)) |
> +   
> S_028B90_ENABLE(shader->selector->gs_num_invocations > 0));
> }
> r600_store_context_reg_seq(cb, R_02891C_SQ_GS_VERT_ITEMSIZE, 4);
> r600_store_value(cb, cp_shader->ring_item_size >> 2);
> diff --git a/src/gallium/drivers/r600/r600_pipe.h 
> b/src/gallium/drivers/r600/r600_pipe.h
> index 384ba80..72f5ab8 100644
> --- a/src/gallium/drivers/r600/r600_pipe.h
> +++ b/src/gallium/drivers/r600/r600_pipe.h
> @@ -311,6 +311,11 @@ struct r600_pipe_shader_selector {
> /* PIPE_SHADER_[VERTEX|FRAGMENT|...] */
> unsignedtype;
>
> +   /* geometry shader properties */
> +   unsignedgs_output_prim;
> +   unsignedgs_max_out_vertices;
> +   unsignedgs_num_invocations;
> +
> unsignednr_ps_max_color_exports;
>  };
>
> diff --git a/src/gallium/drivers/r600/r600_shader.c 
> b/src/gallium/drivers/r600/r600_shader.c
> index 9d0d76f..b830479 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -2010,13 +2010,13 @@ static int r600_shader_from_tgsi(struct r600_context 
> *rctx,
> /* we don't need this one */
> break;
> case TGSI_PROPERTY_GS_OUTPUT_PRIM:
> -   shader->gs_output_prim = property->u[0].Data;
> +   pipeshader->selector->gs_output_prim = 
> property->u[0].Data;

this is a layering viola

Re: [Mesa-dev] [PATCH 3/4] r600g: Don't repeat tgsi_scan_shader(), just use result

2015-08-26 Thread Marek Olšák
On Tue, Aug 25, 2015 at 1:56 PM, Edward O'Callaghan
 wrote:
> From: Edward O'Callaghan 
>
> tgsi_shader_scan() has already happened so just use the results.
>
> Signed-off-by: Edward O'Callaghan 
> Signed-off-by: Dave Airlie 

Did Dave really give you this sign-off?

> ---
>  src/gallium/drivers/r600/r600_shader.c | 35 
> ++
>  1 file changed, 10 insertions(+), 25 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_shader.c 
> b/src/gallium/drivers/r600/r600_shader.c
> index b830479..009a8f2 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -1809,7 +1809,6 @@ static int r600_shader_from_tgsi(struct r600_context 
> *rctx,
> struct tgsi_token *tokens = pipeshader->selector->tokens;
> struct pipe_stream_output_info so = pipeshader->selector->so;
> struct tgsi_full_immediate *immediate;
> -   struct tgsi_full_property *property;
> struct r600_shader_ctx ctx;
> struct r600_bytecode_output output[32];
> unsigned output_done, noutput;
> @@ -1968,6 +1967,16 @@ static int r600_shader_from_tgsi(struct r600_context 
> *rctx,
> ctx.nliterals = 0;
> ctx.literals = NULL;
> shader->fs_write_all = FALSE;
> +   if (ctx.info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS])
> +   shader->fs_write_all = TRUE;
> +
> +   shader->vs_position_window_space = FALSE;
> +   if (ctx.info.properties[TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION])
> +   shader->vs_position_window_space = TRUE;
> +
> +   pipeshader->selector->gs_output_prim = 
> ctx.info.properties[TGSI_PROPERTY_GS_OUTPUT_PRIM];
> +   pipeshader->selector->gs_max_out_vertices = 
> ctx.info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES];
> +   pipeshader->selector->gs_num_invocations = 
> ctx.info.properties[TGSI_PROPERTY_GS_INVOCATIONS];

Same as in the previous patch. The selector isn't owned by shader
variants, so shader variants shouldn't modify it.

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


Re: [Mesa-dev] [PATCH 1/3] winsys/radeon: handle non-zero finite timeout when waiting for buffers

2015-08-26 Thread Marek Olšák
Ping

On Sun, Aug 23, 2015 at 2:13 PM, Marek Olšák  wrote:
> From: Marek Olšák 
>
> ---
>  src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 54 
> +++
>  src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 25 +
>  2 files changed, 41 insertions(+), 38 deletions(-)
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] vc4: Initialize pack field of qreg to 0 in qir_get_temp

2015-08-26 Thread Boyan Ding
This avoids generation of undefined packing in qir and qpu instructions,
fixing a lot of rendering errors.

Fixes 8b36d107fdd (vc4: Pack the unorm-packing bits into a src MUL
instruction when possible.)

Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Boyan Ding 
---
 src/gallium/drivers/vc4/vc4_qir.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/vc4/vc4_qir.c 
b/src/gallium/drivers/vc4/vc4_qir.c
index 9d93071..12dedce 100644
--- a/src/gallium/drivers/vc4/vc4_qir.c
+++ b/src/gallium/drivers/vc4/vc4_qir.c
@@ -314,6 +314,7 @@ qir_get_temp(struct vc4_compile *c)
 
 reg.file = QFILE_TEMP;
 reg.index = c->num_temps++;
+reg.pack = 0;
 
 if (c->num_temps > c->defs_array_size) {
 uint32_t old_size = c->defs_array_size;
-- 
2.5.0

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


Re: [Mesa-dev] [PATCH] mesa: remove pointless es31 checks, fix indirect to only be in es31

2015-08-26 Thread Tapani Pälli

On 08/24/2015 06:37 PM, Ilia Mirkin wrote:

On Mon, Aug 24, 2015 at 11:35 AM, Ilia Mirkin  wrote:

Signed-off-by: Ilia Mirkin 
---
  src/mesa/main/get.c  | 37 +---
  src/mesa/main/get_hash_params.py | 46 
  2 files changed, 24 insertions(+), 59 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 307a5ff..6a4e233 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -361,48 +361,13 @@ static const int 
extra_ARB_shader_image_load_store_and_tessellation[] = {
 EXTRA_END
  };

-static const int extra_ARB_draw_indirect_es31[] = {
-   EXT(ARB_draw_indirect),
-   EXTRA_API_ES31,
-   EXTRA_END
-};
-
-static const int extra_ARB_shader_image_load_store_es31[] = {
-   EXT(ARB_shader_image_load_store),
-   EXTRA_API_ES31,
-   EXTRA_END
-};
-
-static const int extra_ARB_shader_atomic_counters_es31[] = {
-   EXT(ARB_shader_atomic_counters),
-   EXTRA_API_ES31,
-   EXTRA_END
-};
-
-static const int extra_ARB_texture_multisample_es31[] = {
-   EXT(ARB_texture_multisample),
-   EXTRA_API_ES31,
-   EXTRA_END
-};
-
-static const int extra_ARB_texture_gather_es31[] = {
-   EXT(ARB_texture_gather),
-   EXTRA_API_ES31,
-   EXTRA_END
-};
-
+/* HACK: remove when ARB_compute_shader is actually supported */
  static const int extra_ARB_compute_shader_es31[] = {
 EXT(ARB_compute_shader),
 EXTRA_API_ES31,
 EXTRA_END
  };

-static const int extra_ARB_explicit_uniform_location_es31[] = {
-   EXT(ARB_explicit_uniform_location),
-   EXTRA_API_ES31,
-   EXTRA_END
-};
-
  EXTRA_EXT(ARB_texture_cube_map);
  EXTRA_EXT(EXT_texture_array);
  EXTRA_EXT(NV_fog_distance);
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 517c391..e12166d 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -410,33 +410,33 @@ descriptor=[
  # Enums in OpenGL and ES 3.1
  { "apis": ["GL", "GL_CORE", "GLES31"], "params": [
  # GL_ARB_shader_image_load_store / GLES 3.1
-  [ "MAX_IMAGE_UNITS", "CONTEXT_INT(Const.MaxImageUnits), 
extra_ARB_shader_image_load_store_es31" ],
-  [ "MAX_VERTEX_IMAGE_UNIFORMS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxImageUniforms), 
extra_ARB_shader_image_load_store_es31" ],
-  [ "MAX_FRAGMENT_IMAGE_UNIFORMS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms), 
extra_ARB_shader_image_load_store_es31" ],
-  [ "MAX_COMBINED_IMAGE_UNIFORMS", "CONTEXT_INT(Const.MaxCombinedImageUniforms), 
extra_ARB_shader_image_load_store_es31" ],
+  [ "MAX_IMAGE_UNITS", "CONTEXT_INT(Const.MaxImageUnits), 
extra_ARB_shader_image_load_store" ],
+  [ "MAX_VERTEX_IMAGE_UNIFORMS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxImageUniforms), 
extra_ARB_shader_image_load_store" ],
+  [ "MAX_FRAGMENT_IMAGE_UNIFORMS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms), 
extra_ARB_shader_image_load_store" ],
+  [ "MAX_COMBINED_IMAGE_UNIFORMS", "CONTEXT_INT(Const.MaxCombinedImageUniforms), 
extra_ARB_shader_image_load_store" ],

  # GL_ARB_shader_atomic_counters / GLES 3.1
[ "ATOMIC_COUNTER_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, 
extra_ARB_shader_atomic_counters_es31" ],

Errr, naturally this one needs to be fixed too. I've done that locally.


With that fixed

Reviewed-by: Tapani Pälli 

I also verified that there's no changes with current CTS results and 
enums are not exposed for GLES 2.0 (like I was afraid before).



-  [ "MAX_ATOMIC_COUNTER_BUFFER_BINDINGS", 
"CONTEXT_INT(Const.MaxAtomicBufferBindings), extra_ARB_shader_atomic_counters_es31" ],
-  [ "MAX_ATOMIC_COUNTER_BUFFER_SIZE", "CONTEXT_INT(Const.MaxAtomicBufferSize), 
extra_ARB_shader_atomic_counters_es31" ],
-  [ "MAX_VERTEX_ATOMIC_COUNTER_BUFFERS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers), 
extra_ARB_shader_atomic_counters_es31" ],
-  [ "MAX_VERTEX_ATOMIC_COUNTERS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxAtomicCounters), 
extra_ARB_shader_atomic_counters_es31" ],
-  [ "MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers), 
extra_ARB_shader_atomic_counters_es31" ],
-  [ "MAX_FRAGMENT_ATOMIC_COUNTERS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters), 
extra_ARB_shader_atomic_counters_es31" ],
-  [ "MAX_COMBINED_ATOMIC_COUNTER_BUFFERS", 
"CONTEXT_INT(Const.MaxCombinedAtomicBuffers), extra_ARB_shader_atomic_counters_es31" ],
-  [ "MAX_COMBINED_ATOMIC_COUNTERS", "CONTEXT_INT(Const.MaxCombinedAtomicCounters), 
extra_ARB_shader_atomic_counters_es31" ],
+  [ "MAX_ATOMIC_COUNTER_BUFFER_BINDINGS", 
"CONTEXT_INT(Const.MaxAtomicBufferBindings), extra_ARB_shader_atomic_counters" ],
+  [ "MAX_ATOMIC_COUNTER_BUFFER_SIZE", "CONTEXT_INT(Const.MaxAtomicBufferSize), 
extra_ARB_shader_atomic_counters" ],
+  [ "MAX_VERTEX_ATOMIC_COUNTER_BUFFERS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers), 
extra_ARB_shader_atomic_counters" ],
+  [ "MAX_VER

Re: [Mesa-dev] [PATCH 5/6] mesa: enable enums for OES_texture_storage_multisample_2d_array

2015-08-26 Thread Ilia Mirkin
On Wed, Aug 26, 2015 at 5:03 AM, Tapani Pälli  wrote:
> On 08/26/2015 08:26 AM, Ilia Mirkin wrote:
>>
>> On Wed, Aug 26, 2015 at 1:19 AM, Tapani Pälli 
>> wrote:
>>>
>>> On 08/24/2015 04:18 PM, Ilia Mirkin wrote:

 On Fri, Aug 21, 2015 at 3:22 AM, Tapani Pälli 
 wrote:
>
> Signed-off-by: Tapani Pälli 
> ---
>src/mesa/main/get_hash_params.py | 6 +++---
>src/mesa/main/texobj.c   | 6 --
>src/mesa/main/texparam.c | 2 +-
>3 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/main/get_hash_params.py
> b/src/mesa/main/get_hash_params.py
> index 517c391..c06e9b1 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -434,6 +434,9 @@ descriptor=[
>  [ "SAMPLE_MASK", "CONTEXT_BOOL(Multisample.SampleMask),
> extra_ARB_texture_multisample_es31" ],
>  [ "MAX_SAMPLE_MASK_WORDS", "CONST(1),
> extra_ARB_texture_multisample_es31" ],
>
> +# GL_ARB_texture_multisample / ES 3.1 with
> GL_OES_texture_storage_multisample_2d_array
> +  [ "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "LOC_CUSTOM, TYPE_INT,
> TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, extra_ARB_texture_multisample_es31"
> ],

 What does the _es31 add? Should be removed, I think. Should be done in
 a cleanup patch later though. Looks like I wasn't looking carefully
 enough at what was going on the list and this managed to sneak
 through... same goes for most (but probably not all) of the _es31
 things.
>>>
>>>
>>> I think using the _es31 is technically the best solution leaving no gaps
>>> or
>>> 'hidden features' where we enable some GLES functionality through desktop
>>> extension. I think we already went through this discussion.
>>
>> Yeah, and I pointed this same thing out then too, and was ignored I
>> believe.
>
>
> Not ignored, Ian stated that we have to see case by case and most of the
> cases I've seen require checks. We should not be able to query this enum
> using GLES 3.0. Doing the '_es31 way' we make sure that these exist only for
> 3.1. We changed to this model when somebody pointed out that in earlier
> model we exposed enums for GLES 2.0 apps.

Yeah, that somebody was me, if you recall. And I strongly argued
against the _es31 stuff when it was first coming in too. But then I
looked away, and this stuff got pushed. Same as with the ARB_dsa stuff
when I kept saying that the piglits had to be core and then eventually
gave up, and it caused a giant thing at mesa 10.6 release time.

>>> For extensions
>>> string enable, I think it's feasible to use desktop feature enables but
>>> anywhere else in the code it hides things from the reader.
>>
>> I must be missing something. Can you describe to me a scenario under
>> which the _es31 thing makes *any* change to the code paths executed?
>> The only one I can imagine is with a driver that doesn't set
>> Extensions.ARB_texture_multisample, but a user has force-enabled ES3.1
>> via override flags. I don't think that this is a case worth worrying
>> about.
>>
>> In fact I've sent a patch to remove all the _es31 things (except for
>> ARB_cs, where it's an actual scenario).
>
>
> OK. Maybe we've been too protective then if it works and I don't think we
> have any 'negative tests' to for example use ES 3.1 enums in a GLES 2.0
> context. Program would need to strange anyway to either include ES 3.1
> headers or use hardcoded values in the calls. I don't have a strong opinion,
> I'm somewhat disappointed that we are changing this once again. Remember,
> first we did this loosely by exposing the enums for anyone. Then we made
> more strict check by adding _es31 so that we would not expose enums in wrong
> contexts and now we are back again giving them for everyone?

I think from your next email you've come around to understanding what
all I've been saying, but just in case, let me restate:

Old check: ARB_texture_multisample || es31

es31 is set based on either a cmdline override (in which case I care
less about compliance) or based on the condition in
compute_version_es2. This condition will only be true if the various
extensions are there, so logically es31 is an && of the various exts.
[And also whether an actual ES31 context was selected.]

Therefore the || es31 does nothing. Literally nothing. You can't
*exclude* GLES2.0 by adding an || condition to the availability, and
in this case, ES31 *implies* that ARB_texture_multisample will have
been set, since no driver will have an ES31 context but not have
ARB_texture_multisample. The only thing it can do is *add*, and it
doesn't increase the number of states that will pass through the
condition for any practical scenario.

In case you're still unconvinced, come up with a scenario and show me
which line of code is executed with the _es31 thing but not without.
Outside of using cmdline overrides on a driver that has no business
exposing ES3.1 in the 

[Mesa-dev] [Bug 91747] Ubuntu 15.04/Oibaf PPA - Unity bar not transparent

2015-08-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91747

Benjamin Bellec  changed:

   What|Removed |Added

 CC||b.bel...@gmail.com

--- Comment #1 from Benjamin Bellec  ---
What hardware do you use ?
Can you provide a screenshot before and after ?

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


Re: [Mesa-dev] [PATCH] i965: Rename INTEL_DEBUG=vec4vs to INTEL_DEBUG=vec4.

2015-08-26 Thread Jason Ekstrand
Acked-by: Jason Ekstrand 

On Wed, Aug 26, 2015 at 2:43 AM, Kenneth Graunke  wrote:
> driParseDebugString() doesn't have actual code to parse comma separated
> lists (or any other supported options?); instead it dumbly uses strstr().
>
> This means that INTEL_DEBUG="vec4vs" will trigger both DEBUG_VEC4VS and
> DEBUG_VS, as "vs" is also a substring.
>
> We should probably improve the driconf parsing, but for now, just rename
> the option so it's usable in the meantime.
>
> Signed-off-by: Kenneth Graunke 
> ---
>  src/mesa/drivers/dri/i965/intel_debug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_debug.c 
> b/src/mesa/drivers/dri/i965/intel_debug.c
> index a077731..b3b3c21 100644
> --- a/src/mesa/drivers/dri/i965/intel_debug.c
> +++ b/src/mesa/drivers/dri/i965/intel_debug.c
> @@ -68,7 +68,7 @@ static const struct dri_debug_control debug_control[] = {
> { "optimizer",   DEBUG_OPTIMIZER },
> { "ann", DEBUG_ANNOTATION },
> { "no8", DEBUG_NO8 },
> -   { "vec4vs",  DEBUG_VEC4VS },
> +   { "vec4",DEBUG_VEC4VS },
> { "spill",   DEBUG_SPILL },
> { "cs",  DEBUG_CS },
> { NULL,0 }
> --
> 2.5.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 02/17] linker: Silence GCC unused parameter warnings

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

linker.cpp:320:55: warning: unused parameter 'ir' [-Wunused-parameter]
virtual ir_visitor_status visit_leave(ir_function *ir)
   ^
linker.cpp:327:53: warning: unused parameter 'ir' [-Wunused-parameter]
virtual ir_visitor_status visit_leave(ir_return *ir)
 ^
linker.cpp:333:49: warning: unused parameter 'ir' [-Wunused-parameter]
virtual ir_visitor_status visit_enter(ir_if *ir)
 ^
linker.cpp:339:49: warning: unused parameter 'ir' [-Wunused-parameter]
virtual ir_visitor_status visit_leave(ir_if *ir)
 ^
linker.cpp:345:51: warning: unused parameter 'ir' [-Wunused-parameter]
virtual ir_visitor_status visit_enter(ir_loop *ir)
   ^
linker.cpp:351:51: warning: unused parameter 'ir' [-Wunused-parameter]
virtual ir_visitor_status visit_leave(ir_loop *ir)
   ^
linker.cpp:2824:53: warning: unused parameter 'ctx' [-Wunused-parameter]
 link_calculate_subroutine_compat(struct gl_context *ctx, struct 
gl_shader_program *prog)
 ^
linker.cpp:2854:47: warning: unused parameter 'ctx' [-Wunused-parameter]
 check_subroutine_resources(struct gl_context *ctx, struct gl_shader_program 
*prog)
   ^
linker.cpp:3368:49: warning: unused parameter 'ctx' [-Wunused-parameter]
 link_assign_subroutine_types(struct gl_context *ctx,
 ^

Also make link_assign_subroutine_types static since it is only called
from this file.

Signed-off-by: Ian Romanick 
---
 src/glsl/linker.cpp | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index a7cd820..72154bf 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -317,38 +317,38 @@ public:
   return visit_continue;
}
 
-   virtual ir_visitor_status visit_leave(ir_function *ir)
+   virtual ir_visitor_status visit_leave(ir_function *)
{
   in_main = false;
   after_return = false;
   return visit_continue;
}
 
-   virtual ir_visitor_status visit_leave(ir_return *ir)
+   virtual ir_visitor_status visit_leave(ir_return *)
{
   after_return = true;
   return visit_continue;
}
 
-   virtual ir_visitor_status visit_enter(ir_if *ir)
+   virtual ir_visitor_status visit_enter(ir_if *)
{
   ++control_flow;
   return visit_continue;
}
 
-   virtual ir_visitor_status visit_leave(ir_if *ir)
+   virtual ir_visitor_status visit_leave(ir_if *)
{
   --control_flow;
   return visit_continue;
}
 
-   virtual ir_visitor_status visit_enter(ir_loop *ir)
+   virtual ir_visitor_status visit_enter(ir_loop *)
{
   ++control_flow;
   return visit_continue;
}
 
-   virtual ir_visitor_status visit_leave(ir_loop *ir)
+   virtual ir_visitor_status visit_leave(ir_loop *)
{
   --control_flow;
   return visit_continue;
@@ -2821,7 +2821,7 @@ check_resources(struct gl_context *ctx, struct 
gl_shader_program *prog)
 }
 
 static void
-link_calculate_subroutine_compat(struct gl_context *ctx, struct 
gl_shader_program *prog)
+link_calculate_subroutine_compat(struct gl_shader_program *prog)
 {
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
   struct gl_shader *sh = prog->_LinkedShaders[i];
@@ -2851,7 +2851,7 @@ link_calculate_subroutine_compat(struct gl_context *ctx, 
struct gl_shader_progra
 }
 
 static void
-check_subroutine_resources(struct gl_context *ctx, struct gl_shader_program 
*prog)
+check_subroutine_resources(struct gl_shader_program *prog)
 {
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
   struct gl_shader *sh = prog->_LinkedShaders[i];
@@ -3364,9 +3364,8 @@ validate_sampler_array_indexing(struct gl_context *ctx,
return true;
 }
 
-void
-link_assign_subroutine_types(struct gl_context *ctx,
- struct gl_shader_program *prog)
+static void
+link_assign_subroutine_types(struct gl_shader_program *prog)
 {
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
   gl_shader *sh = prog->_LinkedShaders[i];
@@ -3588,7 +3587,7 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
}
 
check_explicit_uniform_locations(ctx, prog);
-   link_assign_subroutine_types(ctx, prog);
+   link_assign_subroutine_types(prog);
 
if (!prog->LinkStatus)
   goto done;
@@ -3848,9 +3847,9 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
link_assign_atomic_counter_resources(ctx, prog);
store_fragdepth_layout(prog);
 
-   link_calculate_subroutine_compat(ctx, prog);
+   link_calculate_subroutine_compat(prog);
check_resources(ctx, prog);
-   check_subroutine_resour

[Mesa-dev] [PATCH 06/17] nir: Silence missing field initializer warnings for nir_dest

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

nir/nir.h:576:4: warning: missing initializer for field 'is_ssa' of 'nir_dest' [
-Wmissing-field-initializers]
nir_dest dest = NIR_DEST_INIT;
^
nir/nir.h:538:10: note: 'is_ssa' declared here
bool is_ssa;
  ^
nir/nir.h:576:55: warning: missing initializer for member 'nir_reg_dest::def_lin
k' [-Wmissing-field-initializers]
nir_dest dest = NIR_DEST_INIT;

Number of total warnings in my build reduced from 1927 to 1664
(reduction of 263).

Signed-off-by: Ian Romanick 
---
 src/glsl/nir/nir.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index a9b59b2..a49e376 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -538,7 +538,7 @@ typedef struct {
bool is_ssa;
 } nir_dest;
 
-#define NIR_DEST_INIT (nir_dest) { { { NULL } } }
+#define NIR_DEST_INIT (nir_dest) { { { NULL, { NULL, NULL }, NULL, NULL, 0 } 
}, false }
 
 #define nir_foreach_def(reg, dest) \
list_for_each_entry(nir_dest, dest, &(reg)->defs, reg.def_link)
-- 
2.1.0

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


[Mesa-dev] [PATCH 08/17] nir: Silence missing field initializer warnings for vectors in nir_constant_expressions

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

nir/nir_constant_expressions.c: In function 'evaluate_ball2':
nir/nir_constant_expressions.c:279:7: warning: missing initializer for field 
'z' of 'struct bool_vec' [-Wmissing-field-initializers]
   };
   ^
nir/nir_constant_expressions.c:234:10: note: 'z' declared here
bool z;
  ^

Number of total warnings in my build reduced from 1651 to 1588
(reduction of 63).

Signed-off-by: Ian Romanick 
---
 src/glsl/nir/nir_constant_expressions.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/glsl/nir/nir_constant_expressions.py 
b/src/glsl/nir/nir_constant_expressions.py
index 8fd9b10..6006358 100644
--- a/src/glsl/nir/nir_constant_expressions.py
+++ b/src/glsl/nir/nir_constant_expressions.py
@@ -246,6 +246,13 @@ evaluate_${name}(unsigned num_components, nir_const_value 
*_src)
 _src[${j}].${op.input_types[j][:1]}[${k}],
  % endif
   % endfor
+  % for k in range(op.input_sizes[j], 4):
+ % if op.input_types[j] == "bool":
+false,
+ % else:
+0,
+ % endif
+  % endfor
   };
% endfor
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 13/17] glsl: Silence unused parameter warnings

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

builtin_variables.cpp:1062:53: warning: unused parameter 'name_as_gs_input' 
[-Wunused-parameter]
 const char *name_as_gs_input)
 ^
builtin_functions.cpp:4774:47: warning: unused parameter 'intrinsic_name' 
[-Wunused-parameter]
   const char *intrinsic_name,
   ^
builtin_functions.cpp:4907:66: warning: unused parameter 'state' 
[-Wunused-parameter]
 _mesa_glsl_find_builtin_function_by_name(_mesa_glsl_parse_state *state,
  ^
ir_print_visitor.cpp:589:37: warning: unused parameter 'ir' [-Wunused-parameter]
 ir_print_visitor::visit(ir_barrier *ir)
 ^
linker.cpp:3212:48: warning: unused parameter 'ctx' [-Wunused-parameter]
 build_program_resource_list(struct gl_context *ctx,
^
standalone_scaffolding.cpp:65:57: warning: unused parameter ‘id’ 
[-Wunused-parameter]
 _mesa_shader_debug(struct gl_context *, GLenum, GLuint *id,
 ^

Now src/glsl is _almost_ free of warnings!

Signed-off-by: Ian Romanick 
---
 src/glsl/ast_to_hir.cpp | 2 +-
 src/glsl/builtin_functions.cpp  | 7 ++-
 src/glsl/builtin_variables.cpp  | 8 +++-
 src/glsl/ir.h   | 3 +--
 src/glsl/ir_print_visitor.cpp   | 2 +-
 src/glsl/linker.cpp | 3 +--
 src/glsl/program.h  | 3 +--
 src/glsl/standalone_scaffolding.cpp | 2 +-
 src/mesa/program/ir_to_mesa.cpp | 2 +-
 9 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 06cd6a5..d8d0d58 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4544,7 +4544,7 @@ ast_function::hir(exec_list *instructions,
if (state->es_shader && state->language_version >= 300) {
   /* Local shader has no exact candidates; check the built-ins. */
   _mesa_glsl_initialize_builtin_functions();
-  if (_mesa_glsl_find_builtin_function_by_name(state, name)) {
+  if (_mesa_glsl_find_builtin_function_by_name(name)) {
  YYLTYPE loc = this->get_location();
  _mesa_glsl_error(& loc, state,
   "A shader cannot redefine or overload built-in "
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 2175c66..4c813fd 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -705,7 +705,6 @@ private:
B1(mid3)
 
ir_function_signature *_image_prototype(const glsl_type *image_type,
-   const char *intrinsic_name,
unsigned num_arguments,
unsigned flags);
ir_function_signature *_image(const glsl_type *image_type,
@@ -4771,7 +4770,6 @@ builtin_builder::_mid3(const glsl_type *type)
 
 ir_function_signature *
 builtin_builder::_image_prototype(const glsl_type *image_type,
-  const char *intrinsic_name,
   unsigned num_arguments,
   unsigned flags)
 {
@@ -4823,7 +4821,7 @@ builtin_builder::_image(const glsl_type *image_type,
 unsigned num_arguments,
 unsigned flags)
 {
-   ir_function_signature *sig = _image_prototype(image_type, intrinsic_name,
+   ir_function_signature *sig = _image_prototype(image_type,
  num_arguments, flags);
 
if (flags & IMAGE_FUNCTION_EMIT_STUB) {
@@ -4904,8 +4902,7 @@ _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state 
*state,
 }
 
 ir_function *
-_mesa_glsl_find_builtin_function_by_name(_mesa_glsl_parse_state *state,
- const char *name)
+_mesa_glsl_find_builtin_function_by_name(const char *name)
 {
ir_function *f;
mtx_lock(&builtins_lock);
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 53d3500..30faaa4 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -383,8 +383,7 @@ private:
ir_variable *add_uniform(const glsl_type *type, const char *name);
ir_variable *add_const(const char *name, int value);
ir_variable *add_const_ivec3(const char *name, int x, int y, int z);
-   void add_varying(int slot, const glsl_type *type, const char *name,
-const char *name_as_gs_input);
+   void add_varying(int slot, const glsl_type *type, const char *name);
 
exec_list * const instructions;
struct _mesa_glsl_parse_state * const state;
@@ -1058,8 +1057,7 @@ builtin_variable_generator::generate_cs_special_vars()
  */
 void
 builtin_variable_generator::add_varying(int slot, const glsl_type *type,
-

[Mesa-dev] [PATCH 03/17] i965: Make gen8_upload_state_base_address static

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

All of the other state upload functions are static because the only use
is in the brw_tracked_state structure.

Signed-off-by: Ian Romanick 
---
 src/mesa/drivers/dri/i965/brw_state.h   | 4 
 src/mesa/drivers/dri/i965/gen8_misc_state.c | 3 ++-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
b/src/mesa/drivers/dri/i965/brw_state.h
index 78a1f87..da8a478 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -177,10 +177,6 @@ void brw_upload_invariant_state(struct brw_context *brw);
 uint32_t
 brw_depthbuffer_format(struct brw_context *brw);
 
-/* gen8_misc_state.c */
-void gen8_upload_state_base_address(struct brw_context *brw);
-
-
 /***
  * brw_state.c
  */
diff --git a/src/mesa/drivers/dri/i965/gen8_misc_state.c 
b/src/mesa/drivers/dri/i965/gen8_misc_state.c
index b20038e..a46b252 100644
--- a/src/mesa/drivers/dri/i965/gen8_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_misc_state.c
@@ -29,7 +29,8 @@
 /**
  * Define the base addresses which some state is referenced from.
  */
-void gen8_upload_state_base_address(struct brw_context *brw)
+static void
+gen8_upload_state_base_address(struct brw_context *brw)
 {
uint32_t mocs_wb = brw->gen >= 9 ? SKL_MOCS_WB : BDW_MOCS_WB;
int pkt_len = brw->gen >= 9 ? 19 : 16;
-- 
2.1.0

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


[Mesa-dev] [PATCH 16/17] mesa: Remove target parameter from _mesa_handle_bind_buffer_gen

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

main/bufferobj.c: In function '_mesa_handle_bind_buffer_gen':
main/bufferobj.c:915:37: warning: unused parameter 'target' [-Wunused-parameter]
  GLenum target,
 ^

Signed-off-by: Ian Romanick 
---
 src/mesa/main/bufferobj.c | 7 +++
 src/mesa/main/bufferobj.h | 1 -
 src/mesa/main/varray.c| 3 +--
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index eab9cef..7c6c70a 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -914,7 +914,6 @@ _mesa_free_buffer_objects( struct gl_context *ctx )
 
 bool
 _mesa_handle_bind_buffer_gen(struct gl_context *ctx,
- GLenum target,
  GLuint buffer,
  struct gl_buffer_object **buf_handle,
  const char *caller)
@@ -977,7 +976,7 @@ bind_buffer_object(struct gl_context *ctx, GLenum target, 
GLuint buffer)
else {
   /* non-default buffer object */
   newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
-  if (!_mesa_handle_bind_buffer_gen(ctx, target, buffer,
+  if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
 &newBufObj, "glBindBuffer"))
  return;
}
@@ -4236,7 +4235,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
} else {
   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
}
-   if (!_mesa_handle_bind_buffer_gen(ctx, target, buffer,
+   if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
  &bufObj, "glBindBufferRange"))
   return;
 
@@ -4288,7 +4287,7 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint 
buffer)
} else {
   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
}
-   if (!_mesa_handle_bind_buffer_gen(ctx, target, buffer,
+   if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
  &bufObj, "glBindBufferBase"))
   return;
 
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index b5d73ae..b7154c5 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -74,7 +74,6 @@ _mesa_free_buffer_objects(struct gl_context *ctx);
 
 extern bool
 _mesa_handle_bind_buffer_gen(struct gl_context *ctx,
- GLenum target,
  GLuint buffer,
  struct gl_buffer_object **buf_handle,
  const char *caller);
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 3bab985..7a1dddc 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1698,8 +1698,7 @@ vertex_array_vertex_buffer(struct gl_context *ctx, struct 
gl_vertex_array_object
* Otherwise, we fall back to the same compat profile behavior as other
* object references (automatically gen it).
*/
-  if (!_mesa_handle_bind_buffer_gen(ctx, GL_ARRAY_BUFFER, buffer,
-&vbo, func))
+  if (!_mesa_handle_bind_buffer_gen(ctx, buffer, &vbo, func))
  return;
} else {
   /* The ARB_vertex_attrib_binding spec says:
-- 
2.1.0

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


[Mesa-dev] [PATCH 07/17] nir: Silence missing field initializer warnings for nir_alu_src

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

nir/nir_builder.h:234:4: warning: missing initializer for field 'use_link' of 'n
ir_src' [-Wmissing-field-initializers]
nir_alu_src alu_src = { NIR_SRC_INIT };
^

Number of total warnings in my build reduced from 1664 to 1651.
(reduction of 13).

Patch generated by:

egrep -lr 'nir_alu_src .* = \{ NIR_SRC_INIT \}' src/ | while read f
do
sed --in-place -e 's/nir_alu_src \(.*\) = { NIR_SRC_INIT }/nir_alu_src 
\1 = { NIR_SRC_INIT, false, false, { 0, } }/' $f
done

Signed-off-by: Ian Romanick 
---
 src/glsl/nir/nir_builder.h | 4 ++--
 src/glsl/nir/nir_search.c  | 2 +-
 src/mesa/program/prog_to_nir.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h
index 9223e83..b3d7be2 100644
--- a/src/glsl/nir/nir_builder.h
+++ b/src/glsl/nir/nir_builder.h
@@ -231,7 +231,7 @@ static inline nir_ssa_def *
 nir_swizzle(nir_builder *build, nir_ssa_def *src, unsigned swiz[4],
 unsigned num_components, bool use_fmov)
 {
-   nir_alu_src alu_src = { NIR_SRC_INIT };
+   nir_alu_src alu_src = { NIR_SRC_INIT, false, false, { 0, } };
alu_src.src = nir_src_for_ssa(src);
for (int i = 0; i < 4; i++)
   alu_src.swizzle[i] = swiz[i];
@@ -250,7 +250,7 @@ nir_ssa_for_src(nir_builder *build, nir_src src, int 
num_components)
if (src.is_ssa && src.ssa->num_components == num_components)
   return src.ssa;
 
-   nir_alu_src alu = { NIR_SRC_INIT };
+   nir_alu_src alu = { NIR_SRC_INIT, false, false, { 0, } };
alu.src = src;
for (int j = 0; j < 4; j++)
   alu.swizzle[j] = j;
diff --git a/src/glsl/nir/nir_search.c b/src/glsl/nir/nir_search.c
index c33d6c3..c36054c 100644
--- a/src/glsl/nir/nir_search.c
+++ b/src/glsl/nir/nir_search.c
@@ -289,7 +289,7 @@ construct_value(const nir_search_value *value, nir_alu_type 
type,
   const nir_search_variable *var = nir_search_value_as_variable(value);
   assert(state->variables_seen & (1 << var->variable));
 
-  nir_alu_src val = { NIR_SRC_INIT };
+  nir_alu_src val = { NIR_SRC_INIT, false, false, { 0, } };
   nir_alu_src_copy(&val, &state->variables[var->variable], mem_ctx);
 
   assert(!var->is_constant);
diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index d54f934..96702cb 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -180,7 +180,7 @@ ptn_get_src(struct ptn_compile *c, const struct 
prog_src_register *prog_src)
  if (prog_src->RelAddr) {
 deref_arr->deref_array_type = nir_deref_array_type_indirect;
 
-nir_alu_src addr_src = { NIR_SRC_INIT };
+nir_alu_src addr_src = { NIR_SRC_INIT, false, false, { 0, } };
 addr_src.src = nir_src_for_reg(c->addr_reg);
 nir_ssa_def *reladdr = nir_imov_alu(b, addr_src, 1);
 
@@ -934,7 +934,7 @@ ptn_add_output_stores(struct ptn_compile *c)
   * a vec4 with undefined .xyw components.  We resolve it to a scalar, 
to
   * match GLSL's gl_FragDepth and the expectations of most backends.
   */
- nir_alu_src alu_src = { NIR_SRC_INIT };
+ nir_alu_src alu_src = { NIR_SRC_INIT, false, false, { 0, } };
  alu_src.src = nir_src_for_reg(c->output_regs[FRAG_RESULT_DEPTH]);
  alu_src.swizzle[0] = SWIZZLE_Z;
  store->src[0] = nir_src_for_ssa(nir_fmov_alu(b, alu_src, 1));
-- 
2.1.0

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


[Mesa-dev] [PATCH 17/17] mesa: Remove gl_context parameter from _mesa_initialize_buffer_object and dd:NewBufferObject

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

_mesa_initialize_buffer_object did not use it.  Once that parameter was
removed, none of the implementations of dd::NewBufferObject used it
either.

Also silences a warning:

main/bufferobj.c: In function '_mesa_initialize_buffer_object':
main/bufferobj.c:503:51: warning: unused parameter 'ctx' [-Wunused-parameter]
 _mesa_initialize_buffer_object(struct gl_context *ctx,
   ^

Signed-off-by: Ian Romanick 
---
 src/mesa/drivers/dri/i915/intel_buffer_objects.c|  4 ++--
 src/mesa/drivers/dri/i965/intel_buffer_objects.c|  4 ++--
 src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c|  4 ++--
 src/mesa/drivers/dri/radeon/radeon_buffer_objects.c |  5 ++---
 src/mesa/main/bufferobj.c   | 13 +
 src/mesa/main/bufferobj.h   |  3 +--
 src/mesa/main/dd.h  |  3 +--
 src/mesa/main/shared.c  |  2 +-
 src/mesa/state_tracker/st_cb_bufferobjects.c|  4 ++--
 src/mesa/vbo/vbo_exec_api.c |  2 +-
 src/mesa/vbo/vbo_save_api.c |  2 +-
 11 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_buffer_objects.c 
b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
index ef06743..6db2a88 100644
--- a/src/mesa/drivers/dri/i915/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
@@ -68,11 +68,11 @@ release_buffer(struct intel_buffer_object *intel_obj)
  * internal structure where somehow shared.
  */
 static struct gl_buffer_object *
-intel_bufferobj_alloc(struct gl_context * ctx, GLuint name)
+intel_bufferobj_alloc(GLuint name)
 {
struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
 
-   _mesa_initialize_buffer_object(ctx, &obj->Base, name);
+   _mesa_initialize_buffer_object(&obj->Base, name);
 
obj->buffer = NULL;
 
diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c 
b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
index ff05b5c..3c34129 100644
--- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
@@ -134,14 +134,14 @@ release_buffer(struct intel_buffer_object *intel_obj)
  * internal structure where somehow shared.
  */
 static struct gl_buffer_object *
-brw_new_buffer_object(struct gl_context * ctx, GLuint name)
+brw_new_buffer_object(GLuint name)
 {
struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
if (!obj) {
   _mesa_error_no_memory(__func__);
}
 
-   _mesa_initialize_buffer_object(ctx, &obj->Base, name);
+   _mesa_initialize_buffer_object(&obj->Base, name);
 
obj->buffer = NULL;
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c 
b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
index afccf35..aa0d6dd 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
@@ -48,7 +48,7 @@ get_bufferobj_map(struct gl_context *ctx, struct 
gl_buffer_object *obj,
 }
 
 static struct gl_buffer_object *
-nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer)
+nouveau_bufferobj_new(GLuint buffer)
 {
struct nouveau_bufferobj *nbo;
 
@@ -56,7 +56,7 @@ nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer)
if (!nbo)
return NULL;
 
-   _mesa_initialize_buffer_object(ctx, &nbo->base, buffer);
+   _mesa_initialize_buffer_object(&nbo->base, buffer);
 
return &nbo->base;
 }
diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c 
b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
index d9d4f5f..a40cf19 100644
--- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
+++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
@@ -39,12 +39,11 @@ get_radeon_buffer_object(struct gl_buffer_object *obj)
 }
 
 static struct gl_buffer_object *
-radeonNewBufferObject(struct gl_context * ctx,
-  GLuint name)
+radeonNewBufferObject(GLuint name)
 {
 struct radeon_buffer_object *obj = CALLOC_STRUCT(radeon_buffer_object);
 
-_mesa_initialize_buffer_object(ctx, &obj->Base, name);
+_mesa_initialize_buffer_object(&obj->Base, name);
 
 obj->bo = NULL;
 
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 7c6c70a..c5823da 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -395,14 +395,12 @@ convert_clear_buffer_data(struct gl_context *ctx,
  * Default callback for the \c dd_function_table::NewBufferObject() hook.
  */
 static struct gl_buffer_object *
-_mesa_new_buffer_object(struct gl_context *ctx, GLuint name)
+_mesa_new_buffer_object(GLuint name)
 {
struct gl_buffer_object *obj;
 
-   (void) ctx;
-
obj = MALLOC_STRUCT(gl_buffer_object);
-   _mesa_initialize_buffer_object(ctx, obj, name);
+   _mesa_initialize_buffer_object(obj, name);
return obj;
 }
 
@@ -500,8 +498,7 @@ _mesa_reference_buffer_ob

[Mesa-dev] [PATCH 04/17] i965: Make gen7_enable_hw_binding_tables static

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

All of the other state upload functions are static because the only use
is in the brw_tracked_state structure.

Signed-off-by: Ian Romanick 
Cc: Abdiel Janulgue 
---
 src/mesa/drivers/dri/i965/brw_binding_tables.c | 2 +-
 src/mesa/drivers/dri/i965/brw_state.h  | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c 
b/src/mesa/drivers/dri/i965/brw_binding_tables.c
index b188fc7..508f1f0 100644
--- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
+++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
@@ -311,7 +311,7 @@ gen7_disable_hw_binding_tables(struct brw_context *brw)
 /**
  * Enable hardware binding tables and set up the binding table pool.
  */
-void
+static void
 gen7_enable_hw_binding_tables(struct brw_context *brw)
 {
if (!brw->use_resource_streamer)
diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
b/src/mesa/drivers/dri/i965/brw_state.h
index da8a478..2cc64ca 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -373,7 +373,6 @@ void gen7_update_binding_table_from_array(struct 
brw_context *brw,
   gl_shader_stage stage,
   const uint32_t* binding_table,
   int num_surfaces);
-void gen7_enable_hw_binding_tables(struct brw_context *brw);
 void gen7_disable_hw_binding_tables(struct brw_context *brw);
 void gen7_reset_hw_bt_pool_offsets(struct brw_context *brw);
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 09/17] nir: Fix wonkey indentation in generated code

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/glsl/nir/nir_constant_expressions.py | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/glsl/nir/nir_constant_expressions.py 
b/src/glsl/nir/nir_constant_expressions.py
index 6006358..087aab9 100644
--- a/src/glsl/nir/nir_constant_expressions.py
+++ b/src/glsl/nir/nir_constant_expressions.py
@@ -238,29 +238,29 @@ evaluate_${name}(unsigned num_components, nir_const_value 
*_src)
  <% continue %>
   %endif
 
-  struct ${op.input_types[j]}_vec src${j} = {
+   struct ${op.input_types[j]}_vec src${j} = {
   % for k in range(op.input_sizes[j]):
  % if op.input_types[j] == "bool":
-_src[${j}].u[${k}] != 0,
+  _src[${j}].u[${k}] != 0,
  % else:
-_src[${j}].${op.input_types[j][:1]}[${k}],
+  _src[${j}].${op.input_types[j][:1]}[${k}],
  % endif
   % endfor
   % for k in range(op.input_sizes[j], 4):
  % if op.input_types[j] == "bool":
-false,
+  false,
  % else:
-0,
+  0,
  % endif
   % endfor
-  };
+   };
% endfor
 
% if op.output_size == 0:
   ## For per-component instructions, we need to iterate over the
   ## components and apply the constant expression one component
   ## at a time.
-  for (unsigned _i = 0; _i < num_components; _i++) {
+   for (unsigned _i = 0; _i < num_components; _i++) {
  ## For each per-component input, create a variable srcN that
  ## contains the value of the current (_i'th) component.
  % for j in range(op.num_inputs):
@@ -270,9 +270,9 @@ evaluate_${name}(unsigned num_components, nir_const_value 
*_src)
## Avoid unused variable warnings
<% continue %>
 % elif op.input_types[j] == "bool":
-   bool src${j} = _src[${j}].u[_i] != 0;
+  bool src${j} = _src[${j}].u[_i] != 0;
 % else:
-   ${op.input_types[j]} src${j} = 
_src[${j}].${op.input_types[j][:1]}[_i];
+  ${op.input_types[j]} src${j} = _src[${j}].${op.input_types[j][:1]}[_i];
 % endif
  % endfor
 
@@ -280,36 +280,36 @@ evaluate_${name}(unsigned num_components, nir_const_value 
*_src)
  ## result of the const_expr to it.  If const_expr already contains
  ## writes to dst, just include const_expr directly.
  % if "dst" in op.const_expr:
-${op.output_type} dst;
-${op.const_expr}
+  ${op.output_type} dst;
+  ${op.const_expr}
  % else:
-${op.output_type} dst = ${op.const_expr};
+  ${op.output_type} dst = ${op.const_expr};
  % endif
 
  ## Store the current component of the actual destination to the
  ## value of dst.
  % if op.output_type == "bool":
 ## Sanitize the C value to a proper NIR bool
-_dst_val.u[_i] = dst ? NIR_TRUE : NIR_FALSE;
+  _dst_val.u[_i] = dst ? NIR_TRUE : NIR_FALSE;
  % else:
-_dst_val.${op.output_type[:1]}[_i] = dst;
+  _dst_val.${op.output_type[:1]}[_i] = dst;
  % endif
-  }
+   }
% else:
   ## In the non-per-component case, create a struct dst with
   ## appropriately-typed elements x, y, z, and w and assign the result
   ## of the const_expr to all components of dst, or include the
   ## const_expr directly if it writes to dst already.
-  struct ${op.output_type}_vec dst;
+   struct ${op.output_type}_vec dst;
 
   % if "dst" in op.const_expr:
- ${op.const_expr}
+   ${op.const_expr}
   % else:
  ## Splat the value to all components.  This way expressions which
  ## write the same value to all components don't need to explicitly
  ## write to dest.  One such example is fnoise which has a
  ## const_expr of 0.0f.
- dst.x = dst.y = dst.z = dst.w = ${op.const_expr};
+   dst.x = dst.y = dst.z = dst.w = ${op.const_expr};
   % endif
 
   ## For each component in the destination, copy the value of dst to
@@ -317,9 +317,9 @@ evaluate_${name}(unsigned num_components, nir_const_value 
*_src)
   % for k in range(op.output_size):
  % if op.output_type == "bool":
 ## Sanitize the C value to a proper NIR bool
-_dst_val.u[${k}] = dst.${"xyzw"[k]} ? NIR_TRUE : NIR_FALSE;
+   _dst_val.u[${k}] = dst.${"xyzw"[k]} ? NIR_TRUE : NIR_FALSE;
  % else:
-_dst_val.${op.output_type[:1]}[${k}] = dst.${"xyzw"[k]};
+   _dst_val.${op.output_type[:1]}[${k}] = dst.${"xyzw"[k]};
  % endif
   % endfor
% endif
-- 
2.1.0

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


[Mesa-dev] [PATCH 10/17] nir: Silence unused parameter warnings in nir_constant_expression.c

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

nir/nir_constant_expressions.c:290:25: warning: unused parameter 
'num_components' [-Wunused-parameter]
 evaluate_ball3(unsigned num_components, nir_const_value *_src)
 ^
nir/nir_constant_expressions.c: In function 'evaluate_fddx':
nir/nir_constant_expressions.c:1282:57: warning: unused parameter '_src' 
[-Wunused-parameter]
 evaluate_fddx(unsigned num_components, nir_const_value *_src)
 ^

Number of total warnings in my build reduced from 1588 to 1501
(reduction of 87).

Signed-off-by: Ian Romanick 
---
 src/glsl/nir/nir_constant_expressions.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/glsl/nir/nir_constant_expressions.py 
b/src/glsl/nir/nir_constant_expressions.py
index 087aab9..e2feff3 100644
--- a/src/glsl/nir/nir_constant_expressions.py
+++ b/src/glsl/nir/nir_constant_expressions.py
@@ -255,6 +255,16 @@ evaluate_${name}(unsigned num_components, nir_const_value 
*_src)
   % endfor
};
% endfor
+   % if op.output_size != 0 or "src" not in op.const_expr:
+
+   /* Silence compiler warnings. */
+  % if op.output_size != 0:
+   (void) num_components;
+  % endif
+  % if "src" not in op.const_expr:
+   (void) _src;
+  % endif
+   % endif
 
% if op.output_size == 0:
   ## For per-component instructions, we need to iterate over the
-- 
2.1.0

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


[Mesa-dev] [PATCH 05/17] nir: Silence missing field initializer warnings for nir_src

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

nir/nir.h: In function 'nir_src_for_ssa':
nir/nir.h:552:4: warning: missing initializer for field 'use_link' of 'nir_src'
[-Wmissing-field-initializers]
nir_src src = NIR_SRC_INIT;
^
In file included from nir/nir.c:28:0:
nir/nir.h:508:21: note: 'use_link' declared here
struct list_head use_link;
 ^

Number of total warnings in my build reduced from 2299 to 1927
(reduction of 372).

Signed-off-by: Ian Romanick 
---
 src/glsl/nir/nir.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 222a219..a9b59b2 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -515,7 +515,7 @@ typedef struct nir_src {
bool is_ssa;
 } nir_src;
 
-#define NIR_SRC_INIT (nir_src) { { NULL } }
+#define NIR_SRC_INIT (nir_src) { { NULL }, { NULL, NULL }, { { NULL, NULL, 0 } 
}, false }
 
 #define nir_foreach_use(reg_or_ssa_def, src) \
list_for_each_entry(nir_src, src, &(reg_or_ssa_def)->uses, use_link)
-- 
2.1.0

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


[Mesa-dev] [PATCH 11/17] nir: Trivial clean ups in the generated nir_constant_expressions.c

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/glsl/nir/nir_constant_expressions.py | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/glsl/nir/nir_constant_expressions.py 
b/src/glsl/nir/nir_constant_expressions.py
index e2feff3..099bb77 100644
--- a/src/glsl/nir/nir_constant_expressions.py
+++ b/src/glsl/nir/nir_constant_expressions.py
@@ -226,7 +226,6 @@ static nir_const_value
 evaluate_${name}(unsigned num_components, nir_const_value *_src)
 {
nir_const_value _dst_val = { { {0, 0, 0, 0} } };
-
## For each non-per-component input, create a variable srcN that
## contains x, y, z, and w elements which are filled in with the
## appropriately-typed values.
@@ -238,7 +237,7 @@ evaluate_${name}(unsigned num_components, nir_const_value 
*_src)
  <% continue %>
   %endif
 
-   struct ${op.input_types[j]}_vec src${j} = {
+   const struct ${op.input_types[j]}_vec src${j} = {
   % for k in range(op.input_sizes[j]):
  % if op.input_types[j] == "bool":
   _src[${j}].u[${k}] != 0,
@@ -280,17 +279,17 @@ evaluate_${name}(unsigned num_components, nir_const_value 
*_src)
## Avoid unused variable warnings
<% continue %>
 % elif op.input_types[j] == "bool":
-  bool src${j} = _src[${j}].u[_i] != 0;
+  const bool src${j} = _src[${j}].u[_i] != 0;
 % else:
-  ${op.input_types[j]} src${j} = _src[${j}].${op.input_types[j][:1]}[_i];
+  const ${op.input_types[j]} src${j} = 
_src[${j}].${op.input_types[j][:1]}[_i];
 % endif
  % endfor
-
  ## Create an appropriately-typed variable dst and assign the
  ## result of the const_expr to it.  If const_expr already contains
  ## writes to dst, just include const_expr directly.
  % if "dst" in op.const_expr:
   ${op.output_type} dst;
+
   ${op.const_expr}
  % else:
   ${op.output_type} dst = ${op.const_expr};
@@ -344,10 +343,8 @@ nir_eval_const_opcode(nir_op op, unsigned num_components,
 {
switch (op) {
 % for name in sorted(opcodes.iterkeys()):
-   case nir_op_${name}: {
+   case nir_op_${name}:
   return evaluate_${name}(num_components, src);
-  break;
-   }
 % endfor
default:
   unreachable("shouldn't get here");
-- 
2.1.0

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


[Mesa-dev] [PATCH 01/17] mesa: Fix warning about static being in the wrong place

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

Because the compiler already has enough things to complain about.

grep -rl 'const static' src/ | while read f
do
sed --in-place -e 's/const static/static const/g' $f
done

brw_eu_emit.c: In function 'brw_reg_type_to_hw_type':
brw_eu_emit.c:98:7: warning: 'static' is not at beginning of declaration 
[-Wold-style-declaration]
   const static int imm_hw_types[] = {
   ^
brw_eu_emit.c:120:7: warning: 'static' is not at beginning of declaration 
[-Wold-style-declaration]
   const static int hw_types[] = {
   ^

Signed-off-by: Ian Romanick 
---
 src/egl/wayland/wayland-drm/wayland-drm.c| 2 +-
 src/gallium/drivers/i915/i915_fpc_optimize.c | 2 +-
 src/glsl/builtin_types.cpp   | 2 +-
 src/glsl/ir_reader.cpp   | 2 +-
 src/mesa/drivers/dri/i965/brw_eu_emit.c  | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
b/src/egl/wayland/wayland-drm/wayland-drm.c
index e9c6e0a..e00d9be 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -197,7 +197,7 @@ drm_authenticate(struct wl_client *client,
wl_resource_post_event(resource, WL_DRM_AUTHENTICATED);
 }
 
-const static struct wl_drm_interface drm_interface = {
+static const struct wl_drm_interface drm_interface = {
drm_authenticate,
drm_create_buffer,
 drm_create_planar_buffer,
diff --git a/src/gallium/drivers/i915/i915_fpc_optimize.c 
b/src/gallium/drivers/i915/i915_fpc_optimize.c
index 83bb649..a2b6d27 100644
--- a/src/gallium/drivers/i915/i915_fpc_optimize.c
+++ b/src/gallium/drivers/i915/i915_fpc_optimize.c
@@ -69,7 +69,7 @@ static boolean same_src_reg(struct i915_full_src_register 
*d1, struct i915_full_
d1->Register.Negate == d2->Register.Negate);
 }
 
-const static struct {
+static const struct {
boolean is_texture;
boolean commutes;
unsigned neutral_element;
diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp
index b0156a1..7bcba3f 100644
--- a/src/glsl/builtin_types.cpp
+++ b/src/glsl/builtin_types.cpp
@@ -127,7 +127,7 @@ static const struct glsl_struct_field 
gl_FogParameters_fields[] = {
 #define T(TYPE, MIN_GL, MIN_ES) \
{ glsl_type::TYPE##_type, MIN_GL, MIN_ES },
 
-const static struct builtin_type_versions {
+static const struct builtin_type_versions {
const glsl_type *const type;
int min_gl;
int min_es;
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index 469837f..9796533 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -26,7 +26,7 @@
 #include "glsl_types.h"
 #include "s_expression.h"
 
-const static bool debug = false;
+static const bool debug = false;
 
 namespace {
 
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 4d39762..637fd07 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -95,7 +95,7 @@ brw_reg_type_to_hw_type(const struct brw_device_info *devinfo,
 enum brw_reg_type type, unsigned file)
 {
if (file == BRW_IMMEDIATE_VALUE) {
-  const static int imm_hw_types[] = {
+  static const int imm_hw_types[] = {
  [BRW_REGISTER_TYPE_UD] = BRW_HW_REG_TYPE_UD,
  [BRW_REGISTER_TYPE_D]  = BRW_HW_REG_TYPE_D,
  [BRW_REGISTER_TYPE_UW] = BRW_HW_REG_TYPE_UW,
@@ -117,7 +117,7 @@ brw_reg_type_to_hw_type(const struct brw_device_info 
*devinfo,
   return imm_hw_types[type];
} else {
   /* Non-immediate registers */
-  const static int hw_types[] = {
+  static const int hw_types[] = {
  [BRW_REGISTER_TYPE_UD] = BRW_HW_REG_TYPE_UD,
  [BRW_REGISTER_TYPE_D]  = BRW_HW_REG_TYPE_D,
  [BRW_REGISTER_TYPE_UW] = BRW_HW_REG_TYPE_UW,
-- 
2.1.0

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


[Mesa-dev] [PATCH 12/17] nir: Silence unused parameter warnings

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

This should remove all of the unused parameter warnings in src/glsl/nir.

These cases had the parameter removed:

nir/nir_lower_vars_to_ssa.c: In function 'get_ssa_def_for_block':
nir/nir_lower_vars_to_ssa.c:527:59: warning: unused parameter 'block' 
[-Wunused-parameter]
 get_ssa_def_for_block(struct deref_node *node, nir_block *block,
   ^
nir/nir_print.c: In function 'print_deref_array':
nir/nir_print.c:278:60: warning: unused parameter 'state' [-Wunused-parameter]
 print_deref_array(nir_deref_array *deref, print_var_state *state, FILE *fp)
^
nir/nir_print.c: In function 'print_deref_struct':
nir/nir_print.c:299:37: warning: unused parameter 'state' [-Wunused-parameter]
print_var_state *state, FILE *fp)
 ^
nir/nir_print.c: In function 'print_load_const_instr':
nir/nir_print.c:519:62: warning: unused parameter 'tabs' [-Wunused-parameter]
 print_load_const_instr(nir_load_const_instr *instr, unsigned tabs, FILE *fp)
  ^

These cases had the parameter (void) silenced because the parameter was
necessary for an interface:

nir/glsl_to_nir.cpp:1900:32: warning: unused parameter 'ir' [-Wunused-parameter]
 nir_visitor::visit(ir_barrier *ir)
^
nir/nir_lower_load_const_to_scalar.c: In function 
'lower_load_const_to_scalar_block':
nir/nir_lower_load_const_to_scalar.c:80:58: warning: unused parameter 'data' 
[-Wunused-parameter]
 lower_load_const_to_scalar_block(nir_block *block, void *data)
  ^
nir/nir_lower_to_source_mods.c: In function 'nir_lower_to_source_mods_block':
nir/nir_lower_to_source_mods.c:37:56: warning: unused parameter 'state' 
[-Wunused-parameter]
 nir_lower_to_source_mods_block(nir_block *block, void *state)
^

Signed-off-by: Ian Romanick 
---
 src/glsl/nir/glsl_to_nir.cpp  |  2 +-
 src/glsl/nir/nir_lower_load_const_to_scalar.c |  2 ++
 src/glsl/nir/nir_lower_to_source_mods.c   |  2 ++
 src/glsl/nir/nir_lower_vars_to_ssa.c  |  6 +++---
 src/glsl/nir/nir_print.c  | 12 ++--
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index 77327b6..c9130b2 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -1897,7 +1897,7 @@ nir_visitor::visit(ir_dereference_array *ir)
 }
 
 void
-nir_visitor::visit(ir_barrier *ir)
+nir_visitor::visit(ir_barrier *)
 {
nir_intrinsic_instr *instr =
   nir_intrinsic_instr_create(this->shader, nir_intrinsic_barrier);
diff --git a/src/glsl/nir/nir_lower_load_const_to_scalar.c 
b/src/glsl/nir/nir_lower_load_const_to_scalar.c
index a90e524..d5af3a5 100644
--- a/src/glsl/nir/nir_lower_load_const_to_scalar.c
+++ b/src/glsl/nir/nir_lower_load_const_to_scalar.c
@@ -79,6 +79,8 @@ lower_load_const_instr_scalar(nir_load_const_instr *lower)
 static bool
 lower_load_const_to_scalar_block(nir_block *block, void *data)
 {
+   (void) data;
+
nir_foreach_instr_safe(block, instr) {
   if (instr->type == nir_instr_type_load_const)
  lower_load_const_instr_scalar(nir_instr_as_load_const(instr));
diff --git a/src/glsl/nir/nir_lower_to_source_mods.c 
b/src/glsl/nir/nir_lower_to_source_mods.c
index 94c7e36..fc53d6b 100644
--- a/src/glsl/nir/nir_lower_to_source_mods.c
+++ b/src/glsl/nir/nir_lower_to_source_mods.c
@@ -36,6 +36,8 @@
 static bool
 nir_lower_to_source_mods_block(nir_block *block, void *state)
 {
+   (void) state;
+
nir_foreach_instr(block, instr) {
   if (instr->type != nir_instr_type_alu)
  continue;
diff --git a/src/glsl/nir/nir_lower_vars_to_ssa.c 
b/src/glsl/nir/nir_lower_vars_to_ssa.c
index ccb8f99..9733dc5 100644
--- a/src/glsl/nir/nir_lower_vars_to_ssa.c
+++ b/src/glsl/nir/nir_lower_vars_to_ssa.c
@@ -524,7 +524,7 @@ def_stack_pop_if_in_block(struct deref_node *node, 
nir_block *block)
  * initializer (if it exists) or an SSA undef.
  */
 static nir_ssa_def *
-get_ssa_def_for_block(struct deref_node *node, nir_block *block,
+get_ssa_def_for_block(struct deref_node *node,
   struct lower_variables_state *state)
 {
/* If we have something on the stack, go ahead and return it.  We're
@@ -569,7 +569,7 @@ add_phi_sources(nir_block *block, nir_block *pred,
   src->pred = pred;
   src->src.parent_instr = &phi->instr;
   src->src.is_ssa = true;
-  src->src.ssa = get_ssa_def_for_block(node, pred, state);
+  src->src.ssa = get_ssa_def_for_block(node, state);
 
   list_addtail(&src->src.use_link, &src->src.ssa->uses);
 
@@ -636,7 +636,7 @@ rename_variables_block(nir_block *block, struct 
lower_variables_state *state)
 nir_alu_instr *mov = nir_alu_instr

[Mesa-dev] [PATCH 14/17] glsl: Remove ADD_VARYING macro

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

The purpose of the macro was to create the name_as_gs_input from name.
The previous commit removed the name_as_gs_input from add_varying, so
the macro is unnecessary.

Signed-off-by: Ian Romanick 
---
 src/glsl/builtin_variables.cpp | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 30faaa4..2628434 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -1085,32 +1085,29 @@ builtin_variable_generator::add_varying(int slot, const 
glsl_type *type,
 void
 builtin_variable_generator::generate_varyings()
 {
-#define ADD_VARYING(loc, type, name) \
-   add_varying(loc, type, name)
-
/* gl_Position and gl_PointSize are not visible from fragment shaders. */
if (state->stage != MESA_SHADER_FRAGMENT) {
-  ADD_VARYING(VARYING_SLOT_POS, vec4_t, "gl_Position");
-  ADD_VARYING(VARYING_SLOT_PSIZ, float_t, "gl_PointSize");
+  add_varying(VARYING_SLOT_POS, vec4_t, "gl_Position");
+  add_varying(VARYING_SLOT_PSIZ, float_t, "gl_PointSize");
}
 
if (state->is_version(130, 0)) {
-   ADD_VARYING(VARYING_SLOT_CLIP_DIST0, array(float_t, 0),
+   add_varying(VARYING_SLOT_CLIP_DIST0, array(float_t, 0),
"gl_ClipDistance");
}
 
if (compatibility) {
-  ADD_VARYING(VARYING_SLOT_TEX0, array(vec4_t, 0), "gl_TexCoord");
-  ADD_VARYING(VARYING_SLOT_FOGC, float_t, "gl_FogFragCoord");
+  add_varying(VARYING_SLOT_TEX0, array(vec4_t, 0), "gl_TexCoord");
+  add_varying(VARYING_SLOT_FOGC, float_t, "gl_FogFragCoord");
   if (state->stage == MESA_SHADER_FRAGMENT) {
- ADD_VARYING(VARYING_SLOT_COL0, vec4_t, "gl_Color");
- ADD_VARYING(VARYING_SLOT_COL1, vec4_t, "gl_SecondaryColor");
+ add_varying(VARYING_SLOT_COL0, vec4_t, "gl_Color");
+ add_varying(VARYING_SLOT_COL1, vec4_t, "gl_SecondaryColor");
   } else {
- ADD_VARYING(VARYING_SLOT_CLIP_VERTEX, vec4_t, "gl_ClipVertex");
- ADD_VARYING(VARYING_SLOT_COL0, vec4_t, "gl_FrontColor");
- ADD_VARYING(VARYING_SLOT_BFC0, vec4_t, "gl_BackColor");
- ADD_VARYING(VARYING_SLOT_COL1, vec4_t, "gl_FrontSecondaryColor");
- ADD_VARYING(VARYING_SLOT_BFC1, vec4_t, "gl_BackSecondaryColor");
+ add_varying(VARYING_SLOT_CLIP_VERTEX, vec4_t, "gl_ClipVertex");
+ add_varying(VARYING_SLOT_COL0, vec4_t, "gl_FrontColor");
+ add_varying(VARYING_SLOT_BFC0, vec4_t, "gl_BackColor");
+ add_varying(VARYING_SLOT_COL1, vec4_t, "gl_FrontSecondaryColor");
+ add_varying(VARYING_SLOT_BFC1, vec4_t, "gl_BackSecondaryColor");
   }
}
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 15/17] mesa: Silence unused parameter warnings in bufferobj.c

2015-08-26 Thread Ian Romanick
From: Ian Romanick 

main/bufferobj.c: In function 'count_buffer_size':
main/bufferobj.c:520:26: warning: unused parameter 'key' [-Wunused-parameter]
 count_buffer_size(GLuint key, void *data, void *userData)
  ^
main/bufferobj.c: In function 'flush_mapped_buffer_range_fallback':
main/bufferobj.c:740:56: warning: unused parameter 'index' [-Wunused-parameter]
gl_map_buffer_index index)
^

Signed-off-by: Ian Romanick 
---
 src/mesa/main/bufferobj.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index e17b41c..eab9cef 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -523,6 +523,7 @@ count_buffer_size(GLuint key, void *data, void *userData)
   (const struct gl_buffer_object *) data;
GLuint *total = (GLuint *) userData;
 
+   (void) key;
*total = *total + bufObj->Size;
 }
 
@@ -742,6 +743,7 @@ flush_mapped_buffer_range_fallback(struct gl_context *ctx,
(void) offset;
(void) length;
(void) obj;
+   (void) index;
/* no-op */
 }
 
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH 01/17] mesa: Fix warning about static being in the wrong place

2015-08-26 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin 

On Wed, Aug 26, 2015 at 1:19 PM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> Because the compiler already has enough things to complain about.
>
> grep -rl 'const static' src/ | while read f
> do
> sed --in-place -e 's/const static/static const/g' $f
> done
>
> brw_eu_emit.c: In function 'brw_reg_type_to_hw_type':
> brw_eu_emit.c:98:7: warning: 'static' is not at beginning of declaration 
> [-Wold-style-declaration]
>const static int imm_hw_types[] = {
>^
> brw_eu_emit.c:120:7: warning: 'static' is not at beginning of declaration 
> [-Wold-style-declaration]
>const static int hw_types[] = {
>^
>
> Signed-off-by: Ian Romanick 
> ---
>  src/egl/wayland/wayland-drm/wayland-drm.c| 2 +-
>  src/gallium/drivers/i915/i915_fpc_optimize.c | 2 +-
>  src/glsl/builtin_types.cpp   | 2 +-
>  src/glsl/ir_reader.cpp   | 2 +-
>  src/mesa/drivers/dri/i965/brw_eu_emit.c  | 4 ++--
>  5 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
> b/src/egl/wayland/wayland-drm/wayland-drm.c
> index e9c6e0a..e00d9be 100644
> --- a/src/egl/wayland/wayland-drm/wayland-drm.c
> +++ b/src/egl/wayland/wayland-drm/wayland-drm.c
> @@ -197,7 +197,7 @@ drm_authenticate(struct wl_client *client,
> wl_resource_post_event(resource, WL_DRM_AUTHENTICATED);
>  }
>
> -const static struct wl_drm_interface drm_interface = {
> +static const struct wl_drm_interface drm_interface = {
> drm_authenticate,
> drm_create_buffer,
>  drm_create_planar_buffer,
> diff --git a/src/gallium/drivers/i915/i915_fpc_optimize.c 
> b/src/gallium/drivers/i915/i915_fpc_optimize.c
> index 83bb649..a2b6d27 100644
> --- a/src/gallium/drivers/i915/i915_fpc_optimize.c
> +++ b/src/gallium/drivers/i915/i915_fpc_optimize.c
> @@ -69,7 +69,7 @@ static boolean same_src_reg(struct i915_full_src_register 
> *d1, struct i915_full_
> d1->Register.Negate == d2->Register.Negate);
>  }
>
> -const static struct {
> +static const struct {
> boolean is_texture;
> boolean commutes;
> unsigned neutral_element;
> diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp
> index b0156a1..7bcba3f 100644
> --- a/src/glsl/builtin_types.cpp
> +++ b/src/glsl/builtin_types.cpp
> @@ -127,7 +127,7 @@ static const struct glsl_struct_field 
> gl_FogParameters_fields[] = {
>  #define T(TYPE, MIN_GL, MIN_ES) \
> { glsl_type::TYPE##_type, MIN_GL, MIN_ES },
>
> -const static struct builtin_type_versions {
> +static const struct builtin_type_versions {
> const glsl_type *const type;
> int min_gl;
> int min_es;
> diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
> index 469837f..9796533 100644
> --- a/src/glsl/ir_reader.cpp
> +++ b/src/glsl/ir_reader.cpp
> @@ -26,7 +26,7 @@
>  #include "glsl_types.h"
>  #include "s_expression.h"
>
> -const static bool debug = false;
> +static const bool debug = false;
>
>  namespace {
>
> diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
> b/src/mesa/drivers/dri/i965/brw_eu_emit.c
> index 4d39762..637fd07 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
> +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
> @@ -95,7 +95,7 @@ brw_reg_type_to_hw_type(const struct brw_device_info 
> *devinfo,
>  enum brw_reg_type type, unsigned file)
>  {
> if (file == BRW_IMMEDIATE_VALUE) {
> -  const static int imm_hw_types[] = {
> +  static const int imm_hw_types[] = {
>   [BRW_REGISTER_TYPE_UD] = BRW_HW_REG_TYPE_UD,
>   [BRW_REGISTER_TYPE_D]  = BRW_HW_REG_TYPE_D,
>   [BRW_REGISTER_TYPE_UW] = BRW_HW_REG_TYPE_UW,
> @@ -117,7 +117,7 @@ brw_reg_type_to_hw_type(const struct brw_device_info 
> *devinfo,
>return imm_hw_types[type];
> } else {
>/* Non-immediate registers */
> -  const static int hw_types[] = {
> +  static const int hw_types[] = {
>   [BRW_REGISTER_TYPE_UD] = BRW_HW_REG_TYPE_UD,
>   [BRW_REGISTER_TYPE_D]  = BRW_HW_REG_TYPE_D,
>   [BRW_REGISTER_TYPE_UW] = BRW_HW_REG_TYPE_UW,
> --
> 2.1.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 02/17] linker: Silence GCC unused parameter warnings

2015-08-26 Thread Ilia Mirkin
Fair enough... if they need ctx in the future, someone can re-add them.

Reviewed-by: Ilia Mirkin 

On Wed, Aug 26, 2015 at 1:19 PM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> linker.cpp:320:55: warning: unused parameter 'ir' [-Wunused-parameter]
> virtual ir_visitor_status visit_leave(ir_function *ir)
>^
> linker.cpp:327:53: warning: unused parameter 'ir' [-Wunused-parameter]
> virtual ir_visitor_status visit_leave(ir_return *ir)
>  ^
> linker.cpp:333:49: warning: unused parameter 'ir' [-Wunused-parameter]
> virtual ir_visitor_status visit_enter(ir_if *ir)
>  ^
> linker.cpp:339:49: warning: unused parameter 'ir' [-Wunused-parameter]
> virtual ir_visitor_status visit_leave(ir_if *ir)
>  ^
> linker.cpp:345:51: warning: unused parameter 'ir' [-Wunused-parameter]
> virtual ir_visitor_status visit_enter(ir_loop *ir)
>^
> linker.cpp:351:51: warning: unused parameter 'ir' [-Wunused-parameter]
> virtual ir_visitor_status visit_leave(ir_loop *ir)
>^
> linker.cpp:2824:53: warning: unused parameter 'ctx' [-Wunused-parameter]
>  link_calculate_subroutine_compat(struct gl_context *ctx, struct 
> gl_shader_program *prog)
>  ^
> linker.cpp:2854:47: warning: unused parameter 'ctx' [-Wunused-parameter]
>  check_subroutine_resources(struct gl_context *ctx, struct gl_shader_program 
> *prog)
>^
> linker.cpp:3368:49: warning: unused parameter 'ctx' [-Wunused-parameter]
>  link_assign_subroutine_types(struct gl_context *ctx,
>  ^
>
> Also make link_assign_subroutine_types static since it is only called
> from this file.
>
> Signed-off-by: Ian Romanick 
> ---
>  src/glsl/linker.cpp | 27 +--
>  1 file changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index a7cd820..72154bf 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -317,38 +317,38 @@ public:
>return visit_continue;
> }
>
> -   virtual ir_visitor_status visit_leave(ir_function *ir)
> +   virtual ir_visitor_status visit_leave(ir_function *)
> {
>in_main = false;
>after_return = false;
>return visit_continue;
> }
>
> -   virtual ir_visitor_status visit_leave(ir_return *ir)
> +   virtual ir_visitor_status visit_leave(ir_return *)
> {
>after_return = true;
>return visit_continue;
> }
>
> -   virtual ir_visitor_status visit_enter(ir_if *ir)
> +   virtual ir_visitor_status visit_enter(ir_if *)
> {
>++control_flow;
>return visit_continue;
> }
>
> -   virtual ir_visitor_status visit_leave(ir_if *ir)
> +   virtual ir_visitor_status visit_leave(ir_if *)
> {
>--control_flow;
>return visit_continue;
> }
>
> -   virtual ir_visitor_status visit_enter(ir_loop *ir)
> +   virtual ir_visitor_status visit_enter(ir_loop *)
> {
>++control_flow;
>return visit_continue;
> }
>
> -   virtual ir_visitor_status visit_leave(ir_loop *ir)
> +   virtual ir_visitor_status visit_leave(ir_loop *)
> {
>--control_flow;
>return visit_continue;
> @@ -2821,7 +2821,7 @@ check_resources(struct gl_context *ctx, struct 
> gl_shader_program *prog)
>  }
>
>  static void
> -link_calculate_subroutine_compat(struct gl_context *ctx, struct 
> gl_shader_program *prog)
> +link_calculate_subroutine_compat(struct gl_shader_program *prog)
>  {
> for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
>struct gl_shader *sh = prog->_LinkedShaders[i];
> @@ -2851,7 +2851,7 @@ link_calculate_subroutine_compat(struct gl_context 
> *ctx, struct gl_shader_progra
>  }
>
>  static void
> -check_subroutine_resources(struct gl_context *ctx, struct gl_shader_program 
> *prog)
> +check_subroutine_resources(struct gl_shader_program *prog)
>  {
> for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
>struct gl_shader *sh = prog->_LinkedShaders[i];
> @@ -3364,9 +3364,8 @@ validate_sampler_array_indexing(struct gl_context *ctx,
> return true;
>  }
>
> -void
> -link_assign_subroutine_types(struct gl_context *ctx,
> - struct gl_shader_program *prog)
> +static void
> +link_assign_subroutine_types(struct gl_shader_program *prog)
>  {
> for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
>gl_shader *sh = prog->_LinkedShaders[i];
> @@ -3588,7 +3587,7 @@ link_shaders(struct gl_context *ctx, struct 
> gl_shader_program *prog)
> }
>
> check_explicit_uniform_locations(ctx, prog);
> -   link_assign_subroutine_types(ctx, prog);
> +   link_assign_subroutine_typ

[Mesa-dev] [PATCH 1/2] i964/fs: Refactor assign_constant_locations

2015-08-26 Thread Jason Ekstrand
Now that all constant locations are assigned in a single function, we can
refactor it a bit to unify things.  In particular, we now handle
pull_constant_loc and push_constant_loc more similarly and we only modify
stage_prog_data->params[] in one place at the end of the function.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 86 +---
 1 file changed, 40 insertions(+), 46 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 8f2056ee..a575181 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1784,57 +1784,49 @@ fs_visitor::assign_constant_locations()
if (dispatch_width != 8)
   return;
 
+   unsigned int num_pull_constants = 0;
+
pull_constant_loc = ralloc_array(mem_ctx, int, uniforms);
memset(pull_constant_loc, -1, sizeof(pull_constant_loc[0]) * uniforms);
 
-   /* Walk through and find array access of uniforms.  Put a copy of that
-* uniform in the pull constant buffer.
+   bool is_live[uniforms];
+   memset(is_live, 0, sizeof(is_live));
+
+   /* First, we walk through the instructions and do two things:
+*
+*  1) Figure out which uniforms are live.
+*
+*  2) Find all indirect access of uniform arrays and flag them as needing
+* to go into the pull constant buffer.
 *
 * Note that we don't move constant-indexed accesses to arrays.  No
 * testing has been done of the performance impact of this choice.
 */
foreach_block_and_inst_safe(block, fs_inst, inst, cfg) {
   for (int i = 0 ; i < inst->sources; i++) {
- if (inst->src[i].file != UNIFORM || !inst->src[i].reladdr)
+ if (inst->src[i].file != UNIFORM)
 continue;
 
- int uniform = inst->src[i].reg;
-
- /* If this array isn't already present in the pull constant buffer,
-  * add it.
-  */
- if (pull_constant_loc[uniform] == -1) {
-const gl_constant_value **values = 
&stage_prog_data->param[uniform];
-
-assert(param_size[uniform]);
-
-for (int j = 0; j < param_size[uniform]; j++) {
-   pull_constant_loc[uniform + j] = 
stage_prog_data->nr_pull_params;
+ if (inst->src[i].reladdr) {
+int uniform = inst->src[i].reg;
 
-   stage_prog_data->pull_param[stage_prog_data->nr_pull_params++] =
-  values[j];
+/* If this array isn't already present in the pull constant buffer,
+ * add it.
+ */
+if (pull_constant_loc[uniform] == -1) {
+   assert(param_size[uniform]);
+   for (int j = 0; j < param_size[uniform]; j++)
+  pull_constant_loc[uniform + j] = num_pull_constants++;
 }
+ } else {
+/* Mark the the one accessed uniform as live */
+int constant_nr = inst->src[i].reg + inst->src[i].reg_offset;
+if (constant_nr >= 0 && constant_nr < (int) uniforms)
+   is_live[constant_nr] = true;
  }
   }
}
 
-   /* Find which UNIFORM registers are still in use. */
-   bool is_live[uniforms];
-   for (unsigned int i = 0; i < uniforms; i++) {
-  is_live[i] = false;
-   }
-
-   foreach_block_and_inst(block, fs_inst, inst, cfg) {
-  for (int i = 0; i < inst->sources; i++) {
- if (inst->src[i].file != UNIFORM)
-continue;
-
- int constant_nr = inst->src[i].reg + inst->src[i].reg_offset;
- if (constant_nr >= 0 && constant_nr < (int) uniforms)
-is_live[constant_nr] = true;
-  }
-   }
-
/* Only allow 16 registers (128 uniform components) as push constants.
 *
 * Just demote the end of the list.  We could probably do better
@@ -1865,27 +1857,29 @@ fs_visitor::assign_constant_locations()
   } else {
  /* Demote to a pull constant. */
  push_constant_loc[i] = -1;
-
- int pull_index = stage_prog_data->nr_pull_params++;
- stage_prog_data->pull_param[pull_index] = stage_prog_data->param[i];
- pull_constant_loc[i] = pull_index;
+ pull_constant_loc[i] = num_pull_constants++;
   }
}
 
stage_prog_data->nr_params = num_push_constants;
+   stage_prog_data->nr_pull_params = num_pull_constants;
 
/* Up until now, the param[] array has been indexed by reg + reg_offset
-* of UNIFORM registers.  Condense it to only contain the uniforms we
-* chose to upload as push constants.
+* of UNIFORM registers.  Move pull constants into pull_param[] and
+* condense param[] to only contain the uniforms we chose to push.
+*
+* NOTE: Because we are condensing the params[] array, we know that
+* push_constant_loc[i] <= i and we can do it in one smooth loop without
+* having to make a copy.
 */
for (unsigned int i = 0; i < uniforms; i++) {
-  int remapped = push_constant_loc[i];
+  const gl_constant_value *value = sta

[Mesa-dev] [PATCH 0/2] i965: Two more UNIFORM cleanups

2015-08-26 Thread Jason Ekstrand
These two patches are largely a re-send of other patches in my bigger
series to push small uniform arrays.  The first patch is a really nice
cleanup that I think we want regardless of pushing uniform arrays.
Unfortunately, it was in the middle of the series after a patch to the same
function that was very much a uniform arrays patch.  I've now pulled the
cleanup part out on its own so that we can get it merged.  The second patch
fixes a bug that we've had for probably about as long as anyone can
remember and we should get it merged and back-ported to 10.6.

Jason Ekstrand (2):
  i964/fs: Refactor assign_constant_locations
  i965/fs: Split VGRFs after lowering pull constants

 src/mesa/drivers/dri/i965/brw_fs.cpp | 90 +---
 1 file changed, 42 insertions(+), 48 deletions(-)

-- 
2.4.3

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


[Mesa-dev] [PATCH 2/2] i965/fs: Split VGRFs after lowering pull constants

2015-08-26 Thread Jason Ekstrand
The split_virtual_grfs code doesn't properly rewrite reladdr so we need to
make sure that any uniform indirects are lowered away first.

Cc: "10.6" 
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index a575181..81009a0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -4780,11 +4780,11 @@ fs_visitor::optimize()
 */
bld = fs_builder(this, 64);
 
-   split_virtual_grfs();
-
assign_constant_locations();
demote_pull_constants();
 
+   split_virtual_grfs();
+
 #define OPT(pass, args...) ({   \
   pass_num++;   \
   bool this_progress = pass(args);  \
-- 
2.4.3

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


Re: [Mesa-dev] [PATCH 23/25] glsl: Implement the required built-in functions when OES_shader_image_atomic is enabled.

2015-08-26 Thread Jose Fonseca

On 17/08/15 18:14, Matt Turner wrote:

On Mon, Aug 17, 2015 at 9:46 AM, Francisco Jerez  wrote:

This is basically just the same atomic functions exposed by
ARB_shader_image_load_store, with one exception:

 "highp float imageAtomicExchange(
  coherent IMAGE_PARAMS,
  float data);"

There's no float atomic exchange overload in the original
ARB_shader_image_load_store or GL 4.2, so this seems like new
functionality that requires specific back-end support and a separate
availability condition in the built-in function generator.
---
  src/glsl/builtin_functions.cpp | 25 -
  1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index c53858e..444d0ee 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -401,8 +401,16 @@ shader_image_load_store(const _mesa_glsl_parse_state 
*state)
  static bool
  shader_image_atomic(const _mesa_glsl_parse_state *state)
  {
-   return (state->is_version(420, 0) ||
-   state->ARB_shader_image_load_store_enable);
+   return (state->is_version(420, 320) ||
+   state->ARB_shader_image_load_store_enable ||
+   state->OES_shader_image_atomic_enable);
+}
+
+static bool
+shader_image_atomic_exchange_float(const _mesa_glsl_parse_state *state)
+{
+   return (state->is_version(450, 320) ||
+   state->OES_shader_image_atomic_enable);
  }

  static bool
@@ -506,7 +514,8 @@ private:
IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE = (1 << 3),
IMAGE_FUNCTION_READ_ONLY = (1 << 4),
IMAGE_FUNCTION_WRITE_ONLY = (1 << 5),
-  IMAGE_FUNCTION_AVAIL_ATOMIC = (1 << 6)
+  IMAGE_FUNCTION_AVAIL_ATOMIC = (1 << 6),
+  IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE = (1 << 7)


I wonder if MSVC is okay with a trailing comma here?



Yes, MSVC is OK with additional commas on enums.

Jose

PS: I was on PTO last week and I'm still catching up on email.

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


Re: [Mesa-dev] [PATCH 13/17] glsl: Silence unused parameter warnings

2015-08-26 Thread Ilia Mirkin
On Wed, Aug 26, 2015 at 1:20 PM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> builtin_variables.cpp:1062:53: warning: unused parameter 'name_as_gs_input' 
> [-Wunused-parameter]
>  const char *name_as_gs_input)
>  ^
> builtin_functions.cpp:4774:47: warning: unused parameter 'intrinsic_name' 
> [-Wunused-parameter]
>const char *intrinsic_name,
>^
> builtin_functions.cpp:4907:66: warning: unused parameter 'state' 
> [-Wunused-parameter]
>  _mesa_glsl_find_builtin_function_by_name(_mesa_glsl_parse_state *state,
>   ^
> ir_print_visitor.cpp:589:37: warning: unused parameter 'ir' 
> [-Wunused-parameter]
>  ir_print_visitor::visit(ir_barrier *ir)
>  ^
> linker.cpp:3212:48: warning: unused parameter 'ctx' [-Wunused-parameter]
>  build_program_resource_list(struct gl_context *ctx,
> ^
> standalone_scaffolding.cpp:65:57: warning: unused parameter ‘id’ 
> [-Wunused-parameter]
>  _mesa_shader_debug(struct gl_context *, GLenum, GLuint *id,
>  ^
>
> Now src/glsl is _almost_ free of warnings!
>
> Signed-off-by: Ian Romanick 
> ---
>  src/glsl/ast_to_hir.cpp | 2 +-
>  src/glsl/builtin_functions.cpp  | 7 ++-
>  src/glsl/builtin_variables.cpp  | 8 +++-
>  src/glsl/ir.h   | 3 +--
>  src/glsl/ir_print_visitor.cpp   | 2 +-
>  src/glsl/linker.cpp | 3 +--
>  src/glsl/program.h  | 3 +--
>  src/glsl/standalone_scaffolding.cpp | 2 +-
>  src/mesa/program/ir_to_mesa.cpp | 2 +-
>  9 files changed, 12 insertions(+), 20 deletions(-)
>
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index 06cd6a5..d8d0d58 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -4544,7 +4544,7 @@ ast_function::hir(exec_list *instructions,
> if (state->es_shader && state->language_version >= 300) {
>/* Local shader has no exact candidates; check the built-ins. */
>_mesa_glsl_initialize_builtin_functions();
> -  if (_mesa_glsl_find_builtin_function_by_name(state, name)) {
> +  if (_mesa_glsl_find_builtin_function_by_name(name)) {
>   YYLTYPE loc = this->get_location();
>   _mesa_glsl_error(& loc, state,
>"A shader cannot redefine or overload built-in "
> diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
> index 2175c66..4c813fd 100644
> --- a/src/glsl/builtin_functions.cpp
> +++ b/src/glsl/builtin_functions.cpp
> @@ -705,7 +705,6 @@ private:
> B1(mid3)
>
> ir_function_signature *_image_prototype(const glsl_type *image_type,
> -   const char *intrinsic_name,
> unsigned num_arguments,
> unsigned flags);
> ir_function_signature *_image(const glsl_type *image_type,
> @@ -4771,7 +4770,6 @@ builtin_builder::_mid3(const glsl_type *type)
>
>  ir_function_signature *
>  builtin_builder::_image_prototype(const glsl_type *image_type,
> -  const char *intrinsic_name,
>unsigned num_arguments,
>unsigned flags)
>  {
> @@ -4823,7 +4821,7 @@ builtin_builder::_image(const glsl_type *image_type,
>  unsigned num_arguments,
>  unsigned flags)
>  {
> -   ir_function_signature *sig = _image_prototype(image_type, intrinsic_name,
> +   ir_function_signature *sig = _image_prototype(image_type,
>   num_arguments, flags);

I think this is old code... mine reads like

   ir_function_signature *sig = (this->*prototype)(image_type, intrinsic_name,
   num_arguments, flags);

So you'll have more updating to do if you want to remove
intrinsic_name there. Should be straightforward though.

>
> if (flags & IMAGE_FUNCTION_EMIT_STUB) {
> @@ -4904,8 +4902,7 @@ _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state 
> *state,
>  }
>
>  ir_function *
> -_mesa_glsl_find_builtin_function_by_name(_mesa_glsl_parse_state *state,
> - const char *name)
> +_mesa_glsl_find_builtin_function_by_name(const char *name)
>  {
> ir_function *f;
> mtx_lock(&builtins_lock);
> diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
> index 53d3500..30faaa4 100644
> --- a/src/glsl/builtin_variables.cpp
> +++ b/src/glsl/builtin_variables.cpp
> @@ -383,8 +383,7 @@ private:
> ir_variable *add_uniform(const glsl_type *type, const char *name);
> ir_variable *add_c

Re: [Mesa-dev] [PATCH 14/17] glsl: Remove ADD_VARYING macro

2015-08-26 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin 

On Wed, Aug 26, 2015 at 1:20 PM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> The purpose of the macro was to create the name_as_gs_input from name.
> The previous commit removed the name_as_gs_input from add_varying, so
> the macro is unnecessary.
>
> Signed-off-by: Ian Romanick 
> ---
>  src/glsl/builtin_variables.cpp | 27 ---
>  1 file changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
> index 30faaa4..2628434 100644
> --- a/src/glsl/builtin_variables.cpp
> +++ b/src/glsl/builtin_variables.cpp
> @@ -1085,32 +1085,29 @@ builtin_variable_generator::add_varying(int slot, 
> const glsl_type *type,
>  void
>  builtin_variable_generator::generate_varyings()
>  {
> -#define ADD_VARYING(loc, type, name) \
> -   add_varying(loc, type, name)
> -
> /* gl_Position and gl_PointSize are not visible from fragment shaders. */
> if (state->stage != MESA_SHADER_FRAGMENT) {
> -  ADD_VARYING(VARYING_SLOT_POS, vec4_t, "gl_Position");
> -  ADD_VARYING(VARYING_SLOT_PSIZ, float_t, "gl_PointSize");
> +  add_varying(VARYING_SLOT_POS, vec4_t, "gl_Position");
> +  add_varying(VARYING_SLOT_PSIZ, float_t, "gl_PointSize");
> }
>
> if (state->is_version(130, 0)) {
> -   ADD_VARYING(VARYING_SLOT_CLIP_DIST0, array(float_t, 0),
> +   add_varying(VARYING_SLOT_CLIP_DIST0, array(float_t, 0),
> "gl_ClipDistance");
> }
>
> if (compatibility) {
> -  ADD_VARYING(VARYING_SLOT_TEX0, array(vec4_t, 0), "gl_TexCoord");
> -  ADD_VARYING(VARYING_SLOT_FOGC, float_t, "gl_FogFragCoord");
> +  add_varying(VARYING_SLOT_TEX0, array(vec4_t, 0), "gl_TexCoord");
> +  add_varying(VARYING_SLOT_FOGC, float_t, "gl_FogFragCoord");
>if (state->stage == MESA_SHADER_FRAGMENT) {
> - ADD_VARYING(VARYING_SLOT_COL0, vec4_t, "gl_Color");
> - ADD_VARYING(VARYING_SLOT_COL1, vec4_t, "gl_SecondaryColor");
> + add_varying(VARYING_SLOT_COL0, vec4_t, "gl_Color");
> + add_varying(VARYING_SLOT_COL1, vec4_t, "gl_SecondaryColor");
>} else {
> - ADD_VARYING(VARYING_SLOT_CLIP_VERTEX, vec4_t, "gl_ClipVertex");
> - ADD_VARYING(VARYING_SLOT_COL0, vec4_t, "gl_FrontColor");
> - ADD_VARYING(VARYING_SLOT_BFC0, vec4_t, "gl_BackColor");
> - ADD_VARYING(VARYING_SLOT_COL1, vec4_t, "gl_FrontSecondaryColor");
> - ADD_VARYING(VARYING_SLOT_BFC1, vec4_t, "gl_BackSecondaryColor");
> + add_varying(VARYING_SLOT_CLIP_VERTEX, vec4_t, "gl_ClipVertex");
> + add_varying(VARYING_SLOT_COL0, vec4_t, "gl_FrontColor");
> + add_varying(VARYING_SLOT_BFC0, vec4_t, "gl_BackColor");
> + add_varying(VARYING_SLOT_COL1, vec4_t, "gl_FrontSecondaryColor");
> + add_varying(VARYING_SLOT_BFC1, vec4_t, "gl_BackSecondaryColor");
>}
> }
>
> --
> 2.1.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 15/17] mesa: Silence unused parameter warnings in bufferobj.c

2015-08-26 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin 

On Wed, Aug 26, 2015 at 1:20 PM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> main/bufferobj.c: In function 'count_buffer_size':
> main/bufferobj.c:520:26: warning: unused parameter 'key' [-Wunused-parameter]
>  count_buffer_size(GLuint key, void *data, void *userData)
>   ^
> main/bufferobj.c: In function 'flush_mapped_buffer_range_fallback':
> main/bufferobj.c:740:56: warning: unused parameter 'index' 
> [-Wunused-parameter]
> gl_map_buffer_index index)
> ^
>
> Signed-off-by: Ian Romanick 
> ---
>  src/mesa/main/bufferobj.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index e17b41c..eab9cef 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -523,6 +523,7 @@ count_buffer_size(GLuint key, void *data, void *userData)
>(const struct gl_buffer_object *) data;
> GLuint *total = (GLuint *) userData;
>
> +   (void) key;
> *total = *total + bufObj->Size;
>  }
>
> @@ -742,6 +743,7 @@ flush_mapped_buffer_range_fallback(struct gl_context *ctx,
> (void) offset;
> (void) length;
> (void) obj;
> +   (void) index;
> /* no-op */
>  }
>
> --
> 2.1.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 16/17] mesa: Remove target parameter from _mesa_handle_bind_buffer_gen

2015-08-26 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin 

On Wed, Aug 26, 2015 at 1:20 PM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> main/bufferobj.c: In function '_mesa_handle_bind_buffer_gen':
> main/bufferobj.c:915:37: warning: unused parameter 'target' 
> [-Wunused-parameter]
>   GLenum target,
>  ^
>
> Signed-off-by: Ian Romanick 
> ---
>  src/mesa/main/bufferobj.c | 7 +++
>  src/mesa/main/bufferobj.h | 1 -
>  src/mesa/main/varray.c| 3 +--
>  3 files changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index eab9cef..7c6c70a 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -914,7 +914,6 @@ _mesa_free_buffer_objects( struct gl_context *ctx )
>
>  bool
>  _mesa_handle_bind_buffer_gen(struct gl_context *ctx,
> - GLenum target,
>   GLuint buffer,
>   struct gl_buffer_object **buf_handle,
>   const char *caller)
> @@ -977,7 +976,7 @@ bind_buffer_object(struct gl_context *ctx, GLenum target, 
> GLuint buffer)
> else {
>/* non-default buffer object */
>newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
> -  if (!_mesa_handle_bind_buffer_gen(ctx, target, buffer,
> +  if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
>  &newBufObj, "glBindBuffer"))
>   return;
> }
> @@ -4236,7 +4235,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
> } else {
>bufObj = _mesa_lookup_bufferobj(ctx, buffer);
> }
> -   if (!_mesa_handle_bind_buffer_gen(ctx, target, buffer,
> +   if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
>   &bufObj, "glBindBufferRange"))
>return;
>
> @@ -4288,7 +4287,7 @@ _mesa_BindBufferBase(GLenum target, GLuint index, 
> GLuint buffer)
> } else {
>bufObj = _mesa_lookup_bufferobj(ctx, buffer);
> }
> -   if (!_mesa_handle_bind_buffer_gen(ctx, target, buffer,
> +   if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
>   &bufObj, "glBindBufferBase"))
>return;
>
> diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
> index b5d73ae..b7154c5 100644
> --- a/src/mesa/main/bufferobj.h
> +++ b/src/mesa/main/bufferobj.h
> @@ -74,7 +74,6 @@ _mesa_free_buffer_objects(struct gl_context *ctx);
>
>  extern bool
>  _mesa_handle_bind_buffer_gen(struct gl_context *ctx,
> - GLenum target,
>   GLuint buffer,
>   struct gl_buffer_object **buf_handle,
>   const char *caller);
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index 3bab985..7a1dddc 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -1698,8 +1698,7 @@ vertex_array_vertex_buffer(struct gl_context *ctx, 
> struct gl_vertex_array_object
> * Otherwise, we fall back to the same compat profile behavior as other
> * object references (automatically gen it).
> */
> -  if (!_mesa_handle_bind_buffer_gen(ctx, GL_ARRAY_BUFFER, buffer,
> -&vbo, func))
> +  if (!_mesa_handle_bind_buffer_gen(ctx, buffer, &vbo, func))
>   return;
> } else {
>/* The ARB_vertex_attrib_binding spec says:
> --
> 2.1.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 17/17] mesa: Remove gl_context parameter from _mesa_initialize_buffer_object and dd:NewBufferObject

2015-08-26 Thread Ilia Mirkin
*every* other callback takes a ctx... this feels really asymmetric.
I'd kinda rather just keep the ctx's in and add (void) uses on them.
Don't feel too strongly about it though.

On Wed, Aug 26, 2015 at 1:20 PM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> _mesa_initialize_buffer_object did not use it.  Once that parameter was
> removed, none of the implementations of dd::NewBufferObject used it
> either.
>
> Also silences a warning:
>
> main/bufferobj.c: In function '_mesa_initialize_buffer_object':
> main/bufferobj.c:503:51: warning: unused parameter 'ctx' [-Wunused-parameter]
>  _mesa_initialize_buffer_object(struct gl_context *ctx,
>^
>
> Signed-off-by: Ian Romanick 
> ---
>  src/mesa/drivers/dri/i915/intel_buffer_objects.c|  4 ++--
>  src/mesa/drivers/dri/i965/intel_buffer_objects.c|  4 ++--
>  src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c|  4 ++--
>  src/mesa/drivers/dri/radeon/radeon_buffer_objects.c |  5 ++---
>  src/mesa/main/bufferobj.c   | 13 +
>  src/mesa/main/bufferobj.h   |  3 +--
>  src/mesa/main/dd.h  |  3 +--
>  src/mesa/main/shared.c  |  2 +-
>  src/mesa/state_tracker/st_cb_bufferobjects.c|  4 ++--
>  src/mesa/vbo/vbo_exec_api.c |  2 +-
>  src/mesa/vbo/vbo_save_api.c |  2 +-
>  11 files changed, 20 insertions(+), 26 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i915/intel_buffer_objects.c 
> b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
> index ef06743..6db2a88 100644
> --- a/src/mesa/drivers/dri/i915/intel_buffer_objects.c
> +++ b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
> @@ -68,11 +68,11 @@ release_buffer(struct intel_buffer_object *intel_obj)
>   * internal structure where somehow shared.
>   */
>  static struct gl_buffer_object *
> -intel_bufferobj_alloc(struct gl_context * ctx, GLuint name)
> +intel_bufferobj_alloc(GLuint name)
>  {
> struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
>
> -   _mesa_initialize_buffer_object(ctx, &obj->Base, name);
> +   _mesa_initialize_buffer_object(&obj->Base, name);
>
> obj->buffer = NULL;
>
> diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c 
> b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> index ff05b5c..3c34129 100644
> --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> @@ -134,14 +134,14 @@ release_buffer(struct intel_buffer_object *intel_obj)
>   * internal structure where somehow shared.
>   */
>  static struct gl_buffer_object *
> -brw_new_buffer_object(struct gl_context * ctx, GLuint name)
> +brw_new_buffer_object(GLuint name)
>  {
> struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
> if (!obj) {
>_mesa_error_no_memory(__func__);
> }
>
> -   _mesa_initialize_buffer_object(ctx, &obj->Base, name);
> +   _mesa_initialize_buffer_object(&obj->Base, name);
>
> obj->buffer = NULL;
>
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c 
> b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
> index afccf35..aa0d6dd 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
> @@ -48,7 +48,7 @@ get_bufferobj_map(struct gl_context *ctx, struct 
> gl_buffer_object *obj,
>  }
>
>  static struct gl_buffer_object *
> -nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer)
> +nouveau_bufferobj_new(GLuint buffer)
>  {
> struct nouveau_bufferobj *nbo;
>
> @@ -56,7 +56,7 @@ nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer)
> if (!nbo)
> return NULL;
>
> -   _mesa_initialize_buffer_object(ctx, &nbo->base, buffer);
> +   _mesa_initialize_buffer_object(&nbo->base, buffer);
>
> return &nbo->base;
>  }
> diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c 
> b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
> index d9d4f5f..a40cf19 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
> @@ -39,12 +39,11 @@ get_radeon_buffer_object(struct gl_buffer_object *obj)
>  }
>
>  static struct gl_buffer_object *
> -radeonNewBufferObject(struct gl_context * ctx,
> -  GLuint name)
> +radeonNewBufferObject(GLuint name)
>  {
>  struct radeon_buffer_object *obj = CALLOC_STRUCT(radeon_buffer_object);
>
> -_mesa_initialize_buffer_object(ctx, &obj->Base, name);
> +_mesa_initialize_buffer_object(&obj->Base, name);
>
>  obj->bo = NULL;
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index 7c6c70a..c5823da 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -395,14 +395,12 @@ convert_clear_buffer_data(struct gl_context *ctx,
>   * Default callback for the \c dd_functi

Re: [Mesa-dev] [PATCH 09/17] nir: Fix wonkey indentation in generated code

2015-08-26 Thread Jason Ekstrand
I think I'd rather just run it through indent like we do for some of
the other auto-generated code.  That way the mako file (the one you'll
actually be editing) can remain readable.
--Jason

On Wed, Aug 26, 2015 at 10:19 AM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> Signed-off-by: Ian Romanick 
> ---
>  src/glsl/nir/nir_constant_expressions.py | 40 
> 
>  1 file changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/src/glsl/nir/nir_constant_expressions.py 
> b/src/glsl/nir/nir_constant_expressions.py
> index 6006358..087aab9 100644
> --- a/src/glsl/nir/nir_constant_expressions.py
> +++ b/src/glsl/nir/nir_constant_expressions.py
> @@ -238,29 +238,29 @@ evaluate_${name}(unsigned num_components, 
> nir_const_value *_src)
>   <% continue %>
>%endif
>
> -  struct ${op.input_types[j]}_vec src${j} = {
> +   struct ${op.input_types[j]}_vec src${j} = {
>% for k in range(op.input_sizes[j]):
>   % if op.input_types[j] == "bool":
> -_src[${j}].u[${k}] != 0,
> +  _src[${j}].u[${k}] != 0,
>   % else:
> -_src[${j}].${op.input_types[j][:1]}[${k}],
> +  _src[${j}].${op.input_types[j][:1]}[${k}],
>   % endif
>% endfor
>% for k in range(op.input_sizes[j], 4):
>   % if op.input_types[j] == "bool":
> -false,
> +  false,
>   % else:
> -0,
> +  0,
>   % endif
>% endfor
> -  };
> +   };
> % endfor
>
> % if op.output_size == 0:
>## For per-component instructions, we need to iterate over the
>## components and apply the constant expression one component
>## at a time.
> -  for (unsigned _i = 0; _i < num_components; _i++) {
> +   for (unsigned _i = 0; _i < num_components; _i++) {
>   ## For each per-component input, create a variable srcN that
>   ## contains the value of the current (_i'th) component.
>   % for j in range(op.num_inputs):
> @@ -270,9 +270,9 @@ evaluate_${name}(unsigned num_components, nir_const_value 
> *_src)
> ## Avoid unused variable warnings
> <% continue %>
>  % elif op.input_types[j] == "bool":
> -   bool src${j} = _src[${j}].u[_i] != 0;
> +  bool src${j} = _src[${j}].u[_i] != 0;
>  % else:
> -   ${op.input_types[j]} src${j} = 
> _src[${j}].${op.input_types[j][:1]}[_i];
> +  ${op.input_types[j]} src${j} = _src[${j}].${op.input_types[j][:1]}[_i];
>  % endif
>   % endfor
>
> @@ -280,36 +280,36 @@ evaluate_${name}(unsigned num_components, 
> nir_const_value *_src)
>   ## result of the const_expr to it.  If const_expr already contains
>   ## writes to dst, just include const_expr directly.
>   % if "dst" in op.const_expr:
> -${op.output_type} dst;
> -${op.const_expr}
> +  ${op.output_type} dst;
> +  ${op.const_expr}
>   % else:
> -${op.output_type} dst = ${op.const_expr};
> +  ${op.output_type} dst = ${op.const_expr};
>   % endif
>
>   ## Store the current component of the actual destination to the
>   ## value of dst.
>   % if op.output_type == "bool":
>  ## Sanitize the C value to a proper NIR bool
> -_dst_val.u[_i] = dst ? NIR_TRUE : NIR_FALSE;
> +  _dst_val.u[_i] = dst ? NIR_TRUE : NIR_FALSE;
>   % else:
> -_dst_val.${op.output_type[:1]}[_i] = dst;
> +  _dst_val.${op.output_type[:1]}[_i] = dst;
>   % endif
> -  }
> +   }
> % else:
>## In the non-per-component case, create a struct dst with
>## appropriately-typed elements x, y, z, and w and assign the result
>## of the const_expr to all components of dst, or include the
>## const_expr directly if it writes to dst already.
> -  struct ${op.output_type}_vec dst;
> +   struct ${op.output_type}_vec dst;
>
>% if "dst" in op.const_expr:
> - ${op.const_expr}
> +   ${op.const_expr}
>% else:
>   ## Splat the value to all components.  This way expressions which
>   ## write the same value to all components don't need to explicitly
>   ## write to dest.  One such example is fnoise which has a
>   ## const_expr of 0.0f.
> - dst.x = dst.y = dst.z = dst.w = ${op.const_expr};
> +   dst.x = dst.y = dst.z = dst.w = ${op.const_expr};
>% endif
>
>## For each component in the destination, copy the value of dst to
> @@ -317,9 +317,9 @@ evaluate_${name}(unsigned num_components, nir_const_value 
> *_src)
>% for k in range(op.output_size):
>   % if op.output_type == "bool":
>  ## Sanitize the C value to a proper NIR bool
> -_dst_val.u[${k}] = dst.${"xyzw"[k]} ? NIR_TRUE : NIR_FALSE;
> +   _dst_val.u[${k}] = dst.${"xyzw"[k]} ? NIR_TRUE : NIR_FALSE;
>   % else:
> -

Re: [Mesa-dev] [PATCH 11/17] nir: Trivial clean ups in the generated nir_constant_expressions.c

2015-08-26 Thread Jason Ekstrand
I like adding constness but I don't really see the need for the
whitespace changes or adding braces and breaks to the switch.
--Jason

On Wed, Aug 26, 2015 at 10:20 AM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> Signed-off-by: Ian Romanick 
> ---
>  src/glsl/nir/nir_constant_expressions.py | 13 +
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/src/glsl/nir/nir_constant_expressions.py 
> b/src/glsl/nir/nir_constant_expressions.py
> index e2feff3..099bb77 100644
> --- a/src/glsl/nir/nir_constant_expressions.py
> +++ b/src/glsl/nir/nir_constant_expressions.py
> @@ -226,7 +226,6 @@ static nir_const_value
>  evaluate_${name}(unsigned num_components, nir_const_value *_src)
>  {
> nir_const_value _dst_val = { { {0, 0, 0, 0} } };
> -
> ## For each non-per-component input, create a variable srcN that
> ## contains x, y, z, and w elements which are filled in with the
> ## appropriately-typed values.
> @@ -238,7 +237,7 @@ evaluate_${name}(unsigned num_components, nir_const_value 
> *_src)
>   <% continue %>
>%endif
>
> -   struct ${op.input_types[j]}_vec src${j} = {
> +   const struct ${op.input_types[j]}_vec src${j} = {
>% for k in range(op.input_sizes[j]):
>   % if op.input_types[j] == "bool":
>_src[${j}].u[${k}] != 0,
> @@ -280,17 +279,17 @@ evaluate_${name}(unsigned num_components, 
> nir_const_value *_src)
> ## Avoid unused variable warnings
> <% continue %>
>  % elif op.input_types[j] == "bool":
> -  bool src${j} = _src[${j}].u[_i] != 0;
> +  const bool src${j} = _src[${j}].u[_i] != 0;
>  % else:
> -  ${op.input_types[j]} src${j} = _src[${j}].${op.input_types[j][:1]}[_i];
> +  const ${op.input_types[j]} src${j} = 
> _src[${j}].${op.input_types[j][:1]}[_i];
>  % endif
>   % endfor
> -
>   ## Create an appropriately-typed variable dst and assign the
>   ## result of the const_expr to it.  If const_expr already contains
>   ## writes to dst, just include const_expr directly.
>   % if "dst" in op.const_expr:
>${op.output_type} dst;
> +
>${op.const_expr}
>   % else:
>${op.output_type} dst = ${op.const_expr};
> @@ -344,10 +343,8 @@ nir_eval_const_opcode(nir_op op, unsigned num_components,
>  {
> switch (op) {
>  % for name in sorted(opcodes.iterkeys()):
> -   case nir_op_${name}: {
> +   case nir_op_${name}:
>return evaluate_${name}(num_components, src);
> -  break;
> -   }
>  % endfor
> default:
>unreachable("shouldn't get here");
> --
> 2.1.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965/gen8+: Skip depth stalls on state change

2015-08-26 Thread Ben Widawsky
Docs suggest this is no longer required starting with Gen8.

Perf (no regressions in n=20)
OglMultithread   0.67%
OglTerrainPanInst0.12%
trex 0.45%
warsow   0.64%

I have a couple of spurious failures in piglit on BSW, and SKL. I have no
evidence that they are related to this patch.

Cc: Chris Wilson 
Signed-off-by: Ben Widawsky 
---
 src/mesa/drivers/dri/i965/brw_pipe_control.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_pipe_control.c 
b/src/mesa/drivers/dri/i965/brw_pipe_control.c
index 7ee3cb6..a2aef8a 100644
--- a/src/mesa/drivers/dri/i965/brw_pipe_control.c
+++ b/src/mesa/drivers/dri/i965/brw_pipe_control.c
@@ -193,6 +193,14 @@ brw_emit_depth_stall_flushes(struct brw_context *brw)
 {
assert(brw->gen >= 6 && brw->gen <= 9);
 
+   /* Starting on BDW, these pipe controls are unnecessary.
+*
+*   WM HW will internally manage the draining pipe and flushing of the 
caches
+*   when this command is issued. The PIPE_CONTROL restrictions are removed.
+*/
+   if (brw->gen >= 8)
+  return;
+
brw_emit_pipe_control_flush(brw, PIPE_CONTROL_DEPTH_STALL);
brw_emit_pipe_control_flush(brw, PIPE_CONTROL_DEPTH_CACHE_FLUSH);
brw_emit_pipe_control_flush(brw, PIPE_CONTROL_DEPTH_STALL);
-- 
2.5.0

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


Re: [Mesa-dev] [PATCH] i965/gen8+: Skip depth stalls on state change

2015-08-26 Thread Ben Widawsky
On Wed, Aug 26, 2015 at 10:52:58AM -0700, Ben Widawsky wrote:
> Docs suggest this is no longer required starting with Gen8.
> 
> Perf (no regressions in n=20)
> OglMultithread   0.67%
> OglTerrainPanInst0.12%
> trex 0.45%
> warsow   0.64%

I forgot to mention this data is from BDW GT3

> 
> I have a couple of spurious failures in piglit on BSW, and SKL. I have no
> evidence that they are related to this patch.
> 
> Cc: Chris Wilson 
> Signed-off-by: Ben Widawsky 
> ---
>  src/mesa/drivers/dri/i965/brw_pipe_control.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_pipe_control.c 
> b/src/mesa/drivers/dri/i965/brw_pipe_control.c
> index 7ee3cb6..a2aef8a 100644
> --- a/src/mesa/drivers/dri/i965/brw_pipe_control.c
> +++ b/src/mesa/drivers/dri/i965/brw_pipe_control.c
> @@ -193,6 +193,14 @@ brw_emit_depth_stall_flushes(struct brw_context *brw)
>  {
> assert(brw->gen >= 6 && brw->gen <= 9);
>  
> +   /* Starting on BDW, these pipe controls are unnecessary.
> +*
> +*   WM HW will internally manage the draining pipe and flushing of the 
> caches
> +*   when this command is issued. The PIPE_CONTROL restrictions are 
> removed.
> +*/
> +   if (brw->gen >= 8)
> +  return;
> +
> brw_emit_pipe_control_flush(brw, PIPE_CONTROL_DEPTH_STALL);
> brw_emit_pipe_control_flush(brw, PIPE_CONTROL_DEPTH_CACHE_FLUSH);
> brw_emit_pipe_control_flush(brw, PIPE_CONTROL_DEPTH_STALL);
> -- 
> 2.5.0
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] winsys/radeon: handle non-zero finite timeout when waiting for buffers

2015-08-26 Thread Alex Deucher
On Wed, Aug 26, 2015 at 7:09 AM, Marek Olšák  wrote:
> Ping

for the series:
Reviewed-by: Alex Deucher 

>
> On Sun, Aug 23, 2015 at 2:13 PM, Marek Olšák  wrote:
>> From: Marek Olšák 
>>
>> ---
>>  src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 54 
>> +++
>>  src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 25 +
>>  2 files changed, 41 insertions(+), 38 deletions(-)
>>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: Rename INTEL_DEBUG=vec4vs to INTEL_DEBUG=vec4.

2015-08-26 Thread Kristian Høgsberg
On Wed, Aug 26, 2015 at 2:43 AM, Kenneth Graunke  wrote:
> driParseDebugString() doesn't have actual code to parse comma separated
> lists (or any other supported options?); instead it dumbly uses strstr().
>
> This means that INTEL_DEBUG="vec4vs" will trigger both DEBUG_VEC4VS and
> DEBUG_VS, as "vs" is also a substring.
>
> We should probably improve the driconf parsing, but for now, just rename
> the option so it's usable in the meantime.

Hehe, yes, sorry about that. Looks good to me, in fact, just 'vec4'
make more sense as it applies to other geometry stages.

Kristian

> Signed-off-by: Kenneth Graunke 
> ---
>  src/mesa/drivers/dri/i965/intel_debug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_debug.c 
> b/src/mesa/drivers/dri/i965/intel_debug.c
> index a077731..b3b3c21 100644
> --- a/src/mesa/drivers/dri/i965/intel_debug.c
> +++ b/src/mesa/drivers/dri/i965/intel_debug.c
> @@ -68,7 +68,7 @@ static const struct dri_debug_control debug_control[] = {
> { "optimizer",   DEBUG_OPTIMIZER },
> { "ann", DEBUG_ANNOTATION },
> { "no8", DEBUG_NO8 },
> -   { "vec4vs",  DEBUG_VEC4VS },
> +   { "vec4",DEBUG_VEC4VS },
> { "spill",   DEBUG_SPILL },
> { "cs",  DEBUG_CS },
> { NULL,0 }
> --
> 2.5.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 11/17] nir: Trivial clean ups in the generated nir_constant_expressions.c

2015-08-26 Thread Matt Turner
On Wed, Aug 26, 2015 at 10:50 AM, Jason Ekstrand  wrote:
> I like adding constness but I don't really see the need for the
> whitespace changes or adding braces and breaks to the switch.

Please don't top quote.

Looks like he's removing braces and breaks from the switch, not adding them.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] st/mesa: use PROGRAM_ARRAY for storing structs containing arrays

2015-08-26 Thread Brian Paul
Previously, we used PROGRAM_ARRAY only for variables which were
arrays or matrices.  But if the variable is a structure containing
an array or matrix, we need to use PROGRAM_ARRAY for that too.

Before, we failed an assertion:
  state_tracker/st_glsl_to_tgsi.cpp:4900:
  Assertion `src_reg->file != PROGRAM_TEMPORARY' failed.
when running the piglit test
glsl-1.20/execution/fs-const-array-of-struct-of-array.shader_test
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 32 +++---
 1 file changed, 29 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 cba9881..6956441 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1123,6 +1123,34 @@ type_size(const struct glsl_type *type)
return 0;
 }
 
+
+/**
+ * If the given GLSL type is an array or matrix or a structure containing
+ * an array/matrix member, return true.  Else return false.
+ *
+ * This is used to determine which kind of temp storage (PROGRAM_TEMPORARY
+ * or PROGRAM_ARRAY) should be used for variables of this type.  Anytime
+ * we have an array that might be indexed with a variable, we need to use
+ * the later storage type.
+ */
+static bool
+type_has_array_or_matrix(const glsl_type *type)
+{
+   if (type->is_array() || type->is_matrix())
+  return true;
+
+   if (type->is_record()) {
+  for (unsigned i = 0; i < type->length; i++) {
+ if (type_has_array_or_matrix(type->fields.structure[i].type)) {
+return true;
+ }
+  }
+   }
+
+   return false;
+}
+
+
 /**
  * In the initial pass of codegen, we assign temporary numbers to
  * intermediate results.  (not SSA -- variable assignments will reuse
@@ -1137,9 +1165,7 @@ glsl_to_tgsi_visitor::get_temp(const glsl_type *type)
src.reladdr = NULL;
src.negate = 0;
 
-   if (!options->EmitNoIndirectTemp &&
-   (type->is_array() || type->is_matrix())) {
-
+   if (!options->EmitNoIndirectTemp && type_has_array_or_matrix(type)) {
   if (next_array >= max_num_arrays) {
  max_num_arrays += 32;
  array_sizes = (unsigned*)
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH] mesa/texformat: Use format conversion function in _mesa_choose_tex_format

2015-08-26 Thread Nanley Chery
On Tue, Aug 25, 2015 at 4:19 PM, Chad Versace 
wrote:

> On Sun 16 Aug 2015, Nanley Chery wrote:
> > The last line of the commit message should say:
> >
> >GL_RGBA4_S3TC  (0x83A3)  -> COMPRESSED_RGBA_S3TC_DXT5_EXT (0x83F3)
>
> There's another weird line too, see below.
>
> > On Wed, Aug 12, 2015 at 4:19 PM, Nanley Chery 
> wrote:
> >
> > > From: Nanley Chery 
> > >
> > > This function's cases for non-generic compressed formats duplicate
> > > the GL to MESA translation in _mesa_glenum_to_compressed_format().
> > > This patch replaces the switch cases with a call to the translation
> > > function. There are no behavioral changes except for the RGB[A]4
> formats:
> > >
> > >case GL_RGB4_S3TC:
> > >  return MESA_FORMAT_RGB_DXT1  (old) -> MESA_FORMAT_RGBA_DXT1 (new)
>  ^
>
> I have trouble believing this line is correct. It adds an alpha channel.
> Can you provide the documentation for that translation?
>
> Since this mapping is nowhere explicitly defined, I was leaning on the
fact that _mesa_glenum_to_compressed_format() uses this mapping and the
last byte of the enums (coincidentally) match up. I did some more/better
research however and I now think that _mesa_choose_tex_format() had the
correct mapping for several reasons:

 * The GL_RGB4_S3TC and GL_RGBA4_S3TC formats are formats that the driver
can chose if the user passes in GL_RGB_S3TC and GL_RGBA_S3TC respectively.
Therefore, it's not a problem for the formats to map to the same
mesa_format (according to
http://homepage.ntlworld.com/neal.tringham/OpenGLGameDev/s3tcoglext.htm)

* MESA_FORMAT_RGBA_DXT5 should be reserved for the RGBA[4]_DXT5_S3TC cases
we currently aren't handling (
https://www.opengl.org/registry/specs/S3/s3tc.txt)

* The mapping in _mesa_choose_tex_format() can also be found
in nouveau_choose_tex_format(), radeonChooseTextureFormat(), and in
st_format.c's format_map[].

Thank you for the feedback. I will send out another patch to correct
_mesa_glenum_to_compressed_format() and (if R-b'd) will omit the note about
the behavioral change in this patch. I could also send out a v2 with an
updated commit message if you'd prefer.

Thanks,
Nanley

> >case GL_RGBA4_S3TC:
> > >  return MESA_FORMAT_RGBA_DXT3 (old) -> MESA_FORMAT_RGBA_DXT5 (new)
> > >
> > > Although unclear, the old behavior was likely a bug, given that online
> > > documentation (few and far between) imply a format mapping of the
> > > following:
> > >
> > >GL_RGB_S3TC(0x83A0)  -> COMPRESSED_RGB_S3TC_DXT1_EXT  (0x83F0)
> > >GL_RGB4_S3TC   (0x83A1)  -> COMPRESSED_RGBA_S3TC_DXT1_EXT (0x83F1)
> > >GL_RGBA_S3TC   (0x83A2)  -> COMPRESSED_RGBA_S3TC_DXT3_EXT (0x83F2)
> > >GL_RGBA4_S3TC  (0x83A2)  -> COMPRESSED_RGBA_S3TC_DXT5_EXT (0x83F2)
> > >
> > > Cc: Brian Paul 
> > > Cc: Ian Romanick 
> > > Signed-off-by: Nanley Chery 
> > > ---
> > >  src/mesa/main/texformat.c | 94
> > > +++
> > >  1 file changed, 13 insertions(+), 81 deletions(-)
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 11/17] nir: Trivial clean ups in the generated nir_constant_expressions.c

2015-08-26 Thread Jason Ekstrand
On Wed, Aug 26, 2015 at 1:40 PM, Matt Turner  wrote:
> On Wed, Aug 26, 2015 at 10:50 AM, Jason Ekstrand  wrote:
>> I like adding constness but I don't really see the need for the
>> whitespace changes or adding braces and breaks to the switch.
>
> Please don't top quote.
>
> Looks like he's removing braces and breaks from the switch, not adding them.

Right, my bad.  Sorry for the noise.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 11/17] nir: Trivial clean ups in the generated nir_constant_expressions.c

2015-08-26 Thread Jason Ekstrand
On Wed, Aug 26, 2015 at 10:20 AM, Ian Romanick  wrote:
> From: Ian Romanick 
>
> Signed-off-by: Ian Romanick 
> ---
>  src/glsl/nir/nir_constant_expressions.py | 13 +
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/src/glsl/nir/nir_constant_expressions.py 
> b/src/glsl/nir/nir_constant_expressions.py
> index e2feff3..099bb77 100644
> --- a/src/glsl/nir/nir_constant_expressions.py
> +++ b/src/glsl/nir/nir_constant_expressions.py
> @@ -226,7 +226,6 @@ static nir_const_value
>  evaluate_${name}(unsigned num_components, nir_const_value *_src)
>  {
> nir_const_value _dst_val = { { {0, 0, 0, 0} } };
> -

I'd keep the blank line

> ## For each non-per-component input, create a variable srcN that
> ## contains x, y, z, and w elements which are filled in with the
> ## appropriately-typed values.
> @@ -238,7 +237,7 @@ evaluate_${name}(unsigned num_components, nir_const_value 
> *_src)
>   <% continue %>
>%endif
>
> -   struct ${op.input_types[j]}_vec src${j} = {
> +   const struct ${op.input_types[j]}_vec src${j} = {
>% for k in range(op.input_sizes[j]):
>   % if op.input_types[j] == "bool":
>_src[${j}].u[${k}] != 0,
> @@ -280,17 +279,17 @@ evaluate_${name}(unsigned num_components, 
> nir_const_value *_src)
> ## Avoid unused variable warnings
> <% continue %>
>  % elif op.input_types[j] == "bool":
> -  bool src${j} = _src[${j}].u[_i] != 0;
> +  const bool src${j} = _src[${j}].u[_i] != 0;
>  % else:
> -  ${op.input_types[j]} src${j} = _src[${j}].${op.input_types[j][:1]}[_i];
> +  const ${op.input_types[j]} src${j} = 
> _src[${j}].${op.input_types[j][:1]}[_i];
>  % endif
>   % endfor
> -

Same here.  Other than that, I like the cleanup.  With the blank lines kept,

Reviewed-by: Jason Ekstrand 

>   ## Create an appropriately-typed variable dst and assign the
>   ## result of the const_expr to it.  If const_expr already contains
>   ## writes to dst, just include const_expr directly.
>   % if "dst" in op.const_expr:
>${op.output_type} dst;
> +
>${op.const_expr}
>   % else:
>${op.output_type} dst = ${op.const_expr};
> @@ -344,10 +343,8 @@ nir_eval_const_opcode(nir_op op, unsigned num_components,
>  {
> switch (op) {
>  % for name in sorted(opcodes.iterkeys()):
> -   case nir_op_${name}: {
> +   case nir_op_${name}:
>return evaluate_${name}(num_components, src);
> -  break;
> -   }
>  % endfor
> default:
>unreachable("shouldn't get here");
> --
> 2.1.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 2/2] mesa/texformat: use format conversion function in _mesa_choose_tex_format

2015-08-26 Thread Nanley Chery
From: Nanley Chery 

This function's cases for non-generic compressed formats duplicate
the GL to MESA translation in _mesa_glenum_to_compressed_format().
This patch replaces the switch cases with a call to the translation
function.

Cc: Brian Paul 
Cc: Chad Versace 
Cc: Ian Romanick 
Signed-off-by: Nanley Chery 
---
 src/mesa/main/texformat.c | 94 +++
 1 file changed, 13 insertions(+), 81 deletions(-)

diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index f4d17e1..fd9f335 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -38,6 +38,7 @@
 #include "mtypes.h"
 #include "texcompress.h"
 #include "texformat.h"
+#include "glformats.h"
 
 #define RETURN_IF_SUPPORTED(f) do {\
if (ctx->TextureFormatSupported[f]) \
@@ -276,87 +277,6 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum 
target,
  RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR_REV);
   break;
 
-   /* For non-generic compressed format we assert two things:
-*
-* 1. The format has already been validated against the set of available
-*extensions.
-*
-* 2. The driver only enables the extension if it supports all of the
-*formats that are part of that extension.
-*/
-   case GL_COMPRESSED_RGB_FXT1_3DFX:
-  return MESA_FORMAT_RGB_FXT1;
-   case GL_COMPRESSED_RGBA_FXT1_3DFX:
-  return MESA_FORMAT_RGBA_FXT1;
-   case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-   case GL_RGB_S3TC:
-   case GL_RGB4_S3TC:
-  return MESA_FORMAT_RGB_DXT1;
-   case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-  return MESA_FORMAT_RGBA_DXT1;
-   case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
-   case GL_RGBA_S3TC:
-   case GL_RGBA4_S3TC:
-  return MESA_FORMAT_RGBA_DXT3;
-   case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-  return MESA_FORMAT_RGBA_DXT5;
-   case GL_COMPRESSED_RED_RGTC1:
-  return MESA_FORMAT_R_RGTC1_UNORM;
-   case GL_COMPRESSED_SIGNED_RED_RGTC1:
-  return MESA_FORMAT_R_RGTC1_SNORM;
-   case GL_COMPRESSED_RG_RGTC2:
-  return MESA_FORMAT_RG_RGTC2_UNORM;
-   case GL_COMPRESSED_SIGNED_RG_RGTC2:
-  return MESA_FORMAT_RG_RGTC2_SNORM;
-   case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
-  return MESA_FORMAT_L_LATC1_UNORM;
-   case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
-  return MESA_FORMAT_L_LATC1_SNORM;
-   case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
-  return MESA_FORMAT_LA_LATC2_UNORM;
-   case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
-  return MESA_FORMAT_LA_LATC2_SNORM;
-   case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
-  return MESA_FORMAT_LA_LATC2_UNORM;
-   case GL_ETC1_RGB8_OES:
-  return MESA_FORMAT_ETC1_RGB8;
-   case GL_COMPRESSED_RGB8_ETC2:
-  return MESA_FORMAT_ETC2_RGB8;
-   case GL_COMPRESSED_SRGB8_ETC2:
-  return MESA_FORMAT_ETC2_SRGB8;
-   case GL_COMPRESSED_RGBA8_ETC2_EAC:
-  return MESA_FORMAT_ETC2_RGBA8_EAC;
-   case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
-  return MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC;
-   case GL_COMPRESSED_R11_EAC:
-  return MESA_FORMAT_ETC2_R11_EAC;
-   case GL_COMPRESSED_RG11_EAC:
-  return MESA_FORMAT_ETC2_RG11_EAC;
-   case GL_COMPRESSED_SIGNED_R11_EAC:
-  return MESA_FORMAT_ETC2_SIGNED_R11_EAC;
-   case GL_COMPRESSED_SIGNED_RG11_EAC:
-  return MESA_FORMAT_ETC2_SIGNED_RG11_EAC;
-   case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
-  return MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1;
-   case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
-  return MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1;
-   case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
-  return MESA_FORMAT_SRGB_DXT1;
-   case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
-  return MESA_FORMAT_SRGBA_DXT1;
-   case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
-  return MESA_FORMAT_SRGBA_DXT3;
-   case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-  return MESA_FORMAT_SRGBA_DXT5;
-   case GL_COMPRESSED_RGBA_BPTC_UNORM:
-  return MESA_FORMAT_BPTC_RGBA_UNORM;
-   case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
-  return MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM;
-   case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:
-  return MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT;
-   case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
-  return MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT;
-
case GL_ALPHA16F_ARB:
   RETURN_IF_SUPPORTED(MESA_FORMAT_A_FLOAT16);
   RETURN_IF_SUPPORTED(MESA_FORMAT_A_FLOAT32);
@@ -844,6 +764,18 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum 
target,
case GL_BGRA:
   RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
   break;
+
+   default:
+  /* For non-generic compressed format we assert two things:
+   *
+   * 1. The format has already been validated against the set of available
+   *extensions.
+   *
+   * 2. The driver only enables the extension if it supports all of the
+   *formats that are part of that extension.
+   */
+  if (_mesa_is_compressed_format(ctx, internalFormat))
+ return _mesa_g

[Mesa-dev] [PATCH 1/2] mesa/texcompress: correct mapping of S3TC formats in conversion function

2015-08-26 Thread Nanley Chery
From: Nanley Chery 

MESA_FORMAT_RGBA_DXT5 should actually be reserved for GL_RGBA[4]_DXT5_S3TC.
Also, Gallium and other dri drivers (radeon and nouveau) follow this mapping
scheme.

Cc: Brian Paul 
Cc: Chad Versace 
Cc: Ian Romanick 
Signed-off-by: Nanley Chery 
---
 src/mesa/main/texcompress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index edfb036..de82b49 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -378,15 +378,15 @@ _mesa_glenum_to_compressed_format(GLenum format)
 
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_RGB_S3TC:
+   case GL_RGB4_S3TC:
   return MESA_FORMAT_RGB_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-   case GL_RGB4_S3TC:
   return MESA_FORMAT_RGBA_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
case GL_RGBA_S3TC:
+   case GL_RGBA4_S3TC:
   return MESA_FORMAT_RGBA_DXT3;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-   case GL_RGBA4_S3TC:
   return MESA_FORMAT_RGBA_DXT5;
 
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
-- 
2.5.0

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


[Mesa-dev] [Bug 91039] [d3d9] D3D9 state tracker crashes due to stack misalignment if Mesa is compiled with -mfpmath=sse

2015-08-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91039

xpue  changed:

   What|Removed |Added

 CC||r9k...@gmail.com

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


[Mesa-dev] [PATCH] Revert "i965: Stop aux data compare preventing program binary re-use"

2015-08-26 Thread Ben Widawsky
This reverts commit 1bba29ed403e735ba0bf04ed8aa2e571884fcaaf
Author: Topi Pohjolainen 
Date:   Thu Jun 25 14:00:41 2015 +0300

i965: Stop aux data compare preventing program binary re-use

This fixes an intermittent failure in
piglit.spec.arb_pixel_buffer_object.texsubimage pbo.sklm64 (maybe other
platforms as well, but it is harder to reproduce). I can usually hit the failure
within 10 runs of the test. This is a very hairy commit to debug. I'll let Topi
handle it, or else we should go with the revert. I am open to either. I got
lucky that Jenkins caught this on a run.

Here was the script I used for bisect:

i=0
while [ $i -lt 40 ] ; do
   ./bin/texsubimage pbo -auto -fbo > /dev/null 2>&1
   [[ $? != 0 ]] && echo fail && exit 1
   ((i++))
done

exit 0

Cc: 
Cc: Kenneth Graunke 
Cc: Topi Pohjolainen 
Reported-by: Mark Janes  (jenkins)
Signed-off-by: Ben Widawsky 
---
 src/mesa/drivers/dri/i965/brw_state_cache.c | 52 ++---
 1 file changed, 32 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c 
b/src/mesa/drivers/dri/i965/brw_state_cache.c
index fbc0419..e50d6a0 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -200,23 +200,36 @@ brw_cache_new_bo(struct brw_cache *cache, uint32_t 
new_size)
 }
 
 /**
- * Attempts to find an item in the cache with identical data.
+ * Attempts to find an item in the cache with identical data and aux
+ * data to use
  */
-static const struct brw_cache_item *
-brw_lookup_prog(const struct brw_cache *cache,
-enum brw_cache_id cache_id,
-const void *data, unsigned data_size)
+static bool
+brw_try_upload_using_copy(struct brw_cache *cache,
+ struct brw_cache_item *result_item,
+ const void *data,
+ const void *aux)
 {
-   const struct brw_context *brw = cache->brw;
+   struct brw_context *brw = cache->brw;
unsigned i;
-   const struct brw_cache_item *item;
+   struct brw_cache_item *item;
 
for (i = 0; i < cache->size; i++) {
   for (item = cache->items[i]; item; item = item->next) {
+const void *item_aux = item->key + item->key_size;
 int ret;
 
-if (item->cache_id != cache_id || item->size != data_size)
+if (item->cache_id != result_item->cache_id ||
+item->size != result_item->size ||
+item->aux_size != result_item->aux_size) {
+   continue;
+}
+
+ if (cache->aux_compare[result_item->cache_id]) {
+if (!cache->aux_compare[result_item->cache_id](item_aux, aux))
+   continue;
+ } else if (memcmp(item_aux, aux, item->aux_size) != 0) {
continue;
+}
 
  if (!brw->has_llc)
 drm_intel_bo_map(cache->bo, false);
@@ -226,11 +239,13 @@ brw_lookup_prog(const struct brw_cache *cache,
 if (ret)
continue;
 
-return item;
+result_item->offset = item->offset;
+
+return true;
   }
}
 
-   return NULL;
+   return false;
 }
 
 static uint32_t
@@ -279,8 +294,6 @@ brw_upload_cache(struct brw_cache *cache,
 {
struct brw_context *brw = cache->brw;
struct brw_cache_item *item = CALLOC_STRUCT(brw_cache_item);
-   const struct brw_cache_item *matching_data =
-  brw_lookup_prog(cache, cache_id, data, data_size);
GLuint hash;
void *tmp;
 
@@ -292,15 +305,14 @@ brw_upload_cache(struct brw_cache *cache,
hash = hash_key(item);
item->hash = hash;
 
-   /* If we can find a matching prog in the cache already, then reuse the
-* existing stuff without creating new copy into the underlying buffer
-* object. This is notably useful for programs generating shaders at
-* runtime, where multiple shaders may compile to the same thing in our
-* backend.
+   /* If we can find a matching prog/prog_data combo in the cache
+* already, then reuse the existing stuff.  This will mean not
+* flagging CACHE_NEW_* when transitioning between the two
+* equivalent hash keys.  This is notably useful for programs
+* generating shaders at runtime, where multiple shaders may
+* compile to the thing in our backend.
 */
-   if (matching_data) {
-  item->offset = matching_data->offset;
-   } else {
+   if (!brw_try_upload_using_copy(cache, item, data, aux)) {
   item->offset = brw_alloc_item_data(cache, data_size);
 
   /* Copy data to the buffer */
-- 
2.5.0

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


[Mesa-dev] [PATCH] st/mesa: cache tgsi opcode info in the instruction

2015-08-26 Thread Dave Airlie
From: Dave Airlie 

Instead of looking this up lots, lets just cache it in the instruction
translation up front. I just noticed this function what high in a profile
of shader-db on radeonsi.

Signed-off-by: Dave Airlie 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 39 --
 1 file changed, 16 insertions(+), 23 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index cba9881..65aae40 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -262,6 +262,7 @@ public:
int dead_mask; /**< Used in dead code elimination */
 
class function_entry *function; /* Set on TGSI_OPCODE_CAL or 
TGSI_OPCODE_BGNSUB */
+   const struct tgsi_opcode_info *info;
 };
 
 class variable_storage : public exec_node {
@@ -530,25 +531,16 @@ swizzle_for_size(int size)
return size_swizzles[size - 1];
 }
 
-static bool
-is_tex_instruction(unsigned opcode)
-{
-   const tgsi_opcode_info* info = tgsi_get_opcode_info(opcode);
-   return info->is_tex;
-}
-
 static unsigned
-num_inst_dst_regs(unsigned opcode)
+num_inst_dst_regs(const glsl_to_tgsi_instruction *op)
 {
-   const tgsi_opcode_info* info = tgsi_get_opcode_info(opcode);
-   return info->num_dst;
+   return op->info->num_dst;
 }
 
 static unsigned
-num_inst_src_regs(unsigned opcode)
+num_inst_src_regs(const glsl_to_tgsi_instruction *op)
 {
-   const tgsi_opcode_info* info = tgsi_get_opcode_info(opcode);
-   return info->is_tex ? info->num_src - 1 : info->num_src;
+   return op->info->is_tex ? op->info->num_src - 1 : op->info->num_src;
 }
 
 glsl_to_tgsi_instruction *
@@ -592,6 +584,7 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned 
op,
assert(num_reladdr == 0);
 
inst->op = op;
+   inst->info = tgsi_get_opcode_info(op);
inst->dst[0] = dst;
inst->dst[1] = dst1;
inst->src[0] = src0;
@@ -3538,7 +3531,7 @@ count_resources(glsl_to_tgsi_visitor *v, gl_program *prog)
v->samplers_used = 0;
 
foreach_in_list(glsl_to_tgsi_instruction, inst, &v->instructions) {
-  if (is_tex_instruction(inst->op)) {
+  if (inst->info->is_tex) {
  for (int i = 0; i < inst->sampler_array_size; i++) {
 unsigned idx = inst->sampler.index + i;
 v->samplers_used |= 1 << idx;
@@ -3673,7 +3666,7 @@ glsl_to_tgsi_visitor::rename_temp_register(int index, int 
new_index)
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
   unsigned j;
 
-  for (j = 0; j < num_inst_src_regs(inst->op); j++) {
+  for (j = 0; j < num_inst_src_regs(inst); j++) {
  if (inst->src[j].file == PROGRAM_TEMPORARY &&
  inst->src[j].index == index) {
 inst->src[j].index = new_index;
@@ -3687,7 +3680,7 @@ glsl_to_tgsi_visitor::rename_temp_register(int index, int 
new_index)
  }
   }
 
-  for (j = 0; j < num_inst_dst_regs(inst->op); j++) {
+  for (j = 0; j < num_inst_dst_regs(inst); j++) {
  if (inst->dst[j].file == PROGRAM_TEMPORARY && inst->dst[j].index == 
index) {
 inst->dst[j].index = new_index;
  }
@@ -3703,7 +3696,7 @@ glsl_to_tgsi_visitor::get_first_temp_read(int index)
unsigned i = 0, j;
 
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
-  for (j = 0; j < num_inst_src_regs(inst->op); j++) {
+  for (j = 0; j < num_inst_src_regs(inst); j++) {
  if (inst->src[j].file == PROGRAM_TEMPORARY &&
  inst->src[j].index == index) {
 return (depth == 0) ? i : loop_start;
@@ -3737,7 +3730,7 @@ glsl_to_tgsi_visitor::get_first_temp_write(int index)
unsigned j;
 
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
-  for (j = 0; j < num_inst_dst_regs(inst->op); j++) {
+  for (j = 0; j < num_inst_dst_regs(inst); j++) {
  if (inst->dst[j].file == PROGRAM_TEMPORARY && inst->dst[j].index == 
index) {
 return (depth == 0) ? i : loop_start;
  }
@@ -3763,7 +3756,7 @@ glsl_to_tgsi_visitor::get_last_temp_read(int index)
unsigned i = 0, j;
 
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
-  for (j = 0; j < num_inst_src_regs(inst->op); j++) {
+  for (j = 0; j < num_inst_src_regs(inst); j++) {
  if (inst->src[j].file == PROGRAM_TEMPORARY &&
  inst->src[j].index == index) {
 last = (depth == 0) ? i : -2;
@@ -3795,7 +3788,7 @@ glsl_to_tgsi_visitor::get_last_temp_write(int index)
unsigned j;
 
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
-  for (j = 0; j < num_inst_dst_regs(inst->op); j++) {
+  for (j = 0; j < num_inst_dst_regs(inst); j++) {
  if (inst->dst[j].file == PROGRAM_TEMPORARY && inst->dst[j].index == 
index)
 last = (depth == 0) ? i : -2;
   }
@@ -4193,7 +4186,7 @@ glsl_to_tgsi_visitor::merge_two_dsts(void)
foreach_in_list_safe(glsl_to_tgsi_instruc

[Mesa-dev] [RFC] optimise st_glsl_to_tgsi

2015-08-26 Thread Dave Airlie
I profiled shader-db running on radeonsi, and the temp register
handling passes in the glsl->tgsi convertor were quite heavy
users of CPU.

These two passes are my attempt at cleaning them up to avoid
looping over the instruction set so much. I'm in the process
of piglitting then,

On my CPU, a shader-db in one thread takes about 24s before
this and about 21s after, and glsl_to_tgsi_visitor goes
down the profile list.

Dave.

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


[Mesa-dev] [PATCH] st/mesa: move to renumbering registers in a group

2015-08-26 Thread Dave Airlie
From: Dave Airlie 

This can be done with a single pass for the instruction base,
and takes renumber_registers out of its spot on the profile.

Signed-off-by: Dave Airlie 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 57 --
 1 file changed, 38 insertions(+), 19 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e07db11..5c69d73 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -336,6 +336,11 @@ struct array_decl {
unsigned array_size;
 };
 
+struct rename_reg_pair {
+   int old_reg;
+   int new_reg;
+};
+
 struct glsl_to_tgsi_visitor : public ir_visitor {
 public:
glsl_to_tgsi_visitor();
@@ -479,7 +484,7 @@ public:
 
void simplify_cmp(void);
 
-   void rename_temp_register(int index, int new_index);
+   void rename_temp_registers(int num_renames, struct rename_reg_pair 
*renames);
void get_first_temp_read(int *first_reads);
void get_last_temp_read_first_temp_write(int *last_reads, int 
*first_writes);
void get_last_temp_write(int *last_writes);
@@ -3660,29 +3665,30 @@ glsl_to_tgsi_visitor::simplify_cmp(void)
 
 /* Replaces all references to a temporary register index with another index. */
 void
-glsl_to_tgsi_visitor::rename_temp_register(int index, int new_index)
+glsl_to_tgsi_visitor::rename_temp_registers(int num_renames, struct 
rename_reg_pair *renames)
 {
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
   unsigned j;
-
+  int k;
   for (j = 0; j < num_inst_src_regs(inst); j++) {
- if (inst->src[j].file == PROGRAM_TEMPORARY &&
- inst->src[j].index == index) {
-inst->src[j].index = new_index;
- }
+ if (inst->src[j].file == PROGRAM_TEMPORARY)
+for (k = 0; k < num_renames; k++)
+   if (inst->src[j].index == renames[k].old_reg)
+  inst->src[j].index = renames[k].new_reg;
   }
 
   for (j = 0; j < inst->tex_offset_num_offset; j++) {
- if (inst->tex_offsets[j].file == PROGRAM_TEMPORARY &&
- inst->tex_offsets[j].index == index) {
-inst->tex_offsets[j].index = new_index;
- }
+ if (inst->tex_offsets[j].file == PROGRAM_TEMPORARY)
+for (k = 0; k < num_renames; k++)
+   if (inst->tex_offsets[j].index == renames[k].old_reg)
+  inst->tex_offsets[j].index = renames[k].new_reg;
   }
 
   for (j = 0; j < num_inst_dst_regs(inst); j++) {
- if (inst->dst[j].file == PROGRAM_TEMPORARY && inst->dst[j].index == 
index) {
-inst->dst[j].index = new_index;
- }
+ if (inst->dst[j].file == PROGRAM_TEMPORARY)
+ for (k = 0; k < num_renames; k++)
+if (inst->dst[j].index == renames[k].old_reg)
+   inst->dst[j].index = renames[k].new_reg;
   }
}
 }
@@ -4213,7 +4219,9 @@ glsl_to_tgsi_visitor::merge_registers(void)
 {
int *last_reads = rzalloc_array(mem_ctx, int, this->next_temp);
int *first_writes = rzalloc_array(mem_ctx, int, this->next_temp);
+   struct rename_reg_pair *renames = rzalloc_array(mem_ctx, struct 
rename_reg_pair, this->next_temp);
int i, j;
+   int num_renames = 0;
 
/* Read the indices of the last read and first write to each temp register
 * into an array so that we don't have to traverse the instruction list as
@@ -4240,7 +4248,9 @@ glsl_to_tgsi_visitor::merge_registers(void)
   * as the register at index j. */
  if (first_writes[i] <= first_writes[j] &&
  last_reads[i] <= first_writes[j]) {
-rename_temp_register(j, i); /* Replace all references to j with 
i.*/
+renames[num_renames].old_reg = j;
+renames[num_renames].new_reg = i;
+num_renames++;
 
 /* Update the first_writes and last_reads arrays with the new
  * values for the merged register index, and mark the newly unused
@@ -4252,6 +4262,8 @@ glsl_to_tgsi_visitor::merge_registers(void)
   }
}
 
+   rename_temp_registers(num_renames, renames);
+   ralloc_free(renames);
ralloc_free(last_reads);
ralloc_free(first_writes);
 }
@@ -4264,19 +4276,26 @@ glsl_to_tgsi_visitor::renumber_registers(void)
int i = 0;
int new_index = 0;
int *first_reads = rzalloc_array(mem_ctx, int, this->next_temp);
-
-   for (i = 0; i < this->next_temp; i++)
+   struct rename_reg_pair *renames = rzalloc_array(mem_ctx, struct 
rename_reg_pair, this->next_temp);
+   int num_renames = 0;
+   for (i = 0; i < this->next_temp; i++) {
   first_reads[i] = -1;
+   }
get_first_temp_read(first_reads);
 
for (i = 0; i < this->next_temp; i++) {
   if (first_reads[i] < 0) continue;
-  if (i != new_index)
- rename_temp_register(i, new_index);
+  if (i != new_index) {
+ renames[num_renames].old_reg = i;
+ renames[num_renam

Re: [Mesa-dev] [RFC] optimise st_glsl_to_tgsi

2015-08-26 Thread Dave Airlie
On 27 August 2015 at 11:29, Dave Airlie  wrote:
> I profiled shader-db running on radeonsi, and the temp register
> handling passes in the glsl->tgsi convertor were quite heavy
> users of CPU.
>
> These two passes are my attempt at cleaning them up to avoid
> looping over the instruction set so much. I'm in the process
> of piglitting then,
>
> On my CPU, a shader-db in one thread takes about 24s before
> this and about 21s after, and glsl_to_tgsi_visitor goes
> down the profile list.

okay they don't show any shader-db changes and piglit seems
to be heading for a clean run on radeonsi.

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


[Mesa-dev] [PATCH 2/2] st/mesa: move to renumbering registers in a group

2015-08-26 Thread Dave Airlie
From: Dave Airlie 

This can be done with a single pass for the instruction base,
and takes renumber_registers out of its spot on the profile.

Signed-off-by: Dave Airlie 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 57 --
 1 file changed, 38 insertions(+), 19 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e07db11..5c69d73 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -336,6 +336,11 @@ struct array_decl {
unsigned array_size;
 };
 
+struct rename_reg_pair {
+   int old_reg;
+   int new_reg;
+};
+
 struct glsl_to_tgsi_visitor : public ir_visitor {
 public:
glsl_to_tgsi_visitor();
@@ -479,7 +484,7 @@ public:
 
void simplify_cmp(void);
 
-   void rename_temp_register(int index, int new_index);
+   void rename_temp_registers(int num_renames, struct rename_reg_pair 
*renames);
void get_first_temp_read(int *first_reads);
void get_last_temp_read_first_temp_write(int *last_reads, int 
*first_writes);
void get_last_temp_write(int *last_writes);
@@ -3660,29 +3665,30 @@ glsl_to_tgsi_visitor::simplify_cmp(void)
 
 /* Replaces all references to a temporary register index with another index. */
 void
-glsl_to_tgsi_visitor::rename_temp_register(int index, int new_index)
+glsl_to_tgsi_visitor::rename_temp_registers(int num_renames, struct 
rename_reg_pair *renames)
 {
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
   unsigned j;
-
+  int k;
   for (j = 0; j < num_inst_src_regs(inst); j++) {
- if (inst->src[j].file == PROGRAM_TEMPORARY &&
- inst->src[j].index == index) {
-inst->src[j].index = new_index;
- }
+ if (inst->src[j].file == PROGRAM_TEMPORARY)
+for (k = 0; k < num_renames; k++)
+   if (inst->src[j].index == renames[k].old_reg)
+  inst->src[j].index = renames[k].new_reg;
   }
 
   for (j = 0; j < inst->tex_offset_num_offset; j++) {
- if (inst->tex_offsets[j].file == PROGRAM_TEMPORARY &&
- inst->tex_offsets[j].index == index) {
-inst->tex_offsets[j].index = new_index;
- }
+ if (inst->tex_offsets[j].file == PROGRAM_TEMPORARY)
+for (k = 0; k < num_renames; k++)
+   if (inst->tex_offsets[j].index == renames[k].old_reg)
+  inst->tex_offsets[j].index = renames[k].new_reg;
   }
 
   for (j = 0; j < num_inst_dst_regs(inst); j++) {
- if (inst->dst[j].file == PROGRAM_TEMPORARY && inst->dst[j].index == 
index) {
-inst->dst[j].index = new_index;
- }
+ if (inst->dst[j].file == PROGRAM_TEMPORARY)
+ for (k = 0; k < num_renames; k++)
+if (inst->dst[j].index == renames[k].old_reg)
+   inst->dst[j].index = renames[k].new_reg;
   }
}
 }
@@ -4213,7 +4219,9 @@ glsl_to_tgsi_visitor::merge_registers(void)
 {
int *last_reads = rzalloc_array(mem_ctx, int, this->next_temp);
int *first_writes = rzalloc_array(mem_ctx, int, this->next_temp);
+   struct rename_reg_pair *renames = rzalloc_array(mem_ctx, struct 
rename_reg_pair, this->next_temp);
int i, j;
+   int num_renames = 0;
 
/* Read the indices of the last read and first write to each temp register
 * into an array so that we don't have to traverse the instruction list as
@@ -4240,7 +4248,9 @@ glsl_to_tgsi_visitor::merge_registers(void)
   * as the register at index j. */
  if (first_writes[i] <= first_writes[j] &&
  last_reads[i] <= first_writes[j]) {
-rename_temp_register(j, i); /* Replace all references to j with 
i.*/
+renames[num_renames].old_reg = j;
+renames[num_renames].new_reg = i;
+num_renames++;
 
 /* Update the first_writes and last_reads arrays with the new
  * values for the merged register index, and mark the newly unused
@@ -4252,6 +4262,8 @@ glsl_to_tgsi_visitor::merge_registers(void)
   }
}
 
+   rename_temp_registers(num_renames, renames);
+   ralloc_free(renames);
ralloc_free(last_reads);
ralloc_free(first_writes);
 }
@@ -4264,19 +4276,26 @@ glsl_to_tgsi_visitor::renumber_registers(void)
int i = 0;
int new_index = 0;
int *first_reads = rzalloc_array(mem_ctx, int, this->next_temp);
-
-   for (i = 0; i < this->next_temp; i++)
+   struct rename_reg_pair *renames = rzalloc_array(mem_ctx, struct 
rename_reg_pair, this->next_temp);
+   int num_renames = 0;
+   for (i = 0; i < this->next_temp; i++) {
   first_reads[i] = -1;
+   }
get_first_temp_read(first_reads);
 
for (i = 0; i < this->next_temp; i++) {
   if (first_reads[i] < 0) continue;
-  if (i != new_index)
- rename_temp_register(i, new_index);
+  if (i != new_index) {
+ renames[num_renames].old_reg = i;
+ renames[num_renam

[Mesa-dev] st_glsl_to_tgsi optimisations

2015-08-26 Thread Dave Airlie
Oh I missed one of these patches on the initial send, at least
shader-db shows no output changes with these on radeonsi,
and also it removes the merge/renumber passes from the profiles
for a shader-db run.

Dave.

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


[Mesa-dev] [PATCH 1/2] st/mesa: reduce time spent in calculating temp read/writes

2015-08-26 Thread Dave Airlie
From: Dave Airlie 

The glsl->tgsi convertor does some temporary register reduction
however in profiling shader-db this shows up quite highly,

so optimise things to reduce the number of loops through
all the instructions we do. This drops merge_registers
from 4-5% on the profile to 1%. I think this can be reduced
further by possibly optimising the renumber pass.

Signed-off-by: Dave Airlie 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 153 +++--
 1 file changed, 79 insertions(+), 74 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 65aae40..e07db11 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -480,10 +480,9 @@ public:
void simplify_cmp(void);
 
void rename_temp_register(int index, int new_index);
-   int get_first_temp_read(int index);
-   int get_first_temp_write(int index);
-   int get_last_temp_read(int index);
-   int get_last_temp_write(int index);
+   void get_first_temp_read(int *first_reads);
+   void get_last_temp_read_first_temp_write(int *last_reads, int 
*first_writes);
+   void get_last_temp_write(int *last_writes);
 
void copy_propagate(void);
int eliminate_dead_code(void);
@@ -3688,8 +3687,8 @@ glsl_to_tgsi_visitor::rename_temp_register(int index, int 
new_index)
}
 }
 
-int
-glsl_to_tgsi_visitor::get_first_temp_read(int index)
+void
+glsl_to_tgsi_visitor::get_first_temp_read(int *first_reads)
 {
int depth = 0; /* loop depth */
int loop_start = -1; /* index of the first active BGNLOOP (if any) */
@@ -3697,15 +3696,15 @@ glsl_to_tgsi_visitor::get_first_temp_read(int index)
 
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
   for (j = 0; j < num_inst_src_regs(inst); j++) {
- if (inst->src[j].file == PROGRAM_TEMPORARY &&
- inst->src[j].index == index) {
-return (depth == 0) ? i : loop_start;
+ if (inst->src[j].file == PROGRAM_TEMPORARY) {
+if (first_reads[inst->src[j].index] == -1)
+first_reads[inst->src[j].index] = (depth == 0) ? i : 
loop_start;
  }
   }
   for (j = 0; j < inst->tex_offset_num_offset; j++) {
- if (inst->tex_offsets[j].file == PROGRAM_TEMPORARY &&
- inst->tex_offsets[j].index == index) {
-return (depth == 0) ? i : loop_start;
+ if (inst->tex_offsets[j].file == PROGRAM_TEMPORARY) {
+if (first_reads[inst->tex_offsets[j].index] == -1)
+   first_reads[inst->tex_offsets[j].index] = (depth == 0) ? i : 
loop_start;
  }
   }
   if (inst->op == TGSI_OPCODE_BGNLOOP) {
@@ -3718,91 +3717,73 @@ glsl_to_tgsi_visitor::get_first_temp_read(int index)
   assert(depth >= 0);
   i++;
}
-   return -1;
 }
 
-int
-glsl_to_tgsi_visitor::get_first_temp_write(int index)
+void
+glsl_to_tgsi_visitor::get_last_temp_read_first_temp_write(int *last_reads, int 
*first_writes)
 {
int depth = 0; /* loop depth */
int loop_start = -1; /* index of the first active BGNLOOP (if any) */
-   int i = 0;
-   unsigned j;
-
+   unsigned i = 0, j;
+   int k;
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
+  for (j = 0; j < num_inst_src_regs(inst); j++) {
+ if (inst->src[j].file == PROGRAM_TEMPORARY)
+last_reads[inst->src[j].index] = (depth == 0) ? i : -2;
+  }
   for (j = 0; j < num_inst_dst_regs(inst); j++) {
- if (inst->dst[j].file == PROGRAM_TEMPORARY && inst->dst[j].index == 
index) {
-return (depth == 0) ? i : loop_start;
- }
+ if (inst->dst[j].file == PROGRAM_TEMPORARY)
+if (first_writes[inst->dst[j].index] == -1)
+   first_writes[inst->dst[j].index] = (depth == 0) ? i : 
loop_start;
+  }
+  for (j = 0; j < inst->tex_offset_num_offset; j++) {
+ if (inst->tex_offsets[j].file == PROGRAM_TEMPORARY)
+last_reads[inst->tex_offsets[j].index] = (depth == 0) ? i : -2;
   }
   if (inst->op == TGSI_OPCODE_BGNLOOP) {
  if(depth++ == 0)
 loop_start = i;
   } else if (inst->op == TGSI_OPCODE_ENDLOOP) {
- if (--depth == 0)
+ if (--depth == 0) {
 loop_start = -1;
-  }
-  assert(depth >= 0);
-  i++;
-   }
-   return -1;
-}
-
-int
-glsl_to_tgsi_visitor::get_last_temp_read(int index)
-{
-   int depth = 0; /* loop depth */
-   int last = -1; /* index of last instruction that reads the temporary */
-   unsigned i = 0, j;
-
-   foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
-  for (j = 0; j < num_inst_src_regs(inst); j++) {
- if (inst->src[j].file == PROGRAM_TEMPORARY &&
- inst->src[j].index == index) {
-last = (depth == 0) ? i : -2;
+for (k = 0; k < this->next_temp; k++) {
+   if (last_reads[k] == -2) {
+  last_reads[k] = i

[Mesa-dev] [PATCH v2 1/4] glapi: add GL_OES_texture_storage_multisample_2d_array extension

2015-08-26 Thread Tapani Pälli
Signed-off-by: Tapani Pälli 
Reviewed-by: Marta Lofstedt 
---
 src/mapi/glapi/gen/es_EXT.xml | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index 642e3b3..cfca5a9 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -798,4 +798,23 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
-- 
2.1.0

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


[Mesa-dev] [PATCH v2 0/4] OES_texture_storage_multisample_2d_array

2015-08-26 Thread Tapani Pälli
Hi;

Once more the OES_texture_storage_multisample_2d_array extension
with using ARB_texture_multisample enable bit rather than introducing
own one.

Thanks;

Tapani Pälli (4):
  glapi: add GL_OES_texture_storage_multisample_2d_array extension
  mesa: Add extension enable for
OES_texture_storage_multisample_2d_array
  glsl: add support for OES_texture_storage_multisample_2d_array
  mesa: enable enums for OES_texture_storage_multisample_2d_array

 src/glsl/builtin_functions.cpp   |  5 +++--
 src/glsl/builtin_types.cpp   |  3 ++-
 src/glsl/glcpp/glcpp-parse.y |  2 ++
 src/glsl/glsl_lexer.ll   |  6 +++---
 src/glsl/glsl_parser_extras.cpp  |  1 +
 src/glsl/glsl_parser_extras.h|  2 ++
 src/mapi/glapi/gen/es_EXT.xml| 19 +++
 src/mesa/main/extensions.c   |  1 +
 src/mesa/main/get_hash_params.py |  6 +++---
 src/mesa/main/texobj.c   |  3 ++-
 src/mesa/main/texparam.c |  2 +-
 11 files changed, 39 insertions(+), 11 deletions(-)

-- 
2.1.0

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


[Mesa-dev] [PATCH v2 4/4] mesa: enable enums for OES_texture_storage_multisample_2d_array

2015-08-26 Thread Tapani Pälli
v2: use _mesa_is_gles31(ctx) for verifying we are on ES 3.1,
remove _es31 usage from get_hash_params.py

Signed-off-by: Tapani Pälli 
---
 src/mesa/main/get_hash_params.py | 6 +++---
 src/mesa/main/texobj.c   | 3 ++-
 src/mesa/main/texparam.c | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 73213f4..b3c337e 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -434,6 +434,9 @@ descriptor=[
   [ "SAMPLE_MASK", "CONTEXT_BOOL(Multisample.SampleMask), 
extra_ARB_texture_multisample" ],
   [ "MAX_SAMPLE_MASK_WORDS", "CONST(1), extra_ARB_texture_multisample" ],
 
+# GL_ARB_texture_multisample / ES 3.1 with 
GL_OES_texture_storage_multisample_2d_array
+  [ "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "LOC_CUSTOM, TYPE_INT, 
TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, extra_ARB_texture_multisample" ],
+
 # GL_ARB_texture_gather / GLES 3.1
   [ "MIN_PROGRAM_TEXTURE_GATHER_OFFSET", 
"CONTEXT_INT(Const.MinProgramTextureGatherOffset), extra_ARB_texture_gather"],
   [ "MAX_PROGRAM_TEXTURE_GATHER_OFFSET", 
"CONTEXT_INT(Const.MaxProgramTextureGatherOffset), extra_ARB_texture_gather"],
@@ -740,9 +743,6 @@ descriptor=[
   [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, 
extra_texture_buffer_object" ],
   [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, 
extra_texture_buffer_object" ],
 
-# GL_ARB_texture_multisample / GL 3.2
-  [ "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "LOC_CUSTOM, TYPE_INT, 
TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, extra_ARB_texture_multisample" ],
-
 # GL 3.0
   [ "CONTEXT_FLAGS", "CONTEXT_INT(Const.ContextFlags), extra_version_30" ],
 
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index c5d83e1..a1be1e3 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1612,7 +1612,8 @@ _mesa_tex_target_to_index(const struct gl_context *ctx, 
GLenum target)
   return ((_mesa_is_desktop_gl(ctx) && 
ctx->Extensions.ARB_texture_multisample) ||
   _mesa_is_gles31(ctx)) ? TEXTURE_2D_MULTISAMPLE_INDEX: -1;
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
-  return _mesa_is_desktop_gl(ctx) && 
ctx->Extensions.ARB_texture_multisample
+  return ((_mesa_is_desktop_gl(ctx) && 
ctx->Extensions.ARB_texture_multisample) ||
+  _mesa_is_gles31(ctx))
  ? TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX: -1;
default:
   return -1;
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 72d3611..3f6f8ba 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1223,6 +1223,7 @@ legal_get_tex_level_parameter_target(struct gl_context 
*ctx, GLenum target,
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
   return ctx->Extensions.ARB_texture_cube_map;
case GL_TEXTURE_2D_MULTISAMPLE:
+   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
   return ctx->Extensions.ARB_texture_multisample;
}
 
@@ -1267,7 +1268,6 @@ legal_get_tex_level_parameter_target(struct gl_context 
*ctx, GLenum target,
* "target may also be TEXTURE_BUFFER, indicating the texture buffer."
*/
   return ctx->API == API_OPENGL_CORE && ctx->Version >= 31;
-   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
case GL_PROXY_TEXTURE_2D_MULTISAMPLE:
case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:
   return ctx->Extensions.ARB_texture_multisample;
-- 
2.1.0

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


[Mesa-dev] [PATCH v2 2/4] mesa: Add extension enable for OES_texture_storage_multisample_2d_array

2015-08-26 Thread Tapani Pälli
v2: use ARB_texture_multisample bit to enable extension

Signed-off-by: Tapani Pälli 
---
 src/mesa/main/extensions.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 03303ac..a57d5ba 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -336,6 +336,7 @@ static const struct extension extension_table[] = {
{ "GL_OES_texture_half_float",  o(OES_texture_half_float),  
   ES2, 2005 },
{ "GL_OES_texture_half_float_linear",   
o(OES_texture_half_float_linear),  ES2, 2005 },
{ "GL_OES_texture_mirrored_repeat", o(dummy_true),  
 ES1,   2005 },
+   { "GL_OES_texture_storage_multisample_2d_array",o(ARB_texture_multisample), 
  ES31, 2014 },
{ "GL_OES_texture_npot",
o(ARB_texture_non_power_of_two), ES1 | ES2, 2005 },
{ "GL_OES_vertex_array_object", o(dummy_true),  
 ES1 | ES2, 2010 },
 
-- 
2.1.0

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


[Mesa-dev] [PATCH v2 3/4] glsl: add support for OES_texture_storage_multisample_2d_array

2015-08-26 Thread Tapani Pälli
v2: use ARB_texture_multisample enable bit

Patch adds extension enable bit and enables required keywords
and builtin functions for the extension.

Signed-off-by: Tapani Pälli 
---
 src/glsl/builtin_functions.cpp  | 5 +++--
 src/glsl/builtin_types.cpp  | 3 ++-
 src/glsl/glcpp/glcpp-parse.y| 2 ++
 src/glsl/glsl_lexer.ll  | 6 +++---
 src/glsl/glsl_parser_extras.cpp | 1 +
 src/glsl/glsl_parser_extras.h   | 2 ++
 6 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 1bc3de4..4092d68 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -284,8 +284,9 @@ texture_multisample(const _mesa_glsl_parse_state *state)
 static bool
 texture_multisample_array(const _mesa_glsl_parse_state *state)
 {
-   return state->is_version(150, 0) ||
-  state->ARB_texture_multisample_enable;
+   return state->is_version(150, 320) ||
+  state->ARB_texture_multisample_enable ||
+  state->OES_texture_storage_multisample_2d_array_enable;
 }
 
 static bool
diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp
index 9cf198f..0d0d71d 100644
--- a/src/glsl/builtin_types.cpp
+++ b/src/glsl/builtin_types.cpp
@@ -307,7 +307,8 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state 
*state)
   add_type(symbols, glsl_type::usamplerCubeArray_type);
}
 
-   if (state->ARB_texture_multisample_enable) {
+   if (state->ARB_texture_multisample_enable ||
+   state->OES_texture_storage_multisample_2d_array_enable) {
   add_type(symbols, glsl_type::sampler2DMS_type);
   add_type(symbols, glsl_type::isampler2DMS_type);
   add_type(symbols, glsl_type::usampler2DMS_type);
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 18e50af..2d631f0 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -2382,6 +2382,8 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t 
*parser, intmax_t versio
 add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
   if (extensions->OES_standard_derivatives)
  add_builtin_define(parser, "GL_OES_standard_derivatives", 1);
+  if (extensions->ARB_texture_multisample)
+ add_builtin_define(parser, 
"GL_OES_texture_storage_multisample_2d_array", 1);
   }
} else {
   add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index 24998c1..9d7ad74 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -347,9 +347,9 @@ usampler2DArray KEYWORD(130, 300, 130, 300, 
USAMPLER2DARRAY);
 sampler2DMSKEYWORD_WITH_ALT(150, 300, 150, 310, 
yyextra->ARB_texture_multisample_enable, SAMPLER2DMS);
 isampler2DMS   KEYWORD_WITH_ALT(150, 300, 150, 310, 
yyextra->ARB_texture_multisample_enable, ISAMPLER2DMS);
 usampler2DMS   KEYWORD_WITH_ALT(150, 300, 150, 310, 
yyextra->ARB_texture_multisample_enable, USAMPLER2DMS);
-sampler2DMSArray   KEYWORD_WITH_ALT(150, 300, 150, 0, 
yyextra->ARB_texture_multisample_enable, SAMPLER2DMSARRAY);
-isampler2DMSArray  KEYWORD_WITH_ALT(150, 300, 150, 0, 
yyextra->ARB_texture_multisample_enable, ISAMPLER2DMSARRAY);
-usampler2DMSArray  KEYWORD_WITH_ALT(150, 300, 150, 0, 
yyextra->ARB_texture_multisample_enable, USAMPLER2DMSARRAY);
+sampler2DMSArray   KEYWORD_WITH_ALT(150, 300, 150, 320, 
yyextra->ARB_texture_multisample_enable||yyextra->OES_texture_storage_multisample_2d_array_enable,
 SAMPLER2DMSARRAY);
+isampler2DMSArray  KEYWORD_WITH_ALT(150, 300, 150, 320, 
yyextra->ARB_texture_multisample_enable||yyextra->OES_texture_storage_multisample_2d_array_enable,
 ISAMPLER2DMSARRAY);
+usampler2DMSArray  KEYWORD_WITH_ALT(150, 300, 150, 320, 
yyextra->ARB_texture_multisample_enable||yyextra->OES_texture_storage_multisample_2d_array_enable,
 USAMPLER2DMSARRAY);
 
/* keywords available with ARB_texture_cube_map_array_enable extension on 
desktop GLSL */
 samplerCubeArray   KEYWORD_WITH_ALT(400, 0, 400, 0, 
yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAY);
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 6440a96..939a03c 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -626,6 +626,7 @@ static const _mesa_glsl_extension 
_mesa_glsl_supported_extensions[] = {
EXT(OES_EGL_image_external, false, true,  
OES_EGL_image_external),
EXT(OES_standard_derivatives,   false, true,  
OES_standard_derivatives),
EXT(OES_texture_3D, false, true,  EXT_texture3D),
+   EXT(OES_texture_storage_multisample_2d_array, false, true, 
ARB_texture_multisample),
 
/* All other extensions go here, sorted alphabetically.
 */
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index e2145be..295cd10 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/g

Re: [Mesa-dev] [PATCH v2 3/4] glsl: add support for OES_texture_storage_multisample_2d_array

2015-08-26 Thread Matt Turner
On Wed, Aug 26, 2015 at 8:40 PM, Tapani Pälli  wrote:
> v2: use ARB_texture_multisample enable bit
>
> Patch adds extension enable bit and enables required keywords
> and builtin functions for the extension.
>
> Signed-off-by: Tapani Pälli 
> ---
>  src/glsl/builtin_functions.cpp  | 5 +++--
>  src/glsl/builtin_types.cpp  | 3 ++-
>  src/glsl/glcpp/glcpp-parse.y| 2 ++
>  src/glsl/glsl_lexer.ll  | 6 +++---
>  src/glsl/glsl_parser_extras.cpp | 1 +
>  src/glsl/glsl_parser_extras.h   | 2 ++
>  6 files changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
> index 1bc3de4..4092d68 100644
> --- a/src/glsl/builtin_functions.cpp
> +++ b/src/glsl/builtin_functions.cpp
> @@ -284,8 +284,9 @@ texture_multisample(const _mesa_glsl_parse_state *state)
>  static bool
>  texture_multisample_array(const _mesa_glsl_parse_state *state)
>  {
> -   return state->is_version(150, 0) ||
> -  state->ARB_texture_multisample_enable;
> +   return state->is_version(150, 320) ||
> +  state->ARB_texture_multisample_enable ||
> +  state->OES_texture_storage_multisample_2d_array_enable;
>  }
>
>  static bool
> diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp
> index 9cf198f..0d0d71d 100644
> --- a/src/glsl/builtin_types.cpp
> +++ b/src/glsl/builtin_types.cpp
> @@ -307,7 +307,8 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state 
> *state)
>add_type(symbols, glsl_type::usamplerCubeArray_type);
> }
>
> -   if (state->ARB_texture_multisample_enable) {
> +   if (state->ARB_texture_multisample_enable ||
> +   state->OES_texture_storage_multisample_2d_array_enable) {
>add_type(symbols, glsl_type::sampler2DMS_type);
>add_type(symbols, glsl_type::isampler2DMS_type);
>add_type(symbols, glsl_type::usampler2DMS_type);
> diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
> index 18e50af..2d631f0 100644
> --- a/src/glsl/glcpp/glcpp-parse.y
> +++ b/src/glsl/glcpp/glcpp-parse.y
> @@ -2382,6 +2382,8 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t 
> *parser, intmax_t versio
>  add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
>if (extensions->OES_standard_derivatives)
>   add_builtin_define(parser, "GL_OES_standard_derivatives", 
> 1);
> +  if (extensions->ARB_texture_multisample)
> + add_builtin_define(parser, 
> "GL_OES_texture_storage_multisample_2d_array", 1);
>}
> } else {
>add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
> diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
> index 24998c1..9d7ad74 100644
> --- a/src/glsl/glsl_lexer.ll
> +++ b/src/glsl/glsl_lexer.ll
> @@ -347,9 +347,9 @@ usampler2DArray KEYWORD(130, 300, 130, 300, 
> USAMPLER2DARRAY);
>  sampler2DMSKEYWORD_WITH_ALT(150, 300, 150, 310, 
> yyextra->ARB_texture_multisample_enable, SAMPLER2DMS);
>  isampler2DMS   KEYWORD_WITH_ALT(150, 300, 150, 310, 
> yyextra->ARB_texture_multisample_enable, ISAMPLER2DMS);
>  usampler2DMS   KEYWORD_WITH_ALT(150, 300, 150, 310, 
> yyextra->ARB_texture_multisample_enable, USAMPLER2DMS);
> -sampler2DMSArray   KEYWORD_WITH_ALT(150, 300, 150, 0, 
> yyextra->ARB_texture_multisample_enable, SAMPLER2DMSARRAY);
> -isampler2DMSArray  KEYWORD_WITH_ALT(150, 300, 150, 0, 
> yyextra->ARB_texture_multisample_enable, ISAMPLER2DMSARRAY);
> -usampler2DMSArray  KEYWORD_WITH_ALT(150, 300, 150, 0, 
> yyextra->ARB_texture_multisample_enable, USAMPLER2DMSARRAY);
> +sampler2DMSArray   KEYWORD_WITH_ALT(150, 300, 150, 320, 
> yyextra->ARB_texture_multisample_enable||yyextra->OES_texture_storage_multisample_2d_array_enable,
>  SAMPLER2DMSARRAY);
> +isampler2DMSArray  KEYWORD_WITH_ALT(150, 300, 150, 320, 
> yyextra->ARB_texture_multisample_enable||yyextra->OES_texture_storage_multisample_2d_array_enable,
>  ISAMPLER2DMSARRAY);
> +usampler2DMSArray  KEYWORD_WITH_ALT(150, 300, 150, 320, 
> yyextra->ARB_texture_multisample_enable||yyextra-

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


Re: [Mesa-dev] [PATCH v2 0/3] cs: Add gl_GlobalInvocationID

2015-08-26 Thread Tapani Pälli

All 3 patches

Reviewed-by: Tapani Pälli 

On 08/23/2015 10:09 AM, Jordan Justen wrote:

git://people.freedesktop.org/~jljusten/mesa cs-global-id-v2
http://patchwork.freedesktop.org/bundle/jljusten/cs-global-id-v2

For i965, these also depend on the texture sampling series:
http://patchwork.freedesktop.org/bundle/jljusten/cs%20texture%20sampling/

And the gl_LocalInvocationID series:
http://patchwork.freedesktop.org/bundle/jljusten/i965-local-inv-id-v1/

These patches allow piglit's
tests/spec/arb_compute_shader/execution/basic-global-id-atomic.shader_test
to pass.

To test, I set MESA_GL_VERSION_OVERRIDE=4.3,
MESA_GLSL_VERSION_OVERRIDE=430 and
MESA_EXTENSION_OVERRIDE=GL_ARB_compute_shader.

Jordan Justen (3):
   glsl/cs: Don't strip gl_GlobalInvocationID and dependencies
   glsl: Move link_get_main_function_signature to a common location
   glsl/cs: Initialize gl_GlobalInvocationID in main()

  src/glsl/builtin_functions.cpp  | 28 
  src/glsl/builtin_variables.cpp  | 58 +
  src/glsl/glsl_parser_extras.cpp |  2 ++
  src/glsl/ir.h   |  6 
  src/glsl/linker.cpp | 31 ++
  src/glsl/linker.h   |  3 --
  src/glsl/lower_vertex_id.cpp|  2 +-
  src/glsl/opt_dead_builtin_variables.cpp | 14 
  8 files changed, 111 insertions(+), 33 deletions(-)



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


Re: [Mesa-dev] [PATCH v2 0/4] OES_texture_storage_multisample_2d_array

2015-08-26 Thread Ilia Mirkin
Series is Reviewed-by: Ilia Mirkin 
On Aug 26, 2015 11:41 PM, "Tapani Pälli"  wrote:

> Hi;
>
> Once more the OES_texture_storage_multisample_2d_array extension
> with using ARB_texture_multisample enable bit rather than introducing
> own one.
>
> Thanks;
>
> Tapani Pälli (4):
>   glapi: add GL_OES_texture_storage_multisample_2d_array extension
>   mesa: Add extension enable for
> OES_texture_storage_multisample_2d_array
>   glsl: add support for OES_texture_storage_multisample_2d_array
>   mesa: enable enums for OES_texture_storage_multisample_2d_array
>
>  src/glsl/builtin_functions.cpp   |  5 +++--
>  src/glsl/builtin_types.cpp   |  3 ++-
>  src/glsl/glcpp/glcpp-parse.y |  2 ++
>  src/glsl/glsl_lexer.ll   |  6 +++---
>  src/glsl/glsl_parser_extras.cpp  |  1 +
>  src/glsl/glsl_parser_extras.h|  2 ++
>  src/mapi/glapi/gen/es_EXT.xml| 19 +++
>  src/mesa/main/extensions.c   |  1 +
>  src/mesa/main/get_hash_params.py |  6 +++---
>  src/mesa/main/texobj.c   |  3 ++-
>  src/mesa/main/texparam.c |  2 +-
>  11 files changed, 39 insertions(+), 11 deletions(-)
>
> --
> 2.1.0
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev