Commit Graph

2392 Commits

Author SHA1 Message Date
John Kessenich
9cfc15513f Merge pull request #1118 from xorgy/only-swizzle-numbers-and-bools
Only try swizzles on vectors, numbers, and booleans.
2017-10-22 23:28:22 -06:00
John Kessenich
016e47f7a3 Merge branch 'only-parse-inf-constant-in-hlsl' of https://github.com/xorgy/glslang into xorgy-only-parse-inf-constant-in-hlsl 2017-10-22 23:20:42 -06:00
John Kessenich
6e33b787d3 Tests: Add test for GLSL +-#INF. 2017-10-22 23:17:18 -06:00
John Kessenich
79a4074047 Merge pull request #1120 from xorgy/overlong-hex-literal
Check for hexadecimal literals exceeding MaxTokenLength.
2017-10-22 23:09:32 -06:00
Aaron Muir Hamilton
6031266244 GLSL: Only parse [-]1.#INF in HLSL mode. 2017-10-23 02:56:27 +00:00
Aaron Muir Hamilton
9028ed204d Check for hexadecimal literals exceeding MaxTokenLength. 2017-10-22 17:55:14 +00:00
Aaron Muir Hamilton
07c0bcea92 Only try swizzles on vectors, numbers, and booleans. 2017-10-21 19:54:37 +00:00
John Kessenich
b1eaf82cc8 Merge pull request #1115 from LoopDawg/stdarray-binding-set
Nonfunctional: minor: use std::array for per-set shifts, fix warning.
2017-10-20 16:31:26 -06:00
LoopDawg
2915da303f Nonfunctional: minor: use std::array for per-set shifts, fix warning.
Two unrelated, minor tweaks:

(1) Use std::array for shiftBindingForSet.  Now matches shiftBinding.
(2) Add parens in shouldFlatten() to make compiler warning happy.
2017-10-20 12:02:38 -06:00
John Kessenich
573cc9e9aa Merge pull request #1111 from LoopDawg/per-set-binding-offsets
Add per-descriptor-set IO mapping shift values.
2017-10-20 11:35:29 -06:00
John Kessenich
7a9db71f46 SPV: Don't emit StorageImageMultisample capability for subpass images. 2017-10-20 10:56:50 -06:00
John Kessenich
6cfeced8de Non-functional: missing comments from missed git add. 2017-10-20 10:56:20 -06:00
John Kessenich
1b46f137f7 HLSL: Fix #1106. Support shader setting of binding/set for $Global. 2017-10-19 16:54:25 -06:00
LoopDawg
08a14422c1 Add per-descriptor-set IO mapping shift values.
This PR adds the ability to provide per-descriptor-set IO mapping shift
values.  If a particular binding does not land into a per-set value,
then it falls back to the prior behavior (global shifts per resource class).

Because there were already 6 copies of many different methods and internal
variables and functions, and this PR would have added 6 more, a new API is
introduced to cut down on replication and present a cleaner interface.
For the global (non-set-specific) API, the old entry points still exist
for backward compatibility, but are phrased internally in terms of the
following.

    // Resource type for IO resolver
    enum TResourceType {
        EResSampler,
        EResTexture,
        EResImage,
        EResUbo,
        EResSsbo,
        EResUav,
        EResCount
    };

Methods on TShader:

    void setShiftBinding(TResourceType res, unsigned int base);
    void setShiftBindingForSet(TResourceType res, unsigned int set, unsigned int base);

The first method replaces the 6 prior entry points of various spellings, which
exist now in depreciated form.  The second provides per-resource-set functionality.
Both accept an enum from the list above.

From the command line, the existing options can accept either a single shift value as
before, or a series of 1 or more [set offset] pairs.  Both can be provided, as in:

    ... --stb 20 --stb 2 25 3 30 ...

which will use the offset 20 for anything except descriptor set 2 (which uses 25) and
3 (which uses 30).
2017-10-19 11:50:30 -06:00
John Kessenich
fe4e572c53 GLSL->SPIR-V: Put precision decorations on imageLoad(). 2017-10-19 02:07:30 -06:00
John Kessenich
f0e35bf0ef GLSL: Make sampling operations have agnostic precision qualifiers for desktop.
Desktop defaults to highp for samplers, but this should not apply to the built-in
functions, so make it appy only to user declarations.
2017-10-19 00:32:59 -06:00
John Kessenich
3112b5686d Merge pull request #1113 from xorgy/preprocessor-int-min-over-negative-one
Preprocessor: Evaluate INT_MIN / -1 to 0.
2017-10-19 00:24:05 -06:00
John Kessenich
0b55e0f203 Merge pull request #1102 from KhronosGroup/partially-flatten
HLSL: Partially flatten hierarchies, instead of all or nothing.
2017-10-18 14:53:53 -06:00
Aaron Muir Hamilton
dc756a61c8 Preprocessor: Evaluate INT_MIN / -1 to 0.
This division is undefined behaviour which raises SIGFPE on x86.
  Most C++ preprocessors evaluate this silently to 0.
2017-10-18 19:56:19 +00:00
John Kessenich
a50b107e62 Build: Fix build warning. 2017-10-17 12:27:51 -06:00
John Kessenich
8b555f7458 Merge pull request #1109 from xorgy/never-try-to-swizzle-void
GLSL: Don't try to swizzle void.
2017-10-17 09:03:17 -06:00
Aaron Muir Hamilton
5313613dd1 Don't try to swizzle void. 2017-10-17 09:04:38 +00:00
GregF
856502cb1b Update spirv-tools known-good 2017-10-16 21:05:13 -06:00
John Kessenich
7d67c6cbc2 PP: Fix #1104: Missing check for #if overflow.
Also, rationalized this to generally make it safer and more readable.
It could use a more modern approach, at some point...
2017-10-16 15:29:07 -06:00
John Kessenich
1a4bbc4a95 HLSL: More clip fix: It is more involved than previous commit. Complete. 2017-10-16 13:11:53 -06:00
John Kessenich
4ce5b562bb Fix #1103: clip() works on int/uint. 2017-10-16 11:42:35 -06:00
John Kessenich
5889fa03f9 Tests: Add clip(int) tests. 2017-10-16 11:40:32 -06:00
John Kessenich
cf571f7310 Infrastructure: Add a TShader method to publicly expose the intermediate.
Fixes #1088.
2017-10-12 23:12:40 -06:00
John Kessenich
41aa19953f HLSL: Partially flatten hierarchies, instead of all or nothing.
Fixes #1092.  Allows arrays of opaques to keep arrayness, unless
needed by uniform array flattening.
Can handle assignments of mixed amounts of flattening.
2017-10-12 16:52:32 -06:00
John Kessenich
60e9161100 Merge pull request #1098 from LoopDawg/attribute-gets
HLSL: nonfunctional: add helper access methods to TAttributeMap
2017-10-11 06:05:06 +03:00
John Kessenich
0d1f63ec83 Merge pull request #1097 from SWIFTingAround/master
Set cmake-policy CMP0048 to NEW
2017-10-11 01:54:06 +03:00
John Kessenich
ad2bc097e2 Merge pull request #1094 from LoopDawg/split-shadow-tx
HLSL: nonfunctional: rename setId -> switchId, add comment
2017-10-11 01:48:49 +03:00
John Kessenich
ddb45f8d95 Merge pull request #1080 from hedejing/master
Add getAsLoopNode() method for TIntermLoop
2017-10-11 01:48:04 +03:00
LoopDawg
52c087ff53 HLSL: add helper access methods to TAttributeMap
There was some code replication around getting string and integer
values out of an attribute map.  This adds new methods to the
TAttributeMap class to encapsulate some accessor details.
2017-10-10 14:59:40 -06:00
Tim Diekmann
aab0001220 Set cmake-policy CMP0048 to NEW 2017-10-10 16:26:31 +02:00
He Dejing
fdbd0ebab1 Add getAsLoopNode() method for Loop node
follow local conventions of spaces
2017-10-08 15:40:42 +08:00
LoopDawg
028c5a8dc4 HLSL: nonfunctional: rename setId -> switchId, add comment
Method rename, add comment about its intended use.  No
test diffs.
2017-10-07 16:43:18 -06:00
John Kessenich
bb79abccb3 HLSL: Validate implicit initializer assignment to opaque members.
Fixes #1091.
2017-10-07 13:25:21 -06:00
John Kessenich
07ed11f9a0 SPV: GeneratorVersion: bump version number because of atomic decrement change. 2017-10-07 11:41:20 -06:00
John Kessenich
b27de0289c Merge pull request #1090 from tafuri/#1084-fix-segfault
Only track variables in the global scope
2017-10-07 07:19:21 +03:00
John Kessenich
48d6e798bc SPV: Correct semantics of atomic-counter decrement.
The semantics differ between GLSL/HLSL and SPIR-V.
Translate between these.
2017-10-06 21:21:48 -06:00
John Kessenich
592e8f0441 HLSL: Tests: Add subset of flattened opaque test to legalize results. 2017-10-06 21:01:07 -06:00
Sebastian Tafuri
4f6865f406 Added test for local structured buffer variable 2017-10-07 00:47:54 +02:00
Sebastian Tafuri
5133b108da Fixed formatting 2017-10-07 00:12:50 +02:00
John Kessenich
908813c25d Merge pull request #1089 from LoopDawg/split-shadow-tx
HLSL: split textures used for both shadow and non-shadow modes
2017-10-07 00:33:20 +03:00
Sebastian Tafuri
0a82611174 Only track variables in the global scope 2017-10-06 22:45:00 +02:00
LoopDawg
73c57bbe50 HLSL: split textures used for both shadow and non-shadow modes
A single texture can statically appear in code mixed with a shadow sampler
and a non-shadow sampler.  This would be create invalid SPIR-V, unless
one of them is provably dead.

The previous detection of this happened before DCE, so some shaders would
trigger the error even though they wouldn't after DCE.  To handle that
case, this PR splits the texture into two: one with each mode.  It sets
"needsLegalization" (if that happens for any texture) to warn that this shader
will need post-compilation legalization.

If the texture is only used with one of the two modes, behavior is as it
was before.
2017-10-06 11:23:16 -06:00
John Kessenich
263986eb6e Readme: Update with additional Windows build information for SPIRV-tools build. 2017-10-06 00:24:41 -06:00
John Kessenich
2c9c2af640 Merge pull request #1085 from KhronosGroup/flatten-assign-subset
HLSL: Fix #954: Track/access subsets of flattened multi-level aggrega…
2017-10-04 23:41:08 +03:00
John Kessenich
700bdeb742 HLSL: Fix #954: Track/access subsets of flattened multi-level aggregates.
Works in conjuction with d1be754 to represent and modify a partially
dereferenced multi-level flattened aggregate.
2017-10-04 13:40:13 -06:00