Commit Graph

71 Commits

Author SHA1 Message Date
Lionel Landwerlin 9a806d2d15 mesa: add NV_image_formats extension support
This extension can be enabled automatically as it is a subset of
ARB_shader_image_load_store.

v2: Replace helper function by qualifier struct field (Ilia)
    Enable NV_image_formats using ARB_shader_image_load_store (Ilia)

v3: Drop extension field from gl_extensions (Ilia)
    Release notes (Ilia)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98480
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2016-11-18 13:27:28 +00:00
Marek Olšák a4a93103fb glsl: use the linear allocator for ast_node and derived classes
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-31 11:53:38 +01:00
Samuel Pitoiset dd2bda7002 glsl: process local_size_variable input qualifier
This is the new layout qualifier introduced by
ARB_compute_variable_group_size which allows to use a variable work
group size.

v4: - add missing '%s' in the monster format string

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-07 00:18:57 +02:00
Kenneth Graunke d82f8d9772 glsl: Handle patch qualifier on interface blocks.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2016-08-30 22:09:36 -07:00
Ian Romanick 06201e4f1a glsl: Allow invocations layout qualifier with GL_OES_geometry_shader
Fixes

dEQP-GLES31.functional.geometry_shading.instanced.geometry_1_invocations
dEQP-GLES31.functional.geometry_shading.instanced.invocation_per_layer_2d_array
dEQP-GLES31.functional.geometry_shading.instanced.invocation_per_layer_2d_multisample_array
dEQP-GLES31.functional.geometry_shading.instanced.invocation_per_layer_3d
dEQP-GLES31.functional.geometry_shading.instanced.invocation_per_layer_cubemap
dEQP-GLES31.functional.geometry_shading.instanced.multiple_layers_per_invocation_2d_array
dEQP-GLES31.functional.geometry_shading.instanced.multiple_layers_per_invocation_2d_multisample_array
dEQP-GLES31.functional.geometry_shading.instanced.multiple_layers_per_invocation_3d
dEQP-GLES31.functional.geometry_shading.instanced.multiple_layers_per_invocation_cubemap
dEQP-GLES31.functional.geometry_shading.query.geometry_shader_invocations

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-08-26 15:03:14 -07:00
Ilia Mirkin 4b6819b407 glsl: process blend_support_* qualifiers
v2 (Ken): Add a BLEND_NONE enum value (no qualifiers in use).
v3 (Ken): Rename gl_blend_support_qualifier to gl_advanced_blend_mode.
v4 (Ken): Mark map[] as static const (Ilia).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2016-08-25 19:22:09 -07:00
Francisco Jerez 19e929a177 glsl: Handle the inout qualifier in fragment shader output declarations.
According to the EXT_shader_framebuffer_fetch extension the inout
qualifier can be used on ESSL 3.0+ shaders to declare a special kind
of fragment output that gets implicitly initialized with the previous
framebuffer contents at the current fragment coordinates.  In addition
we allow using the same language to define FB fetch outputs in GLSL
1.3+ shaders in preparation for the desktop MESA_shader_framebuffer_fetch
extensions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-08-24 13:28:30 -07:00
Kenneth Graunke eb1a0ddfd5 glsl: Mark tessellation qualifier maps static const.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2016-08-23 21:15:59 -07:00
Kenneth Graunke f9f462936a glsl: Fix invariant matching in GLSL 4.30 and GLSL ES 1.00.
Old languages (GLSL <= 4.20 and GLSL ES 1.00) require "invariant"
to be specified on both inputs and outputs, and match when linking.

New languages only allow outputs to be qualified as "invariant"
and remove the "invariant must match" restriction when linking
varyings (because no input can have that qualifier).

Commit 426a50e208 introduced the new
behavior for ES 3.00.  It also removed the "must match" restriction
for ES 1.00 shaders, which I believe is incorrect.  This patch adds
that back, as well as making 4.30+ follow the new rules.

Thanks to Qiankun Miao for noticing this discrepancy.

Fixes a WebGL 2.0 conformance test when run in Chromium:
https://www.khronos.org/registry/webgl/sdk/tests/deqp/data/gles3/shaders/qualification_order.html?webglVersion=2

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96971
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2016-08-11 23:56:53 -07:00
Kenneth Graunke 58709d36d7 glsl: Add extension plumbing for OES/EXT_tessellation_shader.
This adds the #extension directive support, built-in #defines,
lexer keyword support, and updates has_tessellation_shader().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2016-08-08 09:59:03 -07:00
Kenneth Graunke 86915b495b glsl: Simplify interface qualifier parsing.
This better matches the grammar in section 4.3.9 of the GLSL 4.5 spec,
and also removes some redundant code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2016-08-07 23:48:48 -07:00
Kenneth Graunke d0642c52fc glsl: Add a has_tessellation_shader() helper.
Similar to has_geometry_shader(), has_compute_shader(), and so on.
This will make it easier to add more conditions here later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2016-08-07 23:47:55 -07:00
Dave Airlie 3466db3969 glsl/parser: handle multiple layout sections with AST nodes.
For geometry/compute inputs and tess control outputs, we create
an AST node to keep track of some things. However if we have
multiple layout sections, we don't ever link the node into the AST.

This is because we create the node on the rightmost layout declaration
and don't pass it back in so it gets linked at the end of the parsing
of the rightmost.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-23 16:20:01 +10:00
Timothy Arceri daa8df590b glsl: parse component layout qualifier
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-01 23:12:52 +10:00
Timothy Arceri c9afd94af6 glsl: parse new transform feedback layout qualifiers
We reuse the existing offset field for holding the xfb_offset
expression but create a new flag as to avoid hitting the rules
for the offset qualifier for UBOs.

xfb_buffer qualifiers require extra processing when merging as
they can be applied to global out defaults. We just apply the
same rules as we do for the stream qualifier as the spec says:

   "The *xfb_buffer* qualifier follows the same conventions,
    behavior, defaults, and inheritance rules as the qualifier
    stream, and the examples for stream apply here as well."

For xfb_stride we push everything into a global out field for
later processing as xfb_stride applies to the entire buffer.
We still need to have a separate field to store per variable
strides because they can still effect implicit offsets
e.g. when applied to block members with implicit offsets.

Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-03-31 12:50:00 +11:00
Kenneth Graunke af41c0b7e0 glsl: Add function parameters to the parser symbol table.
In a shader such as:

    struct S { float f; }
    float identity(float S) { return S; }

we would think that "S" in "return S" referred to a structure, even
though it's shadowed by the "float S" parameter in the inner struct.

This led to the parser's grammar seeing TYPE_IDENTIFIER and getting
confused.

Fixes dEQP-GLES2.functional.shaders.scoping.valid.
function_parameter_hides_struct_type_{vertex,fragment}.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2016-03-07 14:09:55 -08:00
Kenneth Graunke c4960068d5 glsl: Add single declaration variables to the symbol table too.
The lexer/parser use a symbol table to classify identifiers as
variables, functions, or structure types.

For some reason, we neglected to add variables in simple declarations
such as

    int x = 5;

but did add subsequent variables in multi-declarations:

    int x = 5, y = 6; // y gets added, but not x, for some reason

Fixes four dEQP-GLES2.functional.shaders.scoping.valid subcases:
- local_int_variable_hides_struct_type_vertex
- local_int_variable_hides_struct_type_fragment
- local_struct_variable_hides_struct_type_vertex
- local_struct_variable_hides_struct_type_fragment

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2016-03-07 14:09:31 -08:00
Timothy Arceri 5a27fefffe glsl: parse align layout qualifier
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2016-03-05 19:39:01 +11:00
Timothy Arceri 6f45484ac7 glsl: enable offset layout qualifier for ARB_enhanced_layouts
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
2016-03-05 19:38:26 +11:00
Timothy Arceri 78d3098c05 glsl: rework parsing of blocks
Previously interface blocks were giving the global default flags of
uniform blocks. This meant we could not check for invalid qualifiers
on interface blocks because they always contained invalid flags.

This changes parsing so that interface blocks now get an empty
set of layouts.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2016-03-05 19:07:00 +11:00
Emil Velikov eb63640c1d glsl: move to compiler/
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
2016-01-26 16:08:33 +00:00
Renamed from src/glsl/glsl_parser.yy (Browse further)