I’m trying importance sample an environment texture.
For this I’m using a buffer populated by a quite large struct (some floats, 64 float marginal distribution, 64x64 float conditional and a 64x64 float3 pixeldata). The problem is that I can’t simply write e.g.
(1)float3 color = buf.pixeldata,
since this gives me data corruption (probably because optix doesn’t like me reading the same data from every thread?). However writing
(2) buftype a = buf; float3 color = a.pixeldata,
works fine although very slow.
So, my question(s) is:
- Is there a better way to setup my solution?( for example, putting the distributions and pixeldata in textures)
- Can I use something similar to restrict const in CUDA?