Commit Graph

1287 Commits

Author SHA1 Message Date
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
d55fe86512 HLSL: Fix #1257: layout float1, int1, etc., as scalars. 2018-02-27 00:48:17 -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
9c9c4e90df GLSL/SPV: Fix #1196: Require resources to have layout(binding=X). 2018-02-22 11:47:41 -07:00
John Kessenich
2d9973de0e Tests: specExamples.vert is used twice, it needs two different output names. 2018-02-21 18:42:10 -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
John Kessenich
b587fb6208 GLSL: Fix #1247. Remove extraneous *= matrix test. 2018-02-15 12:22:25 -07:00
John Kessenich
23ea3db3e5 Warning for #pragma once. GLSL and HLSL. Addresses #824. 2018-02-11 23:23:22 -07:00
David Neto
497d5ffefd Update SPIRV-Tools known-good
One legalization case updated for a renumbered ID
2018-02-09 13:20:45 -05: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
David Neto
d123299281 Update SPIRV-Tools known-good
Update SPIRV-Tools.  Relevant functional changes:
 - Optimizer enhancements:
   - ADCE now removes OpSwitch
   - Block merging occurs in more cases
 - Optimizer fixes:
   - Constant propagation (CCP): support matrix constants
   - #1199: Optimizer: Fix CCP: don't propagate spec constants.
   - #1203: Optimizer: Fix common uniform elim bug introduced by refactoring.
   - #1210: Optimizer: Aggressive dead code elimination: Fix 'break' identification.
   - #1212: Optimizer: Aggressive dead code elimination: Was skipping too many instructions.
   - #1214: Optimizer: Aggressive dead code elimination: Fix infinite loop.
   - #1228: Optimizer: Fix CCP: Handling of varying Phi nodes; was resulting in infinite loop.
   - #1245: Optimizer: Dead branch elimination: Avoid a null pointer dereference.
   - #1250: Optimizer: Dead branch elimination: Avoid spuriously reporting a change.
   - #1262: Support building on VisualStudio 2013 again

Update SPIRV-Headers, with "unified1" directory.

Updated one Glslang legalization test base result due to better block merging.
2018-02-05 14:30:13 -05:00
John Kessenich
b3f9e0a334 GLSL: Fix #1229: merge array sizes in parameter declarations. 2018-02-02 12:41:25 -07:00
John Kessenich
98e733cb58
Merge pull request #1232 from KhronosGroup/control-flow-attributes
Control flow attributes
2018-02-02 09:03:44 -07:00
John Kessenich
da0b18c3db Error message: Improve error message (will help another party id a bug). 2018-02-01 11:09:21 -07:00
John Kessenich
304765681b AST: dump attributes along with control flow. 2018-02-01 00:55:26 -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
6c1c2766b6 SPV: Bump SPIR-V header to the unified1 version (version 1.2). 2018-01-29 16:16:11 -07:00
David Neto
0e58bbd5aa Update known-good spirv-tools.
Optimizations used in HLSL legalization now sweep away unused types.
2018-01-12 12:52:04 -05:00
John Kessenich
e22e347395 HLSL: Fix #1208: accept both int and uint in asuint() and asint(). 2018-01-11 13:26:09 -07:00
John Kessenich
eb2c0c72bf GLSL: XFB: more support for built-in block redeclarations with XFB.
- correct inheritence (or not) of the right XFB buffer
- compute implicit stride (fixes #1212)
- semantic check block-member redeclarations
- inherit stride from a member
2018-01-09 18:00:33 -07:00
John Kessenich
9c6f8cc29b Scanner: Many int16 and float16 fixes, including performance.
- fixes #1209, addresses most of #1187
- only query feature availability on seeing the feature
  (was doing it for every single token)
- correct case-sensitive checks for multi-character suffixes
2018-01-08 15:59:29 -07:00
John Kessenich
c043aadd25 Scanner: Many int64 fixes, including performance.
- partially addresses #1209 and #1187
- only query 64-bit extension on seeing use of a 64-bit literal
  (was doing it for every single token)
- correct HLSL acceptance of 64-bit literal syntax (still an int though)
- error on overflow of 32-bit literal type
2018-01-08 11:52:23 -07:00
John Kessenich
132cf53737 HLSL: Fix #1203: Declare anonymous members for cbuffer with no ';'
The grammar for no semicolon and no object name for cbuffer/tbuffer
was correct, but the production still skipped the anonymous declarations
if an identifier followed.
2018-01-02 11:27:54 -07:00
John Kessenich
fd1e8a78a8 HLSL: Fix 1201: Accept 'layout' as an identifier. 2017-12-29 20:59:13 -07:00
John Kessenich
046bae0bab HLSL: Attributes: Add [[vk::constant_id()]] and [[vk::push_constant]] 2017-12-23 17:29:45 -07:00
John Kessenich
e08ed0ccf4
Merge pull request #1190 from jfmarquis/hlsl-store-type-propagation
HLSL: Fix possibly incorrect type conversion in Store2-3-4
2017-12-21 14:59:34 -07:00
John Kessenich
8a3f7a12d4 Merge branch 'flatten1' of https://github.com/greg-lunarg/glslang into greg-lunarg-flatten1 2017-12-21 12:25:52 -07:00
John Kessenich
b3cff2f297 HLSL Tests: Remove optimization from tests that don't need it.
This is to create more stable test results.
2017-12-21 12:17:25 -07: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
Jean-François Marquis
3f0aff8ee5 HLSL: Fix possibly incorrect type conversion in StoreN and LoadN
Set type to r-value resulting from indexing vector, to prevent
float->uint conversion when source is already uint. Resulting
OpConvertFToU would otherwise fail validation because source is
already uint.
For LoadN, incorrect uint->float->uint can be avoided; fixing
potential truncation of big integer values.
2017-12-21 12:11:40 -05:00
John Kessenich
e1ff231235 GLSL: Fix #1193: no 'location' on uniform/buffer block. 2017-12-16 10:07:22 -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
070aaeafcd HLSL: Fix #1192: when bool operands are converted to ints, convert result type. 2017-12-15 21:46:09 -07:00
John Kessenich
788fbeb36f HLSL: Make attributes for built-in override semantics.
Fixes #1188.
2017-12-15 08:15:26 -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
John Kessenich
be3842f6ae GLSL: Implement XFB for redeclared built-in blocks. 2017-12-15 04:43:59 -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
LoopDawg
0cff51004d HLSL: for split output structs, propagate indirection to builtin.
Some stage (e.g, hull shaders) have arrayed builtin outputs (e.g, position).
When copying from the internal structure to the split form, it is necessary
to propagate that indirection to the actual arrayed outputs.  This was not
happening.

Addresses #1181
2017-12-12 16:22:48 -07:00
John Kessenich
e078059d06
Merge pull request #1174 from LoopDawg/y-flip
HLSL: add optional position.Y inversion
2017-12-12 09:16:01 -07:00
John Kessenich
8116cfc9bf HLSL: Give error on unsupported buffer initializer. 2017-12-09 04:42:42 -07:00
John Kessenich
67fca7c4ce
Merge pull request #1178 from LoopDawg/primitiveid-hs-input
HLSL: Allow primitive id on hull shader input
2017-12-08 19:35:17 -07:00
LoopDawg
280c75ca51 HLSL: Allow primitive id on hull shader inputs
Fixes #979
2017-12-08 12:01:16 -07:00