Commit Graph

1731 Commits

Author SHA1 Message Date
steve-lunarg
7ea7ff4cd4 Add EOpD3DCOLORtoUBYTE4 decomposition 2017-01-03 14:42:18 -07:00
John Kessenich
affc26674d PP: Recognize <> style #include header names. I.e., #include <header-name>.
Also correctly test and handle missing newline.
2017-01-03 11:05:16 -07:00
John Kessenich
faa720f14c PP: Fix issue #426, recover from bad-source macro expansion. 2017-01-02 17:56:08 -07:00
John Kessenich
bc5196c003 SPV: Fix issue #369, don't support gl_NumSamples -> SPIR-V. 2017-01-02 17:01:21 -07:00
John Kessenich
f37f4d23fc HLSL: Fix issue #646: map SV_DispatchThreadID -> GlobalInvocationID. 2017-01-02 14:59:19 -07:00
John Kessenich
aa6d56298d HLSL: Handle const with no initializer. Fixes issue #651. 2016-12-30 16:42:57 -07:00
John Kessenich
53864846a9 HLSL: Support empty {} initializers for arrays and scalars. 2016-12-30 16:39:18 -07:00
John Kessenich
807a0d9e2f Merge pull request #640 from chaoc/modify-shader-ballot
Modify shader ballot extension by adding OpSubgroupReadInvocationKHR
2016-12-21 17:40:29 -07:00
John Kessenich
f48faec3ee PP: Non-functional: Make a proper class out of the atom <-> string mapping. 2016-12-21 13:49:16 -07:00
chaoc
f200da8631 Modify shader ballot extension by adding OpSubgroupReadInvocationKHR 2016-12-21 12:08:09 -08:00
John Kessenich
224b1f733b PP: Support operator creation with token pasting. 2016-12-21 12:32:56 -07:00
John Kessenich
0c4b7c931a PP: Rationalize names of tokens. 2016-12-21 11:55:53 -07:00
John Kessenich
2dcdda921f Merge pull request #641 from chaoc/passthrough
Add support for SPV_NV_geometry_shader_passthrough
2016-12-21 10:59:07 -07:00
John Kessenich
906b0a3e60 Merge pull request #644 from hrydgard/override-warning-fixes
Fix a large number of Clang warnings about inconsistent usage of 'override'
2016-12-21 10:50:33 -07:00
Henrik Rydgård
9a931b39bc Fix a large number of warnings about inconsistent usage of 'override' produced by clang 2016-12-21 12:48:08 +01:00
John Kessenich
907aabb6b0 PP: Non-functional: Only use string <-> atom mapping when needed.
Also, eliminate the 'atom' field of TPpToken.

Parsing a real 300 line shader, through to making the AST, is about 10% faster.

Memory is slightly reduced (< 1%).

The whole google-test suite, inclusive of all testing overhead, SPIR-V generation,
etc., runs 3% faster.

Since this is a code *simplification* that leads to perf. improvement, I'm not
going to invest too much more in measuring the perf. than this. The PP code is
simply now in a better state to see how to further rationalize/improve it.
2016-12-20 23:36:05 -07:00
John Kessenich
54af2de761 PP: Non-functional: rationalize TPpToken.
Always keep 'token' outside.
Always return the string to upper levels inside.
2016-12-20 19:42:53 -07:00
John Kessenich
1fbb9c1430 PP: Non-functional: clean up, simplify, completely identical operation. 2016-12-20 18:36:49 -07:00
chaoc
6e5acae144 Add support for SPV_NV_geometry_shader_passthrough 2016-12-20 13:28:52 -08:00
John Kessenich
3c264ce8f3 Merge pull request #639 from hrydgard/master
CMake: Add option to make it possible to not build the executables
2016-12-20 11:02:11 -07:00
John Kessenich
7a21a11528 Merge pull request #638 from chaoc/master
Add support for SPV_NV_sample_mask_override_coverage
2016-12-20 11:01:21 -07:00
John Kessenich
b8387c87d0 PP: Non-functional: Remove custom allocator and related improvements.
Removed the preprocesser memory pool.

Removed extra copies and unnecessary allocations of objects related to the ones
that were using the pool.

Replaced some allocated pointers with objects instead, generally using more
modern techiques. There end up being fewer memory allocations/deletions to get right.

Overall combined effect of all changes is to use slightly less memory and
run slightly faster (< 1% for both, but noticable).

As part of simplifying the code base, this change makes it easier to see
PP symbol tracking, which I suspect has an even bigger run-time simplification
to make.
2016-12-19 21:57:06 -07:00
Henrik Rydgård
868746ad55 Add option to make it possible not to build the executables 2016-12-20 01:56:00 +01:00
John Kessenich
bfff871dad PP: Add missing i64val code.
Also, checking both 'atom' and 'name' is redundant, and I'm hoping to
eliminate more atom stuff.
2016-12-19 17:46:20 -07:00
chaoc
0ad6a4e60d Add support for SPV_NV_sample_mask_override_coverage 2016-12-19 16:29:34 -08:00
chaoc
7583ed73ef Merge remote-tracking branch 'refs/remotes/KhronosGroup/master' 2016-12-19 16:21:14 -08:00
John Kessenich
432576fdce Build: Fix #633, add missing overrides. 2016-12-19 14:43:42 -07:00
John Kessenich
0955b1cb35 Merge pull request #637 from KhronosGroup/token-paste
PP: Implement token pasting for PP identifiers.
2016-12-19 14:31:57 -07:00
John Kessenich
e6cbc5b19d Merge pull request #624 from steve-lunarg/remapper-strip-removed
WIP: Remapper: remove debug info for IDs stripped in other passes
2016-12-19 14:07:58 -07:00
John Kessenich
4ba444b61c Merge pull request #635 from steve-lunarg/sample-fix-2
HLSL: allow "sample" in expressions.
2016-12-19 13:30:29 -07:00
John Kessenich
059d46ee45 Merge pull request #625 from jbeich/gcc6
Unbreak build on FreeBSD with GCC/libstdc++ 6.2.0
2016-12-19 13:30:06 -07:00
John Kessenich
d485e0b710 PP: Implement token pasting for PP identifiers.
Implement token pasting as per the C++ specification, within the current
style of the PP code.
Non-identifiers (turning 12 ## 10 into the numeral 1210) is not yet covered;
they should be a simple incremental change built on this one.
Addresses issue #255.
2016-12-19 09:19:43 -07:00
steve-lunarg
a64ed3eba0 HLSL: allow "sample" in expressions.
Unlike other qualifiers, HLSL allows "sample" to be either a qualifier keyword or an
identifier (e.g, a variable or function name).

A fix to allow this was made a while ago, but that fix was insufficient when 'sample'
was used in an expression.  The problem was around the initial ambiguity between:

   sample float a; // "sample" is part of a fully specified type
and
   sample.xyz;     // sample is a keyword in a dot expression

Both start the same.  The "sample" was being accepted as a qualifier before enough
further parsing was done to determine we were not a declaration after all.  This
consumed the token, causing it to fail for its real purpose.

Now, when accepting a fully specified type, the token is pushed back onto the stack if
the thing is not a fully specified type.  This leaves it available for subsequent
purposes.

Changed the "hlsl.identifier.sample.frag" test to exercise this situation, distilled
down from a production shaders.
2016-12-18 18:01:34 -07:00
John Kessenich
abf5057948 Fix comment typo. 2016-12-16 17:11:18 -07:00
John Kessenich
1e275c8486 HLSL: More robust handling of bad shader input, catching a few more things. 2016-12-14 17:02:32 -07:00
John Kessenich
dca93d6baa Merge pull request #629 from null77/fix-unicode
Change unicode dash to ASCII.
2016-12-14 15:15:41 -07:00
Jamie Madill
cebd97eb24 Change unicode dash to ASCII.
This change is helpful for integration with Chromium, which recently
added a compiler option to warn when compiling any source files which
use extended characters. In this case the offending character was a
single unicode dash in a comment.
2016-12-14 15:48:56 -05:00
John Kessenich
95abd284dd Merge pull request #628 from null77/fix-cast-warn
Fix size_t to int cast warnings.
2016-12-13 19:32:01 -07:00
Jamie Madill
3ec327c5a5 Fix size_t to int cast warnings.
Several instances in Visual Studio 2015:

warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
2016-12-13 17:33:07 -05:00
John Kessenich
20f01e7fd0 Fix last commit; EOptionKeepUncalled incorrect enum bug. 2016-12-12 11:41:43 -07:00
steve-lunarg
297754cfe8 Remapper: remove debug info for IDs stripped in other passes
If some DCE is performed such as removing dead functions, then even
if we are NOT stripping debug info, we still must remove the debug
opcodes that refer to the now-dead IDs.

Also, this adds a small change to perform no ID remapping if none
is requested, making spirv-remap properly be a no-op if no options
are given.
2016-12-12 09:01:11 -07:00
John Kessenich
906cc21816 Linker: Eliminate uncalled functions, because they can be ill-defined.
Fixes issue #610. Also provides a testing option to keep uncalled functions.
2016-12-09 19:22:20 -07:00
John Kessenich
bf6d7f43fd Linker: Track the mangled entry-point name along with the non-mangled one. 2016-12-09 17:29:07 -07:00
John Kessenich
4b6ce415ef GLSL Linker: Track entry point across compilation units.
This wasn't needed until the recent generalization of "main" to "entry point",
so makes some HLSL-specific code be generic now, for GLSL functional correctness.
2016-12-09 17:14:27 -07:00
Jan Beich
1bcb254a30 Add missing header and drop duplicate one
In file included from C:/Projects/glslang/glslang/MachineIndependent/glslang.y:59:0:
glslang/MachineIndependent/ParseHelper.h:276:24: error: 'va_list' has not been declared
                        va_list args);
                        ^~~~~~~
2016-12-09 22:40:55 +00:00
John Kessenich
6a60c2f9ea Linker: Walk the call graph to report an error on missing bodies. 2016-12-08 23:22:21 -07:00
John Kessenich
e795cc915c Merge pull request #621 from steve-lunarg/recursive-flattening
HLSL: Recursive composite flattening
2016-12-08 11:18:07 -07:00
John Kessenich
302e619e4e Merge pull request #619 from steve-lunarg/opcode-specific-promote
HLSL: opcode specific promotion rules for interlocked ops
2016-12-08 11:17:21 -07:00
John Kessenich
56b4547624 Merge pull request #620 from fjhenigman/foo
GLSL: Always define TShader::~Includer().
2016-12-08 11:15:59 -07:00
steve-lunarg
a2b01a0da8 HLSL: Recursive composite flattening
This PR implements recursive type flattening.  For example, an array of structs of other structs
can be flattened to individual member variables at the shader interface.

This is sufficient for many purposes, e.g, uniforms containing opaque types, but is not sufficient
for geometry shader arrayed inputs.  That will be handled separately with structure splitting,
 which is not implemented by this PR.  In the meantime, that case is detected and triggers an error.

The recursive flattening extends the following three aspects of single-level flattening:

- Flattening of structures to individual members with names such as "foo[0].samp[1]";

- Turning constant references to the nested composite type into a reference to a particular
  flattened member.

- Shadow copies between arrays of flattened members and the nested composite type.

Previous single-level flattening only flattened at the shader interface, and that is unchanged by this PR.
Internally, shadow copies are, such as if the type is passed to a function.

Also, the reasons for flattening are unchanged.  Uniforms containing opaque types, and interface struct
types are flattened.  (The latter will change with structure splitting).

One existing test changes: hlsl.structin.vert, which did in fact contain a nested composite type to be
flattened.

Two new tests are added: hlsl.structarray.flatten.frag, and hlsl.structarray.flatten.geom (currently
issues an error until type splitting is online).

The process of arriving at the individual member from chained postfix expressions is more complex than
it was with one level.  See large-ish comment above HlslParseContext::flatten() for details.
2016-12-07 14:40:01 -07:00