Commit Graph

587 Commits

Author SHA1 Message Date
Rex Xu
81f4c03a76 Fix issues of SPIRV headers 2018-03-02 17:42:37 +08: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
5630d0ec79 Fix typo. 2018-03-02 01:09:28 -07: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
46413d5780 SPV: Fix #1258: cache constant structs by id, not opcode.
Constants were generally cached by type opcode, but all structures share the
same type opcode (OpTypeStruct), so they need to be cached by type id.
2018-02-26 19:35:39 -07:00
John Kessenich
57f6a016f0 SPV: Complete OpModuleProcessed implementation, enabled by have 1.2 headers. 2018-02-22 19:36:18 -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
5c3eed542d SPV: Create more access chains addressing a few swizzling issues.
- Fixes #1233
- Treats local bools like anything else
- more consistently deals with a dynamic component selection
2018-02-06 07:24:12 -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
John Kessenich
43f5b27321 Non-Functional: Use OpModuleProcessed from the unified header. 2018-01-31 18:06:44 -07:00
John Kessenich
6c1c2766b6 SPV: Bump SPIR-V header to the unified1 version (version 1.2). 2018-01-29 16:16:11 -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
2505057af8 SPV: Memory model: Reduce set of memory-semantic bits requested for "all". 2017-12-16 00:34:08 -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
e9e0cb60ec Update to latest public headers. 2017-12-14 03:00:44 -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
e86b4c84d6 Remapper: Fix strip algo when strip ranges overlap 2017-11-02 14:01:57 -06:00
GregF
cc80d80d8d Update spirv-tools known-good 2017-10-23 16:48:42 -06:00
John Kessenich
7a9db71f46 SPV: Don't emit StorageImageMultisample capability for subpass images. 2017-10-20 10:56:50 -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
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
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
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
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
ea1ea974eb Address #1052: Have language-level exits of case statements. 2017-09-11 19:25:17 -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
LoopDawg
2baa774259 Linux build warning fix
* Remove complaint about unused function parameter in resolveUniformLocation()
* Remove complaint about defined but not used variable in spvIR.h
2017-08-31 18:09:58 -06:00
John Kessenich
8268a35504 Build: Attempt better support for VS 2012.
Fix #1020. Fix #1021. Fix #1022.
2017-08-25 21:35:37 -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
260f50616a SPV: Correct selection of storage-image capabilities. Fixes #986.
Code was reflecting an old historical use of sampled as a SPIR-V
2-valued operand, instead of its current 3 values.
2017-08-14 22:10:00 -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
John Kessenich
d2d3a14237 SPV: Update to latest 1.0 headers, removing redundancies in GLSL.ext.AMD.h. 2017-07-25 21:03:29 -06: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
John Kessenich
735d7e56a6 Address part A of #982: $Global will use std140 instead of HLSL offsets.
From comment about this:
Adjust alignment for HLSL rules
TODO: make this consistent in early phases of code: adjusting this late means inconsistencies with earlier code, which for reflection is an issue.
Until reflection is brought in sync with these adjustments, don't apply to $Global,
which is the most likely to rely on reflection, and least likely to rely
implicit layouts.
2017-07-13 11:39:16 -06:00
Rex Xu
57e65929e4 HLSL: Translate directive [flatten] and [branch] to SPV control mask. 2017-07-06 11:31:33 +08:00
John Kessenich
9645f78293 Merge pull request #965 from chaoc/spv-khr-post-depth-coverage
Implement SPV_KHR_post_depth_coverage
2017-07-05 14:48:19 -06:00
chaoc
c120452754 Implement SPV_KHR_post_depth_coverage
Added support for both extension GL_ARB_post_depth_coverage and GL_EXT_post_depth_coverage.
2017-07-05 12:27:15 -07:00
John Kessenich
17b5f9175d Merge pull request #969 from d3x0r/patch-1
Add option to skip installation
2017-07-04 11:00:42 -06:00
Rohith Chandran
6206091e63 Fix CMake scripts: The set_property script can be used to set only a single property, so now setting the POSITION_INDEPENDENT_CODE property correctly. 2017-07-04 10:53:45 -04:00
d3x0r
4e53d9052d Update CMakeLists.txt 2017-07-04 06:00:35 -07:00
Rex Xu
37cdceed41 Implement extension GL_ARB_shader_stencil_export 2017-06-29 17:50:46 +08:00
John Kessenich
e2ff404f6b Merge pull request #917 from KhronosGroup/remove-redundant-locations
Replace #422: Remove the redundant location setting in AST->SPIR-V.
2017-06-15 12:11:37 -06:00
Rex Xu
301a2bc8a7 SPV: Fix an typo of SPV_AMD_texture_gather_bias_lod 2017-06-14 23:09:39 +08:00
Rex Xu
cabbb788b4 Implement extension GL_AMD_gpu_shader_int16
- Add int16 types (int16_t, uint16_t, i16vec, u16vec).
- Add int16 support to GLSL operators.
- Add int16 type conversions (to int16, from int16).
- Add int16 built-in functions.
2017-06-09 17:11:23 +08:00
Rex Xu
225e0fcadd Implement the extension GL_AMD_texture_gather_bias_lod 2017-06-05 16:41:06 +08:00
John Kessenich
7cdf3fc3c6 Replace #422: Remove the redundant location setting in AST->SPIR-V.
This was redundant in two ways:
1) it replicated algorithms owned in the front end, and
2) it sometimes left location information on both a block and its members.
2017-06-04 13:22:39 -06:00
John Kessenich
e485c7af58 SPV: Debug output: Include OpLine information for execution path.
Note that declaratives are not handled, only procedurals.
2017-05-31 18:50:53 -06:00
John Kessenich
121853f4df SPV: Add OpSource shader source code and file name. 2017-05-31 17:14:15 -06:00
John Kessenich
d6af18f621 Merge pull request #901 from LoopDawg/imat-construct
HLSL: Add imat, umat, and bmat constructors
2017-05-24 23:12:58 -06:00
John Kessenich
84cc15f0d0 HLSL: Fix #903: Don't short-circuit && or ||. 2017-05-24 16:47:32 -06:00
LoopDawg
174ccb8f1d HLSL: Add imat, umat, and bmat constructors
Fixes #894
2017-05-20 21:54:16 -06:00
John Kessenich
7b8c386c5d More non-determinism fixed. 2017-05-19 23:44:51 -06:00
John Kessenich
b6cabc4f24 Fix C++ portability, non-deterministic order of argument evaluation. 2017-05-19 23:29:50 -06:00
John Kessenich
80f92a190a Fix #857: Convert uniform int to local bool for struct alias assignment.
This was done for one direction, but not both directions, so this commit
picks up the other direction.
2017-05-19 23:00:13 -06:00
John Kessenich
0d2b4713c5 HLSL: Don't do logical short-circuits when the operands are bool-vectors.
This seems a bit ill-defined, and was generating code that made OpPhi of two
operands that were Boolean vectors result in a scalar bool.
2017-05-19 20:19:00 -06:00
LoopDawg
65c2eed65d Remapper: handle embedded opcode in OpSpecConstantOp
OpSpecConstantOp contains an embedded opcode which is given as a literal
argument to the OpSpecConstantOp.  The subsequent arguments are as the
embedded op would expect, which may be a mixture of IDs and literals.  This
adds support for that to the remapper binary parser.  Upon seeing such an
embedded op, the parser flips over to parsing the argument list as
appropriate for that opcode.

Fixes #882.
2017-05-18 16:13:04 -06:00
Lei Zhang
2840f63fbc Use unordered_set in ReadableOrderTraverser.
Previously we are using unordered_map to map to bool, which can
be simplified with unordered_set.
2017-05-11 20:48:34 -04:00
Aras Pranckevicius
23d3c712bc [lumped builds] Add include guards (#pragma once) to header files that did not have any.
The codebase seems to use both “#pragma once“ approach, and “#ifndef / #define” approach,
so I picked pragma once as that one is less typing & less brittle.

When glslang is built with some other build system and lumped/unity builds are used,
without the include guards some headers would get included multiple times, leading to duplicate
declaration errors.
2017-05-10 16:58:38 +03:00
John Kessenich
a5c5fb6118 SPV: Emit extension for using StorageClassStorageBuffer. 2017-05-05 05:09:58 -06:00
steve-lunarg
f1709e7146 HLSL: implement [unroll] and [loop] attributes
This adds infrastructure suitable for any front end to create SPIR-V loop
control flags.  The only current front end doing so is HLSL.

[unroll] turns into spv::LoopControlUnrollMask
[loop] turns into spv::LoopControlDontUnrollMask
no specification means spv::LoopControlMaskNone
2017-05-03 13:44:40 -06:00
David Seifert
22afc38b55 Modernise CMake #2
This reverts commit cfc69d95af.
* Change CMAKE_INSTALL_PREFIX default on Windows in order
  to prevent permission denied errors when trying to install
  to "Program Files".
2017-04-29 11:23:15 +02:00
John Kessenich
cfc69d95af Revert "Modernise CMake" 2017-04-28 22:04:24 -06:00
David Seifert
5a5699bdbd Modernise CMake
* Use `GNUInstallDirs` in order to respect GNU conventions.
  This is especially important for multi-arch/multi-lib setups.
* Specify position independent mode building properly, without
  using the historic hack of adding `-fPIC` as a definition.
  This makes the build system more portable.
* Only detect C++ (and not C) to slightly speed up configuring.
* Specify C++11 mode using modern CMake idioms.
* Fix some whitespace issues.
2017-04-28 22:46:52 +02:00
John Kessenich
670271890d SPV: Support test #pragma for generating the StorageBuffer storage class.
Longer term, this storage class should be generated based on the mode
of compilation.
2017-04-19 18:34:49 -06:00
John Kessenich
d1141843c0 SPV Non-functional: fix ordering causing problems with another branch. 2017-04-13 17:08:11 -06:00
John Kessenich
ae79697db1 Merge pull request #827 from amdrexu/feature4
Implement the extension SPV_KHR_16bit_storage
2017-04-08 10:03:45 -06:00
John Kessenich
a09eefd8aa Non-functional: Fix typos in comments. 2017-04-07 15:40:30 -06:00
John Kessenich
6fa17641b5 HLSL: Emit the OpSource HLSL instruction for HLSL, using new headers. 2017-04-07 15:40:01 -06:00
Rex Xu
f89ad98013 Implement the extension SPV_KHR_16bit_storage 2017-04-07 23:22:33 +08:00
John Kessenich
38a425355b SPV: Move to latest public headers. 2017-04-06 17:21:58 -06:00
John Kessenich
4f1403ed1b SPV: Fix #807: use --hlsl-offsets to allow hlsl-style offsets in a buffer.
Corresponds to the EShMsgHlslOffsets flag in messages.
Works for both GLSL and HLSL.
2017-04-05 17:38:20 -06:00
steve-lunarg
e741249b72 HLSL: pass tessellation execution modes through to SPIR-V
The SPIR-V generator had assumed tessellation modes such as
primitive type and vertex order would only appear in tess eval
(domain) shaders.  SPIR-V allows either, and HLSL allows and
possibly requires them to be in the hull shader.

This change:

1. Passes them through for either tessellation stage, and,

2. Does not set up defaults in the domain stage for HLSl compilation,
to avoid conflicting definitions.
2017-03-31 11:47:18 -06:00
John Kessenich
e434ad923e Fix #809: smear scalar condition in OpSelect for selecting vector operands. 2017-03-30 10:16:22 -06:00
John Kessenich
714e58b2fc Merge pull request #801 from amdrexu/bugfix
HLSL: Fix an issue of frexp().
2017-03-29 10:04:30 -06:00
Rex Xu
bcf291a7ba Don't emit NV-specific interface members if NV extensions are disabled. 2017-03-29 23:01:36 +08:00
Rex Xu
470026f9d7 HLSL: Fix an issue of frexp().
The "exp" parameter is floating-point type in HLSL intrinsic while it is
integer type in GLSL built-in function.
2017-03-29 17:12:40 +08:00
John Kessenich
aa3c64c214 Fix #800 (mostly): set of Linux warnings. 2017-03-28 09:52:38 -06:00
John Kessenich
0e7378446b Fix #790: Don't emit NV-specific interface members unless enabled by extension. 2017-03-24 18:40:40 -06:00
John Kessenich
3778979cd4 HLSL: non-static member functions: track and find active anonymous 'this' scopes and members.
Thanks to @steve-lunarg for his input and discussions on handling member functions.
2017-03-21 23:56:40 -06:00
John Kessenich
4960baaf66 HLSL: Basic turn on of non-static member functions.
Still need: pass by reference in SPIR-V and symbol-table level
for accessing 'this' members from member functions.
2017-03-19 18:09:59 -06:00
Rex Xu
5e317ffe40 SPV: Fix unexpected declarations of capability and extension 2017-03-16 23:02:39 +08:00
steve-lunarg
0b5c2ae70e Preserve signedness in SPV image query ops
The AST->SPIRV translation of image queries was dropping signedness,
causing some validation troubles.
2017-03-10 12:51:59 -07:00
John Kessenich
0479437a5c SPV: Fix #739: OpSelect can only operate on scalars and vectors. 2017-03-01 13:49:11 -07:00
John Kessenich
69a2c69649 Merge pull request #736 from steve-lunarg/structbuffer-params
HLSL: add structuredbuffer pass by reference in fn params
2017-02-28 13:10:51 -07:00
John Kessenich
42e33c9bec SPV: Update SPV header to official Rev. 10 of 1.0, and fix the consequences of doing so. 2017-02-27 01:50:28 -07:00
John Kessenich
6c8aaacd28 SPV: Implement new extensions GL_KHX_device_group and GL_KHX_multiview.
These correspond to SPV_KHR_device_group and SPV_KHR_multiview.
Also, bring tests up to date with Khronos internals, and some misc. related changes.
2017-02-27 01:20:51 -07:00
steve-lunarg
dd8287a109 WIP: HLSL: add structuredbuffer pass by reference in fn params
This PR adds the ability to pass structuredbuffer types by reference
as function parameters.

It also changes the representation of structuredbuffers from anonymous
blocks with named members, to named blocks with pseudonymous members.
That should not be an externally visible change.
2017-02-26 11:13:42 -07:00
John Kessenich
4a57dced66 SPV: Handle nested opaque types as function parameters. 2017-02-24 19:22:54 -07:00
Rex Xu
3e783f9b49 SPV: Unexpected declarations of capabilities from NV extensions. 2017-02-22 16:44:48 +08:00
steve-lunarg
5da1f038d8 HLSL: implement 4 (of 6) structuredbuffer types
This is a partial implemention of structurebuffers supporting:

* structured buffer types of:
*   StructuredBuffer
*   RWStructuredBuffer
*   ByteAddressBuffer
*   RWByteAddressBuffer

* Atomic operations on RWByteAddressBuffer

* Load/Load[234], Store/Store[234], GetDimensions methods (where allowed by type)

* globallycoherent flag

But NOT yet supporting:

* AppendStructuredBuffer / ConsumeStructuredBuffer types
* IncrementCounter/DecrementCounter methods

Please note: the stride returned by GetDimensions is as calculated by glslang for std430,
and may not match other environments in all cases.
2017-02-21 15:51:49 -07:00
John Kessenich
8f674e821e Fix issue #676: emit error message on failure to open spv file. 2017-02-18 09:45:40 -07:00
John Kessenich
0302bdf04a SPV: Fix #723: construct vectors from matrices. 2017-02-17 19:06:21 -07:00
John Kessenich
b0561d934c Merge pull request #720 from flaviobortot/master
Added --vn option to generate a C header file containing a variable a…
2017-02-17 09:34:08 -07:00
Maciej Jesionowski
5227b6decb Fix mismatched doc string for SPV_KHR_subgroup_vote
Text for opcodes OpSubgroupAllKHR and OpSubgroupAnyKHR was swapped.
2017-02-17 13:45:29 +01:00
Flavio
15017db971 Removed tabs and replaced with spaces. Changed layout for "else if" 2017-02-15 14:29:33 -08:00
chaoc
df3956c50f Implement NVX_multiview_per_view_attributes 2017-02-14 15:04:33 -08:00
John Kessenich
8e6c6cef6a SPV: Implement specialization constants for ?:. 2017-02-08 17:07:07 -07:00
John Kessenich
433e9ff896 SPV: Emit OpSelect when a selection node is simple enough.
Also, ensures it has a type, no disallowed side effects,
or performance trade offs.
2017-02-08 17:03:13 -07:00
John Kessenich
65ee230f1c HLSL: Add tests and refine what decorations are passed through per stage/in/out. 2017-02-06 23:13:16 -07:00
Flavio
aea3c890d3 Added --vn option to generate a C header file containing a variable assigned to the hex representation of the shader. This is a standard feature on Microsoft's HLSL compiler and it allows developers to include pre-compiled shaders directly into the code. This option enables "Hex output", so it is NOT required to specify -x as well. The output file name is preserved, so no ".h" extension is added. If you want the output file to have ".h" extension then you have to specify it on the output file name. The generated header file uses the "#pragma once" pragma to avoid multiple inclusions. 2017-02-06 11:46:35 -08:00
Endre Oma
ad58d45437 SPV: Emit names of specialization constants 2017-01-31 21:16:17 +01:00
Benjamin Saunders
5a074532af Install headers
This enables the vulkan loader to be built against an installed glslang.
2017-01-29 17:46:44 -08:00
John Kessenich
c0904c15c2 Merge pull request #690 from ligfx/proper_dependencies
CMake: add target_link_libraries internally
2017-01-26 15:13:27 -07:00
Vlad Ivanov
689490fd4d SpvBuilder: add const specifier to vector reference arguments 2017-01-26 20:46:42 +03:00
Rex Xu
c708f98081 Fix a CMakeLists issue 2017-01-24 14:24:21 +08:00
John Kessenich
64b010f390 Merge pull request #678 from chaoc/stereo_view_rendering
support SPV_NV_viewport_array2 and SPV_NV_stereo_view_rendering
2017-01-21 12:05:47 -07:00
Michael Maltese
6077a19ba3 CMake: add target_link_libraries internally
Makes it easier to include glslang in a larger CMake project---instead
of having to call `target_link_libraries(glslang OSDependent OGLCompiler
HLSL)`, for example, you only need to call
`target_link_libraries(glslang)` and it will pull in the helpers it
needs.

This is also better in terms of cleaning up the "public interface",
of sorts, for building glslang: end-users probably shouldn't need to
know or be explicitly dependent on internal targets.
2017-01-21 10:59:15 -08:00
chaoc
771d89fc36 support SPV_NV_viewport_array2 and SPV_NV_stereo_view_rendering 2017-01-20 16:48:26 -08:00
Mike Weiblen
4e9e400ec6 Fix for not-handled-in-switch warnings
Added default to the switch() for AMD_EXTENSIONS to avoid a spew
of warning messages.
2017-01-20 13:39:30 -07:00
John Kessenich
d3aea5edaf Merge pull request #679 from ashwinkolhe/akolhe_spv_khr_subgroup_vote
Implement SPV_KHR_subgroup_vote
2017-01-19 16:16:49 -07:00
Rex Xu
430ef40ab4 Implement new revision of extension GL_AMD_shader_ballot
- Add support for invocation functions with "InclusiveScan" and
  "ExclusiveScan" modes.
- Add support for invocation functions taking int64/uint64/doube/float16
  as inout data types.
2017-01-19 12:09:51 +08:00
Ashwin Kolhe
c720f3e639 Implement SPV_KHR_subgroup_vote
doc.cpp: Add capabilities, scope to the opcodes. Add opcode and
capability strings.
GLSL.ext.KHR.h: Add extension
string.
GlslangToSpv.cpp: Fix handling of opcodes to generate
appropriate SPIR-V.
spirv.hpp: Add capability and opcode
enums.
spv.shaderGroupVote.comp.out: Update SPIR-V output for test
shader.
2017-01-18 14:16:49 -08:00
John Kessenich
fdf6347f0a HLSL: Add EOpMatrixSwizzle, selectively decomposed to other ops, for issue #670.
Since EOpMatrixSwizzle is a new op, existing back-ends only work when the
front end first decomposes it to other operations. So far, this is only
being done for simple assignment into matrix swizzles.
2017-01-13 12:35:01 -07:00
Alex Szpakowski
844dd45db6 Add a virtual destructor to a class which has virtual methods. 2017-01-08 17:57:21 -04:00
John Kessenich
927608b393 Non-functional: White space after "//", mostly for copyrights. 2017-01-06 12:34:14 -07:00
John Kessenich
ecba76fe73 Non-Functional: Whitespace, comments, replace accidentally deleted comment.
- fixed ParseHelper.cpp newlines (crlf -> lf)
- removed trailing white space in most source files
- fix some spelling issues
- extra blank lines
- tabs to spaces
- replace #include comment about no location
2017-01-06 11:24:14 -07:00