ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.11k stars 1.28k forks source link

SetOverlayTexture produces error: D3D11 ERROR: ID3D11DeviceContext::CopySubresourceRegion: Cannot invoke CopySubresourceRegion #1484

Open TheIronWolfModding opened 3 years ago

TheIronWolfModding commented 3 years ago

Solved: overlay needs: DXGI_FORMAT_B8G8R8X8_UNORM. Note: internal error messages still persist, would appreciate if anyone explains what could be the cause.

I am getting the below error in SetOverlayTexture and Submit calls. I admit, I am doing the unusual things like converting DX9 texture to DX11. However, everything works nicely -the only bad visual side effect I noticed, is that my textures do not display correctly in the Overlay. I think pixels with alpha are ignored and I see through them in the overlay.

But I wanted to ask for help decoding the below message: how to diagnose this and any hints?

DX9 Texture format is: D3DFMT_A8R8G8B8 DXGI: DXGI_FORMAT_B8G8R8A8_UNORM

D3D11 ERROR: ID3D11DeviceContext::CopySubresourceRegion: Cannot invoke CopySubresourceRegion when the Formats of each Resource are not the same or at least castable to each other, unless one format is compressed (DXGI_FORMAT_R9G9B9E5_SHAREDEXP, or DXGI_FORMATBC[1,2,3,4,5]* ) and the source format is similar to the dest according to: BC[1|4] ~= R16G16B16A16|R32G32, BC[2|3|5] ~= R32G32B32A32, R9G9B9E5_SHAREDEXP ~= R32. [ RESOURCE_MANIPULATION ERROR #281: COPYSUBRESOURCEREGION_INVALIDSOURCE]

Update: if I Submit the same exact texture, it looks correct. But if I set it as OverlayTexture, overlay has areas missing. Honestly, I do not even care about the above error as long as overlay displays texture fully...

Thanks in advance.

TheIronWolfModding commented 3 years ago

Reactivating to see if anyone has an idea how to solve this. Happens on Submit and SetOverlayTexture. D3D11 ERROR: ID3D11DeviceContext::CopySubresourceRegion: Cannot invoke CopySubresourceRegion when the Formats of each Resource are not the same or at least castable to each other, unless one format is compressed (DXGI_FORMAT_R9G9B9E5_SHAREDEXP, or DXGI_FORMATBC[1,2,3,4,5]* ) and the source format is similar to the dest according to: BC[1|4] ~= R16G16B16A16|R32G32, BC[2|3|5] ~= R32G32B32A32, R9G9B9E5_SHAREDEXP ~= R32. [ RESOURCE_MANIPULATION ERROR #281: COPYSUBRESOURCEREGION_INVALIDSOURCE]

Raivr-dev commented 3 years ago

Reading the error message and your texture descriptions, it looks like the order of the color bytes in the two textures are not the same. The DX9 texture starts with the alpha byte, the other starts with blue.

TheIronWolfModding commented 3 years ago

Reading the error message and your texture descriptions, it looks like the order of the color bytes in the two textures are not the same. The DX9 texture starts with the alpha byte, the other starts with blue.

True. But I use https://docs.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-legacy-formats to map formats.

That said, I do not see how DX9 source texture format is relevant here (yes my post is confusing, sorry about that ...). I submit DX11 DXGI_FORMAT_B8G8R8A8_UNORM to OpenVR. Why exactly does it complain about?