diff options
| author | venkataram-nv <vedavamadath@nvidia.com> | 2024-07-26 14:04:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-26 14:04:22 -0700 |
| commit | c0bff66541302309ff4833e8d4ae2eba1561498a (patch) | |
| tree | f8e90eb03a0b621d80a454aa2cec1139e5e455f0 /tests | |
| parent | a266cbfe961f7f7bc80efc4f6c137e8771cb62c6 (diff) | |
Disable warnings for input global variables (#4745)
* Disable warnings for input global variables
* Update comment to reflect actual check
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
* Update comments in uninitialized-globals.slang
* Update uninitialized-globals.slang
* Refactoring test variable
* Typo in test
---------
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/diagnostics/uninitialized-globals.slang | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/tests/diagnostics/uninitialized-globals.slang b/tests/diagnostics/uninitialized-globals.slang index 314881a80..635db1e29 100644 --- a/tests/diagnostics/uninitialized-globals.slang +++ b/tests/diagnostics/uninitialized-globals.slang @@ -1,8 +1,8 @@ -//TEST:SIMPLE(filecheck=CHK): -target spirv +//TEST:SIMPLE(filecheck=CHK): -allow-glsl -target spirv // Using groupshared variables groupshared float4 gsConstexpr = float4(1.0f); -groupshared float4 gsUndefined; +groupshared float4 gsUninitialized; // OK float use_constexpr_initialized_gs() @@ -12,8 +12,8 @@ float use_constexpr_initialized_gs() float use_undefined_gs() { - //CHK-DAG: warning 41017: use of uninitialized global variable 'gsUndefined' - return gsUndefined.x; + //CHK-DAG: ([[# @LINE + 1]]): warning 41017: use of uninitialized global variable 'gsUninitialized' + return gsUninitialized.x; } // Using static variables @@ -35,7 +35,7 @@ void write_to_later() float use_never_written() { - //CHK-DAG: warning 41017: use of uninitialized global variable 'writtenNever' + //CHK-DAG: ([[# @LINE + 1]]): warning 41017: use of uninitialized global variable 'writtenNever' return writtenNever; } @@ -45,4 +45,35 @@ float use_later_writte() return writtenLater; } +// Varying inputs never warn +layout(location = 0) in vec4 data; + +vec4 glsl_layout_in_ok() +{ + return data; +} + +// Layout outputs should still be written to at some point +layout(location = 1) out vec4 x; + +vec4 glsl_layout_out_undefined() +{ + //CHK-DAG: ([[# @LINE + 1]]): warning 41017: use of uninitialized global variable 'x' + return x; +} + +layout(location = 2) out vec4 y; + +void glsl_layout_out_store(vec4 data) +{ + // Written to here... + y = data; +} + +vec4 glsl_layout_out_ok() +{ + // ...so read here is treated as OK + return y; +} + //CHK-NOT: warning 41017 |
