Commit Graph

328 Commits

Author SHA1 Message Date
John Kessenich
66011cb2c2 SPV: Implement Vulkan 1.1 features and extensions. 2018-03-06 16:12:04 -07:00
John Kessenich
c6c80a6e48 Versioning: Address #1255: Move to semantic versioning.
Still missing is automation and final decisions on mechanisms in general.
2018-03-05 22:23:17 -07:00
John Kessenich
0216f24f0e SPV: Bump up the generator number. 2018-03-03 11:47:07 -07:00
Rex Xu
1e5d7b0b27 Implement the extension GL_AMD_gpu_shader_half_float_fetch
- Support new opaque types: f16sampler*, f16image*, f16subpassInput*.
- Add new built-in GLSL texture/image functions.
2018-03-02 16:48:03 +08:00
John Kessenich
c5215791f5 IO mapper: Fix #1261: Supply location mapper with size computer.
This factored computeTypeLocationSize() out of needing the TIntermediate contents,
and uses it to show how to know how many locations an object needs.
However, it still does not do cross stage, or mixed location/no-location
analysis.
2018-02-27 13:31:48 -07:00
John Kessenich
4bee531fc1 HLSL: Fix #1249: Always execute both sides of ternary "?:".
This is semantically required by HLSL, and frequently results in using
OpSelect instead of control flow.
2018-02-20 21:32:33 -07:00
LoopDawg
4425f245a5 HLSL: Add conversions for image ops during SPV construction
HLSL allows image and texture types to be templatized on sub-vec4 types,
or even structures.  This was mostly handled already during creation of
sampling operations.  However, for operator[] which can generate image
loads, this wasn't happening.

It also isn't very easy to do at that point in time, because operator[]
does not know where the results it produces will end up.  They may be
an lvalue or an rvalue, and there's a post-process to convert loads to
stores.  They may end up in atomic ops.

To bypass that difficulty, GlslangToSpv now looks for this case and
adds the appropriate conversion.  LIMITATION: this only works for
cases for which a simple conversion opcode suffices.  That is to say,
it will not work if the type is templatized on a struct.
2018-02-18 13:13:36 -07:00
GregF
8a4848f5b2 Add DeadInsertElim to legalization and RedundancyElim to -Os. 2018-02-07 16:04:42 -07:00
John Kessenich
71b5da60d0 SPV: Bump up generator number, because previous commit changes code gen slightly. 2018-02-06 08:06:36 -07:00
John Kessenich
a2858d9bdd GLSL: Implement GL_EXT_control_flow_attributes.
See https://github.com/KhronosGroup/GLSL/pull/11.
2018-02-01 00:55:08 -07:00
John Kessenich
e18fd20d5c HLSL: Refactor attribute implementation.
- make it sharable with GLSL
- correct the case insensitivity
- remove the map; queries are not needed, all entries need processing
- make it easier to build bottom up (will help GLSL parsing)
- support semantic checking and reporting
- allow front-end dependent semantics and attribute name mapping
2018-02-01 00:30:34 -07:00
John Kessenich
2b5ea9f851 SPV Version: Emit the requested SPIR-V version, not the header version.
Fixes #1236.
2018-01-31 18:41:59 -07:00
Frank Henigman
541f7bbd50 Fix unused function warning.
TGlslangToSpvTraverser::getExtBuiltins is only used when AMD_EXTENSIONS
is defined, so only define it in that case to avoid an unused function
warning.
2018-01-16 00:18:26 -05:00
GregF
e0639287df HLSL Legalization: Add scalar replacement
This allow for propagation through structs with dynamically indexed
arrays. This supports recent removal of non-io struct flattening.
2017-12-21 11:30:13 -07:00
John Kessenich
3f0d4bcd6a SPV: Document history of the generator version number. 2017-12-16 23:46:37 -07:00
John Kessenich
838d7afc61 SPV: HLSL: Move to correct HLSL barrier semantics, per Khronos recommendation. 2017-12-16 00:34:08 -07:00
John Kessenich
c72e5937dd SPV: Bump the generator number to account for barrier changes. 2017-12-16 00:34:08 -07:00
John Kessenich
8297936dd6 SPV: Change barrier emission to conform to Khronos decisions.
The memory model group agreed to these definitions for how
to map GLSL barrier, memoryBarrier, etc. With HLSL following suit.
2017-12-16 00:30:10 -07:00
John Kessenich
edaf556778 SPV: Plumb through XFB buffer and stride information.
Also, only emit this XFB information where the SPIR-V spec says
it should be emitted: essentially, on objects.

This and the previous commit together fix #1185.
2017-12-15 06:25:14 -07:00
Piers Daniell
1c5443c693 Add implementation of SPV_EXT_fragment_fully_covered
This implementation uses the GLSL extension
GL_NV_conservative_raster_underestimation to generate the new SPIR-V
FullyCoveredEXT built in.
2017-12-14 07:42:23 -07:00
John Kessenich
6a14f78061 HLSL: Fix #1163: treat buffers as references when calling functions.
This continues to prevent writing output buffers (out from a function),
but fixes the problem where the copy-in/out was not getting done.

Making everything work will require knowing both in/out-ness and bufferness,
but these are currently mutually exclusive, because both are storage
qualifiers.
2017-12-04 02:48:10 -07:00
John Kessenich
cbdf871d7f SPV: SampleMask does not depend on SampleRateShading.
Fixes #1158.
Fixes #1159.
2017-11-20 16:32:49 -07:00
John Kessenich
a372a3ed1e Versioning: Update some version strings. Still need better overall version. 2017-11-02 22:34:43 -06:00
GregF
cc80d80d8d Update spirv-tools known-good 2017-10-23 16:48:42 -06:00
John Kessenich
fe4e572c53 GLSL->SPIR-V: Put precision decorations on imageLoad(). 2017-10-19 02:07:30 -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
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
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
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
Rex Xu
e8fe8b0de9 Implement extension GL_NV_shader_atomic_int64 2017-09-27 12:06:27 +08:00
John Kessenich
5f77d864f3 HLSL: Fix #1064: Don't include empty structures on OpEntryPoint 2017-09-19 11:23:58 -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
amhagan
05506bb874 Implement the extension GL_AMD_shader_fragment_mask 2017-09-09 22:05:24 +08:00
LoopDawg
76117921b9 Fix lvalue check in SPIR-V generation
There were several locations in TGlslangToSpvTraverser::handleUserFunctionCall testing for
whether a fn argument should be in the lvalue or rvalue array.  They must get the same
result for indexing sanity, but had slightly different logic.

They're now forced into the same test.
2017-09-06 15:04:52 -06:00
John Kessenich
74c5f711b4 Merge pull request #1014 from KhronosGroup/SPV_EXT_shader_viewport_index_layer
SPV: 1st pass implementation of SPV_EXT_shader_viewport_index_layer.
2017-08-25 13:33:16 -06:00
John Kessenich
35343cb84d Merge pull request #1034 from KhronosGroup/module-processes
SPV reflection: Add OpModuleProcessed for compile options.
2017-08-25 13:05:54 -06:00
John Kessenich
b41bff69d2 SPV: 1st pass implementation of SPV_EXT_shader_viewport_index_layer. 2017-08-25 13:04:39 -06:00
John Kessenich
2a27116cae SPV reflection: Add OpModuleProcessed for compile options. 2017-08-25 11:48:02 -06:00
John Kessenich
fc3436941e Merge pull request #1029 from amdrexu/feature2
Implement extension GL_AMD_shader_image_load_store_lod
2017-08-23 23:13:19 -06:00
Rex Xu
129799a709 Implement extension GL_AMD_shader_image_load_store_lod 2017-08-24 06:56:39 +08:00
Rex Xu
e8fdd79f2e SPV: Implement extension SPV_EXT_shader_stencil_export 2017-08-24 06:26:15 +08:00
John Kessenich
786e8795ee Build: Fix build when NV_EXTENSIONS is not enabled. 2017-08-19 15:54:49 -06:00
John Kessenich
d6be6da031 SPV: Fix #1016: Don't allow non-GLSL-extension protected Layer and ViewportIndex members. 2017-08-17 23:49:39 -06:00
John Kessenich
0d0c6d38f0 GLSL 4.6: Implement atomic counter ops and SPV_KHR_shader_atomic_counter_ops. 2017-07-31 03:00:04 -06:00
Rex Xu
286ca432cf SPV: Memory qualifiers should decorate top-level block members 2017-07-27 14:33:16 +08:00
LoopDawg
ef94b1a5ca Fix dref explicit LOD form of sample with cube texture arrays
The dref parameter was being used as the LOD.  Now it it's properly the dref.
2017-07-24 18:45:37 -06:00
John Kessenich
961cd35b73 SPV: Fix #995: Include memory decorations on parameters. 2017-07-18 03:07:43 -06:00
John Kessenich
fad6297206 SPV: Non-functional: support lists of decorations per parameter. 2017-07-18 02:46:59 -06:00