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.
Currently no debug info is emitted for buffer reference types, which
resulted in the SPIR-V backend code asserting when trying to emit the
debug info for struct member that had such a type. Instead, the code now
skips such struct members. Full debug info for buffer references may
require forward references in the debug info instructions, which is
currently prohibited by the spec.
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.
Previously, the type names in the nonsemantic shader debug info would be
"int", "uint", or "float" for all numeric types. This change makes the
correct names such as "int8_t" or "float16_t" get emitted.
The `function` parameter is only used by an assert currently, so mark
it as "maybe unused". Alternatively the parameter could be removed,
but avoid such API churn for now.
The containsPhysicalStorageBufferOrArray function now handles struct
types correctly, checking their contents recursively for buffer
reference types. As a result, OpVariables containing structs that have
members that are buffer references now have the appropriate
AliasedPointer or RestrictPointer decoration as per the spec.
Fixes#3188
We previously use createOp() in SPV builder to create type declaration.
However, all type declarations should be placed in const-type-variable
declaration section. And duplicated type defintions ought to be avoided.
We now make a method in SPV builder to perform this operation with a
more general solution: makeGenericType().
Full vector and fully specified vector swizzle stores are not affected by this change, only partial swizzles ie swizzles with fewer components than the vector being stored to.
Previously the vector being stored to loaded and any components not specified in the swizzle were used to create a full store to the vector.
While this change generates more SPIR-V instructions, it is necessary for correctness.
Fixes#2518.
In a matrix constructor that takes a number of components, as many
components as necessary must be taken, with the rest discarded, as GLSL
allows more components than necessary to be specified. For example, the
following:
mat4 m4 = mat4(v4, v4.yzwx, v4.zwx, v4.zwxy, v4.wxyz);
is equivalent to:
mat4 m4 = mat4(v4, v4.yzwx, v4.zwx, v4.zwxy, v4.w);
glslang takes the components from the constructor and builds the single
components of the matrix in a 2D array before constructing the matrix
itself. It however did not check for extra parameters and was thus
writing OOB to said 2D array. This is fixed in this change
Signed-off-by: Shahbaz Youssefi <shabbyx@gmail.com>
* Fix traceRay/executeCallable to have id instead of constant.
Update to final (non-provisional) SPIR-V capabilities
(includes review feedback)
- Change visibilty of findLinkerObjects.
See merge request GLSL/glslang!78
* Add support for OpConvertUToAccelerationStructureKHR.
GLSL : https://gitlab.khronos.org/GLSL/GLSL/-/merge_requests/60
SPV : https://gitlab.khronos.org/spirv/spirv-extensions/-/merge_requests/182
See merge request GLSL/glslang!77
* Add volatile qualifier to certain builtins for ray tracing.
See merge request GLSL/glslang!81
* make gl_RayTmaxEXT volatile in intersection shader
Vulkan Issue #2268
* Add testing for layouts on SBT
vulkan/vulkan#2230
- no layout specified should be same as std430
- explicitly test std140, std430, scalar layouts
See merge request GLSL/glslang!86
* Support for new opcodes OpIgnoreIntersectionKHR and OpTerminateRayKHR
vulkan/vulkan#2374
Add support for ignoreIntersectionEXT and terminateRayEXT as block
terminator statements.
See merge request GLSL/glslang!87
* Fix code-generation issues with global ray query variables
See merge request GLSL/glslang!88
* update dependencies for spirv-headers and tools
And update mesh shader results
* Fix indeterminate argument ordering
Authored-by: David Neto <dneto@google.com>
Co-authored-by: Ashwin Lele (NVIDIA Corporation) <alele@nvidia.com>
Co-authored-by: Neslisah <Neslisah.Torosdagli@amd.com>
This implements a new nonunifom analysis suggested by @jbolz. This change
generates nonUniform decorations that were previously missing and avoids
generation of incorrect decorations. Most notably, it now generates
decorations for nonuniform functions and out params. It avoids generating
decorations for lvalues which themselves are not nonuniform.
* 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>
Add more builder functions to OpExecutionMode, OpExecutionModeId,
OpDecorateString, OpMemberDecorateString.
According to SPIR-V, OpExecutionMode and OpExecutionModeId could
take variable extra operands. Current implementation doesn't support
this and assumes at most 3 operands are extra operands. It is not
true. Similarly, OpDecorateString and OpMemberDecorateString could
support multiple strings either as literal strings or as string
operands. Further, OpDecorate and OpDecorateId have the same problem,
taking variable extra operands.
The direct pointer argument to stores has to use
the NonUniform decoration but we were not using
qualifiers at all to decorate the NonUniform pointer.
(Test fixes by Greg Fischer <greg@lunarg.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
The normal IEEE not equal operation tests whether operands are unordered
or not equal (so comparison with a NaN returns true). This corresponds
to the SPIR-V OpFUnordNotEqual, so change to using that.
Saved about 21K, size down to 380K of MSVC x86 code.
Fixed one bug that needs to be looked at on the master branch:
The test for needing a Vulkan binding has a bug in it, "!layoutAttachment"
which does not mean "no layoutAttachment", because that is non-zero.
This is why some test and test results changed.
About 50 fewer #ifdefs.
About 14K smaller.
Note, the base size is ill-defined due to optimizer settings (size vs. performance),
compression, and target architecture. Some recent %'s are accidentally reported as
3X the real savings. Early %'s were accurate. What matters though is that each
step got worthwhile gains, and what the final size ends up being.
Save about 100K.
N.B.: This is done by eliminating a function call, at a high level,
not by #ifdef'ing a bunch of code.
Also, removed no longer needed *_EXTENSION #ifdef in the code not
needed by GLSLANG_WEB.