6

In HLSL I have two arrays:

int arr1[2]; 
int arr2[2];

I need to copy contents of arr1 to arr2.

Should I iterate through every element?

arr2[0] = arr1[0]; 
arr2[1] = arr1[1];

Is there any specific HLSL tool (like memcpy() in C/C++)?

Or could I just write arr2 = arr1; and that will work for me?

Oliort UA
  • 1,568
  • 1
  • 14
  • 31

1 Answers1

0

arr2 = arr1 works fine. There is no reason to go through every element and it could add quite a bit of time depending on the number of array elements or their size.

mcky
  • 823
  • 2
  • 7
  • 20