Hi,
I’m trying to capture a coloured image from a camera using RHILockTexture2D like this -
FRHITexture2D *fast_cap_texture = fast_rt_resource_->TextureRHI->GetTexture2D();
uint32 stride;
auto *src = (const unsigned char*)RHILockTexture2D(fast_cap_texture, 0, RLM_ReadOnly, stride, false);
if (src)
FMemory::BigBlockMemcpy(latest_result_.pixels->data(), src, height * stride);
This is working correctly on Windows, however, on Linux, it’s crashing due to an assert (trace is here - Assertion failed: LockMode == RLM_WriteOnly [File:/home/rajat/UnrealEngine/UE_4. - Pastebin.com, it’s for 4.25 but similar for 4.24 as well)
I tried commenting out the assert in the Engine code, and it didn’t crash, however, I’m getting garbage data. Using RLM_WriteOnly rather than changing the Engine code gives garbage data on both Win & Linux
RLM_ReadOnly works correctly on Win & with OpenGL on Linux (-opengl
on cmdline) gives correct data. Crash is happening on 4.25 as well. I’m not sure but seems like a bug in Vulkan on Linux.
Background: Working on a UE4 based simulator AirSim, entire code - https://github.com/microsoft/AirSim/pull/2713
This is my first time posting a question here, so please let me know if any info is required, etc. Any comments or suggestions would be great!
Thanks!