MCPcopy Create free account
hub / github.com/cocos/cocos-engine / getXRSwapchainFormat

Method getXRSwapchainFormat

native/cocos/platform/java/modules/XRInterface.cpp:680–712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

678}
679
680gfx::Format XRInterface::getXRSwapchainFormat() {
681#if CC_USE_XR
682 int swapchainFormat = xr::XrEntry::getInstance()->getXRConfig(xr::XRConfigKey::SWAPCHAIN_FORMAT).getInt();
683 #if CC_USE_GLES3
684 if (swapchainFormat == GL_SRGB_ALPHA_EXT) {
685 return gfx::Format::SRGB8_A8;
686 }
687
688 if (swapchainFormat == GL_RGBA8) {
689 return gfx::Format::RGBA8;
690 }
691
692 if (swapchainFormat == GL_BGRA8_EXT) {
693 return gfx::Format::BGRA8;
694 }
695 #endif
696
697 #if CC_USE_VULKAN
698 if (swapchainFormat == VK_FORMAT_R8G8B8A8_SRGB) {
699 return gfx::Format::SRGB8_A8;
700 }
701
702 if (swapchainFormat == VK_FORMAT_R8G8B8A8_UNORM) {
703 return gfx::Format::RGBA8;
704 }
705
706 if (swapchainFormat == VK_FORMAT_B8G8R8A8_UNORM) {
707 return gfx::Format::BGRA8;
708 }
709 #endif
710#endif
711 return gfx::Format::BGRA8;
712}
713
714void XRInterface::updateXRSwapchainTypedID(uint32_t typedID) {
715#if CC_USE_XR

Callers 1

doInitMethod · 0.80

Calls 2

getXRConfigMethod · 0.80
getIntMethod · 0.45

Tested by

no test coverage detected