How do I return arrays in amp restricted functions?

May 19, 2013 at 2:03am
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 May 19, 2013 at 6:39am
May 19, 2013 at 2:58am
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;
}
May 19, 2013 at 6:12am
I don't know if that will work, can I "new" an array in amp restricted functions?
Last edited on May 19, 2013 at 6:15am
May 21, 2013 at 5:10am
Yeah "new" is definitely forbidden. Does anyone else have any suggestions?
May 21, 2013 at 5:26am
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.