Commit Graph

572 Commits

Author SHA1 Message Date
John Kessenich
548c3adecd Front-end: Complete GL_ARB_compute_shader, previous commit was missing new barriers.
This amends the previous commit, which ommitted barriers in version 420 for compute shader.
2016-05-30 19:38:39 -06:00
John Kessenich
d94c003fb7 Front-end: Complete GL_ARB_compute_shader implementation.
Core compute shaders were working, but the extension wasn't implemented.
2016-05-30 19:29:40 -06:00
John Kessenich
0f5e3ad23c Fix issue #313: Catch internal attempts to modify built-in symbols that don't exist.
Also beefed up support for running compute shaders is #version 420, but this
work is only partially done.
2016-05-29 18:24:31 -06:00
John Kessenich
7d8141987c Merge pull request #309 from jekstrand/sampler-params
SPV: Don't shadow sampler parameters when performing function calls
2016-05-25 17:35:54 -06:00
Jason Ekstrand
76d0ac1a6f SPV: Don't shadow sampler parameters when performing function calls
Fixes #179
2016-05-25 13:49:47 -07:00
Thomas Perl
7bfd08d21c Check for linking multiple ES shaders to the same stage 2016-05-25 09:26:43 +02:00
Thomas Perl
0bb546f8ae Fix test case for the "empty" linker test case
The test result should only give one error about linking
ES and non-ES shading language compilation units:

 - empty.frag: No version info, interpreted as 100, ES
 - empty2.frag: No version info, interpreted as 100, ES
 - empty3.frag: Version declared as 110, non-ES

Previously, because the new intermediate is always created
without version/profile information, there would be two
linker errors:

 1.) When merging the new intermediate with empty.frag
 2.) When merging (new intermediate + empty.frag + empty2.frag) with empty3.frag

Now, there is only one error; as the error with merging the
new intermediate with empty.frag has been removed.
2016-05-24 13:24:24 +02:00
Thomas Perl
63d4794e8e Add test case: Link 2 ESSL fragment shader units 2016-05-24 13:15:01 +02:00
John Kessenich
d82c906378 Vulkan: Finish semantics for what creates spec-const-semantics.
Note: This required adding a new test mode to see the AST for vulkan tests.
This also required reworking some deeper parts of type creation, regarding
when storage qualification and constness is deduced bottom-up or dictated
top-down.
2016-05-23 23:10:18 -06:00
Rex Xu
bbceed7be3 SPV: Fix an issue of interpolation decoration.
GLSL interpolation qualifiers and auxiliary storage qualifiers are not
mutually exclusive. So when they are translated to SPIR-V decorations, two
independent utility methods should be employed to do this job.
2016-05-21 09:45:47 +08:00
John Kessenich
2921e0c54a KHR_vulkan_glsl: name mangle distinguish pure textures.
Fixes issue #252.
2016-05-20 16:59:27 -06:00
John Kessenich
22e0d41448 SPV: Don't put locations on OpTypeStruct. Related to Issue #291. 2016-05-20 15:40:53 -06:00
John Kessenich
eee0c73432 Merge pull request #297 from antiagainst/config-tests
Test compiling shaders with given resource limits using GTest.
2016-05-20 13:46:31 -06:00
John Kessenich
0133c1233e HLSL: Add more matrix types to the grammar. 2016-05-20 12:17:26 -06:00
John Kessenich
8d72f1a2c4 Full stack: distinguish between a scalar and a vector of size 1.
There have been GLSL extensions considering this, and HLSL does it.
This is a fully backward compatible change that allows this distinction.
2016-05-20 12:14:39 -06:00
John Kessenich
823fc65644 SPV: Don't emit memory barrier for ESSL barrier(), but still do for GLSL barrier().
Addresses issue #205.
Current open Khronos bug for finalizing this.
2016-05-19 18:26:42 -06:00
Lei Zhang
1b141728a6 Test compiling shaders with given resource limits using GTest. 2016-05-19 14:18:21 -04:00
John Kessenich
b5cfd79f0a Merge pull request #288 from thp/attribute-reflection
Reflection: Add support for querying vertex attributes in reflection API
2016-05-19 10:13:08 -06:00
Thomas Perl
bef7428dfd Update test cases for vertex attribute reflection 2016-05-19 09:30:29 +02:00
John Kessenich
9349108d06 Merge pull request #295 from amdrexu/bugfix
Parser: Redeclaration of gl_CullDistance is disallowed mistakenly.
2016-05-19 00:00:54 -06:00
Rex Xu
3d9165fde4 Parser: Redeclaration of gl_CullDistance is disallowed mistakenly. 2016-05-19 12:26:27 +08:00
scygan
2c86427640 Fix missing location decoration for structures put directly on input/output interfaces
Spec for decorating the OpVariable:
	"The remaining variables listed by OpEntryPoint with the Input or Output storage class form the user-defined variable interface. These variables must be identified with a Location decoration"

Spec for decorating struct type:
	"The layout of a structure type used as an Input or Output depends on whether it is also a Block (i.e. has a Block decoration).
	If it is a not a Block, then the structure type must have a Location decoration"
2016-05-18 18:22:21 +02:00
John Kessenich
6e0985dd9d Merge branch 'struct_member_decorations' of https://github.com/scyganINTEL/glslang into scyganINTEL-struct_member_decorations 2016-05-17 10:03:37 -06:00
Rex Xu
c1992e5e57 SPV: Correct an issue in createUnaryMatrixOperation().
Type of the source is not necessarily the same as that of the destination.
2016-05-17 18:57:18 +08:00
John Kessenich
ebb505355d SPV: Don't add clip/cull distance capabilities unless used.
These capabalities were added on declaration of the members, but
that is considered too aggressive, as those members are automatically
declared in some shaders that don't use them.  Now, actual access
is needed to make the capabalities be declared.
2016-05-16 19:32:59 -06:00
John Kessenich
e5f29393da Tests: Add a set of gtest-file-based HLSL tests. 2016-05-16 17:39:50 -06:00
John Kessenich
7a27de6dd1 Merge pull request #253 from amdrexu/bugfix2
SPV: Handle matrix's OpFConvert vector by vector.
2016-05-16 16:49:20 -06:00
Rex Xu
62dda787c7 Parser: Add missing vector relational functions for double type. 2016-05-14 14:21:16 +08:00
Rex Xu
73e3ce78f4 SPV: Handle matrix's OpFConvert vector by vector. 2016-05-14 09:20:52 +08:00
John Kessenich
4678ca9dac HLSL: Add function call syntax and AST building. 2016-05-13 09:33:42 -06:00
John Kessenich
36962c7ab7 Merge pull request #276 from amdrexu/bugfix
Parser: Redeclare gl_ClipDistance/gl_CullDistance should update their array sizes.
2016-05-12 14:22:56 -06:00
Rex Xu
5839031759 SPV: Add capability ImageGatherExtended if necessary. 2016-05-11 16:38:50 +08:00
Rex Xu
827b23b8a1 Parser: Redeclare gl_ClipDistance/gl_CullDistance should update their array sizes. 2016-05-11 15:50:41 +08:00
John Kessenich
3357d870e4 Merge pull request #222 from Qining/support-precise
Full stack: Support *precise* qualifier
2016-05-09 20:18:33 -06:00
John Kessenich
7b3096a93d Merge pull request #270 from scyganINTEL/bitfield_buildins
Use proper precision qualifiers for bitfield build-in functions on ES
2016-05-09 20:17:40 -06:00
GregF
5bdf49cdc8 fix check for non-positive array size 2016-05-09 17:07:04 -06:00
scygan
9c56d84b73 Use proper precision qualifiers for bitfield build-in functions on ES
This change causes ES shaders to precision qualifiers for build-in functions as defined in ESSL spec. It especially mattersfor functions that are defined as highp or taking a highp.

Fixes vulkanCTS dEQP-VK.glsl.builtin.function.integer.bitfieldreverse.*, where bitfieldReverse() retval was wrongly marked as RelaxedPrecision.

Note: floatBitsToInt/floatBitsToUInt precision is also broken, but in different way - so it is not addressed here.
2016-05-09 17:51:25 +02:00
qining
5bec2b5619 integer type operation should not be noContraction 2016-05-09 10:46:40 -04:00
qining
0c96db5a4c add a test for matrix, fix a variable name 2016-05-09 10:46:40 -04:00
qining
1a0d93f416 Fix the test of precise output function parameter
Rebase to 5cc344d8ce and update the
expected test result.
2016-05-09 10:46:40 -04:00
qining
9220dbb078 Precise and noContraction propagation
Reimplement the whole workflow to make that: precise'ness of struct
    members won't spread to other non-precise members of the same struct
    instance.

    Approach:
    1. Build the map from symbols to their defining nodes. And for each
    object node (StructIndex, DirectIndex, Symbol nodes, etc), generates an
    accesschain path. Different AST nodes that indicating a same object
    should have the same accesschain path.

    2. Along the building phase in step 1, collect the initial set of
    'precise' (AST qualifier: 'noContraction') objects' accesschain paths.

    3. Start with the initial set of 'precise' accesschain paths, use it as
    a worklist, do as the following steps until the worklist is empty:

        1) Pop an accesschain path from worklist.
        2) Get the symbol part from the accesschain path.
        3) Find the defining nodes of that symbol.
        4) For each defining node, check whether it is defining a 'precise'
        object, or its assignee has nested 'precise' object. Get the
        incremental path from assignee to its nested 'precise' object (if
        any).
        5) Traverse the right side of the defining node, obtain the
        accesschain paths of the corresponding involved 'precise' objects.
        Update the worklist with those new objects' accesschain paths.
        Label involved operations with 'noContraction'.

    In each step, whenever we find the parent object of an nested object is
    'precise' (has 'noContraction' qualifier), we let the nested object
    inherit the 'precise'ness from its parent object.
2016-05-09 10:46:40 -04:00
scygan
8add151c4b SPIR-V do not decorate: members of plain structs with location; non-top level members with interp.
This fixes some vulkanCTS tests that use struct arrays as a member of in/out interface blocks.

From Vulkan spec:
"If it is a not a Block, then the structure type must have a Location decoration. Its members are assigned consecutive locations in their declaration order, with the first member assigned to the location specified for the structure type. >>>>> The members, and their nested types, must not themselves have Location decorations <<<<"

From SPIR-V spec:
"When applied to structure-type members, the Decorations Noperspective, Flat, Patch, Centroid, and Sample can only be applied to the top-level members of the structure type. (Nested objects' types cannot be structures whose members are decorated with these decorations.)"
2016-05-06 16:54:54 +02:00
John Kessenich
baa9fa5df7 Merge branch 'feature2' of https://github.com/amdrexu/glslang into amdrexu-feature2 2016-05-05 16:32:39 -06:00
John Kessenich
5cc344d8ce Front-End: precise: capture noContraction on output parameter declarations. 2016-05-05 13:36:55 -06:00
John Kessenich
c8a5676025 Merge branch 'feature' of https://github.com/amdrexu/glslang into amdrexu-feature 2016-05-05 12:04:22 -06:00
Lei Zhang
17535f7d55 Create a new logger class for all messages w.r.t. SPIR-V build. 2016-05-05 10:15:06 -04:00
Rex Xu
338b185a2b Implement the extension GL_ARB_shader_group_vote. 2016-05-05 20:38:33 +08:00
Rex Xu
574ab04caa Implement the extension GL_ARB_shader_ballot
Add new built-in variables and functions to the parser (SPIR-V tokens are missing).
2016-05-05 19:02:35 +08:00
John Kessenich
3c1e08057e Front-end precise: Propagate noContraction up the AST when dereferencing structs.
This should be the last commit in this sequence to form the base of the work
in pull request #222.
2016-05-04 13:29:21 -06:00
John Kessenich
17f0786418 Parser: Precise: Recognize 'precise', tag types, and do related semantic checking.
This partly overlaps pull request #222, we have divided the work on this one.
2016-05-04 12:54:56 -06:00