I see many rendering examples use ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER() macro. I can’t find it in 4.26.1
Has it been removed, replaced? If true,then how do I do something like this:
?
Thanks.
I see many rendering examples use ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER() macro. I can’t find it in 4.26.1
Has it been removed, replaced? If true,then how do I do something like this:
?
Thanks.
+1
i have the same problem on upgrading my project to 4.26 from 4.23…
just went back a version to 4.25 and got this deprication warning:
Please use ENQUEUE_RENDER_COMMAND instead Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
hope this helps
unfortunatly i cannot find any documentation about how to replace ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER() with ENQUEUE_RENDER_COMMAND as it takes different arguments.
However, what i found is this commit from the engine sourcecode where the old function gets replaced by the new.
https://github.com/EpicGames/UnrealEngine/commit/41f6b93892dcf626a5acc155f7d71c756a5624b0
My c++ skills are limited, but in case i can get it to run, i will post it here…
Epic has replaced ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER etc with ENQUEUE_RENDER_COMMAND in the latest version. As the guys above said,there is no proper docs regarding this transition, but it is clear from the source commits. In fact, ENQUEUE_RENDER_COMMAND is less confusing too use as well.
You have to pass a Lambda now. Which in my opinion is way better. You can now define as many parameters as you want and only have to worry about knowing 1 nomenclature( in this case ENQUEUE_RENDER_COMMAND)
float sDataA =0;
FStruct sDataB = FStruct();
UObject* sObject = NewObject();
ENQUEUE_RENDER_COMMAND(NameOfCommand/YouDefineThis/)(
[sData, sDataB, sObject ](FRHICommandListImmediate& RHICmdList)
{
RHICmdList.Command()/Choose your Command to execute according to your captured parameters/;
})
For anyone need help:
ENQUEUE_RENDER_COMMAND(
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;
});