Buffer trouble with TonemapperSimple

Hi,
I have some troubles getting the tonemapper to work. I have 2 simple buffers and a single tonemapper:

optix::Buffer InputBuffer = context->createBuffer(RT_BUFFER_INPUT, RT_FORMAT_FLOAT4, width, height);
optix::Buffer OutputBuffer = context->createBuffer(RT_BUFFER_OUTPUT, RT_FORMAT_FLOAT4, width, height);
optix::PostprocessingStage inTonemapStage = context->createBuiltinPostProcessingStage("TonemapperSimple");
inTonemapStage->declareVariable("input_buffer")->set(InputBuffer);
inTonemapStage->declareVariable("output_buffer")->set(OutputBuffer);
optix::CommandList cmdList = context->createCommandList();
cmdList->appendPostprocessingStage(inTonemapStage, width, height);
cmdList->finalize();
...inputbuffer.map() ... unmap() ...
cmdList->execute();

At runtime I get this in the execute():

(Details: Function "_rtCommandListExecute" caught exception: Assertion failed: "!( pinnedDevice & buf->m_allocatedSet ).empty() : Trying to pin buffer to device without allocation", file: C:\u\workspace\rel5.0-win64-cuda90-VS2015-build-Release\sw\wsapps\raytracing\rtsdk\rel5.0\src\Memory\MemoryManager.cpp, line: 742)'

If I use the denoiser instead of the tonemapper it works fine. So what am I missing for the tonemapper to work? The denoiser example does not look much different in the buffers. The only difference is the raytracing stage in front of the tonemapper.

Thanks,
Nico

I am guessing you are running on dual GPU? Does the error go away if you restrict to a single device (eg, via CUDA_VISIBLE_DEVICES=1 env var)?

in the original Denoiser sample there’s also a version without denoiser “commandListWithoutDenoiser”, but with pure tone mapper. That one is always executed for all “early frames”. Try to simply use that.
In your code above there’s also this line missing:
commandListWithoutDenoiser->appendLaunch(0, width, height);

Hi,

thanks for the input. Although I do use a laptop with integrated + dedicated card setting CUDA_VISIBLE_DEVICES doesn’t help. And as I said, the other postprocessing stage works, the denoiser example from the sdk too.

commandListWithoutDenoiser->appendLaunch(0, width, height); would only work if I have a rendering kernel before denoising, but I fill the buffer from an external source, so that shouldn’t be the issue. I really looked at the sdk example and the only difference I can see is that I don’t have a rendering kernel … I directly fill the buffer from an image.

I’ve reproduced the behavior by pruning down the optixDenoiser example and filed a bug report against OptiX.

You can workaround the problem temporarily by appending a launch of an empty ray generation program to the command list before the tonemapper stage.

Thanks for checking and confirming my suspicion.

Nico