hi i create a little plugin to handle web cam on windows, but i have this issue with texture streaming pool size with UE 4.10 package
when i run editor all is ok!, my UTexture2D is perfectly update by fit camera, but in a package dont work!, give me this error: Texture streaming size pool over 4232111222.00mb WTF???
this is only happen within a plugin, the exact same code works in package if not a plugin class,
is this a bug?
this is the sample code is test and i confirm:
// Fill out your copyright notice in the Description page of Project Settings.
//header
#pragma once
#include "GameFramework/Pawn.h"
#include "MyPawn.generated.h"
UCLASS()
class ANDROIDAR_API AMyPawn : public APawn
{
GENERATED_BODY()
public:
UPROPERTY()
UTexture2D* PawnTexture;
TArray<FColor> rawData;
FUpdateTextureRegion2D *echoUpdateTextureRegion;
// Sets default values for this pawn's properties
AMyPawn();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
UFUNCTION(BlueprintPure, Category = "ARToolKit")
UTexture2D* getTexture();
};
// Region Data struct
struct FUpdateTextureRegionsData
{
FTexture2DResource* Texture2DResource;
int32 MipIndex;
uint32 NumRegions;
FUpdateTextureRegion2D* Regions;
uint32 SrcPitch;
uint32 SrcBpp;
uint8* SrcData;
};
and now the source:
// Fill out your copyright notice in the Description page of Project Settings.
#include "ANDROIDAR.h"
#include "MyPawn.h"
// Sets default values
AMyPawn::AMyPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AMyPawn::BeginPlay()
{
Super::BeginPlay();
PawnTexture = UTexture2D::CreateTransient(640, 480, PF_B8G8R8A8);
echoUpdateTextureRegion = new FUpdateTextureRegion2D(0, 0, 0, 0, 640, 480);
PawnTexture->UpdateResource();
rawData.Init(FColor(255, 0, 0, 255), 640 * 480);
}
// Called every frame
void AMyPawn::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
FUpdateTextureRegionsData* RegionData = new FUpdateTextureRegionsData;
RegionData->Texture2DResource = (FTexture2DResource*)PawnTexture->Resource;
RegionData->MipIndex = 0;
RegionData->NumRegions = 1;
RegionData->Regions = echoUpdateTextureRegion;
RegionData->SrcPitch = (uint32)(4 * 640);
RegionData->SrcBpp = 4;
RegionData->SrcData = (uint8*)rawData.GetData();
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;
});
}
// Called to bind functionality to input
void AMyPawn::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
}
UTexture2D* AMyPawn::getTexture()
{
return PawnTexture;
}