gl_SecondaryPositionNV and gl_PositionPerViewNV are inconsistently
declared inside and outside of gl_PerVertex. This breaks interface block
matching. For now ignore these errors since it should be fixed with how
they are declared.
Avoid adding global uniform blocks to stages that don't already have it.
Otherwise multiple stages point to the same block object, and a
remapping that occurs later on will change the mapping on multiple
stages.
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
* 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.
* 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 new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (#2408)
* Add more flexible SpirvToolsDisassemble interface to allow specifying spv_target_env for disassembly output.
Improve documentation on existing SpirvToolsDisassemble interface.
* Update pre-processor check - following existing ENABLE_OPT checks.
* Fix not-found header paths for glslangValidator and glslangtests.
* Add spirv_tools/include path where there is an ENABLE_OPT=1 in the BUILD.gn configuration.
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.
This is based on spv.paramMemory.frag.out which exercises the
writeonly storage image case.
This appears to need desktop GLSL.
The generated SPIR-V fails validation because the image_write function
takes a parameter which is pointer to an OpTypeImage with Unknown format.
But the parameters passed in are pointer to OpTypeImage with formats Rgba32f
and Rgba16f. The validator rejects this, saying the parameter types must
match.
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>
This problem needs to be fixed, but in parallel, we need to see master
and any other changes to it passing all tests.
The removed test is ray-tracing centric, and may indicate non-determinism
in recent code added for that functionality.
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>
`glslang_pch()` did manual mangling of the compiler flags to enable pre-compiled headers.
I couldn't get this approach to work with the `MachineIndependent` subdirectory, but fortunately CMake has added first-class support for precompiled headers in 3.16, which does work with subdirectories.
Moved `glslang_pch()` to the other global function declarations.
`glslang_pch()` is a no-op when using CMake earlier than `3.16`.
CMake's PCH implementation does not need the `pch.cpp` files, so just remove them.
This adds or changes binding/location decorations in 100s of shaders.
It also allows more output (spv.register.autoassign.rangetest.frag)
due to allowing ioMap() to fail.
Fix#2298.
The AST has two precisions, an operation precision and a result precision.
Actual use of GLSL with mediump samplers wants the result precision, so
pick that up instead of the operation precision.
* Fix xfb_stride limit issue
Unsized array can't apply to transform trace. layout qualifier "offset" require GL_ARB_enhanced_layouts enable or glsl core version > 440.
* Add negative test for xfb limit
* update case result
* Fix compile information issue
Fix compile information issue and test comment issue.
* remove es profile condition, use profileRequires to limit.
* Fix xfb_stride limit issue
Unsized array can't apply to transform trace. layout qualifier "offset" require GL_ARB_enhanced_layouts enable or glsl core version > 440.
Add negative test for xfb limit
* Move es profile check out of version number check
* Adjust error information and related cases
remove the new version check, refine original version check.
* Revert condition for vulkan, and remove redundant test code.
If a uniform has an initializer it will now be given as the optional
initializer operand to the OpVariable instruction.
Fixes: https://github.com/KhronosGroup/glslang/issues/1259
Signed-off-by: Neil Roberts <nroberts@igalia.com> (the code)
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com> (the tests)
Signed-off-by: Arcady Goldmints-Orlov <agoldmints@igalia.com>
Co-authored-by: Neil Roberts <nroberts@igalia.com>
* rework how shader interface block naming rules are handled
* Fixes 2136
According to the spec, shader interfaces (uniform blocks, buffer
blocks, input blocks, output blocks) all should be matched up via
their block names across all compilation units, not instance names.
Also, all block names can be re-used between all 4 interface types
without conflict. This change makes it so all of these blocks are
matched and remapped using block name and not by instance name.
Additional the rule that matched uniform and buffer blocks must
either be anonymous or named (but not nessearily the same name) is
now imposed.
* add warning if instance names differ between matched shader interfaces
* Add test cases from #2137 which is now fixed as well.
* replace some tab characters with spaces
* buffer blocks and uniform blocks now share the same block namespace
* Fixes#2005
Allow multiple units in a stage to have push_constants as long
as the blocks match.
Requires #2006 to be fixed to be functional.
* tweaks to #2005 fix after some testing
* add unit tests for push constants across multiple compilation units
For #2005
* update reference output for tests that fail validation
* fix uninitialized result.validationResult
There is a flag to disable the SPVRemapper during the GLSLang build.
That flag is check in some, but not all spots so if you try to build
with SPVRemapper disabled you get CMake errors and compile errors.
This CL fixs up the build so building with -DENABLE_SPVREMAPPER=0 will
complete correclty.
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.
Focus was on the front end (not SPIR-V), minus the grammar.
Reduces #ifdef count by around 320 and makes the web build 270K smaller,
which is about 90% the target size.
The grammar and scanner will be another step, as will the SPIR-V backend.
This makes heavy use of methods #ifdef'd to return false as a global way
of turning off code, relying on C++ DCE to do the rest.
Including spirv and AST tests
Also increase size of TBuiltInVariable bitfields since we've now exceeded 127
and add a static_assert to make this easier to find next time it happens!
with subgroup touch tests (error and non-error cases)
Currently the subgroup built-ins are NOT giving the correct output.
This is fixed in the next commit.
with subgroup touch testing (error and non-error cases)
Add missing symbolTable.relateToOperator("subgroupMemoryBarrierShared") call for
Mesh/Task shaders so they don't assert in ParseHelper.cpp
(and GL_NV_shader_subgroup_partitioned) based on GL/ES version
instead of predicating it on vulkan SPV generation
Also add AST testing.
The glsl.450.subgroup* files are largely the same as the spv.subgroup*
The glsl.es320.subgroup* files are the same as the 450 versions, but modified to be ES compatible.
Allow constructors to and from references to be constant folded. Section 4.3.3
says constructors whose arguments are all constant expressions must fold.
Disallow 'const' on buffer reference types. It is not a 'non-void transparent
basic data type' (it is not considered 'basic').
Handle buffer reference constants (which can be assigned to a non-const reference,
or can be further folded to another type of constant) by converting to
'constructor(uint64_t constant)' in addConversion.
Disallow == and != operators on reference types.
* Changed unit tests to only record known the validation pass/fail
status
* errors are output as part of the failure message if the result is
unexpected
* can turn off validation for each test individually
* Moved some SPV_KHR_vulkan_memory_model tests to be compiled for Vulkan
1.1
Without this commit, if the XfbStride was explicitly set, the
decoration was added twice on the shader.
v2 (changes after Jonh Kessenich first review)
* Simplified by just removing the firs assignment
* Removed assert
including SPV generation using SPV_EXT_fragment_invocation_density.
This is an alias of the functionality in SPV_NV_shading_rate, and thus in some
cases we can only have one set of the tokens present (switch statements), so
we have picked the EXT version. This required updating the expected test
results for SPV_NV_shading_rate.
Also updated the known-good for spirv-headers so that the validator in
spirv-tools knows about the new extension.
This change adds unary conversion folding when the source is a constant.
This fixes an ISV issue whereby:
```
const float16_t f = float16_t(42.0);
```
Wouldn't compile because the conversion operator would always produce an
EvqTemporary when it could have produced an EvqConst.
I've also added a test case that proves out that all basic-type to
basic-type conversions work.
If a block has assigned a XfbOffset it is assumed that it would
inherit the current global XfbBuffer. This commit fixes two use cases:
1) Getting the members of a Block with a XfbOffset to be assigned an
offset, as explained on GLSL 4.60 spec, section "4.4.2 Output
Layout Qualifiers", subsection "Transform Feedback Layout
Qualifiers".
2) Compute properly an error on overlapping ranges if a block is
assigned a XfbOffset and one of it members is assigned a explicit
one. This gets working because when the members of a block get
assigned a Offset/Buffer at fixBlockXfbOffsets, then the block is
deassigned the Offsets, so ranges are computed only with the block
members.
BTW, this is already done when redeclaring block builtins.
Fixes#1535