Commit Graph

2366 Commits

Author SHA1 Message Date
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
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
John Kessenich
86a82bb955 Merge pull request #1081 from xxxbxxx/for-upstream-1
HLSL: Fix crash when flattening both side of assignement simultaneously.
2017-10-04 22:01:25 +03:00
Unknown
a6085875ef HLSL: Fix crash when flattening both side of assignement simultaneously. 2017-10-03 09:10:26 +02:00
John Kessenich
2491965904 Merge pull request #1075 from LoopDawg/subpass-input
HLSL: add subpass input types and methods
2017-10-03 01:47:48 +03:00
LoopDawg
7f93d56ef2 HLSL: add subpass input types and methods
Add support for Subpass Input proposal of issue #1069.

Subpass input types are given as:

    layout(input_attachment_index = 1) SubpassInput<float4> subpass_f;
    layout(input_attachment_index = 2) SubpassInput<int4>   subpass_i;
    layout(input_attachment_index = 3) SubpassInput<uint4>  subpass_u;

    layout(input_attachment_index = 1) SubpassInputMS<float4> subpass_ms_f;
    layout(input_attachment_index = 2) SubpassInputMS<int4>   subpass_ms_i;
    layout(input_attachment_index = 3) SubpassInputMS<uint4>  subpass_ms_u;

The input attachment may also be specified using attribute syntax:

    [[vk::input_attachment_index(7)]] SubpassInput subpass_2;

The template type may be a shorter-than-vec4 vector, but currently user
structs are not supported.  (An unimplemented error will be issued).

The load operations are methods on objects of the above type:

    float4 result = subpass_f.SubpassLoad();
    int4   result = subpass_i.SubpassLoad();
    uint4  result = subpass_u.SubpassLoad();

    float4 result = subpass_ms_f.SubpassLoad(samp);
    int4   result = subpass_ms_i.SubpassLoad(samp);
    uint4  result = subpass_ms_u.SubpassLoad(samp);

Additionally, the AST printer could not print EOpSubpass* nodes.  Now it can.

Fixes #1069
2017-10-02 12:46:55 -06:00
John Kessenich
092b7d2e20 Build: Fix a couple build issues. 2017-09-30 14:54:18 -06:00
John Kessenich
77ea30bdc9 HLSL: Additional attribute support: [[]], namespace, parameters:
- support C++11 style brackets [[...]]
- support namespaces [[vk::...]]
- support these on parameter declarations in functions
- support location, binding/set, input attachments
2017-09-30 14:34:50 -06:00
John Kessenich
3693e631f5 Fix #1060: Could crash if using --source-entry-point with -e; fixed. 2017-09-29 17:51:52 -06:00
John Kessenich
5a57ca680f Merge pull request #1078 from greg-lunarg/addopt14
Remove opaque workarounds
2017-09-29 20:57:30 +03:00
GregF
354a54c67d Legalization: Fix tests after workarounds removed 2017-09-29 10:08:20 -06:00
John Kessenich
d41993d9d2 SPV: rationalize parameter handling for "original" and "writable" parameters. 2017-09-29 09:58:11 -06:00
John Kessenich
bed4e4f7e4 HLSL: Pass opaques by local copy, instead of by interface original.
Also, remove assumption that if something is opaque that it
must be in the UniformConstant storage class.

This allows function declarations to know all parameters will
be in the Function storage class.
2017-09-29 09:57:00 -06:00
John Kessenich
15fa7ef5f5 HLSL: Remove workarounds for assigning to opaques.
This assumes it will be combined with optimizing transforms
that eliminate assignments to opaques.
2017-09-29 09:53:24 -06:00
John Kessenich
dabd1bf2f0 Merge pull request #1076 from LoopDawg/shadow-tx-types
HLSL: force textures to shadow modes from combined samplers
2017-09-29 05:07:50 +03:00
LoopDawg
195f584e09 HLSL: force textures to shadow modes from combined samplers
Texture shadow mode must match the state of the sampler they are
combined with.  This change does that, both for the AST and the
symbol table.  Note that the texture cannot easily be *created*
the right way, because this may not be known at that time.  Instead,
the texture is subsequently patched.

This cannot work if a single texture is used with both a shadow and
non-shadow sampler, so that case is detected and generates an error.
This is permitted by the HLSL language, however.  See #1073 discussion.

Fixed one test source that was using a texture with both shadow and
non-shadow samplers.
2017-09-28 14:17:25 -06:00
John Kessenich
fc7aeaee55 Merge pull request #1077 from greg-lunarg/addopt12
Legalization: Fix warnings and disable tests when spirv-tools not present
2017-09-28 22:38:29 +03:00
GregF
52fe3d598c Legalization: Fix warnings and disable tests when spirv-tools not present 2017-09-28 10:13:23 -06:00
John Kessenich
3ddcd3f12f Merge pull request #1070 from greg-lunarg/addopt8
Enable HLSL legalization
2017-09-28 05:56:56 +03:00
GregF
e2b3616370 Advance spirv-opt known-good to hopefully fix travis multithread failure 2017-09-27 15:46:59 -06:00
GregF
b56366ab75 Legalization: Skip spirv-tools tests 2017-09-27 15:23:15 -06:00
GregF
741d1f20ed Pick up latest spirv-tools in attempt to fix travis failures 2017-09-27 15:22:19 -06:00
GregF
87fd74291a Try Python interpreter on update_glslang_sources.py in appveyor 2017-09-27 15:20:56 -06:00
GregF
f451756d82 Fix travis and appveyor calls to update_glslang_sources.py 2017-09-27 15:19:28 -06:00
GregF
cd1f169c6a Enable HLSL legalization
Also added known-good mechanism to fetch latest validated spirv-tools.
Also added -Od and -Os to disable optimizer and optimize for size.

Fetching spirv-tools is optional for both glsl and hlsl. Legalization
of hlsl is done by default if spirv-opt is present at cmake time.
Optimization for glsl is currently done through the option -Os.

Legalization testing is currently only done on four existing shaders.
A separate baseLegalResults directory holds those results. All previous
testing is done with the optimizer disabled.
2017-09-27 15:06:05 -06:00
John Kessenich
44dd6a00c3 Merge pull request #1072 from amdrexu/feature
Implement extension GL_NV_shader_atomic_int64
2017-09-27 18:11:06 +03:00
Rex Xu
e8fe8b0de9 Implement extension GL_NV_shader_atomic_int64 2017-09-27 12:06:27 +08:00
John Kessenich
f21c173a05 Merge pull request #1071 from antiagainst/ninja-make
Travis: use make instead of ninja
2017-09-26 00:08:30 -06:00