SPIR-V requires that any instruction using the result of an
OpSampledImage instruction be in the same block as the OpSampledImage.
This is hard to guarantee in code generation but easy to fix after the
fact, by simply inserting a new OpSampledImage before the user of its
result if needed, with the new instruction having the same operands as
the original OpSampledImage.
This change adds a new pass to spv::Builder::postProcess that does this.
This might leave the original OpSampledImage instructions "orphaned"
with no users of their result ID, but dead code elimination would take
care of those further down the line.
- Correctly populate the field `currentFileId` with the presence of include directive
- Support lazy OpLine/OpDebugLine generation only when a real instruction is added instead of a debug location is set
- Improve the debug location tracking to per-block instead of just per-builder
- A few bug fixes related to debug source info
1. Pull OpDebugFunction, OpDebugScope and OpDebugVariable for params out
of makeFunctionEntry.
2. Put above in a separate function called setupDebugFunctionEntry,
which also accept line number and set it correctly in builder.
3. Call setupDebugFunctionEntry in makeFunction. Also special case
handle entry function since it's created ealier elsewhere.
Adds the --no-link option which outputs the compiled shader binaries
without linking them. This is a first step towards allowing users to
create SPIR-v binary, non-executable libraries.
When using the --no-link option, all functions are decorated with the
Export linkage attribute.
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
* Implement GL_EXT_terminate_invocation.
* terminateInvocation: declare the SPV extension
* Update test results for spirv-tools and bison version bumps
Co-authored-by: John Kessenich <cepheus@frii.com>
This simplifies and enforces use of precision in many more places,
to help avoid accidental loss of RelaxedPrecision through intermediate
operations. Known fixes are:
- ?:
- function return values with mis-matched precision
- precision of function return values when a copy was needed to fix types
More aggressively prune unreachable code as follows.
When no control flow edges reach a merge block or continue target:
- delete their contents so that:
- a merge block becomes OpLabel, then OpUnreachable
- a continue target becomes OpLabel, then an OpBranch back to the
loop header
- any basic block which is dominated by such a merge block or continue
target is removed as well.
- decorations targeting the removed instructions are removed.
Enables the SPIR-V builder post-processing step the GLSLANG_WEB case.
- 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
Fix issue #185 by removing OpDecorate instructions whose target IDs are
defined in unreachable blocks and thus not dumped in the generated
SPIR-V code.
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.