Optix stack issue

Hi,

I have developed a path tracer and it initially works. After that the complexity of the code has grown, the rendering starts to show garbage:

I’m pretty sure isn’t an algorithm issue, but a stack size/registers one. Actually I set the stack size to 1536 bytes:

m_context->setStackSize(1536);

Playing with the stack size, sometimes the image appears black and other the color changes (but the garbage is still present).

How I can figure out where is the problem?

Please help!

Thanks in advance,

P.S.: The path tracer is iterative.

My system: Optix 3.0.1, CUDA 5.0, core i7 8Gb (notebook), nVidia Geforce 555M 2GB (compute_20, sm_21), VS2010, Win7 64 bit, nVidia driver 332.21.

Oh, never mind, I forgot to initialize a structure. Not a stack/register issue. Ignore this.