• Advertisement
Sign in to follow this  

OpenCL array of arrays

This topic is 2178 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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).

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement