Fix OpImageRead result type when compiling HLSL
- Per the Vulkan spec, OpImageRead must return a 4-component vector always. When compiling HLSL, loads from a RWTexture of a template type with < 4 components would incorrectly generate an OpImageRead with a < 4 component result, resulting in validation errors.
- This was previously fixed for OpImageFetch in commit 4425f24; this commit does the same thing for OpImageRead.
- Added associated tests and expanded existing image fetch tests to check all the different types of textures, in both float and int incarnations, for completeness.
- Update other HLSL tests involving OpImageRead
SPIR-V disallows bool in interface blocks, which is emulated with uint.
When loading a bool variable (through accessChainLoad()), it's converted
from uint to bool if it came from an interface block.
This was handled for bool and bvecN, but not for bool arrays. This
change implements the conversion for bool arrays.
Closes#2694
- Add support of SPIR-V execution mode qualifiers.
- Add support of SPIR-V storage class qualifier.
- Add support of SPIR-V decorate qualifiers.
- Add support of SPIR-V type specifier.
- Add support of SPIR-V intruction qualifiers.
- Add support of spirv_by_reference/spirv_literal parameter qualifier.
- Add shader stage macros introduced by this extension.
Previous check was missing type difference between uniform array
actual arg with stride decoration and the formal arg without. Now
does logical or component-wise copy where needed.
Fixes#2637
Generate load of interpolant for first operand to GLSLstd450
InterpolateAt* SPIR-V ops. This allows the interpolants to
propagate from the input struct in the wrapper around main
into the shader during HLSL legalization. A new pass has been
added to legalization which will remove the load and replace
with the pointer of the load to create valid external
interpolate op.
Fixes#2584
Using const char* is not a good choice. We assume strings are always
from spv::E_SPV_XXX definitions. However, it is not the case. We can
store the name strings of extended intruction set in local variables.
Issue #2483
According to GLSL spec the prototype is:
uint rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQueryEXT q, bool committed);
but that was incorrectly getting translated to SPIRV as an `int`, and this was
causing SPIR-V validation errors when used.
Added explicit testing for the return types of all the builtin functions in GL_EXT_ray_query
* update spirv-headers and fix handling of gl_HitTEXT
Update spirv-headers known_good to f027d53ded7e230e008d37c8b47ede7cd308e19d
and update SPIRV/spirv.hpp to copy from that version as well.
In GLSL gl_HitTNV/gl_HitTEXT is defined as an alias of gl_RayTmaxNV/gl_RayTmaxEXT
SPV_NV_ray_tracing has a dedicated HitTNV which gl_HitTNV maps to.
For SPV_KHR_ray_tracing, gl_HitTEXT gets mapped to a RayTmaxKHR decoraged variable
to simplify the SPIRV consumer.
This change fixes the mapping for the GL_EXT_ray_tracing extension, and updates
the test results to match.
* update MissNV shader test to not use ObjectRay builtins
They shouldn't existing in the miss stage because there is no object intersected
* Add ray query capability if acceleration structure used
Fixes#2430
in non-ray tracing stages and the extension is enabled
* Add ray query capability if ray query declared
* Fix printing of TypeRayQueryKHR
It's no longer spelled with "Provisional"
* 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>
Use of gl_Layer and gl_ViewportIndex in tessellation and vertex
shaders should not trigger the addition of the Geometry capability.
Fixes#2461
Added tests for use of gl_Layer and gl_ViewportIndex in a tessellation
evaluation shader.
Several tests for NVIDIA features for tessellation, vertex, or mesh
shaders now lose the Geometry or MultiViewport capabilities.
This is ok because the functionality is already covered by
the ShaderViewportIndexLayerNV capability.
The spv.meshShaderPerViewBuiltins.mesh test now fails validation
because the validator does not know that PrimitiveId (and possibly
other) builtins are enabled by the MeshShadingNV capability.
I filed https://github.com/KhronosGroup/SPIRV-Headers/issues/179 to
fix the grammar upstream.
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>
* Code refine and adding missing features
1. Add new level for built in symbols.
2. Fix issues for structure members' qualifiers.
3. Global qualifier fix.
4. IO Mapper refine. Add support for checking with mangle names.
* Additional missing features
* Invariant member. (Only check non-interface).
* Split block nesting level and struct nesting level. To fix issues of checking 'invariant' qualifier.
Current grammar would check block/struct member without its parent class's information.
So we split nesting level, and 'invariant' would only be checked within a struct.
* Format anonymous block names. Refine codes for symbols from all kinds of resouces.
* Fix writeonly check.
* Use LValueBase to find operator.
* Fix random null ptr issue.
* invariant check, stage in io mapping, reference parameter should be used and remove wrong codes introduced with ordering vector.
* Remained: to be fixed with double check link.vk.multiblocksValid
* Fix version error.
invariant
* Revert loc modification.
* When targeting SPIR-V 1.5, using gl_ViewportIndex will emit OpCapability ShaderViewportIndex and using gl_Layer will emit OpCapability CapabilityShaderLayer. OpCapability ShaderViewportIndexLayerEXT will only get emitted if the target < SPIR-V 1.5
* When using one of the viewport/layer arrays extensions, fallback to OpCapability ShaderViewportIndexLayerEXT, even when targeting SPIR-V 1.5
* Revert "When using one of the viewport/layer arrays extensions, fallback to OpCapability ShaderViewportIndexLayerEXT, even when targeting SPIR-V 1.5"
This reverts commit dccca82f40.
* Using gl_Layer and gl_ViewportIndex outside of the geometry shader stage still requires one of the viewport extensions even when targeting SPIR-V 1.5
(Fixes a problem introduced by 670536b663)
Translate printf() to what GL_EXT_debug_printf has done. HLSL could
define non-constant string variable and we don't have such features
in SPIR-V, so just support constant string variable.
By directly creating the OpImage instructions we were not propagating
the appropriate decorations.
Since this had a lot of cases I centralized the OpImage creation
a bit too.
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>)
We need separate concepts for
- total set of extensions ever enabled, for the back end
- current state of extensions, for parsing
- the set of features currently enabled for building the AST
This change strips a few features similar to GLSLANG_WEB but doesn't
remove every detail like the latter. It also hardcodes profile/version
to core/450.
In particular, TBuiltIns::initialize is specialized to remove most of
what is not supported or won't be supported by ANGLE. The result of
this function is parsed with TParseContext::parseShaderStrings which is
a performance bottleneck.
This change shaves about 300KB off of ANGLE's binary size and reduces
the cost of SetupBuiltinSymbolTable to nearly a sixth.
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>