[Mesa-dev] [PATCH] i965/gs: Fix incorrect numbering of DWORDs in 3DSTATE_GS

2013-09-27 Thread Paul Berry
In commit 247f90c77e8f3894e963d796628246ba0bde27b5 (i965/gs: Set control data header size/format appropriately for EndPrimitive()), I incorrectly numbered the DWORDs in the 3DSTATE_GS command starting from 1 instead of starting from 0. This caused the control data format to be programmed into the

Re: [Mesa-dev] [PATCH 3/4] glsl/gs: handle gl_ClipDistance geometry input in lower_clip_distance.

2013-09-28 Thread Paul Berry
On 27 September 2013 14:32, Ian Romanick wrote: > There are some bits of this patch I'm trying to understand. I think > they can be cleared up by one question below... > > On 09/14/2013 01:00 PM, Paul Berry wrote: > > From: Bryan Cain > > > > This corresponds

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

2013-10-01 Thread Paul Berry
Previously, we computed dFdy() using the following instruction: add(8) dst<1>F src<4,4,0)F -src.2<4,4,0>F { align1 1Q } That had the disadvantage that it computed the same value for all 4 pixels of a 2x2 subspan, which meant that it was less accurate than dFdx(). This patch changes it to the f

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

2013-10-02 Thread Paul Berry
On 30 September 2013 03:08, Chris Forbes wrote: > From: Maxence Le Dore > > Reviewed-by: Kenneth Graunke > This patch broke "make check" for me. src/mesa/main/tests/test-suite.log shows: == Mesa 9.3.0-devel: src/mesa/main/tests/test-

[Mesa-dev] [PATCH 00/19] glsl: Support redeclaration of gl_PerVertex interface blck.

2013-10-02 Thread Paul Berry
This patch series adds the necessary machinery to the GLSL compiler to allow shaders to redeclare the gl_PerVertex interface block. Although the precise rules for how to redeclare gl_PerVertex were not published until GLSL 4.10, it seems clear from context that this was intended as a clarification

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

2013-10-02 Thread Paul Berry
We use a location of -1 for variables which don't have their own assigned locations--this includes ir_variables which represent named interface blocks. Technically the location assigned to gl_in doesn't matter, since gl_in is only accessed via its members (which have their own locations). But it'

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

2013-10-02 Thread Paul Berry
Previously, we erroneously used the name "gl_in" for both the block name and the instance name. --- src/glsl/builtin_variables.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index 3667dc8..91518ba 100644 --- a

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

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

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

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

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

2013-10-02 Thread Paul Berry
GLSL reserves identifiers beginning with "gl_" or containing "__", but we haven't been consistent about enforcing this rule. This patch makes a new function to check whether identifier names are valid. In the process it closes a loophole where we would previously allow function argument names to

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

2013-10-02 Thread Paul Berry
Note: some limited amount of redeclaration is actually allowed, provided the shader is redeclaring the built-in gl_PerVertex interface block. Support for this will be added in future patches. Fixes piglit tests spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-{block-elem,g

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

2013-10-02 Thread Paul Berry
Note: we need to make an exception for the gl_PerVertex interface block, since this is allowed to be redeclared. Future patches will make redeclaration of gl_PerVertex work properly. Fixes piglit test spec/glsl-1.50/compiler/interface-block-name-uses-gl-prefix.vert. --- src/glsl/ast_to_hir.cpp |

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

2013-10-02 Thread Paul Berry
Note: we need to make an exception for the gl_PerVertex interface block, since built-in variables are allowed to be redeclared inside it. Future patches will make redeclaration of gl_PerVertex work properly. Fixes piglit tests: - spec/glsl-1.50/compiler/interface-block-array-elem-uses-gl-prefix.v

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

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

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

2013-10-02 Thread Paul Berry
Fixes piglit test spec/glsl-1.10/compiler/struct/struct-name-uses-gl-prefix.vert. --- src/glsl/ast_to_hir.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index bb14fc9..8fb7f2f 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hi

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

2013-10-02 Thread Paul Berry
This patch modifies the get_variable_being_redeclared() function so that it no longer relies on the ast_declaration for the variable being redeclared. In future patches, this will allow get_variable_being_redeclared() to be used for processing redeclarations of the built-in gl_PerVertex interface

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

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

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

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

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

2013-10-02 Thread Paul Berry
This patch verifies that: - The gl_PerVertex input interface block may only be redeclared in a geometry shader, and that it may only be redeclared as gl_in[]. - The gl_PerVertex output interface block may only be redeclared in a vertex or geometry shader, and that it may only be redeclared as

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

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

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

2013-10-02 Thread Paul Berry
>From section 4.1.9 (Arrays) of the GLSL 4.40 spec (as of revision 7): However, unless noted otherwise, blocks cannot be redeclared; an unsized array in a user-declared block cannot be sized through redeclaration. The only place where the spec notes that interface blocks can be redecl

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

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

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

2013-10-02 Thread Paul Berry
Fixes piglit tests: - spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-after-other-usage.geom - spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-after-other-usage.geom - spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-after-usage.geom - spec/glsl-1.50/compiler/vs-redeclares-pervertex-out-a

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

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

Re: [Mesa-dev] [PATCH 06/10] i965: Don't dead-code eliminate instructions that write to the accumulator.

2013-10-04 Thread Paul Berry
On 27 September 2013 18:17, Matt Turner wrote: > v2: Set destination register using brw_null_reg(). > Reviewed-by: Paul Berry > --- > src/mesa/drivers/dri/i965/brw_fs.cpp | 15 ++- > src/mesa/drivers/dri/i965/brw_vec4.cpp | 15 ++- > 2 files chan

Re: [Mesa-dev] [PATCH 09/10] i965/fs: Add a peephole pass to combine ADD with ADDC/SUBB.

2013-10-04 Thread Paul Berry
sitor.cpp | 104 > +++ > 2 files changed, 107 insertions(+) > Reviewed-by: Paul Berry > > diff --git a/src/mesa/drivers/dri/i965/brw_fs.h > b/src/mesa/drivers/dri/i965/brw_fs.h > index 6a53e59..c703c2b 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.h >

Re: [Mesa-dev] [PATCH 09/10] i965/fs: Add a peephole pass to combine ADD with ADDC/SUBB.

2013-10-04 Thread Paul Berry
On 4 October 2013 13:51, Paul Berry wrote: > On 3 October 2013 10:59, Matt Turner wrote: > >> v2: Check fixed_hw_reg.{file,nr} instead of dst.reg. >> v3: Store the bool emitted_addc_or_subb in the class, not static. >> --- >> src/mesa/drivers/dri/i965/brw_fs.h

Re: [Mesa-dev] [PATCH 10/10] i965/vs: Add a peephole pass to combine ADD with ADDC/SUBB.

2013-10-04 Thread Paul Berry
On 3 October 2013 11:00, Matt Turner wrote: > v2: Check fixed_hw_reg.{file,nr} instead of dst.reg. > v3: Store the bool emitted_addc_or_subb in the class, not static. > --- > src/mesa/drivers/dri/i965/brw_vec4.h | 3 + > src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 104 >

Re: [Mesa-dev] [PATCH 09/10] i965/fs: Add a peephole pass to combine ADD with ADDC/SUBB.

2013-10-04 Thread Paul Berry
On 4 October 2013 14:24, Matt Turner wrote: > On Fri, Oct 4, 2013 at 2:19 PM, Paul Berry > wrote: > > On 4 October 2013 13:51, Paul Berry wrote: > >> > >> On 3 October 2013 10:59, Matt Turner wrote: > >>> > >>> v2: Check fixed_hw_reg.

Re: [Mesa-dev] [PATCH 3/4] glsl/gs: handle gl_ClipDistance geometry input in lower_clip_distance.

2013-10-05 Thread Paul Berry
On 28 September 2013 14:59, Paul Berry wrote: > On 27 September 2013 14:32, Ian Romanick wrote: > >> There are some bits of this patch I'm trying to understand. I think >> they can be cleared up by one question below... >> >> On 09/14/2013 01:00 PM, Paul

Re: [Mesa-dev] [PATCH] i965/blorp: Fix the register types on blorp's push constants.

2013-10-07 Thread Paul Berry
, and it meant if you used the push constant as the first operand > you would have been disappointed. > --- > src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 32 > ++-- > 1 file changed, 16 insertions(+), 16 deletions(-) > Reviewed-by: Paul Berry > &g

Re: [Mesa-dev] [PATCH v2] i965: Initialize brw_blorp_const_color_program::prog_data.

2013-10-07 Thread Paul Berry
On 27 September 2013 22:24, Vinson Lee wrote: > Fixes "Uninitialized scalar field" defect reported by Coverity. > > Signed-off-by: Vinson Lee > --- > src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 2 ++ > 1 file changed, 2 insertions(+) > Reviewed-by: Paul Ber

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

2013-10-08 Thread Paul Berry
On 5 October 2013 12:10, Kenneth Graunke wrote: > On 10/02/2013 05:45 PM, Paul Berry wrote: > > Previously, we erroneously used the name "gl_in" for both the block > > name and the instance name. > > --- > > src/glsl/builtin_variables.cpp | 2 +- > >

[Mesa-dev] [PATCH] glsl: Rename the fourth argument to get_interface_instance.

2013-10-08 Thread Paul Berry
Interface declarations have two names associated with them: the block name and the instance name. It's the block name that needs to be passed to get_interface_instance(). This patch renames the argument so that there's no confusion. --- src/glsl/glsl_types.cpp | 8 src/glsl/glsl_types.h

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

2013-10-08 Thread Paul Berry
On 5 October 2013 12:12, Kenneth Graunke wrote: > On 10/02/2013 05:45 PM, Paul Berry wrote: > > GLSL reserves identifiers beginning with "gl_" or containing "__", but > > we haven't been consistent about enforcing this rule. This patch > > makes a

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

2013-10-08 Thread Paul Berry
On 5 October 2013 12:25, Kenneth Graunke wrote: > On 10/02/2013 05:45 PM, Paul Berry wrote: > > This patch modifies the get_variable_being_redeclared() function so > > that it no longer relies on the ast_declaration for the variable being > > redeclared. In future pat

Re: [Mesa-dev] [PATCH 08/10] glsl/linker: Modify array_sizing_visitor to handle named interface blocks.

2013-10-09 Thread Paul Berry
On 8 October 2013 21:17, Jordan Justen wrote: > On Fri, Sep 27, 2013 at 12:05 PM, Paul Berry > wrote: > > Unsized arrays appearing inside named interface blocks now get a > > proper size assigned by the array_sizing_visitor. > > > > Fixes piglit tests: > > -

Re: [Mesa-dev] [PATCH 00/10] glsl: Support unsized arrays in interface blocks.

2013-10-09 Thread Paul Berry
On 8 October 2013 23:25, Jordan Justen wrote: > Patches 1, 2 & 4 - 10: > Reviewed-by: Jordan Justen > > For 8, I replied with a non-essential question, and the same question > is relevant in patch 10. > > For patch 3 I had that question (mentioned on irc) about ir having > ast/parser knowledge.

Re: [Mesa-dev] [PATCH 07/10] glsl: Update ir_variable::max_ifc_array_access properly.

2013-10-09 Thread Paul Berry
On 27 September 2013 12:05, Paul Berry wrote: > This patch adds an implementation of > ir_dereference_record::update_max_array_access(), which ensures that > ir_variable::max_ifc_array_access is properly updated to reflect the > shader's use of arrays appearing within

[Mesa-dev] [PATCH 0/3] Enable GL 3.2 support for i965, bump Mesa version.

2013-10-10 Thread Paul Berry
It's been a long and rocky road, but geometry shader support in Mesa's i965/gen7 driver has finally reached a point I'm willing to call "feature complete". Since geometry shaders were the last remaining feature needed for GL 3.2, it's time to turn on GL 3.2 support. Here is a short patch series t

[Mesa-dev] [PATCH 1/3] i965: Turn on GLSL 1.50 and GL 3.2 support for i965 gen7.

2013-10-10 Thread Paul Berry
Geometry shaders were the last thing we needed to finish before turning on GLSL 1.50 and GL 3.2 support. They are now working well, with just a few piglit failures left to fix. --- src/mesa/drivers/dri/i965/intel_extensions.c | 4 +++- src/mesa/drivers/dri/i965/intel_screen.c | 2 +- 2 files

[Mesa-dev] [PATCH 2/3] mesa: Remove warning that geometry shader support is experimental.

2013-10-10 Thread Paul Berry
Geometry shader support is now working well, and adequately piglit tested. There are just a few piglit failures left to fix. So there's no need for an "experimental" warning anymore. --- src/mesa/main/shaderapi.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/src/mesa/main/shaderapi.c

[Mesa-dev] [PATCH 3/3] mesa: Bump version to 10.0.0.

2013-10-10 Thread Paul Berry
Mesa now supports OpenGL 3.2 and GLSL 1.50, so bump the Mesa major version from 9 to 10 to reflect this. --- VERSION | 2 +- docs/relnotes.html | 2 +- docs/relnotes/10.0.html | 65 + docs/relnotes/9.3.html | 65 --

Re: [Mesa-dev] [PATCH 0/3] Enable GL 3.2 support for i965, bump Mesa version.

2013-10-11 Thread Paul Berry
o the Sandy Bridge geometry shader effort, I'd be delighted to collaborate. Cheers > > Mike > On 11 Oct 2013 05:28, "Paul Berry" wrote: > >> It's been a long and rocky road, but geometry shader support in Mesa's >> i965/gen7 driver has finally reach

[Mesa-dev] [PATCH] mesa: fix transform feedback when a geometry shader is active.

2013-10-11 Thread Paul Berry
From: Bryan Cain When a geometry shader is active, the transform feedback primitive type ("mode") needs to be validated against the geometry shader output primitive type, not the primitive type passed to the glDraw*() function. Fixes the following piglit tests: - glsl-1.50-geometry-primitive-typ

[Mesa-dev] [PATCH] i965/gs: Set the REORDER bit in 3DSTATE_GS.

2013-10-11 Thread Paul Berry
Ivy Bridge's "reorder enable" bit gives us a binary choice for the order in which vertices from triangle strips are delivered to the geometry shader. Neither choice follows the OpenGL spec, but setting the bit is better, because it gets triangle orientation correct. Haswell replaces the "reorder

[Mesa-dev] [PATCH 1/2] vbo: Make vbo_sw_primitive_restart optionally count primitives.

2013-10-11 Thread Paul Berry
This will be necessary in order to get the i965 back-end to produce the correct value of gl_PrimitiveIDIn when using software primitive restart. --- src/mesa/drivers/dri/i965/brw_primitive_restart.c | 2 +- src/mesa/vbo/vbo.h| 3 ++- src/mesa/vbo/vbo_exec_array.c

[Mesa-dev] [PATCH 2/2] i965/gs: Fix gl_PrimitiveIDIn when using SW primitive restart.

2013-10-11 Thread Paul Berry
Ivy Bridge hardware doesn't support primitve restart under all circumstances--when it doesn't, we emulate it in software by splitting up each logical draw operation into multiple 3DPRIMITIVE commands. This causes the hardware's primitive ID counter to be reset to 0, producing incorrect values for g

[Mesa-dev] [PATCH] i965/fs: Remove bogus field prog_data->dispatch_width.

2013-10-11 Thread Paul Berry
Despite the name, this field wasn't being set to the dispatch width at all; it was always 8. The only place it was used was that the constant buffer read length was aligned to it, and as far as I can tell from the docs, there is no need to align this value to the dispatch width; aligning it to a m

Re: [Mesa-dev] [PATCH] i965/gs: Set the REORDER bit in 3DSTATE_GS.

2013-10-11 Thread Paul Berry
On 11 October 2013 14:13, Matt Turner wrote: > On Fri, Oct 11, 2013 at 1:27 PM, Paul Berry > wrote: > > Ivy Bridge's "reorder enable" bit gives us a binary choice for the > > order in which vertices from triangle strips are delivered to the > > geome

[Mesa-dev] [PATCH] glsl: Add new GLSL 1.50 constants.

2013-10-11 Thread Paul Berry
This patch populates the following built-in GLSL 1.50 variables based on constants stored in ctx->Const: - gl_MaxVertexOutputComponents - gl_MaxGeometryInputComponents - gl_MaxGeometryOutputComponents - gl_MaxFragmentInputComponents - gl_MaxGeometryTextureImageUnits - gl_MaxGeometryOutputVertices

Re: [Mesa-dev] [PATCH] glsl: Add new GLSL 1.50 constants.

2013-10-11 Thread Paul Berry
On 11 October 2013 17:53, Matt Turner wrote: > On Fri, Oct 11, 2013 at 5:29 PM, Paul Berry > wrote: > > This patch populates the following built-in GLSL 1.50 variables based > > on constants stored in ctx->Const: > > > > - gl_MaxVertexOutputComponents &g

Re: [Mesa-dev] [PATCH 0/3] Enable GL 3.2 support for i965, bump Mesa version.

2013-10-12 Thread Paul Berry
On 10 October 2013 21:27, Paul Berry wrote: > It's been a long and rocky road, but geometry shader support in Mesa's > i965/gen7 driver has finally reached a point I'm willing to call > "feature complete". Since geometry shaders were the last remaining > fe

Re: [Mesa-dev] [PATCH 7/7] i965: Move the common binding table offset code to brw_shader.cpp.

2013-10-14 Thread Paul Berry
function argument rather than a class member. That way it wouldn't be necessary to grep through the code to verify that no one else uses it. With that changed, this patch is: Reviewed-by: Paul Berry I already sent out a comment on patch 4/7. The remainder of the series is: Reviewed-by: Pau

[Mesa-dev] [PATCH] glsl: In update_max_array_access, fix interface instance check.

2013-10-15 Thread Paul Berry
In commit f878d20 (glsl: Update ir_variable::max_ifc_array_access properly), I accidentally used the wrong kind of check to determine whether the variable being accessed was an interface instance (I used var->get_interface_type() != NULL when I should have used var->is_interface_instance()). As a

Re: [Mesa-dev] [PATCH] i965/fs: Remove bogus field prog_data->dispatch_width.

2013-10-15 Thread Paul Berry
On 11 October 2013 16:18, Eric Anholt wrote: > Paul Berry writes: > > > Despite the name, this field wasn't being set to the dispatch width at > > all; it was always 8. The only place it was used was that the > > constant buffer read length was aligned to it, and

[Mesa-dev] [PATCH] glsl: When disabling gl_PerVertex variables, check that mode matches.

2013-10-15 Thread Paul Berry
In commit 1b4a737 (glsl: Support redeclaration of VS and GS gl_PerVertex output), I added code to ensure that when an unnamed gl_PerVertex interface block is redeclared, any ir_variables that weren't included in the redeclaration are removed from the IR (and the symbol table). This ensures that on

[Mesa-dev] [PATCH 1/2] glsl: Call check_builtin_array_max_size when redeclaring gl_in.

2013-10-15 Thread Paul Berry
Normally when a built-in array (such as gl_ClipDistance) is redeclared, we call get_variable_being_redeclared() to do the redeclaration, and it in turn calls check_builtin_array_max_size() to make sure that the redeclared array size isn't too large. However when a built-in array is redeclared as p

[Mesa-dev] [PATCH 2/2] glsl: Remove unused gl_PerVertex interface blocks.

2013-10-15 Thread Paul Berry
The GLSL 4.10 rules for redeclaration of built-in interface blocks (which we've chosen to regard as clarifications of GLSL 1.50) only require gl_PerVertex blocks to match in shaders that actually use those blocks. The easiest way to implement this is to detect situations where a compiled shader do

[Mesa-dev] [PATCH] glsl: Treat layout-qualifier-id's as case-insensitive in desktop GLSL.

2013-10-15 Thread Paul Berry
In desktop GLSL, location qualifiers are case-insensitive. In GLSL ES, they are case-sensitive. This patch handles the difference by using a new function to match layout qualifiers, match_layout_qualifier(), which calls either strcmp() or strcasecmp() as appropriate. Fixes piglit tests: - layout

[Mesa-dev] [RFC PATCH] glsl: Allow mixing of GLSL 1.40 and later shader versions.

2013-10-16 Thread Paul Berry
--- I'm not 100% sure this is the right way to go, and here's why: Taken together, all the GLSL specs except GLSL 4.30 and GLSL 4.40 tell a consistent story: desktop shader versions 1.10 and 1.20 may be linked together, and desktop shader versions 1.40 and above may be linked together. No other

[Mesa-dev] [PATCH] mesa: Fix geometry shader program queries.

2013-10-16 Thread Paul Berry
The queries GEOMETRY_VERTICES_OUT, GEOMETRY_INPUT_TYPE, and GEOMETRY_OUTPUT_TYPE (defined by GL 3.2) differ from the corresponding queries in ARB_geometry_shader4 in the following ways: - They use different enum values - They can only be queried; they cannot be set. - Attempting to query them yi

Re: [Mesa-dev] [RFC PATCH] glsl: Allow mixing of GLSL 1.40 and later shader versions.

2013-10-16 Thread Paul Berry
On 16 October 2013 16:56, Ian Romanick wrote: > On 10/16/2013 10:29 AM, Paul Berry wrote: > > --- > > > > I'm not 100% sure this is the right way to go, and here's why: > > > > Taken together, all the GLSL specs except GLSL 4.30 and GLSL 4.40 tell >

Re: [Mesa-dev] [PATCH] mesa: Fix geometry shader program queries.

2013-10-17 Thread Paul Berry
On 16 October 2013 23:29, Pohjolainen, Topi wrote: > On Wed, Oct 16, 2013 at 11:13:33AM -0700, Paul Berry wrote: > > The queries GEOMETRY_VERTICES_OUT, GEOMETRY_INPUT_TYPE, and > > GEOMETRY_OUTPUT_TYPE (defined by GL 3.2) differ from the corresponding > > queries in ARB_ge

[Mesa-dev] [PATCH 1/8] i965/vec4: Add the ability for attributes to be interleaved.

2013-10-17 Thread Paul Berry
When geometry shaders are operated in "single" or "dual instanced" mode, a single set of geometry shader inputs is interleaved into the thread payload (with each payload register containing a pair of inputs) in order to save register space. This patch modifies vec4_visitor::lower_attributes_to_hw_

[Mesa-dev] [PATCH 0/8] i965/gs: Use DUAL_INSTANCED mode to ease register pressure.

2013-10-17 Thread Paul Berry
Previously, i965 geometry shaders always operated in DUAL_OBJECT mode, which is similar to vertex shader operation in that two independent sets of inputs get dispatched to a single SIMD4x2 geometry shader thread, which executes them both in parallel. When register usage is tight, we need to switch

[Mesa-dev] [PATCH 3/8] i965/vec4: Add the ability to suppress register spilling.

2013-10-17 Thread Paul Berry
In future patches, this will allow us to first try compiling a geometry shader in DUAL_OBJECT mode (which is more efficient but uses more registers) and then if spilling is required, fall back on DUAL_INSTANCED mode. --- src/mesa/drivers/dri/i965/brw_vec4.h | 9 - src/

[Mesa-dev] [PATCH 2/8] i965/vec4: if register allocation fails, don't try to schedule.

2013-10-17 Thread Paul Berry
Otherwise the scheduler would be invoked with prog_data->total_grf == 0, causing havoc. In a future patch, this will allow us to try compiling a geometry shader in DUAL_OBJECT mode with spilling disabled, and then fall back to DUAL_INSTANCED mode if that failed. --- src/mesa/drivers/dri/i965/brw_

[Mesa-dev] [PATCH 4/8] i965/gs: Add the ability to compile a DUAL_INSTANCED geometry shader.

2013-10-17 Thread Paul Berry
Not yet enabled. --- src/mesa/drivers/dri/i965/brw_context.h | 6 ++ src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 25 +-- src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h | 3 ++- src/mesa/drivers/dri/i965/gen7_gs_state.c | 4 +++- 4 files chang

[Mesa-dev] [PATCH 5/8] i965/gs: Fix up gl_PointSize input swizzling for DUAL_INSTANCED gs.

2013-10-17 Thread Paul Berry
Geometry shaders that run in "DUAL_INSTANCED" mode store their inputs in vec4's. This means that when compiling gl_PointSize input swizzling (a MOV instruction which uses a geometry shader input as both source and destination), we need to do two things: - Set force_writemask_all to ensure that th

[Mesa-dev] [PATCH 7/8] i965/gs: If a DUAL_OBJECT gs would spill, fall back to DUAL_INSTANCED.

2013-10-17 Thread Paul Berry
This is similar to what we do for 16-wide vs 8-wide fragment shaders. First we try compiling the geometry shader in DUAL_OBJECT mode. If we can't do that without spilling, we fall back on DUAL_INSTANCED mode, which should require less spilling (since it uses an interleaved layout of payload regist

[Mesa-dev] [PATCH 6/8] i965/gs: fix up primitive ID workaround for DUAL_INSTANCE dispatch.

2013-10-17 Thread Paul Berry
Parallel change to "i965/gs: Fix up gl_PointSize input swizzling for DUAL_INSTANCED gs.", except applied to the gl_PrimitiveID fixup instead of the gl_PointSize fixup. --- src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 18 +- src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp |

[Mesa-dev] [PATCH 8/8] i965: Reduce gl_MaxGeometryInputComponents to 64.

2013-10-17 Thread Paul Berry
Although in principle there is no hardware limitation that prevents gl_MaxGeometryInputComponents from being set to 128 on Gen7, we have the following limitations in the vec4 compiler back end: - Registers assigned to geometry shader inputs can't be spilled or later re-used for any other purpose

Re: [Mesa-dev] [RFC PATCH] glsl: Allow mixing of GLSL 1.40 and later shader versions.

2013-10-17 Thread Paul Berry
On 16 October 2013 22:30, Kenneth Graunke wrote: > On 10/16/2013 04:56 PM, Ian Romanick wrote: > > On 10/16/2013 10:29 AM, Paul Berry wrote: > >> --- > >> > >> I'm not 100% sure this is the right way to go, and here's why: > >> > >&

Re: [Mesa-dev] strcasecmp() not found w/ MSVC

2013-10-17 Thread Paul Berry
On 17 October 2013 12:35, Brian Paul wrote: > Hi Paul, > > It looks like MSVC doesn't have the strcasecmp() function you recently > employed in src/glsl/glsl_parser.yy. > > Looks like the work-around is _stricmp, per > http://stackoverflow.com/**questions/3694723/error-c3861-** > strcasecmp-ident

[Mesa-dev] [PATCH] glsl: Fix MSVC build (missing strcasecmp())

2013-10-17 Thread Paul Berry
MSVC doesn't have a strcasecmp() function; it uses _stricmp() instead. --- src/glsl/glsl_parser.yy | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index ba2dc63..00589e2 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl

[Mesa-dev] [PATCH] glsl/linker: Allow mixing of desktop GLSL versions.

2013-10-17 Thread Paul Berry
Previously, Mesa followed the linkage rules outlined in the GLSL 1.20-1.40 specs, which (collectively) said that GLSL versions 1.10 and 1.20 could be linked together, but no other versions could be linked. In GLSL 4.30, the linkage rules were relaxed so that any two desktop GLSL versions can be li

Re: [Mesa-dev] i965 driver questions

2013-10-18 Thread Paul Berry
On 9 October 2013 03:33, Rogovin, Kevin wrote: > Hi all, > > I've been digging through the i965 driver implementation attempting to > get my head around it. I have a few questions which I hope can be answered: > > * What is LIR? The comments say that Mesa GLSL IR is converted into > LIR whic

Re: [Mesa-dev] [PATCH 1/6] glsl: When constructing a variable with an interface type, set interface_type

2013-10-18 Thread Paul Berry
r->type->is_array() and var->type->fields.array->is_interface(), then var->interface_type == var->type->fields.array. With that fixed, this patch is: Reviewed-by: Paul Berry > > > However, the ir_variable constructor doesn't maintain either invariant. > Tha

Re: [Mesa-dev] [PATCH 2/6] glsl/tests: Verify vertex shader built-ins generated by _mesa_glsl_initialize_variables

2013-10-18 Thread Paul Berry
riable_modes() > +{ > + foreach_list(node, &this->ir) { > + ir_variable *const var = ((ir_instruction *) node)->as_variable(); > + > + switch (var->mode) { > + case ir_var_auto: > + case ir_var_uniform: > + case ir_var_shader_in: > +

Re: [Mesa-dev] [PATCH 3/6] glsl/tests: Verify fragment shader built-ins generated by _mesa_glsl_initialize_variables

2013-10-18 Thread Paul Berry
tion); > + EXPECT_NE(VARYING_SLOT_BFC0, var->location); > + EXPECT_NE(VARYING_SLOT_BFC1, var->location); > + EXPECT_NE(VARYING_SLOT_EDGE, var->location); > + EXPECT_NE(VARYING_SLOT_CLIP_VERTEX, var->location); > + EXPECT_NE(VARYING_SLOT_LAYER,

Re: [Mesa-dev] [PATCH 5/6] glsl/tests: Unit test vertex shader in / out with link_invalidate_variable_locations

2013-10-18 Thread Paul Berry
VERT_ATTRIB_GENERIC0, > + VARYING_SLOT_VAR0); > + > + EXPECT_EQ(VARYING_SLOT_COL0, var->location); > + EXPECT_EQ(0u, var->location_frac); > + EXPECT_TRUE(var->explicit_location); > + EXPECT_FALSE(var->is_unmatched_generic_inout); > +} > + > +TEST_F(invalidate_locations, vertex_out_builtin_without_explicit) > +{ > + /* This test is almost identical to vertex_out_builtin. However, > +* ir_variable::explicit_location is not. > +* link_invalidate_variable_locations has the behavior that non-generic > +* inputs (or outputs) are not modified. > +*/ > I have similar feelings about this test. > + ir_variable *const var = > + new(mem_ctx) ir_variable(glsl_type::vec(4), > + "gl_FrontColor", > + ir_var_shader_out); > + > + EXPECT_FALSE(var->explicit_location); > + EXPECT_EQ(-1, var->location); > + > + var->location = VARYING_SLOT_COL0; > + > + ir.push_tail(var); > + > + link_invalidate_variable_locations(&ir, > + VERT_ATTRIB_GENERIC0, > + VARYING_SLOT_VAR0); > + > + EXPECT_EQ(VARYING_SLOT_COL0, var->location); > + EXPECT_EQ(0u, var->location_frac); > + EXPECT_FALSE(var->explicit_location); > + EXPECT_FALSE(var->is_unmatched_generic_inout); > +} > -- > 1.8.1.4 > With the *_builtin_without_explicit issues resolved, this patch is: Reviewed-by: Paul Berry ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 6/6] glsl: Simplify the interface to link_invalidate_variable_locations

2013-10-18 Thread Paul Berry
eneric_inout can be > simplified. > > Signed-off-by: Ian Romanick > Cc: Paul Berry > --- > src/glsl/linker.cpp | 48 ++--- > src/glsl/linker.h| 3 +- > src/glsl/tests/invalidate_locations_test.cpp | 62 >

Re: [Mesa-dev] Documentation plan: request for comments

2013-10-18 Thread Paul Berry
On 11 October 2013 14:40, Chad Versace wrote: > On 10/10/2013 01:38 AM, Rogovin, Kevin wrote: > >> Hello all, >> >>My current goal is to add documentation to Mesa so that the ramp up >> time of Mesa goes down a great deal. >> > > I support that goal. When I see other projects that publish goo

Re: [Mesa-dev] [PATCH 1/6] glsl: When constructing a variable with an interface type, set interface_type

2013-10-18 Thread Paul Berry
On 18 October 2013 12:17, Paul Berry wrote: > On 11 October 2013 11:18, Ian Romanick wrote: > >> From: Ian Romanick >> >> Ever since the addition of interface blocks with instance names, we have >> had an implicit invariant: >> >> var-

Re: [Mesa-dev] [PATCH] glsl: Initialize per_vertex_accumluator::fields.

2013-10-18 Thread Paul Berry
On 11 October 2013 23:23, Vinson Lee wrote: > Fixes "Uninitialized pointer field" defect reported by Coverity. > > Signed-off-by: Vinson Lee > Reviewed-by: Paul Berry > --- > src/glsl/builtin_variables.cpp | 3 ++- > 1 file changed, 2 insertions(+), 1 deleti

Re: [Mesa-dev] [PATCH 3/8] mesa: Pass number of samples as a program state variable

2013-10-18 Thread Paul Berry
>return _NEW_TRACK_MATRIX; > > + case STATE_NUM_SAMPLES: > + return _NEW_MULTISAMPLE; > I think this should be _NEW_BUFFERS. _NEW_MULTISAMPLE is only flagged when something in gl_multisample_attrib changes, and nothing in that category affects ctx->DrawBuffer->

Re: [Mesa-dev] [PATCH 4/8] glsl: Add new builtins required by GL_ARB_sample_shading

2013-10-18 Thread Paul Berry
ce they don't appear in any shader stage except the fragment shader), and that way they won't take up space in all the data structures that we use to represent varyings (such as the i965 VUE map). With that fixed, and assuming that the other issues brought up by Ken and Ian

Re: [Mesa-dev] [PATCH 5/8] i965/gs: Fix up gl_PointSize input swizzling for DUAL_INSTANCED gs.

2013-10-19 Thread Paul Berry
On 18 October 2013 17:04, Eric Anholt wrote: > Paul Berry writes: > > > Geometry shaders that run in "DUAL_INSTANCED" mode store their inputs > > in vec4's. This means that when compiling gl_PointSize input > > swizzling (a MOV instruction which uses a g

Re: [Mesa-dev] [PATCH 7/8] i965/gs: If a DUAL_OBJECT gs would spill, fall back to DUAL_INSTANCED.

2013-10-19 Thread Paul Berry
On 18 October 2013 16:46, Eric Anholt wrote: > Paul Berry writes: > > Since most geometry shaders used in piglit testing are small, > > DUAL_INSTANCED mode won't get exercised very much in a normal piglit > > run. To force DUAL_INSTANCED mode to be used for all

Re: [Mesa-dev] [PATCH] glsl/linker: Allow mixing of desktop GLSL versions.

2013-10-19 Thread Paul Berry
On 18 October 2013 11:07, Ian Romanick wrote: > On 10/17/2013 08:07 PM, Paul Berry wrote: > > Previously, Mesa followed the linkage rules outlined in the GLSL > > 1.20-1.40 specs, which (collectively) said that GLSL versions 1.10 and > > 1.20 could be linked together, but no

Re: [Mesa-dev] [PATCH 5/8] i965: Implement FS backend for ARB_sample_shading

2013-10-19 Thread Paul Berry
On 18 October 2013 10:30, Anuj Phogat wrote: > I know we can specify stride if we have a brw_reg :- > fs_reg (stride(brw_vec1_grf(0, 0), 2, 4, 0)); > > But I could not find a reliable way to use stride if we have a fs_reg. > That's why I used OR to get the desired result. > The right way to do

Re: [Mesa-dev] [PATCH 5/8] i965: Implement FS backend for ARB_sample_shading

2013-10-19 Thread Paul Berry
On 14 October 2013 10:12, Anuj Phogat wrote: > Implement the FS backend for new builtins added by the extension: > in vec2 gl_SamplePosition > in int gl_SampleID > in int gl_NumSamples > out int gl_SampleMask[] > There is a lot going on in this one patch, and it's getting hard to follow all the

Re: [Mesa-dev] [PATCH 6/8] i965/gen6: Enable the features required for GL_ARB_sample_shading

2013-10-20 Thread Paul Berry
On 14 October 2013 10:12, Anuj Phogat wrote: > - Enable GEN6_WM_MSDISPMODE_PERSAMPLE, GEN6_WM_POSOFFSET_SAMPLE, > GEN6_WM_OMASK_TO_RENDER_TARGET as per extension's specification. > - Don't enable GEN6_WM_16_DISPATCH_ENABLE when GEN6_WM_MSDISPMODE_PERSAMPLE > is enabled. Refer SNB PRM Vol. 2,

Re: [Mesa-dev] [PATCH 7/8] i965/gen7: Enable the features required for GL_ARB_sample_shading

2013-10-20 Thread Paul Berry
On 14 October 2013 10:12, Anuj Phogat wrote: > - Enable GEN7_WM_MSDISPMODE_PERSAMPLE, GEN7_WM_POSOFFSET_SAMPLE, > GEN7_WM_OMASK_TO_RENDER_TARGET as per extension's specification. > - Don't enable GEN7_WM_16_DISPATCH_ENABLE when GEN7_WM_MSDISPMODE_PERSAMPLE > is enabled. Refer IVB PRM Vol. 2,

Re: [Mesa-dev] [PATCH 7/8] i965/gen7: Enable the features required for GL_ARB_sample_shading

2013-10-20 Thread Paul Berry
On 16 October 2013 15:20, Ian Romanick wrote: > On 10/16/2013 02:57 PM, Anuj Phogat wrote: > > On Tue, Oct 15, 2013 at 3:48 PM, Kenneth Graunke > wrote: > >> On 10/14/2013 10:12 AM, Anuj Phogat wrote: > >>> - Enable GEN7_WM_MSDISPMODE_PERSAMPLE, GEN7_WM_POSOFFSET_SAMPLE, > >>> GEN7_WM_OMASK_TO

Re: [Mesa-dev] [PATCH 6/8] i965/gen6: Enable the features required for GL_ARB_sample_shading

2013-10-20 Thread Paul Berry
On 20 October 2013 07:25, Paul Berry wrote: > On 14 October 2013 10:12, Anuj Phogat wrote: > >> - Enable GEN6_WM_MSDISPMODE_PERSAMPLE, GEN6_WM_POSOFFSET_SAMPLE, >> GEN6_WM_OMASK_TO_RENDER_TARGET as per extension's specification. >> - Don't enab

Re: [Mesa-dev] [PATCH 0/8] Implement GL_ARB_sample_shading on Intel hardware

2013-10-20 Thread Paul Berry
ding > i965/gen7: Enable the features required for GL_ARB_sample_shading > i965: Enable ARB_sample_shading on intel hardware >= gen6 > I sent out comments on patches 3-7. Patch 8 is: Reviewed-by: Paul Berry I'll defer to the other

Re: [Mesa-dev] [PATCH 1/3] glsl: Use saved values instead of recomputing them.

2013-10-21 Thread Paul Berry
On 16 October 2013 16:56, Matt Turner wrote: > --- > src/glsl/opt_algebraic.cpp | 12 > 1 file changed, 4 insertions(+), 8 deletions(-) > Series is: Reviewed-by: Paul Berry > > diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp > index 3e

[Mesa-dev] [PATCH 1/2] glsl: mark variables produced by lower_named_interface_blocks.

2013-10-21 Thread Paul Berry
These variables will need to be treated specially by program_resource_visitor, so that they can be addressed through the API using their interface block name (and array index, for interface block arrays). --- src/glsl/ir.h | 12 src/glsl/lower_named_interfa

  1   2   3   4   5   6   7   8   9   10   >