Commit Graph

2568 Commits

Author SHA1 Message Date
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
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
57f6a016f0 SPV: Complete OpModuleProcessed implementation, enabled by have 1.2 headers. 2018-02-22 19:36:18 -07:00
John Kessenich
e1cc1e2eed
Merge pull request #1256 from KhronosGroup/require-binding
GLSL/SPV: Fix #1196: Require resources to have layout(binding=X).
2018-02-22 12:58:29 -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
90ac5fcfe3
Merge pull request #1253 from KhronosGroup/hlsl-ternary-select
HLSL: Fix #1249: Always execute both sides of ternary "?:".
2018-02-21 09:09:01 -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
John Kessenich
a5cae08259
Merge pull request #1250 from LoopDawg/image-fetch-conversion
HLSL: Add conversions for image ops during SPV construction
2018-02-19 18:28:24 -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
98e3fb1926
Merge pull request #1246 from amdrexu/bugfix
Fix an issue of interpolateAtVertexAMD().
2018-02-15 11:18:22 -07:00
Rex Xu
35a3de748a Fix an issue of interpolateAtVertexAMD().
An error message should be reported if the interpolant is not an input.
2018-02-14 11:42:34 +08:00
John Kessenich
23ea3db3e5 Warning for #pragma once. GLSL and HLSL. Addresses #824. 2018-02-11 23:23:22 -07:00
John Kessenich
b5bf536b5f
Merge pull request #1244 from dneto0/update-spirv-tools
Update SPIRV-Tools known-good
2018-02-09 18:17:49 -07:00
John Kessenich
3394353b7e
Merge pull request #1243 from greg-lunarg/kg11
Upgrade update_glslang_sources.py to work with other sites
2018-02-09 18:17:24 -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
GregF
484cbd0484 Upgrade update_glslang_sources.py to work with gitlab branch
--site gitlab must be added to command for gitlab capability.
Default is github.
2018-02-08 16:02:23 -07:00
John Kessenich
4ee5193b53 Non-functional: GLSL: Fix #1242; don't pass reference to nullptr. 2018-02-08 12:13:25 -07:00
John Kessenich
2f658e1f08
Merge pull request #1241 from greg-lunarg/kg9
Add DeadInsertElim to legalization and RedundancyElim to -Os.
2018-02-08 08:59:05 -07:00
GregF
8a4848f5b2 Add DeadInsertElim to legalization and RedundancyElim to -Os. 2018-02-07 16:04:42 -07:00
John Kessenich
b5ab34590e
Merge pull request #1239 from KhronosGroup/deeper-access-chains
SPV: Create more access chains addressing a few swizzling issues.
2018-02-06 09:50:13 -07:00
John Kessenich
9ffc72d1a3
Merge pull request #1238 from zeux/pp-string-buffer
Preprocessor: Use std::string instead of std::stringstream
2018-02-06 09:47:44 -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
Arseny Kapoulkine
75cffdf92c Preprocessor: Use std::string instead of std::stringstream
std::stringstream has a measurable overhead for preprocessing - it
appears that operator<< does a tiny bit of extra work for appending
chars/strings and also can't be inlined in most cases on VS2015;
additionally, std::endl triggers a stream flush which also adds up.

Replacing this with std::string buffer gets the preprocessing time down
from 180ms to 135ms in one case, making it 1.33x faster.

Note that integer-to-string conversion is using std::to_string; in
theory this could be slower than sprintf or manual conversion, but I
haven't found these cases to affect preprocessing time in practice
(std::to_string would always use the short string buffer for
line/version numbers, and the number of calls is not too significant).
2018-02-05 16:07:39 -08:00
John Kessenich
2651ccaec8
Merge pull request #1234 from dneto0/update-spirv
Update SPIRV-Tools known-good
2018-02-05 14:42:45 -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
e349af7e20 Non-functional: Fix #1231: remove duplicated code. 2018-01-31 22:15:45 -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
22f02d09cc EShTargetSpv: Fix #1235, spelling, in a backward compatible way. 2018-01-31 17:53:24 -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
John Kessenich
82ead04c39 Non-functional. Fix #1223: expand comments. 2018-01-17 21:45:25 -07:00
John Kessenich
ade21c716c
Merge pull request #1224 from fjhenigman/unused
Fix unused function warning.
2018-01-17 20:49:47 -07:00
John Kessenich
ab46a2e5e9
Merge pull request #1221 from dneto0/update-spirv
Update known-good spirv-tools.
2018-01-17 02:02:35 -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
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
63400477f6 HLSL: Protect against 'continue' outside of loops. 2018-01-10 03:50:42 -07:00
John Kessenich
9b5668c8ef HLSL: Fix #1214: check for nesting in loop/switch of break statements. 2018-01-09 22:32:42 -07:00
John Kessenich
7420a761a3 HLSL: Fix #1215: propagate error on seeing a type name instead of a variable. 2018-01-09 21:35:44 -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