Hello -
I am struggling to understand one of the differences between Tier 1 Argument Buffers and Tier 2. Can anyone shed some light?
The [Apple Developer Documentation] says that Tier 2 argument buffers can be accessed through pointer indexing and provides this example:
kernel void my_kernel(constant My_AB_Resources *resourcesArray [[buffer(0)]]) {
constant My_AB_Resources & resources = resourcesArray[3];
}
In the book, we do something similar:
Model model = modelsArray[modelIndex];
The only difference appears to be the use of the address of operator (&) and the memory address space (constant) in the example from the developer documentation.
I gather that the first code sample is creating an alias to the element at index 3 of the resourcesArray. But why is that significant? Does it have to do with the immutability of Tier 1 argument buffers?