Hi forum,
I made this plugin long time ago: [Plugin] Android Camera - Engine Source & GitHub - Unreal Engine Forums, and I share with all, now I found one trouble when I update to 4.13 inside my texture update, I was using this method:
bool bFreeData = false;
// call the RHIUpdateTexture2D to refresh the texture with new info
ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER(
UpdateTextureRegionsData,
FUpdateTextureRegionsData*, RegionData, RegionData,
bool, bFreeData, bFreeData,
{
for (uint32 RegionIndex = 0; RegionIndex < RegionData->NumRegions; ++RegionIndex)
{
int32 CurrentFirstMip = RegionData->Texture2DResource->GetCurrentFirstMip();
if (RegionData->MipIndex >= CurrentFirstMip)
{
RHIUpdateTexture2D(
RegionData->Texture2DResource->GetTexture2DRHI(),
RegionData->MipIndex - CurrentFirstMip,
RegionData->Regions[RegionIndex],
RegionData->SrcPitch,
RegionData->SrcData
+ RegionData->Regions[RegionIndex].SrcY * RegionData->SrcPitch
+ RegionData->Regions[RegionIndex].SrcX * RegionData->SrcBpp
);
}
}
if (bFreeData)
{
FMemory::Free(RegionData->Regions);
FMemory::Free(RegionData->SrcData);
}
delete RegionData;
});
For some reason it’s only works on shipping mode, not true for launch and development mode as well, my texture info is ok when I get my uchar8* convertion from android YUV format, I just test some pixel samples, anyway I change my update method for memcpy and is working for each mode, development and shipping also launch.
FTexture2DMipMap& Mip = texture->PlatformData->Mips[0];
void* Data = Mip.BulkData.Lock(LOCK_READ_WRITE);
FMemory::Memcpy(Data, (uint8*)rgb, width * height * 4);
Mip.BulkData.Unlock();
texture->UpdateResource();
is this a bug for UE 4.13? how can I fix it?
update things is always a mess