DX11 works but switches to DX 12 crashed。


FRHICommandListImmediate& list = GRHICommandList.GetImmediateCommandList();
uint8* TextureData = (uint8*)list.LockTexture2D(GameTexture->GetTexture2D(), 0, EResourceLockMode::RLM_ReadOnly, LolStride, false);
if (Runnable)
Runnable->InsertVideo(TextureData);
list.UnlockTexture2D(GameTexture, 0, false);

Does you graphics card support DirectX 12?

My graphics card is RTX 3050 Laaptop GPU,so support DirectX12.

Hmm, if you are using the default game engine and not a custom build I suggest that you verify the engine files. This could resolve the error you are facing. Alternatively try to do such a change on a blank project. It could be that the issue you are facing is tied to some assets or plugins.

I tried, but it still doesn’t work. I used the plugin ffmpeg to export videos.
The code is shown below

void UFFmpegDirector::GetScreenVideoData()
{
	FRHICommandListImmediate& list = GRHICommandList.GetImmediateCommandList();
	uint8* TextureData = (uint8*)list.LockTexture2D(GameTexture->GetTexture2D(), 0, EResourceLockMode::RLM_ReadOnly, LolStride, false);
	if (Runnable)
		Runnable->InsertVideo(TextureData);
	list.UnlockTexture2D(GameTexture, 0, false);
}
void UFFmpegDirector::Begin_Receive_VideoData()
{
	FSlateApplication::Get().GetRenderer()->OnBackBufferReadyToPresent().AddUObject(this, &UFFmpegDirector::OnBackBufferReady_RenderThread);
}

void UFFmpegDirector::OnBackBufferReady_RenderThread(SWindow& SlateWindow, const FTexture2DRHIRef& BackBuffer)
{
	if (gameWindow == &SlateWindow)
	{
		if (ticktime >= Video_Tick_Time)
		{

				GameTexture = BackBuffer;
				GetScreenVideoData();
				ticktime -= Video_Tick_Time;
               }
       }
}

But when running , the code will work well at DX11,but cash at DX12,at this line

uint8* TextureData = (uint8*)list.LockTexture2D(GameTexture->GetTexture2D(), 0, EResourceLockMode::RLM_ReadOnly, LolStride, false);
this is my project. 新建标签页 (github.com)Can you help you.please