Commit Graph

595 Commits

Author SHA1 Message Date
John Kessenich
76d4dfcd51 SPV non-functional: minor readability improvements for texturing. 2016-06-16 12:43:23 -06:00
John Kessenich
ac666e7368 Front-end ESSL: require precision declarations for images. 2016-06-14 22:12:20 -06:00
John Kessenich
9000bd5eb6 Front-end: Make ES floatBitsToInt/intBitsToFloat/etc. all be highp. 2016-06-14 20:38:58 -06:00
John Kessenich
c51287d744 SPV: Update to spec. decisions (and issue #205) for barrier().
A barrier (ESSL/GLSL) or OpControlBarrier when in a tessellation control
shader also means doing memory synchronization for output variables.
2016-06-14 19:50:26 -06:00
LoopDawg
589107095c Implement atomic ops, bit conversions, fix fwidth stage mask, fix saturate dest modifier. 2016-06-13 20:50:36 -06:00
John Kessenich
cd784bc561 Merge pull request #337 from steve-lunarg/intrinsics
HLSL: Add decompositions for some intrinsics.
2016-06-13 08:54:45 -06:00
John Kessenich
630dd7da43 HLSL: Flesh out misc. declaration grammar: semantics/registers/annotations/precise/etc.
Details within these bear even more fleshing out, but would like to have
that driven by actual need.
2016-06-12 23:54:31 -06:00
John Kessenich
e6e7494e2a HLSL: Implement basic "struct" grammar. 2016-06-12 23:54:31 -06:00
LoopDawg
592860cae5 Add decompositions for some HLSL intrinsics. 2016-06-10 17:11:18 -06:00
John Kessenich
41ebc42926 Merge pull request #335 from jekstrand/sampler-params
SPV: Fix pointer address spaces for sampler function parameters
2016-06-09 20:42:23 -06:00
John Kessenich
077e052a8f HLSL: Implement proper nesting of symbol-table scopes and identifier searching. 2016-06-09 02:03:46 -06:00
John Kessenich
71351de879 HLSL: Add all int/float/bool/uint matrix types, void for functions, and a few others. 2016-06-09 01:33:10 -06:00
Jason Ekstrand
ed15ef1a5b GlslangToSpv: Pass the pointer directly into the client function for opaque types
For opaque types such as samplers, images, and atomic counters, we want to
reference the actual object in the child function.  For a long time, we
used a shadow variable and made a copy of the image/sampler.  In 76d0ac1a,
this was changed to not shadow samplers.  However, this didn't cover all
opaque types and it also didn't get the pointer storage classes right.
This commit fixes both of these issues.

Fixes #324
2016-06-08 17:22:46 -07:00
David Neto
a901ffed40 Defer capability decl for ClipDistance, CullDistance, PointSize until actual use
The compiler will mark struct members with those builtins, but won't
declare the capability until that member is accessed by some executable
instruction.

Test changes:
- spv.430.vert: was missing ClipDistance capability.
- spv.precise.tese: remove TessellationPointSize capability.
2016-06-08 09:30:04 -04:00
John Kessenich
80cb324ff6 Front-end: Fix issue #146: which versions allow double in/out. 2016-06-05 18:52:05 -06:00
John Kessenich
133253b6ee Front-end: Fix issue #147: ensure layout(index=N) has N in [0,1]. 2016-06-05 17:25:34 -06:00
John Kessenich
119f8f6906 HLSL: Flesh out the loop grammar and productions. 2016-06-05 15:44:07 -06:00
John Kessenich
0d2b6de45b HLSL: Attribute grammar and if-else grammar/productions. 2016-06-05 12:32:18 -06:00
John Kessenich
1cc1a2813e HLSL: 1) Implement lookahead buffers/stacks for token advance/recede, 2) use it for cast operation.
The grammar now accepts type casts, like "(int)x", but that
has to be disambiguated from "(a + b)", needed deeper lookahead
and backing up than what existed so far.
2016-06-03 16:57:53 -06:00
LoopDawg
643fcb5b43 Add negative intrinsics tests 2016-06-03 16:28:57 -06:00
LoopDawg
ef764a24b2 Fix for empty statement segfault. 2016-06-03 10:57:03 -06:00
LoopDawg
4b67732c13 Initial implementation of direct-mapped subset of HLSL intrinsics with type subset.
This checkin implements about half of the HLSL intrinsics for a subset of their
entire type support (but a useful subset).  The uncommented lines in
TBuiltInParseablesHlsl::identifyBuiltIns shows which are connected.
2016-06-03 08:28:29 -06:00
John Kessenich
a5c33d6ffb SPV: Fix issue #320: Fetch needs to extract the image.
GLSL takes a traditional sampler, but SPIR-V wants just the
sampled image, not the combined sampler and image.
2016-06-02 23:47:29 -06:00
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