Re: [Mesa-dev] [PATCH] glsl: allow duplicate layout-qualifier-names

2016-01-14 Thread Matt Turner
On Wed, Jan 13, 2016 at 9:26 PM, Timothy Arceri
 wrote:
> The special case from detecting stream duplicates is also
> removed, as testing never trigged this error.
>
> From the ARB_shading_language_420pack spec:
>
>"More than one layout qualifier may appear in a single
>declaration. If the same layout-qualifier-name occurs in
>multiple layout qualifiers for the same declaration, the
>last one overrides the former ones."
>
> While the extension spec is taking about multiple layout
> qualifiers we interpret that to mean layout-qualifier-names
> can also occur multiple times within a single layout qualifier.
>
> In Section 4.4 (Layout Qualifiers) of the GLSL 4.40 spec it
> clarifies this:
>
>"More than one layout qualifier may appear in a single
>declaration. Additionally, the same layout-qualifier-name
>can occur multiple times within a layout qualifier or across
>multiple layout qualifiers in the  same declaration"
> ---

As I said in reply to the piglit tests, I don't think this should be
interpreted as a clarification but as an actual behavioral change in
GLSL 4.40/ARB_enhanced_layouts.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glsl: allow duplicate layout-qualifier-names

2016-01-13 Thread Timothy Arceri
The special case from detecting stream duplicates is also
removed, as testing never trigged this error.

From the ARB_shading_language_420pack spec:

   "More than one layout qualifier may appear in a single
   declaration. If the same layout-qualifier-name occurs in
   multiple layout qualifiers for the same declaration, the
   last one overrides the former ones."

While the extension spec is taking about multiple layout
qualifiers we interpret that to mean layout-qualifier-names
can also occur multiple times within a single layout qualifier.

In Section 4.4 (Layout Qualifiers) of the GLSL 4.40 spec it
clarifies this:

   "More than one layout qualifier may appear in a single
   declaration. Additionally, the same layout-qualifier-name
   can occur multiple times within a layout qualifier or across
   multiple layout qualifiers in the  same declaration"
---

 The Nvidia driver allows this for GLSL 4.20 but not for the
 extension.

 Piglit tests:

 http://patchwork.freedesktop.org/patch/70459/

 src/glsl/ast_type.cpp | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index f4e51b8..afae687 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -158,7 +158,8 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
   allowed_duplicates_mask.flags.i |=
  stream_layout_mask.flags.i;
 
-   if ((this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) {
+   if (!state->has_420pack() &&
+   (this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) {
   _mesa_glsl_error(loc, state,
   "duplicate layout qualifiers used");
   return false;
@@ -209,11 +210,6 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
 this->flags.q.stream = 1;
 this->stream = state->out_qualifier->stream;
  }
-  } else {
- if (q.flags.q.explicit_stream) {
-_mesa_glsl_error(loc, state,
- "duplicate layout `stream' qualifier");
- }
   }
}
 
-- 
2.4.3

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