Commit Graph

2348 Commits

Author SHA1 Message Date
John Kessenich
592e8f0441 HLSL: Tests: Add subset of flattened opaque test to legalize results. 2017-10-06 21:01:07 -06: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
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
Lei Zhang
afa128a8df Travis: use make instead of ninja and limit concurrent jobs 2017-09-25 14:04:51 -04:00
John Kessenich
9cf5dfbdc7 Merge pull request #1063 from LoopDawg/remapper-error-cleanup
Remapper: make remapper robust against non-exiting error handlers
2017-09-23 06:32:02 -06:00
John Kessenich
ea5204d192 Build: Merge pull request #1068 from greg-lunarg/addopt4
CMake file changes for SPIR-V legalization for HLSL
2017-09-22 13:51:02 -06:00
GregF
fd34f0e602 CMake changes for HLSL legalization
Cmake now looks for External/spirv-tools. If found, it links in
SPIRV-Tools-opt and SPVRemapper, and adds -DENABLE_OPT to build.
2017-09-21 17:01:47 -06:00
LoopDawg
8004d36528 Remapper: make remapper robust against non-exiting error handlers
Remapper errors are generally fatal: there has been some unexpected situation while
parsing the SPV binary, and there is no reasonable way to carry on.  The
errorHandler() function is called in this case, which by default exits, but
it is possible to submit a handler which does not.  In that case the remapper would
carry on in a bad state.

This change ensures a graceful termination of the remap() function.

While a try {} catch {} construct would be the ideal and safe way to do this,
that's off limits for certain environments, so this tries to do the same thing
with explicit code, to catch all the bailout paths.
2017-09-20 15:19:43 -06:00
John Kessenich
5f77d864f3 HLSL: Fix #1064: Don't include empty structures on OpEntryPoint 2017-09-19 11:23:58 -06:00
John Kessenich
31365afaf4 Merge pull request #1044 from dsrbecky/image_external_essl3
Add support for GL_OES_EGL_image_external_essl3
2017-09-15 21:10:08 -06:00
xavier
ae8af5d33e HLSL: fix array[1] of vec4 constant declaration. 2017-09-15 15:28:38 -06:00
John Kessenich
c64a9dd6a9 Test: Make another test legal HLSL, and rationalize GLSL vs HLSL addConstructor(). 2017-09-15 13:15:23 -06:00
John Kessenich
bdbbc68e29 HLSL: Add bounds checking, shared with GLSL. Partially address #1032. 2017-09-14 20:04:20 -06:00
John Kessenich
346dd7c747 Merge pull request #1051 from LoopDawg/bug-1049
HLSL: allow split type in InputPatch template type, & HS return types.
2017-09-14 18:18:19 -06:00
LoopDawg
4a145dbf45 HLSL: handle split InputPatch templat type in patch constant functions
InputPatch parameters to patch constant functions were not using the
internal (temporary) variable type.  That could cause validation errors
if the input patch had a mixture of builtins and user qualified members.

This uses the entry point's internal form.

There is currently a limitation: if an InputPatch is used in a PCF,
it must also have appeared in the main entry point's parameter list.
That is not a limitation of HLSL.  Currently that situation is detected
and an "implemented" error results.  The limitation can be addressed,
but isn't yet in the current form of the PR.
2017-09-14 16:50:37 -06:00
LoopDawg
a5d8616478 HLSL: allow mixed user & builtin members in hull shader output structure
Hull shaders have an implicitly arrayed output.  This is handled by creating an arrayed form of the
provided output type, and writing to the element of it indexed by InvocationID.

The implicit indirection into that array was causing some troubles when copying to a split
structure.  handleAssign was able to handle simple symbol lvalues, but not an lvalue composed
of an indirection into an array.
2017-09-14 16:50:37 -06:00
John Kessenich
ba6a3c290e GLSL: Make gl_Layer and gl_ViewportIndex always be outside blocks.
There was some ambiguity/contradiction in this behavior, and
Khronos decided glslang should always have these outside blocks,
rather than have stage/vendor/target variations.
2017-09-13 13:22:50 -06:00
John Kessenich
aab3bcffea Merge pull request #1056 from KhronosGroup/glsl-entrypoint-rename
GLSL: Promote HLSL entry-point renaming code to be used by GLSL as well.
2017-09-12 10:53:05 -06:00
John Kessenich
9855bdad00 GLSL: Promote HLSL entry-point renaming code to be used by GLSL as well.
Fixes #1045.
2017-09-12 09:40:54 -06:00
John Kessenich
4f4683d251 Merge pull request #1050 from amdrexu/feature
Implement the extension GL_AMD_shader_fragment_mask
2017-09-12 09:09:37 -06:00
John Kessenich
30ac052574 Merge pull request #1055 from KhronosGroup/strdup
Build: Fix strdup -> _strdup warnings.
2017-09-11 22:04:59 -06:00