diff options
| author | Yong He <yonghe@outlook.com> | 2025-10-09 18:30:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-10 01:30:24 +0000 |
| commit | e420f2f980813559b186a6a6bcd5540f74310d02 (patch) | |
| tree | 8f7a833ed86e8ce2a7b40bd1e9e7da5cb95d66ab /tests | |
| parent | 3cf1f5a616917480c63b76aae906dc36b29e46ce (diff) | |
Defer `IRCastStorageToLogicalDeref` in lowerBufferElementType pass. (#8668)
Fix a regression on metal test.
In `lowerBufferElementTypeToStorageType` pass, not only we want to defer
an argument that is `CastStorageToLogical` to the callee, but also apply
the same defer logic to `CastStorageToLogicalDeref` as well.
Because `CastStorageToLogicalDeref` will appear as argumnet if
`lowerBufferElementTypeToStorageType` is run before we apply the
`in->borrow` transformation pass, which is the case for metal parameter
block legalization.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/metal/sampler-array.slang | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/metal/sampler-array.slang b/tests/metal/sampler-array.slang new file mode 100644 index 000000000..65476543e --- /dev/null +++ b/tests/metal/sampler-array.slang @@ -0,0 +1,34 @@ +//TEST:SIMPLE(filecheck=MTL): -target metal -stage compute -entry computeMain +//TEST:SIMPLE(filecheck=LIB): -target metallib -stage compute -entry computeMain + +// MTL: float S1_test{{.*}}(const S1_default{{.*}} constant* this{{.*}} +// LIB: computeMain + +struct S1 +{ + Texture2D tex[32]; + SamplerState samplers[32]; + float data; + float test(int i) + { + return tex[i].SampleLevel(samplers[i], float2(0.0, 0.0), 0.0).x + data; + } +} + +struct S0 +{ + float data; + RaytracingAccelerationStructure acc; + ParameterBlock<S1> s; +} + +ParameterBlock<S0> g; +RWStructuredBuffer<float> buffer; + +[shader("compute")] +[numthreads(1,1,1)] +void computeMain( + uint3 sv_dispatchThreadID : SV_DispatchThreadID) +{ + buffer[0] = g.data * g.s.test(sv_dispatchThreadID.x); +} |
