I am surely not seeing something in plain view, but a call to RHIUpdateTextureReference
result is a EXCEPTION_ACCESS_VIOLATION. I have a thread that need to update a texture, so I followed the example from Petr Leontev, something like:
// this happens in a mainthread.
UTexture2D* myTexture;
myTexture = UTexture2D::CreateTransient(1024, 1024, EPixelFormat::PF_R8G8B8A8);
FTexture2DRHIRef RHITexture2D_reference;
RHITexture2D_reference = RHIAsyncCreateTexture2D(1, 1, EPixelFormat::PF_B8G8R8A8, 1, TexCreate_ShaderResource, ERHIAccess::CopyDest, &MyMipData, 1, TEXT("HHH"), Task);
// other code that starts a subthread
// this happens in a subthread.
AsyncTask(ENamedThreads::GameThread, []()
{
ENQUEUE_RENDER_COMMAND(UpdateTextureReference)(
[](FRHICommandListImmediate& RHICmdList)
{
RHIUpdateTextureReference(miaTex->TextureReference.TextureReferenceRHI, RHITexture2D_reference);
myTexture->RefreshSamplerStates();
}
}
Is there something so clearly wrong that I am missing it?