-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Closed
Labels
HLSLHLSL Language SupportHLSL Language Support
Description
Local resource arrays codegen is most likely already handled by existing code that creates local copies of arrays when they are used as function arguments, and the fact that we already have copy constructors on resource classes. This task is mostly about adding tests to make sure everything works as expected, and implementing the necessary changes if not.
Local arrays created when indexing sub-arrays of multi-dimensional resource array will be covered by #145426.
Example 1 - simple local resource array initialized by global resource instance:
RWBuffer<float> Buf : register(u5);
RWStructuredBuffer<float> Out : register(u0);
[numthreads(4,1,1)]
void main() {
RWBuffer<float> LocalArray[3];
LocalArray[2] = Buf;
Buf[0] = LocalArray[2][0];
}
Example 2 - resource array as a function argument:
RWBuffer<float> K[3] : register(u0);
RWBuffer<float> Out;
float foo(RWBuffer<float> LK[3]) {
return LK[2][0];
}
[numthreads(4,1,1)]
void main() {
Out[0] = foo(K);
}
Example 3 - resource array argument modified in a function (should write 1
to Y
and 2
to X
):
RWBuffer<int> X : register(u0);
RWBuffer<int> Y : register(u1);
void SomeFn(RWBuffer<int> Arr[2], uint Idx, int Val0) {
Arr[0] = Y;
Arr[0][Idx] = Val0;
}
[numthreads(4,1,1)]
void main(uint GI : SV_GroupIndex) {
RWBuffer<int> Arr[2] = {X, Y};
SomeFn(Arr, GI, 1);
Arr[0][GI] = 2;
}
Depends on #145424.
Metadata
Metadata
Assignees
Labels
HLSLHLSL Language SupportHLSL Language Support
Type
Projects
Status
Closed