I am willing to know weather future version of OptiX will support cache mechanism for RTbuffer, so that just a function call to flush-like API that my all data will push to GPU? Or am I miss understanding that RTbuffer supports cache for now?
It’s not quite clear what you’re asking for.
The next rtContextLaunch in your OptiX application will take care that all dirty buffers are uploaded to the device. It’s marked dirty when you map/unmap them.
Use the flags in the map() call to tell OptiX how you want that to happpen. For example if you replace a whole buffer, use the RT_BUFFER_MAP_WRITE_DISCARD flag, etc.
When using CUDA interop you will be required to mark buffers dirty manually when you changed them in CUDA to trigger potential copies to other devices.
Read the OptiX API Reference document on all buffer related API calls.
My appology. OK,let me simplify my question:
- What will happen when RTbuffer::map()called?(Optix 5.0.1)?
- When the data in the RTbuffer is submitted to the device?(Optix 5.0.1)?
I think I answered both of that above already.
When the buffer is mapped, a virtual host address will be provided to your application which allows to access the buffer’s underlying memory.
Depending on the buffer type and the level and flags arguments you used in the rtBufferMapEx() call, OptiX will behave differently.
For example if you want to exchange a whole input buffer, you would use the RT_BUFFER_MAP_WRITE_DISCARD flag for best performance because there is no need to keep the previous buffer contents available.
If you do not use that flag, OptiX needs to take care that incremental updates would preserve the untouched data, etc.
Again, just read the OptiX API Reference document about all API calls starting with rtBuffer.
The buffer data will be updated in the next rtContextLaunch* call.
That’s also the reason why rtBufferUnmap explains that not calling unmap on a buffer before the next launch is an error.