Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/ghost/intern/GHOST_XrSwapchain.cpp')
-rw-r--r--intern/ghost/intern/GHOST_XrSwapchain.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/intern/ghost/intern/GHOST_XrSwapchain.cpp b/intern/ghost/intern/GHOST_XrSwapchain.cpp
index f7808c20112..9973d99cc37 100644
--- a/intern/ghost/intern/GHOST_XrSwapchain.cpp
+++ b/intern/ghost/intern/GHOST_XrSwapchain.cpp
@@ -54,11 +54,10 @@ static OpenXRSwapchainData::ImageVec swapchain_images_create(XrSwapchain swapcha
GHOST_XrSwapchain::GHOST_XrSwapchain(GHOST_IXrGraphicsBinding &gpu_binding,
const XrSession &session,
const XrViewConfigurationView &view_config)
- : m_oxr(new OpenXRSwapchainData())
+ : m_oxr(std::make_unique<OpenXRSwapchainData>())
{
XrSwapchainCreateInfo create_info = {XR_TYPE_SWAPCHAIN_CREATE_INFO};
uint32_t format_count = 0;
- int64_t chosen_format;
CHECK_XR(xrEnumerateSwapchainFormats(session, 0, &format_count, nullptr),
"Failed to get count of swapchain image formats.");
@@ -68,14 +67,16 @@ GHOST_XrSwapchain::GHOST_XrSwapchain(GHOST_IXrGraphicsBinding &gpu_binding,
"Failed to get swapchain image formats.");
assert(swapchain_formats.size() == format_count);
- if (!gpu_binding.chooseSwapchainFormat(swapchain_formats, chosen_format, m_is_srgb_buffer)) {
+ std::optional chosen_format = gpu_binding.chooseSwapchainFormat(swapchain_formats,
+ m_is_srgb_buffer);
+ if (!chosen_format) {
throw GHOST_XrException(
"Error: No format matching OpenXR runtime supported swapchain formats found.");
}
create_info.usageFlags = XR_SWAPCHAIN_USAGE_SAMPLED_BIT |
XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT;
- create_info.format = chosen_format;
+ create_info.format = *chosen_format;
create_info.sampleCount = view_config.recommendedSwapchainSampleCount;
create_info.width = view_config.recommendedImageRectWidth;
create_info.height = view_config.recommendedImageRectHeight;
@@ -95,7 +96,8 @@ GHOST_XrSwapchain::GHOST_XrSwapchain(GHOST_IXrGraphicsBinding &gpu_binding,
GHOST_XrSwapchain::GHOST_XrSwapchain(GHOST_XrSwapchain &&other)
: m_oxr(std::move(other.m_oxr)),
m_image_width(other.m_image_width),
- m_image_height(other.m_image_height)
+ m_image_height(other.m_image_height),
+ m_is_srgb_buffer(other.m_is_srgb_buffer)
{
/* Prevent xrDestroySwapchain call for the moved out item. */
other.m_oxr = nullptr;