Commit Graph

1982 Commits

Author SHA1 Message Date
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
laddoc
fc3bbbb0ff Update test output typo. 2024-01-30 16:28:38 -05:00
laddoc
725017a588 Support extension EXT_shader_quad_control 2024-01-30 16:28:38 -05:00
Jeff Bolz
79536da264 Fix 'maximally_reconverges' token to match the GLSL spec 2024-01-25 19:30:47 -05:00
Jeff Bolz
8066fa086b Implement GL_EXT_maximal_reconvergence 2024-01-25 13:46:25 -05:00
jimihem
db4d6f85af
The array size of gl_SampleMask and gl_SampleMaskIn is ceil(gl_MaxSamples/32)
Oes spec says:
    For the both the input array gl_SampleMaskIn[] and the output array gl_SampleMask[], bit B of mask M
    (gl_SampleMaskIn[M] or gl_SampleMask[M]) corresponds to sample 32*M+B. These arrays have
    ceil(gl_MaxSamples/32) elements, where gl_MaxSamples is the maximum number of color samples
    supported by the implementation.

    But glslang report error "array must have size before use length".

    layout(location = 0) out mediump vec4 fragColor;
    void main (void)
    {
    for (int i = 0; i < gl_SampleMask.length(); ++i)
    gl_SampleMask[i] = int(0xAAAAAAAA);

       fragColor = vec4(0.0, 1.0, 0.0, 1.0);
    }

* Add two test items, one is for gl_MaxSapmles = 32 and the other one is for gl_MaxSapmles = 64.
2023-12-29 16:23:16 -05:00
jimihem
88c5373ee4
support GL_ARB_texture_multisample extension.
This extension allows the use of "texelFetch" and "textureSize" with 2DMS sampler.
2023-12-28 18:38:39 -05:00
Sajjad Mirza
e17ecb0e80
Emit DebugTypePointer when non-semantic debug info is enabled 2023-12-28 11:00:37 -05:00
Nathaniel Cesario
5ad3d41364 Output 8 and 16 bit capabilities OpSpecConstantOp
OpSpecConstants with 8 or 16 width types require the corresponding
capabilities.

Fixes #3449.
2023-12-15 18:36:00 -05:00
jimihem
a7785ea1ff
Support GL_EXT_draw_instanced extension. 2023-12-12 18:22:04 -05:00
“jimihe”
07e8220d4e support GL_EXT_texture_array extention. 2023-12-12 14:31:34 -05:00
“jimihe”
feb5437942 PP: Report an error when a # is not the first thing on a line
According to the GLSL spec
Each number sign (#) can be preceded in its line only by spaces or horizontal tabs.
It may also be followed by spaces and horizontal tabs, preceding the directive.
2023-12-07 19:29:48 -05:00
Arcady Goldmints-Orlov
530a6266b2 Fix tokenLength test to not trigger spurious preprocessor error
The preprocessor now reports errors for #'s appearing in the wrong
place, which were being triggered by this test. This test is rewritten
slightly to only report the errors we want.
2023-12-07 19:29:48 -05:00
Chao Chen
9a35abff55 Always enable the generation of OpDebugBasicType for bool type 2023-12-06 19:23:45 -05:00
Arcady Goldmints-Orlov
a1138bacff Improve overflow_underflow_toinf_0 test somewhat
Add test cases that will make explicit ±0.0 and ±INF appear in the AST
output to make sure those cases are handled correctly.
2023-11-30 19:10:11 -05:00
Arcady Goldmints-Orlov
a187f47e2c Move overflow_underflow_toinf_0 from runtests to gtest
gtest is the preferred framework for simple tests that don't require
passing special command-line options to glslang.
2023-11-30 19:10:11 -05:00
Samuel Bourasseau
c59b876ca0
Implement relaxed rule for opaque struct members 2023-11-28 19:19:02 -05:00
Nathaniel Cesario
19d541a91d Fix some compiler warnings
This change primarily fixes some -Wconversion warnings from gcc, but
also silences a warning triggered in glslang_tab.cpp, which is generated
code from bison.

There are still several GCC conversion warnings in Types.h due to the
use of bit fields that will be resolved in a future change.
2023-11-28 19:16:16 -05:00
FrostyLeaves
153064f2c7 fix: Support SV_ViewID keywords for hlsl. 2023-11-22 17:04:38 -05:00
“jimihe”
854db99ff1 Out-of-range floats should overflow/underflow to infinity/0.0
glslang representing literal constants with double precision, so 1.0e40 and 1.0e-50 are normal values.

        Shader1:
        precision highp float;
        out vec4 my_FragColor;
        void main()
        {
        // Out-of-range floats should overflow to infinity
        // GLSL ES 3.00.6 section 4.1.4 Floats:
        // "If the value of the floating point number is too large (small) to be stored as a single precision value, it is converted to positive (negative) infinity"
        float correct = isinf(1.0e40) ? 1.0 : 0.0;
        my_FragColor = vec4(0.0, correct, 0.0, 1.0);
        }
        The expected ouput result of this test is vec4(0.0, 1.0, 0.0, 1.0),
        but it's vec4(0.0,0.0,0.0,1.0).Because the return value of isInf is
        false.

        precision highp float;
        out vec4 my_FragColor;
        void main()
        {
        // GLSL ES 3.00.6 section 4.1.4 Floats:
        // "A value with a magnitude too small to be represented as a mantissa and exponent is converted to zero."
        // 1.0e-50 is small enough that it can't even be stored as subnormal.
        float correct = (1.0e-50 == 0.0) ? 1.0 : 0.0;
        my_FragColor = vec4(0.0, correct, 0.0, 1.0);
        }
        The expected ouput result of this test is vec4(0.0, 1.0, 0.0, 1.0),
        but it's vec4(0.0,0.0,0.0,1.0).

        For f32 and f16 type, when the literal constant out of range of the f32
        and f16 number, the value should overflow or underflow to inf or zero.

            glcts test item
        KHR-GLES3.number_parsing.float_out_of_range_as_infinity
2023-11-17 16:30:22 -05:00
Qingyuan Zheng
845e5d5a28 Fix the corrupted test because of rebase 2023-11-14 14:46:44 -07:00
Qingyuan Zheng
109b5979d3 Support NonSemantic DebugValue and generate it for const arg
For passing-by-value semantic, DebugDeclare cannot be used for parameters because there's no pointer.
2023-11-14 14:46:44 -07:00
Nathaniel Cesario
52c59ecd3d Fix interpolant ES error
The restriction of no swizzling and no struct fields as an interpolant
were not being checked when using the ES profile.

Fixes #3277.
2023-11-11 08:53:16 -07:00
Nathaniel Cesario
091b9fd979 Fix GL_ARB_shader_storage_buffer_object version
Ensure that GL_ARB_shader_storage_buffer_object is available from
version GL 400 to GL 420.

Closes #3263.
2023-11-07 15:56:52 -07:00
Malcolm Bechard
1dde7113bb tweak error behavior for redeclared uniforms for vulkan-relaxed
avoids nullptr crash from reading memberType's name, and more user
friendly error message.
2023-10-31 15:02:38 -04:00
Kévin Petit
a9e698322e
Align spirv.hpp to SPIRV-Headers for SPV_KHR_cooperative_matrix
Some of the enumerants used by this extension were missing a KHR suffix.
2023-10-25 19:59:52 -04:00
Chao Chen
979423d84f Add correct line number to OpDebugFunction and OpDebugScope for function:
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.
2023-10-24 13:37:19 -07:00
Arcady Goldmints-Orlov
0504953b35 spirv: don't emit invalid debuginfo for buffer references
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.
2023-10-13 17:49:26 -04:00
Arcady Goldmints-Orlov
48f9ed8b08 spirv: only set LocalSizeId mode when necessary
SPIR-V 1.6 added the LocalSizeId execution mode that allows using
spec constants for setting the work-group size, however it does not
deprecate the LocalSize mode. This change causes the LocalSizeId mode to
only be used when at least one of the workgroup size is actually
specified with a spec constant.

Fixes #3200
2023-10-12 14:45:33 -04:00
Pankaj Mistry
5ff0c048b7
Clean the implementation of GL_EXT_texture_shadow_lod.
Move the parameter verifictation to a centralized place where all the builtins
are verified for correctness.

Add verification for the new builtins with version and extension check
These builtins are supported on GLSL since version 130 and GLES since
version 300.
2023-10-02 15:10:11 -04:00
alelenv
3f02132668
Add support for GL_NV_displacement_micromap.
* Add support for GL_NV_displacement_micromap.
* Update known_good for spirv-headers and spirv-tools.
2023-10-02 15:07:50 -04:00
chirsz-ever
2bfacdac91 Improve preprocessor ouput format
Modify preprocessor.simple.vert to test spaces before parenthesis.
2023-09-22 16:34:08 -04:00
Nathaniel Cesario
4c57db1595 Add --no-link option
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.
2023-09-18 17:31:05 -04:00
Nathaniel Cesario
efc33d1ee5 Fix segfault with atomic arg check
Makes sure that we have an l-value before checking the storage type of
the mem argument passed to an atomic memory operation.

Fixes #3332.
2023-09-15 17:43:04 -04:00
Sajjad Mirza
afe6e781bd
Emit correct nonsemantic debug info for explicitly sized types
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.
2023-09-11 20:11:22 -04:00
Nathaniel Cesario
f3f23fece3 Add a generic texel fetch test
Test all core sampler functions.
2023-09-11 16:51:11 -04:00