Thanks for the reply.
The optix::rtTex2D(…) is used in my code, and I tried toolset v140 (of VS2015) and CUDA 9.0, the same error occured.
Here is some more new information after I tried different methods:
Original codes:
//create some textures (marked as texture group A)
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height) using textures from group A
//succeed
//create some more textures (marked as texture group B)
//at now textures from group A still live in GPU
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height)) using textures from group B
//succeed
//create some more textures (marked as texture group C)
//at now textures from group A and B still live in GPU
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height)) using textures from group C
//succeed
//create some more textures (marked as texture group D)
//at now textures from group A, B and C still live in GPU
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height)) using textures from group D
//succeed
//########
//no more textures created
//at now textures from group A, B, C and D still live in GPU
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height)) using textures from group A
//error occured!!!
//no more textures created
//at now textures from group A, B, C and D still live in GPU
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height)) using textures from group B
//error occured!!!
...//error kept occuring
RT_PROGRAM void PinholeCamera()
{
OptixSceneParam& scene_param = _SCENE_PARAM;
//directly set the output result without calling rtTrace
scene_param.outline_output_buffer_[launch_number] = COLOR_RED;
}
As shown in the above codes, even when the rtTrace(…) function is not called from the PinholeCamera(), the error still occurs.
At first I thought that when I use textures from group A for the second time(where I comment the “########” in the code and when the error begin to occur), maybe these textures from group A get destroyed somewhere accidently. But the thing is that before calling the context_->launch(ENTRY_POINT_PINHOLE, width, height) function I can access these textures from CPU(using map(), unmap()), which means that these textures are still live.
Then I changed the code by adding a texture destroying and recreating process before the context_->launch(ENTRY_POINT_PINHOLE, width, height)) call, no errors occured!!!
Here is the modified code:
Modified codes:
//create some textures (marked as texture group A)
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height) using textures from group A
//succeed
//destroy all existing textures
//create some more textures (marked as texture group B)
//at now textures from group A are dead
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height)) using textures from group B
//succeed
//destroy all existing textures
//create some more textures (marked as texture group C)
//at now textures from group A and B are dead
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height)) using textures from group C
//succeed
//destroy all existing textures
//create some more textures (marked as texture group D)
//at now textures from group A, B and C are dead
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height)) using textures from group D
//succeed
//destroy all existing textures
//textures from group A are recreated
//at now textures from group B, C and D are dead
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height)) using textures from group A
//succeed!!!
//destroy all existing textures
//textures from group B are recreated
//at now textures from group A, C and D are dead
//do rendering(call context_->launch(ENTRY_POINT_PINHOLE, width, height)) using textures from group B
//succeed!!!
...//always succeed!!
RT_PROGRAM void PinholeCamera()
{
OptixSceneParam& scene_param = _SCENE_PARAM;
//call trace
rtTrace(...)
scene_param.outline_output_buffer_[launch_number] = prd.result;
}
But such a solution is not what I want because the texture creation costs too much and also I can’t figure out why I need this destroying and recreation process since everything works fine with older tool chains(OptiX3.9.1 + VS2013 + CUDA7.0 + Window7/Window10).