diff options
| author | Yong He <yonghe@outlook.com> | 2024-12-06 00:55:35 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-06 00:55:35 -0800 |
| commit | 8ce7c6f6958f9f5ed750ef1a823b9e9ed8c042d8 (patch) | |
| tree | e4cb0ff1639ea0cf8209b466bd7d7537db783599 /tests/spirv | |
| parent | 22b64a446c8c37cc0b3670eb117b64575fc54d2f (diff) | |
Support specialization constant on WGSL and Metal. (#5780)
Diffstat (limited to 'tests/spirv')
| -rw-r--r-- | tests/spirv/specialization-constant.slang | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/spirv/specialization-constant.slang b/tests/spirv/specialization-constant.slang index dbf315926..44a7e4432 100644 --- a/tests/spirv/specialization-constant.slang +++ b/tests/spirv/specialization-constant.slang @@ -1,8 +1,27 @@ +//TEST:SIMPLE(filecheck=METAL): -target metal +//TEST:SIMPLE(filecheck=WGSL): -target wgsl -entry computeMain -stage compute //TEST:SIMPLE(filecheck=GLSL): -target glsl -allow-glsl //TEST:SIMPLE(filecheck=GLSL): -target glsl //TEST:SIMPLE(filecheck=CHECK): -target spirv -allow-glsl //TEST:SIMPLE(filecheck=CHECK): -target spirv +// METAL-DAG: constant bool fc_constValue2{{.*}} {{\[\[}}function_constant(1){{\]\]}}; +// METAL-DAG: constant bool constValue2{{.*}} = is_function_constant_defined(fc_constValue2{{.*}}) ? fc_constValue2{{.*}} : true; + +// METAL-DAG: constant float fc_constValue1{{.*}} {{\[\[}}function_constant(7){{\]\]}}; + +// METAL-DAG: constant int fc_constValue0{{.*}} {{\[\[}}function_constant(0){{\]\]}}; + +// METAL-DAG: constant int fc_constValue3{{.*}} {{\[\[}}function_constant(9){{\]\]}}; + +// WGSL-DAG: @id(0) override constValue0{{.*}} = {{.*}} + +// WGSL-DAG: @id(7) override constValue1{{.*}} = {{.*}} + +// WGSL-DAG: @id(1) override constValue2{{.*}} = {{.*}} + +// WGSL-DAG: @id(9) override constValue3{{.*}} = {{.*}} + // CHECK-DAG: OpDecorate %[[C0:[0-9A-Za-z_]+]] SpecId 0 // CHECK-DAG: %[[C0]] = OpSpecConstant %int 1 |
