Commit Graph

916 Commits

Author SHA1 Message Date
Dejan Mircevski
97605c86fd Fix #137 by avoiding a C++11 feature.
Apparently, older MSVC versions don't support brace-initializers for
function arguments.

Thanks @baldurk for a suggestion on his branch.
2016-01-20 10:25:28 -05:00
John Kessenich
7349eab099 Merge pull request #136 from dekimir/no-block-removal
SPV: Don't remove SPIR-V blocks before codegen, use new InReadableOrder instead.
2016-01-19 19:26:08 -07:00
Dejan Mircevski
ed55bcd9f8 Don't remove SPIR-V blocks before codegen.
A removed block releases its instructions, so Module::idToInstruction
suddenly contains dangling references.  The original motivation for
block removal was to skip some unreachable blocks, but that's already
achieved by InReadableOrder.cpp.

Also updated stale comments.
2016-01-19 21:18:14 -05:00
John Kessenich
33782795d9 Merge pull request #127 from dekimir/loopgen
SPV: Rework loop code generation to match SPIR-V 1.0.
2016-01-19 15:32:07 -07:00
Dejan Mircevski
f3c63cc359 Move continue-block to after all branches. 2016-01-19 16:56:45 -05:00
Dejan Mircevski
e7f6cac1bd Merge branch 'topo' into loopgen-after-readable-order 2016-01-19 16:47:41 -05:00
John Kessenich
9a0b59c7b6 Merge pull request #135 from dekimir/topo
SPV: Code-generate SPIR-V blocks in a more readable order
2016-01-19 14:22:53 -07:00
Dejan Mircevski
159b59faa7 Reformat to better match existing style. 2016-01-19 14:52:31 -05:00
Dejan Mircevski
cce6a8acaf (C) Google 2016-01-19 14:50:12 -05:00
Dejan Mircevski
34bc6c3896 Explicitly initialize Instruction::block. 2016-01-19 14:08:32 -05:00
Dejan Mircevski
a7e734962e Remove a redundant check before visit(succ). 2016-01-19 11:49:37 -05:00
Dejan Mircevski
57bbde4a99 Add copyright, remove unused #includes. 2016-01-19 11:44:53 -05:00
Dejan Mircevski
fa242904b0 Make Instruction::getBlock() const. 2016-01-19 11:31:55 -05:00
Dejan Mircevski
377f0cab26 Fix merge issues. 2016-01-19 10:17:33 -05:00
Dejan Mircevski
38d039d063 Rework inReadableOrder() as a recursive descent.
Add a test for unreachable merge block.

Update test results with the new order: mainly delaying merge blocks and
removing unreachable ones.
2016-01-19 10:14:50 -05:00
Dejan Mircevski
9c591487ad Fix spv.branch-return.vert. 2016-01-19 10:11:34 -05:00
Dejan Mircevski
baa55a1591 Add spv.branch-return.vert and fix inReadableOrder(). 2016-01-19 10:11:34 -05:00
Dejan Mircevski
44bfb0d0cd Implement inReadableOrder(). 2016-01-19 10:11:34 -05:00
Dejan Mircevski
454796e008 Call addPredecessor() on OpSwitch blocks. 2016-01-19 10:10:15 -05:00
Dejan Mircevski
5fe789b4af Add Block::successors. 2016-01-19 10:10:15 -05:00
John Kessenich
60a7f3f7ae Merge branch 'master' of github.com:KhronosGroup/glslang 2016-01-18 11:11:46 -07:00
John Kessenich
28ad350b35 Memory: remove a part of the last merge request that causes crashes in multi-threaded mode. 2016-01-18 11:10:40 -07:00
John Kessenich
5996961bd1 Merge pull request #134 from AWoloszyn/glslangvalidator-memory
Freed up some command line memory (not used programmatically).
2016-01-18 11:10:18 -07:00
John Kessenich
3e9add360d Merge pull request #133 from AWoloszyn/spirv-memory
Free memory associated with SPIR-V generation and the pragmaTable.
2016-01-18 10:48:07 -07:00
Andrew Woloszyn
b7946d16bb Free memory associated with SPIR-V generation. 2016-01-18 10:29:41 -05:00
Andrew Woloszyn
b891c2b827 Freed up some memory when no longer needed in glslangValidator. 2016-01-18 09:26:25 -05:00
John Kessenich
712ecb96a2 Doubles: Add all the missing built-in double-based prototypes. 2016-01-16 20:37:43 -07:00
John Kessenich
c57b2a97fa Memory/Perf: For link-mode, isolate file I/O so API can be looped over.
Separating file I/O from compile/link lets the compile/link be done
repeatedly in a loop for testing and measuring of performance and
memory footprint, including seeing memory growth over time for
functional-level memory-leak testing.

While the older compile-only mode already had this functionality,
and typically showed no memory leaks, SPIR-V uses the link path,
has pending "TODO" for memory freeing, and this shows several
kilobytes of leaking per compile-link. Most likely, pending
merge request 131 will address much of this.
2016-01-16 15:30:03 -07:00
John Kessenich
68f1431a55 Merge pull request #121 from amdrexu/feature
Parser & SPV: Implement two extensions regarding GLSL sparse texture.
2016-01-15 00:52:18 -07:00
John Kessenich
863aa667f3 Merge pull request #129 from AWoloszyn/fix-noop-strcpy
Preprocessor: Removed strcpy that copied a value to itself.
2016-01-13 19:12:50 -07:00
John Kessenich
5caf936428 Merge pull request #126 from mgadams/win32_warnings
Fix several build warnings/error encountered with VS2013
2016-01-13 19:11:05 -07:00
John Kessenich
e95fa5e095 Tests: Update to match previous pull request. 2016-01-13 19:04:19 -07:00
John Kessenich
2619e47502 Merge pull request #130 from jekstrand/fix-std140-struct
linkValidate: Round up structure sizes to vec4 in std140
2016-01-13 18:59:31 -07:00
Jason Ekstrand
a76766a434 getBaseAlignment: Use the rowMajor argument for determining matrix strides
The argument version is passed in from above and struct handling ensures
that row-majorness gets propagated correctly from one level to the next.
If we just look at the type itself and it's embedded in a struct that's
declared row-major, we may get the wrong stride.
2016-01-13 17:17:39 -08:00
Jason Ekstrand
79b7046a27 getBaseAlignment: Round up structure sizes to max alignment 2016-01-13 17:17:39 -08:00
Andrew Woloszyn
e602d25f09 Removed strcpy that copied to itself.
Found by running glslang with -fsanitize=address in clang.
Also fixes a potential buffer-overrun with return from lReadByte.
2016-01-12 15:48:00 -05:00
Dejan Mircevski
dba2826328 Merge branch 'master' of github.com:google/glslang into loopgen
Change-Id: Ie8236430bb9e30a9be2e0c1573c42183c2f4d0d4
2016-01-11 16:26:18 -05:00
Dejan Mircevski
832c65c33b Fix back-branch target for do-while loops.
To ensure back branches always go to a header block, create a header
block even for !testFirst loops.  Then unify common code between the
testFirst/!testFirst cases.

Generate the header-block code first, so update golden files.

Realize that certain infinite loops generate invalid SPIR-V, so put a
TODO to instead abort code generation in such cases.

Change-Id: I1e173c8f73daad186cfc666b7d72bd563ed7665d
2016-01-11 15:57:11 -05:00
Dejan Mircevski
c8fbbab419 Update .out files with new loop SPIR-V.
Also update breakForLoop and call builder.closeLoop() in code
generation.

Remove dead code.

Change-Id: Ic8ce5b208530f8787989ef45a2efa405f1b45310
2016-01-11 14:48:36 -05:00
Dejan Mircevski
7819bee82c Switch loops stack to use LoopBlocks.
Also remove dead code.

Change-Id: I2c0177d8cab48b7d6f9442715aecb7951597f3c8
2016-01-11 09:35:22 -05:00
Dejan Mircevski
13228243b2 Test a for loop with no body.
Change-Id: I5b53cc008349afad94b14500506fcab4d6e64d2e
2016-01-10 23:15:08 -05:00
Dejan Mircevski
e537b8b488 Fix unreachable-block removal.
Add a test for loop without a condition.

Change-Id: Idd7fc462218a84b1e745207e2975a3f2897d30a0
2016-01-10 19:37:00 -05:00
Dejan Mircevski
9c6734c8df First cut at new loop codegen.
Change-Id: Id3bdf8b7a5606e7ce5d856ef225d5ddbe59a584b
2016-01-10 12:15:13 -05:00
Mark Adams
364c21c8c0 Fix several build warnings/error encountered with VS2013
This also fixes the newlines for spirv.hpp to be consistent with the rest of the files.
2016-01-06 13:41:02 -05:00
Rex Xu
48edadfd24 Parser & SPV: Implement two extensions regarding GLSL sparse texture.
Implement extension "GL_ARB_sparse_texture2".
Implement extension "GL_ARB_sparse_texture_clamp".
2016-01-05 16:07:02 +08:00
John Kessenich
e23c9849c2 SPV: Handle type punning in createCompositeCompare(). 2016-01-04 23:59:09 -07:00
John Kessenich
f8842e55c0 SPV: Don't do stride decorations for arrays of arrays of blocks. 2016-01-04 19:22:56 -07:00
John Kessenich
c9e0a42b92 SPV: Handle stride decorations for arrays of arrays, and using multiple type instances when strides are used. 2015-12-29 21:27:24 -07:00
John Kessenich
4998789d4e SPV: Fix array strides by explicitly computing them in the getBaseAlignment() algorithm. 2015-12-29 19:20:55 -07:00
John Kessenich
e0b6cad44f SPV: Generalize multiple struct-type instances for interpolation/invariant qualifiers. 2015-12-24 10:30:13 -07:00