Jump to content
  • Advertisement
Sign in to follow this  
Vilem Otte

OpenCL array of arrays

This topic is 2440 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


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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!