@@ -100,7 +100,18 @@ bool OS_Dx12::Dispatch(ID3D12Device* InDevice, ID3D12GraphicsCommandList* InCmdL
100100 // Copy the updated constant buffer data to the constant buffer resource
101101 UINT8* pCBDataBegin;
102102 CD3DX12_RANGE readRange (0 , 0 ); // We do not intend to read from this resource on the CPU
103- _constantBuffer->Map (0 , &readRange, reinterpret_cast <void **>(&pCBDataBegin));
103+ auto result = _constantBuffer->Map (0 , &readRange, reinterpret_cast <void **>(&pCBDataBegin));
104+
105+ if (result != S_OK)
106+ {
107+ LOG_ERROR (" [{0}] _constantBuffer->Map error {1:x}" , _name, (unsigned int ) result);
108+
109+ if (result == DXGI_ERROR_DEVICE_REMOVED && _device != nullptr )
110+ Util::GetDeviceRemovedReason (_device);
111+
112+ return false ;
113+ }
114+
104115 memcpy (pCBDataBegin, &fsr1Constants, sizeof (fsr1Constants));
105116 _constantBuffer->Unmap (0 , nullptr );
106117
@@ -112,7 +123,18 @@ bool OS_Dx12::Dispatch(ID3D12Device* InDevice, ID3D12GraphicsCommandList* InCmdL
112123 // Copy the updated constant buffer data to the constant buffer resource
113124 UINT8* pCBDataBegin;
114125 CD3DX12_RANGE readRange (0 , 0 ); // We do not intend to read from this resource on the CPU
115- _constantBuffer->Map (0 , &readRange, reinterpret_cast <void **>(&pCBDataBegin));
126+ auto result = _constantBuffer->Map (0 , &readRange, reinterpret_cast <void **>(&pCBDataBegin));
127+
128+ if (result != S_OK)
129+ {
130+ LOG_ERROR (" [{0}] _constantBuffer->Map error {1:x}" , _name, (unsigned int ) result);
131+
132+ if (result == DXGI_ERROR_DEVICE_REMOVED && _device != nullptr )
133+ Util::GetDeviceRemovedReason (_device);
134+
135+ return false ;
136+ }
137+
116138 memcpy (pCBDataBegin, &constants, sizeof (constants));
117139 _constantBuffer->Unmap (0 , nullptr );
118140
0 commit comments