DirectX11 crash on Nvidia VGA

My laptop have two card: intel hd graphics 4600 and nvidia geforce gtx 950M
My code just convert nv12 to rgba, and it work well on intel hd graphics 4600 .
But when i change to nvidia card on graphic setting.

 D3D11_MAPPED_SUBRESOURCE ms;
 hr = this->_d3d11_deviceCtx->Map(this->_texture_rgba_copy.Get(), 0, D3D11_MAP_READ, 0, &ms);

it crash at Map to subresource

Exception thrown at 0x00007FF8B1E4AAFB (nvwgf2umx.dll) in TestConsole.exe: 0xC0000005: Access violation reading location 0x0000000000000068.

Can someone look for something wrong in my code? Thank.
NV12ToRgbShader · GitHub (sorry, i’m new on directx and code just copy and edit. )

My system infomations:
-Window 10 21H2
-Nvidia driver version 512.77 (lasted)
-dxdiag Nvidia feature level: 11_0, 10_1, …
-dxdiag DirectX version 12

Shader compile with Shader model Shader Model 4 Level 9_3 (/4_0_level_9_3) (i was try Shader Model 5 but same error)

Here is DxDiag infomation DxDiag.txt (110.7 KB)

After turn on debug i found bropblem.
It because ID3D11DeviceContext::CopySubresourceRegion copy between two devices.
Then i remove create device and using ffmpeg device.

AVCodecContext* _codec_ctx = avcodec_alloc_context3(_codec);
av_hwdevice_ctx_create(
			&_codec_ctx->hw_device_ctx,
			AV_HWDEVICE_TYPE_D3D11VA,
			nullptr,
			nullptr,
			0);
AVHWDeviceContext* hw_device_ctx = reinterpret_cast<AVHWDeviceContext*>(_codec_ctx->hw_device_ctx->data);
AVD3D11VADeviceContext* d3d11va_device_ctx = reinterpret_cast<AVD3D11VADeviceContext*>(hw_device_ctx->hwctx);
_d3d11_device = d3d11va_device_ctx->device;
_d3d11_deviceCtx = d3d11va_device_ctx->device_context;
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.