Commit Graph

43 Commits

Author SHA1 Message Date
Arcady Goldmints-Orlov
592de6cf78 Clean up unused includes. 2024-08-20 09:09:44 -04:00
Boris Zanin
808c7ed17c Implement support for GL_KHR_cooperative_matrix extension 2023-07-26 16:39:17 -06:00
Johannes Kauffmann
e00517acfe SPIRV: remove pre-C++11 workaround 2023-05-10 09:55:02 -06:00
Greg Fischer
9e2b914722 Restore legacy interface for remap()
Fixes ABI breakage caused by #2933
2022-06-01 16:40:29 -06:00
David Neto
ea7e64cf50 Remove unused variable 2022-05-19 13:27:12 -04:00
ahagan
b5aae62731 Add whitelist filtering for debug comments in SPIRV-Remap. 2022-05-11 12:08:25 -04:00
Marius Hillenbrand
78ce7e567f Fix encoding/decoding of string literals for big-endian systems
Per SPIR-V spec, a string literal's UTF-8 octets are encoded packed into
words with little-endian convention. Explicitly perform that encoding
instead of assuming that the host system is little-endian.

Note that this change requires corresponding fixes in SPIRV-Tools.

Fixes #202
2021-11-08 14:12:01 +01:00
Sidney Just
f1121f02ab Fixed SPIR-V remapper not remapping OpExtInst instruction set IDs 2021-06-12 15:30:36 -07:00
craig stout
d0e7ed37fc
[spirv-remap] Fix undefined behavior in hashing (#2403)
There's a statement that intends to generate a 32-bit hashcode, but due
to integer promotion, the intermediate values can trigger signed integer
overflow, which is undefined behavior.

To avoid this, cast at least one operand to unsigned int before
multiplying, which will cause the result to be promoted to unsigned int
instead of signed int.

With this patch, I'm able to build core for qemu-x64 with host_asan-ubsan.

Fixed: 60128
Change-Id: Idd644e534116bf29dca8013936ac39901bbe68fc
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/glslang/+/428254
Reviewed-by: John Bauman <jbauman@google.com>

Co-authored-by: Drew Fisher <zarvox@google.com>
2020-09-26 18:43:30 -06:00
Rex Xu
ac2f01f4bd
SPIRV: Add disassembly support for multiple literal strings (#2397)
According to the extension SPV_GOOGLE_decorate_string,
OpDecorateString (or OpMemberDecorateString) ought to be capable of
supporting multiple literal strings. Each literal strings are padded
with null terminator to make word alignment. The layout is:

  Inst | Target | Decoration | Literal String, Literal String, ...
2020-09-14 09:57:09 -06:00
otakuto
d03da06ac1 Remove execute permissions 2018-08-07 03:16:20 +09:00
GregF
c6831d1ed4 Add support for OpConstantNull and OpConstantSampler to spirv-remap
Fixes issue #1408
2018-06-19 13:51:28 -06:00
John Kessenich
66011cb2c2 SPV: Implement Vulkan 1.1 features and extensions. 2018-03-06 16:12:04 -07:00
GregF
e86b4c84d6 Remapper: Fix strip algo when strip ranges overlap 2017-11-02 14:01:57 -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
ea1ea974eb Address #1052: Have language-level exits of case statements. 2017-09-11 19:25:17 -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
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
steve-lunarg
297754cfe8 Remapper: remove debug info for IDs stripped in other passes
If some DCE is performed such as removing dead functions, then even
if we are NOT stripping debug info, we still must remove the debug
opcodes that refer to the now-dead IDs.

Also, this adds a small change to perform no ID remapping if none
is requested, making spirv-remap properly be a no-op if no options
are given.
2016-12-12 09:01:11 -07:00
steve-lunarg
811d9f4cad WIP: SPIRV remapper: allow 64 bit literals in OperandVariableLiteralId class iteration 2016-08-17 08:33:49 -06:00
David Neto
b86e8b629a Revert "Merge pull request #456 from steve-lunarg/remapper-literal64"
This reverts commit ad08b30f69, reversing
changes made to 28660bb580.

This backs out the pull request
https://github.com/KhronosGroup/glslang/pull/456 because it introduced
several internal errors even on code that only uses 32-bit numeric
types.
2016-08-12 16:49:58 -04:00
steve-lunarg
b249f2fc24 SPIRV: allow 64 bit literals in OperandVariableLiteralId class iteration. 2016-08-12 09:53:31 -06:00
Pyry Haulos
b93e3a3957 Remap Scope and MemorySemantics IDs in SPIRV remapper
Scope and MemorySemantics operands contain IDs as well and may need
remapping.
2016-07-22 09:57:28 -07:00
GregF
39d5e711a7 remapper: do not eliminate interface variables in dce by default
this is done by counting op_entrypoint as a use/def
2016-06-03 09:57:57 -06:00
Eric Engestrom
6a6d6dda95 fix spelling mistakes 2016-04-03 01:17:13 +01:00
John Kessenich
6c292d3ba7 SPV: Implement Vulkan version of GLSL (KHR_vulkan_glsl). 2016-02-15 21:46:55 -07:00
GregF
8548bab1fa spirv-remap: Fixed strings not at end of operands, fixed L/S defect
Also added new op classes.
2016-02-01 16:44:57 -07:00
GregF
036a7944e5 spirv-remap: assert on unhandled OperandClass 2016-02-01 16:13:21 -07:00
GregF
796e15ad27 spirv-remap: inhibit loadstore opt if variable ref'd by other instructions 2016-02-01 16:12:48 -07:00
GregF
3bb040b71b spirv-remap: handle OperandImageOperands during remap 2016-02-01 16:12:00 -07:00
John Kessenich
55e7d11ce8 SPIR-V: Move from Version .99 Rev 31 to Version 1.0, Rev 2. 2015-11-15 22:31:41 -07:00
Andrew Woloszyn
8b64fa5474 Fixes for compiling glslang on Android.
Primarily fix is due to Android not supporting std::to_string().
2015-08-17 11:39:38 -04:00
Steve
3573f2e029 Add missing OpTypeSampledImage to prevent unknown type error from SPVRemapper. 2015-08-11 09:20:14 -06:00
John Kessenich
5e4b1242bf Move to revision 31 of SPIR-V. 2015-08-06 22:55:01 -06:00
Steve
465a14666a Comment out some dead assignments per suggestion from static analysis tools.
Code is left in as comments for clarity to humans.
2015-07-15 14:34:35 -06:00
John Kessenich
140f3df134 Final round for line endings. 2015-06-26 16:58:36 -06:00
John Kessenich
79eaa91e6f glslang portability: Resolve OSX errors, some other OS warnings.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31468 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-06-10 22:05:48 +00:00
John Kessenich
3ef22f2139 SPV compressor: Fixes a possible asserts. Attribution: spvremapper@lunarg.com
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31451 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-06-09 02:01:53 +00:00
John Kessenich
01685c3ff8 SPV compression: Final check-in enabling this on MSVC 2012. All compression submissions from Steve (spvremapper@lunarg.com).
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31236 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-20 16:04:17 +00:00
John Kessenich
3c4a276282 SPIR-V compression: Requires rerunning CMake. Adds a standalone tool for running the SPV compression.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31232 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-19 21:07:04 +00:00
John Kessenich
2aa7f3a671 SPV compression: Remove file/path manipulation stuff, setting up for that to be a separate tool. Added copyright messages as well.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31201 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-15 16:02:07 +00:00
John Kessenich
4217d2ea22 SPIR-V compression: Add stripping and remapping tools for compressibility of generated SPIR-V.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31180 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-13 20:38:44 +00:00