summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-07 17:28:19 -0800
committerGitHub <noreply@github.com>2024-03-07 17:28:19 -0800
commita810aa31f5f366d69e67be96c169fec7d6041df7 (patch)
tree3c8697241d8f3381720661b6f5d3cdaac7789f5d /tools
parent6492906ebe59b573f6243e7c44476944b9dd5592 (diff)
Link-time constant and linkage API improvements. (#3708)
* Link-time constant and linkage API improvements. * Fix. * Allow module name to be empty. * Fix. * Fix. * Fix compile error.
Diffstat (limited to 'tools')
-rw-r--r--tools/gfx-unit-test/link-time-constant.cpp2
-rw-r--r--tools/gfx-unit-test/link-time-constant.slang9
2 files changed, 9 insertions, 2 deletions
diff --git a/tools/gfx-unit-test/link-time-constant.cpp b/tools/gfx-unit-test/link-time-constant.cpp
index 62cb294c1..b349a7dcb 100644
--- a/tools/gfx-unit-test/link-time-constant.cpp
+++ b/tools/gfx-unit-test/link-time-constant.cpp
@@ -79,6 +79,8 @@ namespace gfx_test
R"(
export static const bool turnOnFeature = true;
export static const float constValue = 2.0;
+ export static const int numthread = 1;
+ export static const int arraySize = 4;
)"));
ComputePipelineStateDesc pipelineDesc = {};
diff --git a/tools/gfx-unit-test/link-time-constant.slang b/tools/gfx-unit-test/link-time-constant.slang
index 385932dd4..b23f84ce8 100644
--- a/tools/gfx-unit-test/link-time-constant.slang
+++ b/tools/gfx-unit-test/link-time-constant.slang
@@ -1,17 +1,22 @@
extern static const bool turnOnFeature;
extern static const float constValue;
+extern static const int numthread = -1;
+extern static const int arraySize = -1;
// Main entry-point. Write some value into buffer depending on link
// time constant.
[shader("compute")]
-[numthreads(4, 1, 1)]
+[numthreads(numthread, 1, 1)]
void computeMain(
uint3 sv_dispatchThreadID: SV_DispatchThreadID,
uniform RWStructuredBuffer<float> buffer)
{
+ int array[arraySize];
+
+ array[sv_dispatchThreadID.x] = sv_dispatchThreadID.x;
if (turnOnFeature)
{
- buffer[0] = constValue;
+ buffer[array[0]] = constValue;
}
else
{