I've been looking into trying to get MSAA antialiasing working within an OpenXR VR application.
I'm looking at how the swapchain images get created
XrSwapchainCreateInfo swapchainCreateInfo = XrSwapchainCreateInfo.malloc(stack)
.type$Default()
.next(NULL)
.createFlags(0)
.usageFlags(XR10.XR_SWAPCHAIN_USAGE_SAMPLED_BIT | XR10.XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT)
.format(glColorFormat)
.sampleCount(viewConfig.recommendedSwapchainSampleCount()) //<--- interesting
.width(viewConfig.recommendedImageRectWidth())
.height(viewConfig.recommendedImageRectHeight())
.faceCount(1)
.arraySize(1)
.mipCount(1);
PointerBuffer swapchainHanglePointerBuffer = stack.mallocPointer(1);
checkResponseCode(XR10.xrCreateSwapchain(xrSession, swapchainCreateInfo, swapchainHanglePointerBuffer));
And looking at where recommendedSwapchainSampleCount comes from it is from asking the runtime for its opinion
checkResponseCode(XR10.xrEnumerateViewConfigurationViews(xrInstance, systemID, viewConfigType, viewCountPointer, null));
viewConfigs = XrUtils.fill(
XrViewConfigurationView.calloc(viewCountPointer.get(0)), // use calloc() rather than malloc() to ensure the next field is correctly initialized
XrViewConfigurationView.TYPE,
XR10.XR_TYPE_VIEW_CONFIGURATION_VIEW
);
checkResponseCode(XR10.xrEnumerateViewConfigurationViews(xrInstance, systemID, viewConfigType, viewCountPointer, viewConfigs));
And for my system `viewConfig.recommendedSwapchainSampleCount()` returns 1 (And setting anything else gives me a XR_ERROR_RUNTIME_FAILURE error code). But I don't understand why it's 1. My system aught to be able to support more than that (Its all done locally on the PC right, the headsets not doing the sampling right?); in non VR contexts antialiasing all works fine. (viewConfig.maxSwapchainSampleCount() also returns 1)
My system is:
Oculus Quest 2 running over Virtual Desktop
Windows 10
NVidea GeForce RTX 3070
Am I on the right track here? Any ideas as to how I can get MSAA antialiasing working?
edit; sorry, some how managed to quote reply myself rather than editing :-\ Please ignore this reply
I understand now I think. I need to render to a seperate frame buffer (that supports multisampling) then blit into a second frame buffers for OpenXR to use as its swapchain image