Jump to content

  • Log In with Google      Sign In   
  • Create Account

OpenCL array of arrays


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Vilem Otte   Crossbones+   -  Reputation: 1423

Like
0Likes
Like

Posted 09 March 2012 - 04:19 AM

Hello,

I'd like to ask if anyone has passed an array of structures like this to OpenCL:

struct CPrimitiveContainer
{
	 uint32_t mPrimitiveCount;
	 uint32_t *mPrimitives;
};

I actually thought off a solution some time back (I even used it on CPU to still achieve 2-bytes per KDTree node on 64-bits machines), I wonder whether this one is actually the only solution right now... :

struct CPrimitiveContainer
{
     uint32_t mPrimitiveCount;
     uint32_t mPrimitivesPtr;
}

uint32_t mPrimitiveIDsCount;
uint32_t *mPrimitiveIDs

So, I actually pass array of CPrimitiveContainer and array of unsigned integers (where the mPrimitivesPtr is index where the primitive IDs begin in mPrimitiveIDs array.

This works and seems (to me) to be only way to transfer arrays of arrays (of arrays of ....) to OpenCL (which is quite logical - as I can't just pass pointer and hope that it will work, as all data transfered to VRAM has different address than in RAM).

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS