diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-04-04 18:00:16 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-04 18:00:16 -0400 |
| commit | 68c7d5cda2d6f2eb7bfb3a7e15860eb3ded25424 (patch) | |
| tree | ac4e8384108e70109b084782b414296d015f92b8 /tests | |
| parent | 7bb2de1bc40e535fae93940113db97b5ea44a6f2 (diff) | |
Preliminary support for realtime clock (#2772)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Initial support for realtime clock.
* Add realtime-clock render feature where seems appropriate.
* Fixes to make NVAPI compile properly.
Change realtime-clock.slang check to use maths that can't overflow.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/slang-extension/realtime-clock.slang | 31 | ||||
| -rw-r--r-- | tests/slang-extension/realtime-clock.slang.expected.txt | 5 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/slang-extension/realtime-clock.slang b/tests/slang-extension/realtime-clock.slang new file mode 100644 index 000000000..67d6e2ab0 --- /dev/null +++ b/tests/slang-extension/realtime-clock.slang @@ -0,0 +1,31 @@ +// realtime-clock.slang + +// TODO(JS): +// Disable FXC DX11/DX12 because currently FXC can't compile nvHLSLExtns.h + +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -shaderobj +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-dx11 -slang -compute -output-using-type -nvapi-slot u0 -shaderobj +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -render-feature realtime-clock -output-using-type -shaderobj +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-d3d12 -compute -output-using-type -nvapi-slot u0 -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-d3d12 -compute -use-dxil -output-using-type -nvapi-slot u0 -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj + +// The test doesn't directly use this, but having this defined makes the 0 slot available if NVAPI is going to be used +// Only strictly necessary on the D3D11/D3D12 paths +//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=4):name=nvapiBuffer +RWStructuredBuffer<int> nvapiBuffer; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(8, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint idx = dispatchThreadID.x; + + uint ticksLow = getRealtimeClockLow(); + + uint2 ticks = getRealtimeClock(); + + outputBuffer[idx] = int(idx + ((ticksLow ^ ticks.x) ^ (ticks.x ^ ticksLow))); +}
\ No newline at end of file diff --git a/tests/slang-extension/realtime-clock.slang.expected.txt b/tests/slang-extension/realtime-clock.slang.expected.txt new file mode 100644 index 000000000..9d029e9f2 --- /dev/null +++ b/tests/slang-extension/realtime-clock.slang.expected.txt @@ -0,0 +1,5 @@ +type: int32_t +0 +1 +2 +3 |
