This patch tries to attach debug location of a branch/return instruction to its predecessor or the closing brace. If none could be found, no debug info should be emitted.
Don't report the following error when scanning inactive code (e.g. code inside #if 0):
"error: '#' : (#) can be preceded in its line only by spaces or horizontal tab"
Adds a variable to PpContext to say whether we're currently skipping over an inactive #if/#ifdef/#elif/#else, and don't report the error inside scanToken if true.
fixes 3704
Apply memory decorations from GLSL source to the top-level OpVariable.
Previously, these decorations would only be applied to individual
members. While this is correct behavior, it is more convenient for some
front ends to see the decorations (specifically ReadOnly and WriteOnly)
applied to the whole variable rather than individual members.
Add a Test/baseResults/validation_fails.txt file to track test results
with known validation fails. This will hopefully make it easier to spot
when new test results are added that have invalid SPIR-V.
If an 'in' is present in a shader stage, make sure a matching 'out'
is present in the previous stage. Only enabled when doing Vulkan.
This commit also fixes a bug where previous stage's linkerObjects
got polluted with 'in' variables from the next stage when merging
linker objects.
Nonsemantic instructions aren't allowed before an OpPhi, so don't emit
line and debug scope instructions when the instruction being emitted is
an OpPhi.
When location aliasing, the aliases sharing the location must have the same underlying numerical type and bit width (floating-point or integer, 32-bit versus 64-bit, etc.) and the same auxiliary storage and interpolation qualification.
This adds checks for the "patch" and "sample" qualifiers, and also relaxes the checks when the signedness of integer types differs.
It is invalid if the same decoration is applied to the same id multiple
times. This adds a check before adding a decoration that the decoration
is not already in the list. If it is, then the duplicate is not added.
Fixes#3627
These redundant type conversions were generating illegal SPIR-V when
only the 8-bit/16-bit storage extensions and not the corresponding
arithmetic extensions were enabled.
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.
* location aliasing
when location aliasing, the aliases sharing the location must have the same underlying numerical type
(floating-point or integer) and the same auxiliary storage and interpolation qualification.
The following case, glslang need report error.
layout(vertices = 1) out;
layout (location = 1, component = 0) in double gohan[];
layout (location = 1, component = 2) in float goten[];
in vec4 vs_tcs[];
out vec4 tcs_tes[];
void main()
{
}
* Need consider the following case: location aliasing with different interpolation qualifier.
Test/hlsl.inf.vert tests parsing and some constant math on
infinities, including (-1.#INF * 0.0).
By IEEE 754 rules, that result is a NaN, but its sign is not significant.
The test output assumes a negative-NaN is in the generated SPIR-V.
However, the math library on some platforms (like macOS 14, a.k.a.
Sonoma) will produce a positive NaN instead.
This PR adjusts the test so it takes the absolute value of the NaN,
to ensure we the emitted SPIR-V has the NaN with a 0 for it sign bit.
This function is used to import SPIR-V extended instruction set. It
mistakenly treated the name of SPIR-V extended instruction set as the
name of SPIR-V extension. For example, when we have such code
getExtBuiltins("NonSemantic.DebugBreak")
'NonSemantic.DebugBreak' is added to SPIR-V extension. Rather, the
SPIR-V extension name should be 'SPV_KHR_non_semantics_info'. Therefore,
we must avoid this since the name of SPIR-V extended instruction set is
not necessarily equal to that of relevant SPIR-V extension. Adding a
SPIR-V extension must be done by calling addExtension() explicitly
outside this function.
This change also fixes disassembly issues of debugBreak().
coopmat<> type definition allows type parameters. To make it accept
types defined by spirv_type directive, we add spirvType info to the type
parameters. This change is to support this case. And a test is added to
show the missing usage.
The actual support has been available with GL_EXT_control_flow_attributes.
This change set is to handle
"#extension GL_EXT_control_flow_attributes2 : <val>"
The file and source text was not being set correctly in the test output.
This change makes the test fixture consistent with the command line
behavior, "-gVS", which was my original intent when I added these tests.
Add support for GL_ARB_shading_language_include. Usage is identical to
the way GL_GOOGLE_include_directive currently works glslang (since
GL_ARB_shading_language_include is inherently a runtime feature and
glslang is an offline compiler).
Users can simulate their runtime environment by using a custom
glslang::TShader::Includer or using filenames that match their GL
runtime names.
Closes#249.