Does anybody know how to prevent NVIDIA Falcor from deallocating resources between frames?
I’m attempting to store data computed in the current frame, for re-use in the next, by writing it to a texture in 1 frame and accessing it in the following frame.
I’m adding internal resources to a RenderPassReflection object in the reflect() function of my RenderPass, like so:
RenderPassReflection reflector; ResourceFormat formatFloat = ResourceFormat::RGBA32Float; ResourceFormat formatUint = ResourceFormat::RGBA32Uint; RenderPassReflection::Field::Type temporalType = RenderPassReflection::Field::Type::Texture2D; uint32_t width = 1920; uint32_t height = 1080; uint32_t depth = 1; uint32_t sampleCount = 1; uint32_t mipCount = 1; uint32_t arraySize = 1; reflector.addInternal("temporalBuffer", "An internal temporal buffer").flags(RenderPassReflection::Field::Flags::Persistent).format(formatFloat).resourceType(temporalType, width, height, depth, sampleCount, mipCount, arraySize); return reflector;
The resource is created correctly, and I’m able to access and use the texture in the current frame like you’d expect. However, when I access this texture in the following frame, the data has been corrupted.
I’m relatively new to DX12, but Microsoft PIX shows ResourceBarriers and Fence signal calls throughout the execution where I’d expect based on the documentation I’ve been reading.
My current hypothesis is that Falcor is deallocating the texture between frames.
Here, the " Render Pass Resource Allocation and Lifetime" section in the Falcor documentation explains the
Field::Flags:Persistent bit on a resource tells the graph system a resource needs to retain its data between calls to
RenderPass::execute(), and disables resource-allocation optimizations performed for the resource.
However, when I search the Falcor source code, I can’t find any reference to the “Persistent” flag ever being used. I suspect this might be the problem.
Does anybody know if/where Falcor would be releasing texture memory? I’m not experienced enough with DX12 to know what to look for. Can anybody point me towards some DX12 commands that might signify that this is happening?
I’ve been debugging this problem for over a week at this point, I’d appreciate any help I can get - even if it’s just guesses or suggestions! :)
If you’re curious, this is what I’m seeing: