-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- This holds the graphics information (swapchains, images, image views), the XR space used, and all other necessary information to be used for each frame
- Loading branch information
Showing
5 changed files
with
618 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#pragma once | ||
|
||
#ifndef RAZ_XRSESSION_HPP | ||
#define RAZ_XRSESSION_HPP | ||
|
||
using XrSession = struct XrSession_T*; | ||
struct XrInstance_T; | ||
struct XrSpace_T; | ||
struct XrSwapchain_T; | ||
struct XrSwapchainImageOpenGLKHR; | ||
struct XrViewConfigurationView; | ||
|
||
namespace Raz { | ||
|
||
class XrContext; | ||
|
||
class XrSession { | ||
public: | ||
explicit XrSession(const XrContext& context); | ||
|
||
void begin(unsigned int viewConfigType); | ||
void end(); | ||
void renderFrame(const std::vector<XrViewConfigurationView>& viewConfigViews, | ||
unsigned int viewConfigType, | ||
unsigned int environmentBlendMode); | ||
|
||
~XrSession(); | ||
|
||
private: | ||
using XrInstance = XrInstance_T*; | ||
using XrSpace = XrSpace_T*; | ||
using XrSwapchain = XrSwapchain_T*; | ||
struct ImageViewCreateInfo; | ||
struct RenderLayerInfo; | ||
enum class SwapchainType : uint8_t; | ||
|
||
struct SwapchainInfo { | ||
XrSwapchain swapchain {}; | ||
int64_t swapchainFormat {}; | ||
std::vector<void*> imageViews {}; | ||
}; | ||
|
||
void createSwapchains(const std::vector<XrViewConfigurationView>& viewConfigViews); | ||
void destroySwapchains(); | ||
void createSwapchainImages(SwapchainInfo& swapchainInfo, SwapchainType swapchainType); | ||
unsigned int createSwapchainImageView(const ImageViewCreateInfo& imageViewCreateInfo); | ||
void destroySwapchainImageView(void* imageView); | ||
void createReferenceSpace(); | ||
void destroyReferenceSpace(); | ||
bool renderLayer(RenderLayerInfo& layerInfo, | ||
const std::vector<XrViewConfigurationView>& viewConfigViews, | ||
unsigned int viewConfigType); | ||
|
||
::XrSession m_handle {}; | ||
XrInstance m_instance {}; | ||
int m_state {}; | ||
bool m_isRunning = false; | ||
|
||
std::vector<SwapchainInfo> m_colorSwapchainInfos; | ||
std::vector<SwapchainInfo> m_depthSwapchainInfos; | ||
std::unordered_map<XrSwapchain, std::pair<SwapchainType, std::vector<XrSwapchainImageOpenGLKHR>>> m_swapchainImages; | ||
std::unordered_map<unsigned int, ImageViewCreateInfo> m_imageViews; | ||
|
||
XrSpace m_localSpace {}; | ||
}; | ||
|
||
} // namespace Raz | ||
|
||
#endif // RAZ_XRSESSION_HPP |
Oops, something went wrong.