diff options
| author | Yong He <yonghe@outlook.com> | 2021-05-21 16:38:33 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-21 16:38:33 -0700 |
| commit | 7f8a9994d0bd99a171a1daa0bce46d92c02ccffd (patch) | |
| tree | 0b187e63ab5b9ce6f5ab41266fedaec44091a217 /tests | |
| parent | 172538fdb418f7a2faab1f5a410f3b2cb8e18ba5 (diff) | |
[gfx] Support StructuredBuffer<IInterface>. (#1851)
Co-authored-by: T. Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/dynamic-dispatch-13.slang | 20 | ||||
| -rw-r--r-- | tests/compute/dynamic-dispatch-14.slang | 21 | ||||
| -rw-r--r-- | tests/compute/dynamic-dispatch-bindless-texture.slang | 7 | ||||
| -rw-r--r-- | tests/compute/half-rw-texture-convert.slang | 2 | ||||
| -rw-r--r-- | tests/compute/half-rw-texture-simple.slang | 2 | ||||
| -rw-r--r-- | tests/compute/interface-assoc-type-param.slang | 10 | ||||
| -rw-r--r-- | tests/compute/interface-func-param-in-struct.slang | 8 | ||||
| -rw-r--r-- | tests/disabled-tests.txt | 18 |
8 files changed, 42 insertions, 46 deletions
diff --git a/tests/compute/dynamic-dispatch-13.slang b/tests/compute/dynamic-dispatch-13.slang index 5acc981e1..d44029c23 100644 --- a/tests/compute/dynamic-dispatch-13.slang +++ b/tests/compute/dynamic-dispatch-13.slang @@ -1,9 +1,9 @@ // Test using interface typed shader parameters wrapped inside a `StructuredBuffer`. -//DISABLED_TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj -//DISABLED_TEST(compute):COMPARE_COMPUTE:-dx11 -//DISABLED_TEST(compute):COMPARE_COMPUTE:-vk -//DISABLED_TEST(compute):COMPARE_COMPUTE:-cuda -shaderobj +//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj +//TEST(compute):COMPARE_COMPUTE:-dx11 +//TEST(compute):COMPARE_COMPUTE:-vk +//TEST(compute):COMPARE_COMPUTE:-cuda -shaderobj [anyValueSize(8)] interface IInterface @@ -11,13 +11,14 @@ interface IInterface int run(int input); } +// Specialize gCb1, but not gCb2 + //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=gOutputBuffer RWStructuredBuffer<int> gOutputBuffer; - -//TEST_INPUT:ubuffer(data=[rtti(MyImpl) witness(MyImpl, IInterface) 1 0], stride=4):name=gCb +//TEST_INPUT: set gCb = new StructuredBuffer<IInterface>{new MyImpl{1}}; RWStructuredBuffer<IInterface> gCb; - -//TEST_INPUT:ubuffer(data=[rtti(MyImpl) witness(MyImpl, IInterface) 1 0], stride=4):name=gCb1 +// Add two elements into the structured buffer to prevent specialization. +//TEST_INPUT: set gCb1 = new StructuredBuffer<IInterface>{new MyImpl{1}, new MyImpl2{2}}; RWStructuredBuffer<IInterface> gCb1; [numthreads(4, 1, 1)] @@ -33,9 +34,6 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) gOutputBuffer[tid] = outputVal; } -// Specialize gCb1, but not gCb2 -//TEST_INPUT: globalExistentialType MyImpl -//TEST_INPUT: globalExistentialType __Dynamic // Type must be marked `public` to ensure it is visible in the generated DLL. public struct MyImpl : IInterface { diff --git a/tests/compute/dynamic-dispatch-14.slang b/tests/compute/dynamic-dispatch-14.slang index 4dce1c2ed..8361cd317 100644 --- a/tests/compute/dynamic-dispatch-14.slang +++ b/tests/compute/dynamic-dispatch-14.slang @@ -1,9 +1,12 @@ // Test using interface typed shader parameters with associated types. -//DISABLED_TEST(compute):COMPARE_COMPUTE:-dx11 -//DISABLED_TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj -//DISABLED_TEST(compute):COMPARE_COMPUTE:-vk -//DISABLED_TEST(compute):COMPARE_COMPUTE:-cuda -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile sm_6_0 -use-dxil +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx11 -profile sm_5_0 +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -gl -profile glsl440 +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -vk -profile glsl440 +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cpu + + [anyValueSize(8)] interface IAssoc @@ -21,10 +24,13 @@ interface IInterface //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=gOutputBuffer RWStructuredBuffer<int> gOutputBuffer; -//TEST_INPUT:ubuffer(data=[rtti(MyImpl) witness(MyImpl, IInterface) 1 0], stride=4):name=gCb + +// Specialize gCb1, but not gCb2 +//TEST_INPUT: set gCb = new StructuredBuffer<IInterface>{new MyImpl{1}}; RWStructuredBuffer<IInterface> gCb; -//TEST_INPUT:ubuffer(data=[rtti(MyImpl) witness(MyImpl, IInterface) 1 0], stride=4):name=gCb1 +// Add two elements into the structured buffer to prevent specialization. +//TEST_INPUT: set gCb1 = new StructuredBuffer<IInterface>{new MyImpl{1}, new MyImpl2{2}}; RWStructuredBuffer<IInterface> gCb1; [numthreads(4, 1, 1)] @@ -40,9 +46,6 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) gOutputBuffer[tid] = outputVal; } -// Specialize gCb1, but not gCb2 -//TEST_INPUT: globalExistentialType MyImpl -//TEST_INPUT: globalExistentialType __Dynamic // Type must be marked `public` to ensure it is visible in the generated DLL. public struct MyImpl : IInterface { diff --git a/tests/compute/dynamic-dispatch-bindless-texture.slang b/tests/compute/dynamic-dispatch-bindless-texture.slang index a4483c9e1..8a9d0c128 100644 --- a/tests/compute/dynamic-dispatch-bindless-texture.slang +++ b/tests/compute/dynamic-dispatch-bindless-texture.slang @@ -1,6 +1,6 @@ // Test using interface typed shader parameters with texture typed fields. -//DISABLED_TEST(compute):COMPARE_COMPUTE:-cpu -//DISABLED_TEST(compute):COMPARE_COMPUTE:-cuda +//TEST(compute):COMPARE_COMPUTE:-cpu +//TEST(compute):COMPARE_COMPUTE:-cuda [anyValueSize(16)] interface IInterface @@ -10,8 +10,7 @@ interface IInterface //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=gOutputBuffer RWStructuredBuffer<uint> gOutputBuffer; -//TEST_INPUT: Texture2D(size=8, content = one):name t2D,bindless -//TEST_INPUT:ubuffer(data=[rtti(MyImpl) witness(MyImpl, IInterface) handle(t2D) 0 0], stride=4):name=gCb +//TEST_INPUT: set gCb = new StructuredBuffer<IInterface>{new MyImpl{Texture2D(size=8, content = one)}} StructuredBuffer<IInterface> gCb; [numthreads(4, 1, 1)] diff --git a/tests/compute/half-rw-texture-convert.slang b/tests/compute/half-rw-texture-convert.slang index 338f44454..161033637 100644 --- a/tests/compute/half-rw-texture-convert.slang +++ b/tests/compute/half-rw-texture-convert.slang @@ -19,7 +19,7 @@ // There's no simple way to describe either, so this test just confirms it outputs PTX that can // be executed, and unfortunately doesn't test if the write conversion actually *worked* -//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj -render-features half +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj -render-features half //TEST_INPUT: RWTexture2D(format=R_Float16, size=4, content = one, mipMaps = 1):name rwt2D [format("r16f")] diff --git a/tests/compute/half-rw-texture-simple.slang b/tests/compute/half-rw-texture-simple.slang index c544ee713..95f32c7ce 100644 --- a/tests/compute/half-rw-texture-simple.slang +++ b/tests/compute/half-rw-texture-simple.slang @@ -9,7 +9,7 @@ // TODO(JS): Doesn't work on vk currently, because createTextureView not implemented on vk renderer //DIABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -shaderobj // TODO(JS): Doesn't work on certain CI systems. -//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj -render-features half +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj -render-features half //TEST_INPUT: RWTexture2D(format=R_Float16, size=4, content = one, mipMaps = 1):name rwt2D RWTexture2D<half> rwt2D; diff --git a/tests/compute/interface-assoc-type-param.slang b/tests/compute/interface-assoc-type-param.slang index b315dd5f9..805f673a2 100644 --- a/tests/compute/interface-assoc-type-param.slang +++ b/tests/compute/interface-assoc-type-param.slang @@ -1,7 +1,7 @@ // Tests using associated types through an existential-struct-typed param. -//DISABLED_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cuda -shaderobj -//DISABLED_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cpu -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cuda -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cpu -shaderobj [anyValueSize(8)] interface IInterface @@ -16,7 +16,7 @@ interface IEval uint eval(); } -struct Impl : IInterface +public struct Impl : IInterface { uint val; struct TEval : IEval @@ -48,11 +48,9 @@ void compute(uint tid, Params p) gOutputBuffer[tid] = p.obj[0].getEval().eval(); } -//TEST_INPUT: entryPointExistentialType Impl - [numthreads(4, 1, 1)] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID, -//TEST_INPUT:ubuffer(data=[0 0 0 0 1 0], stride=4):name=params.obj +//TEST_INPUT:set params.obj = new StructuredBuffer<IInterface>{ new Impl{1}} uniform Params params) { uint tid = dispatchThreadID.x; diff --git a/tests/compute/interface-func-param-in-struct.slang b/tests/compute/interface-func-param-in-struct.slang index 9e3e6c201..c47b25d70 100644 --- a/tests/compute/interface-func-param-in-struct.slang +++ b/tests/compute/interface-func-param-in-struct.slang @@ -1,7 +1,7 @@ // Tests specializing a function with existential-struct-typed param. -//DISABLED_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cuda -shaderobj -//DISABLED_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cpu -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cuda -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cpu -shaderobj [anyValueSize(8)] interface IInterface @@ -9,7 +9,7 @@ interface IInterface uint eval(); } -struct Impl : IInterface +public struct Impl : IInterface { uint val; uint eval() @@ -33,7 +33,7 @@ void compute(uint tid, Params p) [numthreads(4, 1, 1)] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID, -//TEST_INPUT:ubuffer(data=[0 0 0 0 1 0], stride=4):name=params.obj +//TEST_INPUT:set params.obj = new StructuredBuffer<IInterface>{new Impl{1}} uniform Params params) { uint tid = dispatchThreadID.x; diff --git a/tests/disabled-tests.txt b/tests/disabled-tests.txt index ea1a2330e..e588c153d 100644 --- a/tests/disabled-tests.txt +++ b/tests/disabled-tests.txt @@ -19,16 +19,6 @@ like it currently does. * compute/dynamic-dispatch-12.slang -### `StructuredBuffer<ISomething>` - -These tests require support for structured buffers where the element type either is an interface type or transitively contains one. - -* compute/dynamic-dispatch-13.slang -* compute/dynamic-dispatch-14.slang -* compute/dynamic-dispatch-bindless-texture.slang -* compute/interface-func-param-in-struct.slang -* compute/interface-assoc-type-param.slang - ### Generic Specialization Parameters These tests make use of generic specialization parameters in ways that don't easily align with the implementation approach that is more focused on existential parameters. @@ -52,6 +42,14 @@ They will need to wait until the shader object implementation(s) are updated to * compute/interface-shader-param-in-struct.slang * compute/interface-shader-param-legalization.slang +### Gfx Limitation + +These tests are disabled due to other limitations of gfx layer. + +* compute/half-rw-texture-convert.slang +* compute/half-rw-texture-simple.slang + + ### Uncategorized These tests need to be binned according to what features they need. |
