st/oxr: Add support for MND_swapchain_usage_input_attachment_bit

This commit is contained in:
Jakob Bornecrantz 2020-07-23 15:30:41 +01:00 committed by Jakob Bornecrantz
parent 40db8d3b55
commit fb9ebe8b88
5 changed files with 46 additions and 4 deletions

View file

@ -0,0 +1 @@
OpenXR: Implement the MND_swapchain_usage_input_attachment_bit extension.

View file

@ -16,6 +16,7 @@ EXTENSIONS = (
['XR_KHR_vulkan_enable', 'XR_USE_GRAPHICS_API_VULKAN'], ['XR_KHR_vulkan_enable', 'XR_USE_GRAPHICS_API_VULKAN'],
['XR_EXT_debug_utils'], ['XR_EXT_debug_utils'],
['XR_MND_headless'], ['XR_MND_headless'],
['XR_MND_swapchain_usage_input_attachment_bit'],
['XR_EXTX_overlay'], ['XR_EXTX_overlay'],
['XR_MNDX_egl_enable', 'XR_USE_PLATFORM_EGL', 'XR_USE_GRAPHICS_API_OPENGL'], ['XR_MNDX_egl_enable', 'XR_USE_PLATFORM_EGL', 'XR_USE_GRAPHICS_API_OPENGL'],
['XR_MNDX_ball_on_a_stick_controller'], ['XR_MNDX_ball_on_a_stick_controller'],

View file

@ -7,10 +7,6 @@
* @ingroup oxr_api * @ingroup oxr_api
*/ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "xrt/xrt_compiler.h" #include "xrt/xrt_compiler.h"
#include "util/u_debug.h" #include "util/u_debug.h"
@ -22,6 +18,11 @@
#include "oxr_api_funcs.h" #include "oxr_api_funcs.h"
#include "oxr_api_verify.h" #include "oxr_api_verify.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
XrResult XrResult
oxr_xrEnumerateSwapchainFormats(XrSession session, oxr_xrEnumerateSwapchainFormats(XrSession session,
@ -62,6 +63,28 @@ oxr_xrCreateSwapchain(XrSession session,
OXR_VERIFY_ARG_NOT_ZERO(&log, createInfo->width); OXR_VERIFY_ARG_NOT_ZERO(&log, createInfo->width);
OXR_VERIFY_ARG_NOT_ZERO(&log, createInfo->height); OXR_VERIFY_ARG_NOT_ZERO(&log, createInfo->height);
// Short hand.
struct oxr_instance *inst = sess->sys->inst;
XrSwapchainUsageFlags flags = 0;
flags |= XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT;
flags |= XR_SWAPCHAIN_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
flags |= XR_SWAPCHAIN_USAGE_UNORDERED_ACCESS_BIT;
flags |= XR_SWAPCHAIN_USAGE_TRANSFER_SRC_BIT;
flags |= XR_SWAPCHAIN_USAGE_TRANSFER_DST_BIT;
flags |= XR_SWAPCHAIN_USAGE_SAMPLED_BIT;
flags |= XR_SWAPCHAIN_USAGE_MUTABLE_FORMAT_BIT;
if (inst->extensions.MND_swapchain_usage_input_attachment_bit) {
flags |= XR_SWAPCHAIN_USAGE_INPUT_ATTACHMENT_BIT_MND;
}
if ((createInfo->usageFlags & ~flags) != 0) {
return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE,
"(createInfo->usageFlags == 0x08%" PRIx64
") contains invalid flags",
createInfo->usageFlags);
}
ret = sess->create_swapchain(&log, sess, createInfo, &sc); ret = sess->create_swapchain(&log, sess, createInfo, &sc);
if (ret != XR_SUCCESS) { if (ret != XR_SUCCESS) {
return ret; return ret;

View file

@ -89,6 +89,19 @@
#endif #endif
/*
* XR_MND_swapchain_usage_input_attachment_bit
*/
#if defined(XR_MND_swapchain_usage_input_attachment_bit)
#define OXR_HAVE_MND_swapchain_usage_input_attachment_bit
#define OXR_EXTENSION_SUPPORT_MND_swapchain_usage_input_attachment_bit(_) \
_(MND_swapchain_usage_input_attachment_bit, \
MND_SWAPCHAIN_USAGE_INPUT_ATTACHMENT_BIT)
#else
#define OXR_EXTENSION_SUPPORT_MND_swapchain_usage_input_attachment_bit(_)
#endif
/* /*
* XR_EXTX_overlay * XR_EXTX_overlay
*/ */
@ -154,6 +167,7 @@
OXR_EXTENSION_SUPPORT_KHR_vulkan_enable(_) \ OXR_EXTENSION_SUPPORT_KHR_vulkan_enable(_) \
OXR_EXTENSION_SUPPORT_EXT_debug_utils(_) \ OXR_EXTENSION_SUPPORT_EXT_debug_utils(_) \
OXR_EXTENSION_SUPPORT_MND_headless(_) \ OXR_EXTENSION_SUPPORT_MND_headless(_) \
OXR_EXTENSION_SUPPORT_MND_swapchain_usage_input_attachment_bit(_) \
OXR_EXTENSION_SUPPORT_EXTX_overlay(_) \ OXR_EXTENSION_SUPPORT_EXTX_overlay(_) \
OXR_EXTENSION_SUPPORT_MNDX_egl_enable(_) \ OXR_EXTENSION_SUPPORT_MNDX_egl_enable(_) \
OXR_EXTENSION_SUPPORT_MNDX_ball_on_a_stick_controller(_) OXR_EXTENSION_SUPPORT_MNDX_ball_on_a_stick_controller(_)

View file

@ -192,6 +192,9 @@ convert_usage_bits(XrSwapchainUsageFlags xr_usage)
if ((xr_usage & XR_SWAPCHAIN_USAGE_MUTABLE_FORMAT_BIT) != 0) { if ((xr_usage & XR_SWAPCHAIN_USAGE_MUTABLE_FORMAT_BIT) != 0) {
usage |= XRT_SWAPCHAIN_USAGE_MUTABLE_FORMAT; usage |= XRT_SWAPCHAIN_USAGE_MUTABLE_FORMAT;
} }
if ((xr_usage & XR_SWAPCHAIN_USAGE_INPUT_ATTACHMENT_BIT_MND) != 0) {
usage |= XRT_SWAPCHAIN_USAGE_INPUT_ATTACHMENT;
}
return usage; return usage;
} }