diff options
| author | Yong He <yonghe@outlook.com> | 2024-03-26 17:35:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-26 17:35:24 -0700 |
| commit | dfdf243f07c977fa59b1a5968ce053bf590f8120 (patch) | |
| tree | 6121218f9e4d664722ed6192ca08f7c0e3c1d45b /tests | |
| parent | 0877d1a3e9d69fdbf4087581df96954e56e4dd97 (diff) | |
Support mutable existential parameters. (#3836)
* Support mutable existential parameters.
* Update test.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/gh-3818.slang | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/bugs/gh-3818.slang b/tests/bugs/gh-3818.slang new file mode 100644 index 000000000..5b2c4db78 --- /dev/null +++ b/tests/bugs/gh-3818.slang @@ -0,0 +1,47 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-shaderobj -output-using-type + +interface IOperation +{ + [mutating] + void Store(float v); + + float Load(); +}; + +struct TOperationMax : IOperation +{ + float result; + + [mutating] + void Store(float v) + { + result = v; + } + + float Load() + { + return result; + } +}; + +float Run(inout IOperation op, float val) +{ + op.Store(val); + return op.Load(); +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<float> outputBuffer; + +[numthreads(4, 1, 1)] +[shader("compute")] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + TOperationMax opMax; + opMax.result = 0.f; + float val = 2.f; + IOperation op = opMax; + float result = Run(op, val); + // CHECK: 2.0 + outputBuffer[0] = result; +} |
