diff options
| author | ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> | 2024-06-10 16:29:56 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-10 13:29:56 -0700 |
| commit | 21bbebb19dfdbbee107b9fd9830e18d5fb6a573a (patch) | |
| tree | 3792cb476b724f465c9b64b03787965b33b562f4 /tests | |
| parent | 72016f9201e4d7820f62e7ef78cee98ed1fc4da0 (diff) | |
Address glslang ordering requirments for 'derivative_group_*NV' (#4323)
* Address glslang ordering requirments for 'derivative_group_*NV'
fixes: #4305
The solution is to emit some `layout`s after a module source is emitted.
Added to slangs gfx backend code to enable the compute shader derivative extension for testing purposes.
* address review
* enable removed test
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/gh-4305.slang | 40 | ||||
| -rw-r--r-- | tests/glsl-intrinsic/intrinsic-texture.slang | 3 |
2 files changed, 41 insertions, 2 deletions
diff --git a/tests/bugs/gh-4305.slang b/tests/bugs/gh-4305.slang new file mode 100644 index 000000000..dd09bda1e --- /dev/null +++ b/tests/bugs/gh-4305.slang @@ -0,0 +1,40 @@ +//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl -DQUAD -DMODIFIER +//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl -DMODIFIER +//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl -DQUAD +//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type -emit-spirv-via-glsl -allow-glsl -xslang -DQUAD +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type -emit-spirv-via-glsl -allow-glsl + +//TEST_INPUT: ubuffer(data=[0], stride=4):out,name outputBuffer +RWStructuredBuffer<float> outputBuffer; +//TEST_INPUT: Texture2D(size=4, content = one):name t2D +Texture2D<float> t2D; +//TEST_INPUT: Sampler:name samplerState +SamplerState samplerState; + +// "local_size_x" must appear before "derivative_group_" +//CHECK:local_size_x +//CHECK:derivative_group_{{.*}}NV + +#ifndef MODIFIER +#ifdef QUAD +layout(derivative_group_quadsNV) in; +#else +layout(derivative_group_linearNV) in; +#endif // #ifdef QUAD +layout(local_size_x = 2, local_size_y = 2, local_size_z = 1) in; + +#else + +#ifdef QUAD +[DerivativeGroupQuad] +#else +[DerivativeGroupLinear] +#endif // #ifdef QUAD +[numthreads(2, 2, 1)] +#endif //#ifndef MODIFIER +void computeMain() +{ + //BUF:1 + outputBuffer[0] = t2D.Sample(samplerState, float2(0.5, 0.5)); +}
\ No newline at end of file diff --git a/tests/glsl-intrinsic/intrinsic-texture.slang b/tests/glsl-intrinsic/intrinsic-texture.slang index 11cf2c5d0..98d93e09f 100644 --- a/tests/glsl-intrinsic/intrinsic-texture.slang +++ b/tests/glsl-intrinsic/intrinsic-texture.slang @@ -7,8 +7,7 @@ //TEST:SIMPLE(filecheck=CUDA): -allow-glsl -stage compute -entry computeMain -target cuda //TEST:SIMPLE(filecheck=CUDA): -allow-glsl -stage fragment -entry fragMain -target cuda -// Enable this test when an issue#4305 is addressed. -//T-EST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -output-using-type //TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer |
