5 int Width,
int Height, EPixelFormat Format, TextureCompressionSettings Compression)
14 this->
Bpp = GPixelFormats[
Format].BlockBytes;
19 ENQUEUE_RENDER_COMMAND(CreateTextureCmd)(
20 [
this](FRHICommandListImmediate& RHICmdList)
33 const float Timeout = 5;
34 const float Granularity = 200.0f / 1000.0f;
35 int NumTries = (int)(Timeout / Granularity);
41 FPlatformProcess::Sleep(Granularity);
54 if (Tud->Data) FMemory::Free(Tud->Data);
66 FScopeLock Lock(&
TudMx);
78 Tud->Data = FMemory::Malloc(Tud->DataSize, PLATFORM_CACHE_LINE_SIZE);
91 const bool HackIsValidThread = (!GIsThreadedRendering || ENamedThreads::GetRenderThread() != ENamedThreads::GameThread);
93 if (!HackIsValidThread)
100 ENQUEUE_RENDER_COMMAND(UpdateTextureCmd)(
101 [Tud](FRHICommandListImmediate& RHICmdList)
118 REALSENSE_ERR(TEXT(
"Invalid video_frame: %s Width=%d Height=%d Bpp=%d"),
119 *
Name, fw, fh, fbpp);
140 for (
int y = 0;
y < fh; ++
y)
142 FMemory::Memcpy(Dst, Src, fw * fbpp);
161 #if WITH_EDITORONLY_DATA 162 Tex->MipGenSettings = TextureMipGenSettings::TMGS_NoMipmaps;
166 Tex->Filter = TextureFilter::TF_Nearest;
170 Tex->UpdateResource();
183 if (Tex && Tex->Resource)
186 ((FTexture2DResource*)Tex->Resource)->GetTexture2DRHI(),
188 FUpdateTextureRegion2D(0, 0, 0, 0, Tud->
Width, Tud->
Height),
190 (
const uint8*)Tud->
Data 195 FScopeLock Lock(&
TudMx);
void EnqueUpdateCommand(FTextureUpdateData *Tud)
int get_bytes_per_pixel() const
void RenderCmd_CreateTexture()
const void * get_data() const
void Update(const rs2::video_frame &Frame)
#define REALSENSE_ERR(Format,...)
virtual ~FDynamicTexture()
void RenderCmd_UpdateTexture(FTextureUpdateData *Tud)
std::vector< FTextureUpdateData * > TudPool
#define NAMED_PROFILER(name)
UTexture2D * TextureObject
FTextureUpdateData * AllocBuffer()
FDynamicTexture(FString Name, int Width, int Height, EPixelFormat Format, TextureCompressionSettings Compression)
void CopyData(FTextureUpdateData *Tud, const rs2::video_frame &Frame)
#define REALSENSE_TRACE(Format,...)
FThreadSafeCounter CommandCounter
TextureCompressionSettings Compression
class FDynamicTexture * Context
int get_stride_in_bytes() const