cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

spectral
Adept II

Structures copy ?

Hi,

In my host I prepare a buffer with different kind of informations (different types of structures). And so, in my kernel I would like to get this information :

I have try this :

__constant char* buffer = ....

BSDFParam_area_light bsdf = *((BSDFParam_area_light*)buffer);

 

But I got an error message : "error: invalid type conversion"

Do you have a solution ?

0 Likes
3 Replies
himanshu_gautam
Grandmaster

viewon01,

What is the definition of structure you are using?I doubt it is just a char* inside the structure.

I feel you can convert the buffer variable into some element of the structure but not to an instance of the structure itself.

0 Likes

himanshu,
the problem here is that BSDFParam_area_light in the conversion is being converted to the wrong address space. The correct casting would be as follows:
BSDFParam_area_light bsdf = *((constant BSDFParam_area_light*)buffer);
0 Likes

That's right !!!

Thanks Micah

0 Likes