Hello,
The current configuration is CUDA 4.1, Optix SDK 2.5.0, Windows 7 64 bits, Visual Studio 2010 with a 32 bits project, and GTX 460.
I’m having a strange behaviour after changing a variable declared in the context. First, I launch the ray generator program. Then I change this variable and launch again the same program. And doing rtPrintf I can see that the first time I send the ray generator program all works as expected, but the second time this program is executed twice: one with the old variable value and one with the new variable value… And I can’t understand why it happens.
The c++ code looks like:
_context["Dynamic"]->setInt(0);
_context->launch( PROGRAM_PHOTON, static_cast<unsigned int>(_numPhotons), static_cast<unsigned int>(1));
splatPhotonsGL();
_context["Dynamic"]->setInt(1);
_context->launch( PROGRAM_PHOTON, static_cast<unsigned int>(_numPhotons), static_cast<unsigned int>(1));
splatPhotonsGL();
and the code of the ray generation program looks like:
rtDeclareVariable(int, Dynamic, , );
RT_PROGRAM void ppass_camera(){
if(Dynamic == 0)
{
if(isPrintable()) rtPrintf("NO DYN\n");
PhotonPRD prdStatic;
prdStatic.type_of_ray = 0; //static
rtTrace(top_object, ray, prdStatic);
} else {
if(isPrintable()) rtPrintf("DYN\n");
PhotonPRD prdDynamic;
prdStatic.type_of_ray = 1; //dynamic
rtTrace(top_object, ray, prdStatic);
}
}
And the output I get after the first launch is:
NO DYN
And after the second launch is:
NO DYN
DYN
Why this happens?
I divided the code in two launches because I don’t have enough color attachments to splat the photons in all the textures that I need… So I don’t know how to solve it…
Thanks!