How do I return arrays in amp restricted functions?

Suppose I have a series of numbers I want to return in an amp restricted function; what is the best way of doing this?

I'm not sure if I can "new" a simple array, and vectors are disallowed and I can't create a concurrency::array on the GPU, so how do I go about returning sets of numbers from amp restricted functions? Is it possible?

1
2
3
4
5
6
7
8
9
10
11
??? const RestrictedFunction() restrict(amp)
{
  float arr [5];
  for (unsigned i = 0; i != 5; ++i)
  {
    arr[i] = i;
  }

  // how do I return this?
  return ???
}
Last edited on
arr is a local vary,canit return.
float* const() restrict(amp)
{
float *arr =new float[5];//remmber to release it.
for (unsigned i = 0; i != 5; ++i)
{
arr[i] = i;
}

return arr;
}
I don't know if that will work, can I "new" an array in amp restricted functions?
Last edited on
Yeah "new" is definitely forbidden. Does anyone else have any suggestions?
I looked on MSDN and it doesn't look like new is forbidden...but if it is, you can't do what you are asking.
Topic archived. No new replies allowed.