Develop
Develop
Select your platform

Bicubic Filtering with OpenXR

You can enable GPU hardware bicubic filtering tuned for the Quest display to enjoy additional fidelity when presenting VR imagery. If you are developing for Meta Quest, the system will fall back to default bilinear interpolation, so you can use the bicubic filtering features without having to special-case older devices.
Use bicubic filtering in OpenXR through either XR_FB_swapchain_update_state_opengl_es or XR_FB_swapchain_update_state_vulkan, depending on the underlying graphics API being used.
For GLES, the XrSwapchainStateSamplerOpenGLESFB struct holds magFilter and minFilter members that you can set directly with valid GL enumerators. For bicubic filtering, use new enumerator values specified via IMG_texture_filter_cubic GL extension. For example:
// Get extension functions
PFN_xrGetSwapchainStateFB _xrGetSwapchainStateFB = NULL;
xrGetInstanceProcAddr(instance,"xrGetSwapchainStateFB",(PFN_xrVoidFunction*)(&_xrGetSwapchainStateFB));
PFN_xrUpdateSwapchainFB _xrUpdateSwapchainFB = NULL;
xrGetInstanceProcAddr(instance, "xrUpdateSwapchainFB",(PFN_xrVoidFunction*)(&_xrUpdateSwapchainFB));
// Get current sampler state for colorTextureSwapChain
XrSwapchainStateSamplerOpenGLESFB samplerState = {XR_TYPE_SWAPCHAIN_STATE_SAMPLER_OPENGL_ES_FB};
_xrGetSwapchainStateFB(colorTextureSwapChain, (XrSwapchainStateBaseHeaderFB*)&samplerState);
// Modify current sampler state to bicubic filtering values specified via IMG_texture_filter_cubic
samplerState.magFilter = GL_CUBIC_IMG;
samplerState.minFilter = GL_CUBIC_MIPMAP_LINEAR_IMG;
// Set modified sampler state to colorTextureSwapChain
_xrUpdateSwapchainFB(scene->EquirectSwapChain.Handle,(XrSwapchainStateBaseHeaderFB*)(&samplerState));

Vulkan usage is similar, though the magnification and minification filter types are VkFilter and the bicubic-related values are provided through VK_IMG_filter_cubic Vulkan extension.
Note: Bicubic filtering requires more GPU resources as the kernel footprint increases. This is especially true for trilinear minification, as it requires two bicubic calculations from separate mip-levels. If used directly for compositor layers, the increased GPU costs will manifest itself in composition timing, which may lead to frame drops and negatively impact the VR experience. You should weigh the increased visual fidelity against the additional GPU resources required to offer the best VR user experience.
Did you find this page helpful?