Draw texture to texture make crash

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);
}

Hello,

I have a few questions in order to help narrow down the cause of this crash:

  • Could you please provide the logs from your project’s Saved->Logs folder?
  • Are you getting a Crash Reporter window? If so, could you please provide your Machine ID from the window and ensure that you hit Send on the window?
  • Which class are the files that you have posted included in?

Hello,

I am marking this topic as resolved for tracking purposes, as we have not heard from you in a few days. If this issue persists, feel free to respond to this thread. For any new issues, please create a new Answerhub topic.

Have a great day