Commit 2ff0cb82 authored by Kevin Qin's avatar Kevin Qin Committed by Commit Bot

OpenXR XrSwapchainCreateInfo Incorrect Format

Current OpenXr implementation has DXGI_FORMAT_R8G8B8A8_UNORM format, but
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB should be used.
OpenXR's swapchain format expects to describe the texture content.
The result of a swapchain image created from OpenXR API always contains a typeless texture.
On the other hand, WebGL API uses CSS color convention that's sRGB.
The RGBA typelss texture from OpenXR swapchain image leads to a linear format render target view
(reference to function D3D11TextureHelper::EnsureRenderTargetView in d3d11_texture_helper.cc).
Therefore, the content in this openxr swapchain image is in sRGB format.

Fixed: 1020392
Change-Id: Id1526e4b3061c81dfb48b5b9fd4bdced7831fd11
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1894049
Commit-Queue: Zheng Qin <zheqi@microsoft.com>
Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723518}
parent 3816a275
...@@ -280,7 +280,14 @@ XrResult OpenXrApiWrapper::CreateSwapchain() { ...@@ -280,7 +280,14 @@ XrResult OpenXrApiWrapper::CreateSwapchain() {
XrSwapchainCreateInfo swapchain_create_info = {XR_TYPE_SWAPCHAIN_CREATE_INFO}; XrSwapchainCreateInfo swapchain_create_info = {XR_TYPE_SWAPCHAIN_CREATE_INFO};
swapchain_create_info.arraySize = 1; swapchain_create_info.arraySize = 1;
swapchain_create_info.format = DXGI_FORMAT_R8G8B8A8_UNORM; // OpenXR's swapchain format expects to describe the texture content.
// The result of a swapchain image created from OpenXR API always contains a
// typeless texture. On the other hand, WebGL API uses CSS color convention
// that's sRGB. The RGBA typelss texture from OpenXR swapchain image leads to
// a linear format render target view (reference to function
// D3D11TextureHelper::EnsureRenderTargetView in d3d11_texture_helper.cc).
// Therefore, the content in this openxr swapchain image is in sRGB format.
swapchain_create_info.format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
// WebVR and WebXR textures are double wide, meaning the texture contains // WebVR and WebXR textures are double wide, meaning the texture contains
// both the left and the right eye, so the width of the swapchain texture // both the left and the right eye, so the width of the swapchain texture
......
...@@ -251,7 +251,7 @@ XrResult xrCreateSwapchain(XrSession session, ...@@ -251,7 +251,7 @@ XrResult xrCreateSwapchain(XrSession session,
XR_ERROR_VALIDATION_FAILURE, XR_ERROR_VALIDATION_FAILURE,
"XrSwapchainCreateInfo usageFlags is not " "XrSwapchainCreateInfo usageFlags is not "
"XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT"); "XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT");
RETURN_IF(create_info->format != DXGI_FORMAT_R8G8B8A8_UNORM, RETURN_IF(create_info->format != DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED, XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED,
"XrSwapchainCreateInfo format unsupported"); "XrSwapchainCreateInfo format unsupported");
RETURN_IF(create_info->sampleCount != OpenXrTestHelper::kSwapCount, RETURN_IF(create_info->sampleCount != OpenXrTestHelper::kSwapCount,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment