Hello UE4 community,
I have been wrestling with an issue for a while (looking at other custom display plugins etc) and not getting anywhere.
I have a custom FCurrentCustomPresent object. It works, but I want to add functionality that updates the state of a texture buffer after a copy to it is complete. Here is the sample pseudo-code:
// My custom present object
class FCurrentCustomPresent : public FDolbyCustomPresent<ID3D11Device>
{
public:
...
...
UpdateState();
...
}
void FCurrentCustomPresent::UpdateState()
{
// Update CPU buffer state variable
myBufferState = BUFFER_IS_SENT;
}
void FCurrentCustomPresent::FinishRendering()
{
...
...
ID3D11Texture2D* myTexture = MyFunctionToGetTexture();
ID3D11Texture2D* inputTexture = (ID3D11Texture2D*)mRenderTexture->GetNativeResource();
ENQUEUE_UNIQUE_RENDER_COMMAND_THREEPARAMETER(
void,
ID3D11Texture2D*, tt, myTexture,
ID3D11Texture2D*, bt, inputTexture,
FCurrentCustomPresent*, This, this,
{
GetD3D11ImmediateContext()->CopyResource(tt, bt);
GetD3D11ImmediateContext()->Flush();
This->UpdateState();
}
);
}
The problem is - that UpdateState() function is not being called. In my “working” implementation so far, I call the UpdateState() function asynchronously, right after the ENQUEUE_ … call and I occasionally see the wrong texture show up at output. Would really appreciate any help or pointers to solve this problem.
Thanks much!