Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Thanks for OP for researching the bugs, and for making it more detailed than “I feel like it could be better”.
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
Are you seeing specific situations where this is not behaving as expected? If so, please provide details such as which headset you are testing with, etc. Thanks.
Note: As per the spec - DXGI resources will be created with their associated TYPELESS format, but the runtime will use the application-specified format for reading the data.
Please elaborate. Swapchains are allocated using the width and height specified by the application via XrSwapchainCreateInfo.
Presumably you are referring to recommendedImageRectWidth/Height values returned by XrViewConfigurationView?
SteamVR performs a mini-benchmark on startup and adjusts recommended resolution based on your video card's performance.
If you look in C:\Program Files (x86)\Steam\logs\vrcompositor.txt you will find output like the following:
https://steamcommunity.com/app/250820/eventcomments/4036978698783065341/
This is correct, but a bit more complex. SteamVR's OpenXR runtime currently transitions D3D12 swapchain images to D3D12_RESOURCE_STATE_RENDER_TARGET (or D3D12_RESOURCE_STATE_DEPTH_WRITE) inside of xrWaitSwapchainImage rather than xrAcquireSwapchainImage. This change was made to address some issues in both Unreal and Unity some time ago. In theory, this should not matter to your app since Acquire should be treated as "peek index" to allow building command lists for the next frame. However, applications must call Wait on the image before they are allowed to submit those command lists to the queue.
Applications are allowed to Acquire all the images in a swapchain. If the transition is performed during that operation, then the compositor/runtime would not be able continue using them (e.g. for reprojection). The entire point of Wait is to handle this. I suspect that distinction was perhaps made after these extensions were originally drafted.
There are ongoing discussions within the OpenXR working group about updating the spec. The Vulkan extension has the same issue. In that particular case, SteamVR is still performing the transition in Acquire, while the Oculus PC runtime transitions in Wait fwiw.
I'm trying a version 2.2.3 and unfortunately now the app stopped working at all. Same code, no changes. This is the crash from console:
```
D3D12 ERROR: ID3D12Device::CreateCommittedResource: D3D12_RESOURCE_DESC::Flags cannot have D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE set without D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL, D3D12_RESOURCE_FLAG_VIDEO_DECODE_REFERENCE_ONLY or D3D12_RESOURCE_FLAG_VIDEO_ENCODE_REFERENCE_ONLY. [ STATE_CREATION ERROR #599: CREATERESOURCE_INVALIDMISCFLAGS]
Exception thrown at 0x00007FFAC41C567C in D3D12Sample.exe: Microsoft C++ exception: _com_error at memory location 0x000000D5BE2FDDD0.
Fri Dec 22 2023 16:22:28.755 [Info] - Failed to create D3D12 swapchain texture
xrCreateSwapchain(context->xr_session, &swapchain_info, &handle) at src\XRSwapchain.h:48 failed with -2
```
We can not create a swapchain anymore with new SteamVR OpenXR implementation.
However, I was able to examine one of the problem: with SRGB formats. And they are supported now! In fact _SRGB format is the first in returned SupportedSwapchainFormats. It wasn't the case with previous versions (I manually examined every DXGI_FORMAT value and none of SRGB formats were in that returned array)
And regarding swapchain size, yeah, this mini benchmark can explain things because I have a high-end 4090 so it is likely crunching numbers at faster pacing, but anyway I still believe that SteamVR should introduce a reasonable cap over native resolution of the headset because currently SteamVR works way slower than Oculus OpenXR with no visible benefits. Also, aspect ratio is different (it is 1:1 on Steam VR and 1:1.03 on Oculus for the same headset). Another thing is SteamVR's swapchain is not divisible by 16, which is a bit painful at least in our usecase.
Try setting XR_SWAPCHAIN_USAGE_SAMPLED_BIT when creating your swapchains. I'm not sure what situation this should not be set, but the OpenXR spec says to set D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE if XR_SWAPCHAIN_USAGE_SAMPLED_BIT is not set. Any swapchain image submitted to the runtime will need to be sampled, so it seems like an error to not just always set this.
Also, as mentioned over here[github.com], we've switched away from using ID3D12Device::CreateCommittedResource for D3D12 OpenXR swapchain images to using ID3D12CompatibilityDevice::CreateSharedResource instead, but that change hasn't shipped yet.
By default, it caps the resolution at 1.5x the driver recommended resolution.
Which headset? There was a bug in Steam Link that was causing the driver reported recommended resolution to be 2048x2048, but that has since been fixed to report the native panel resolution for each device now.
SteamVR rounds to the nearest multiple of 4. OpenXR applications specify swapchain image size, so there is nothing stopping you from further rounding to the nearest 16 instead.
It worked! Thank you!
However the log is still polluted by this now, looks like the state of the swapchains is still wrong, even after Acquire/Wait call (which I always used):
I tested with Quest Pro around 1.5 week ago, I'll see if newer version returns swapchains of different format
I do not see these errors when testing with hello_xr fwiw.
https://github.com/KhronosGroup/OpenXR-SDK-Source/tree/main/src/tests/hello_xr
swapchain->Acquire();
D3D12_CPU_DESCRIPTOR_HANDLE uiRTV = swapchain->rtv.GetCPU(swapchain->img_id);
auto g_CommandList = renderer->commandListRing->GetCurrentCommandList()->Get();
const float clearColor[] = { 0.0f, 0.2f, 0.4f, 1.0f };
g_CommandList->OMSetRenderTargets(1, &uiRTV, FALSE, nullptr);
g_CommandList->ClearRenderTargetView(uiRTV, clearColor, 0, nullptr);
ImGui::Render();
ImGui_ImplDX12_RenderDrawData(ImGui::GetDrawData(), g_CommandList.Get());
swapchain->Release();
And it emits the error. We get an error for every active swapchain in the rendering frame. Acquire does call "Wait" under the hood.
Also, no such errors on other runtimes.