void ATasksPaper::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
if (TextureRenderTarget2D)
{
FCanvas Canvas(TextureRenderTarget2D->GameThread_GetRenderTargetResource(), NULL, 0.0f, 0.0f, 0.0f, GMaxRHIFeatureLevel);
Canvas.Clear(FLinearColor::White);
TArray<FString> strings;
strings.Add(L"Загрузить машину");
strings.Add(L"Перевезти вещи");
strings.Add(L"Разгрузить вещи");
strings.Add(L"Включить электричество");
strings.Add(L"Найти ключ и осмотреть новый дом внутри");
strings.Add(L"Перенести вещи в дом");
strings.Add(L"Выспаться");
if (BackTexture)
{
FCanvasTileItem tileItem(FVector2D::ZeroVector, BackTexture->CreateResource(), FVector2D(12.0f, 12.0f), FLinearColor::White);
//crash here
Canvas.DrawItem(tileItem, FVector2D::ZeroVector);
}
int h, w;
Font->GetStringHeightAndWidth(strings[0], h, w);
for (int i = 0; i < strings.Num(); i++)
{
FCanvasTextItem txtItem(FVector2D::ZeroVector, FText::FromString(strings[i]), Font,
(i<completes.Num() && completes[i] ? FLinearColor::Green : FLinearColor::Red));
//working normal
Canvas.DrawItem(txtItem, FVector2D(40, 120+ i*(h+5)));
}
Canvas.Flush_GameThread();
}
}
code crash line from D3D11Commands.cpp
void FD3D11DynamicRHI::RHISetShaderSampler(FPixelShaderRHIParamRef PixelShaderRHI,uint32 SamplerIndex,FSamplerStateRHIParamRef NewStateRHI)
{
VALIDATE_BOUND_SHADER(PixelShaderRHI);
FD3D11PixelShader* PixelShader = ResourceCast(PixelShaderRHI);
FD3D11SamplerState* NewState = ResourceCast(NewStateRHI);
ID3D11SamplerState* StateResource = NewState->Resource;
//crash here
StateCache.SetSamplerState<SF_Pixel>(StateResource, SamplerIndex);
}