Commit Graph

2017 Commits

Author SHA1 Message Date
dTry
7c4d91e781
Add type checks for hitObjectNV (#3689)
`VK_NV_ray_tracing_invocation_reorder` extension introduces `hitObjectNV`, a special opaque type
that can only be declared without storage qualifiers in either global or function scope.
Added checks/tests to enforce this constraint.

References:
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_NV_ray_tracing_invocation_reorder.html
3e0d9a3b3f/extensions/nv/GLSL_NV_shader_invocation_reorder.txt (L180)

Co-authored-by: Tianyun <tianyuny@nvidia.com>
2024-08-08 08:21:00 -06:00
Arcady Goldmints-Orlov
5398d55e33 Remove execute permissions from source files. 2024-08-06 14:42:01 -06:00
Arcady Goldmints-Orlov
11290021b7 ci: Add a list of known validation fails
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.
2024-08-02 16:47:35 -06:00
Malcolm Bechard
69249e46b6 add cross-stage check for missing outputs
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.
2024-07-29 19:37:59 -04:00
Pavel Asyutchenko
9f34b25f30 Fix HLSL offsets for non-cbuffers (#3668) 2024-07-29 19:24:33 -04:00
Arcady Goldmints-Orlov
592aed9c20 Don't emit debug instructions before an OpPhi
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.
2024-07-22 17:43:12 -04:00
Antoine
dc9f6f61ad
Add column to location logs
This option can be enabled using the new --error-column option to the command line utility.
It can also be enabled programatically.
2024-07-19 18:37:58 -04:00
jimihem
52f68dc6b2
Add more location aliasing checks
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.
2024-07-17 18:23:38 -04:00
jimihem
702026e3f5
Support constant expression calculated by matrixCompMult. 2024-07-15 14:24:16 -04:00
Qingyuan Zheng
704107fda3 Fix function call line number for calls spanning multiple lines. 2024-07-02 14:38:40 -04:00
Qingyuan Zheng
85262fb20e Fill correct file name to OpDebugFunction and add line info for parameters' OpDebugDeclare 2024-07-02 14:23:59 -04:00
Steven Perron
33c7e30860
Don't emit duplicate decorations. (#3635)
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
2024-06-28 19:16:59 -04:00
Arcady Goldmints-Orlov
33d517470e Generate vector constructions more efficiently when sizes match
When two vectors are the same size, there is no need to extract the
components and construct a new vector.
2024-06-24 13:52:56 -04:00
Arcady Goldmints-Orlov
2d8b71fc63 Add test cases for redundant type conversions
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.
2024-06-20 20:12:29 -04:00
Romaric Jodin
eadafe80ed Update known_good.json
Also update test that is now passing
2024-06-17 14:41:34 -04:00
Arcady Goldmints-Orlov
19efb4ec60 Move the spv.debugInfo.frag test back into runtests 2024-06-14 19:01:46 -04:00
Qingyuan Zheng
d8f5681ec0 Add includer to gtest for include file tests.
Turn on debug info flag for non-semantic debug test.
2024-06-14 19:01:46 -04:00
Pedro Olsen Ferreira
02263efcd6 Add support for the ARM extended matrix layout 2024-06-11 15:33:49 -04:00
Arcady Goldmints-Orlov
73eccd4b67 Add the KHR suffix for OpExtInstWithForwardRefsKHR instruction 2024-06-06 18:46:14 -04:00
Arcady Goldmints-Orlov
81f7045aa0 Emit debug info for buffer references
Using OpExtInstWithForwardRefs, the debug type information for buffer
reference types can be emitted alongside the OpFowardPointer opcode.
2024-06-06 18:46:14 -04:00
Jeff Bolz
4da479aa6a Generate SPV_EXT_replicated_composites when requested by pragma.
Implement GL_EXT_spec_constant_composites.
2024-06-03 18:13:07 -04:00
Jeff Bolz
6a8b2b2439 Reuse loads generated for repeated function arguments 2024-06-03 18:13:07 -04:00
Philippe SWARTVAGHER
2b19bf7e1b Fix few typos 2024-05-27 05:16:35 -07:00
Max Andersson
1cad045cc2 Make gl_HitT proper aliases of gl_RayTmax
Changes the gl_HitT builtins properly alias
their gl_RayTmax. Previously they ended up as
duplicate variables, rather than aliased.
2024-05-24 11:08:06 -07:00
arcady-lunarg
7c3c50ea94
spirv: Add a postprocessing pass to fix up uses of OpSampledImage
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.
2024-05-20 13:25:55 -04:00
David Neto
142052fa30 Update validation results of SPV_QCOM_image_processing2
Update SPIRV-Tools to include https://github.com/KhronosGroup/SPIRV-Tools/pull/5646
which fixes validation of SPV_QCOM_imageprocessing2
This allows us to remove the "Validation failed" result for two
tests.
2024-04-30 13:26:38 -04:00
jimihem
44fcbccd06
location aliasing (#3438)
* 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.
2024-04-26 12:05:08 -04:00
Wooyoung Kim
a4f870053f
A couple of fixes to the GL_QCOM_image_processing2 support (#3578)
1) handle the extension requirements of GL_QCOM_image_processing2
   correctly
2) add QCOM image processing decorations to ids only once.
2024-04-23 18:34:51 -04:00
Pavel Asyutchenko
e46c1b725c Keep vec1.x l-value in HLSL
Changes in hlsl.shapeConv.frag are just renumbering,
duplicated load (80) has disappeared for whatever reason.
2024-04-22 11:50:37 -04:00
jimihem
68df223056
index outside gl_SampleMask range, compiler need report error. (#3556) 2024-04-17 20:14:26 -04:00
Pavel Asyutchenko
593dbafd0d
Better follow HLSL offsets rules (#3575)
Matrices consuming one vector are treated like vectors for alignment, and
there is no "trailing padding" for matrices and arrays.
2024-04-17 19:34:28 -04:00
David Neto
dba720ff94 Adjust hlsl infinity-constant test
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.
2024-04-15 18:30:28 -04:00
alan-baker
1e4f53ab2d
Prevent duplicate SPIR-V decorations (#3570)
* Update SPIRV-Tools
  * https://github.com/KhronosGroup/SPIRV-Tools/pull/5641 added
    validation that caught errors
* Modified glslang to prevent duplicate Restrict and Coherent
  decorations
* Modify createConstructor to avoid adding duplicate RelaxedPrecision
  decorations when generating a scalar
2024-04-15 11:39:23 -04:00
“jimihe”
ac5341fe91 Add a test for floating point exponent overflow
This adds a test with a floating point exponent that can't fit into a
32-bit int.
2024-04-01 17:58:50 -04:00
Samuel Bourasseau
0015dc9345
Branch out of relaxed rules on opaque arguments declared at top-level (#3558) 2024-03-29 19:40:26 -04:00
Rex Xu
3225778615 Fix an issue of getExtBuiltins()
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().
2024-03-22 12:35:30 -04:00
Rex Xu
022aea431c
Fix issues of the interaction between cooperative_matrix and spirv_intrinsics
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.
2024-03-21 11:09:00 -04:00
Wooyoung Kim
10ee92feb0
Support for SPV_QCOM_image_processing2 (#3539) 2024-03-20 18:56:00 -04:00
Steve Urquhart
9f37ad360e Support files with UTF8BOM character 2024-03-13 13:03:10 -04:00
Wooyoung Kim
bada5c87ec
GL_EXT_control_flow_attributes2 support. (#3531)
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>"
2024-03-04 16:43:05 -05:00
Jeremy Hayes
bf08e1db5c Fix debug info file and source strings
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.
2024-03-01 18:08:54 -05:00
Nathaniel Cesario
b0df68c490 Add support for GL_ARB_shading_language_include
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.
2024-02-27 18:26:46 -05:00
Pavel Asyutchenko
2c4348f064 Fix HLSL built-in passthrough via inout 2024-02-26 19:04:23 -05:00
Jeff Bolz
2518af09c8 Change fp16_vector_atomic to not require other SPIR-V atomic extensions 2024-02-22 11:51:25 -05:00
AnyOldName3
b8421d7fcc Quote paths in runtest
This means it won't die if the build path contains spaces.
2024-02-19 14:29:42 -05:00
Sajjad Mirza
7a2a1623d8
Emit debug info for accelerationStructure and rayQuery variables. (#3502)
* Add debug info for accelerationStructure and rayQuery variables.
* Add test case for accelerationStructure and rayQuery
2024-02-14 19:43:02 -05:00
Jeff Bolz
48702616ec NV_shader_atomic_fp16_vector 2024-02-14 18:55:55 -05:00
Sven van Haastregt
9fd0fcd737 Add GL_EXT_expect_assume support
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-02-13 16:13:35 -08:00
Qingyuan Zheng
30661abd9c
Clean up the debug line info tracking and generation.
- 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
2024-02-09 10:27:40 -08:00
Sven van Haastregt
b1f7affe94 Add GL_KHR_shader_subgroup_rotate support
Co-authored-by: Neil Hickey <neil.hickey@arm.com>
Co-authored-by: Stuart Brady <stuart.brady@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-02-06 11:04:16 -08:00