2020-06-24 20:22:09 +00:00
|
|
|
#ifndef OPENXR_SWAPCHAINIMPL_HPP
|
|
|
|
#define OPENXR_SWAPCHAINIMPL_HPP
|
|
|
|
|
|
|
|
#include "openxrswapchain.hpp"
|
|
|
|
#include "openxrmanagerimpl.hpp"
|
|
|
|
|
|
|
|
struct XrSwapchainSubImage;
|
2020-10-17 10:33:46 +00:00
|
|
|
struct XrSwapchainImageOpenGLKHR;
|
2020-06-24 20:22:09 +00:00
|
|
|
|
|
|
|
namespace MWVR
|
|
|
|
{
|
2020-06-26 21:02:48 +00:00
|
|
|
/// \brief Implementation of OpenXRSwapchain
|
|
|
|
class OpenXRSwapchainImpl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
OpenXRSwapchainImpl(osg::ref_ptr<osg::State> state, SwapchainConfig config);
|
|
|
|
~OpenXRSwapchainImpl();
|
|
|
|
|
|
|
|
void beginFrame(osg::GraphicsContext* gc);
|
|
|
|
void endFrame(osg::GraphicsContext* gc);
|
|
|
|
|
2020-06-28 09:33:01 +00:00
|
|
|
VRFramebuffer* renderBuffer() const;
|
|
|
|
uint32_t acquiredColorTexture() const;
|
|
|
|
uint32_t acquiredDepthTexture() const;
|
2020-06-26 21:02:48 +00:00
|
|
|
|
|
|
|
bool isAcquired() const;
|
|
|
|
XrSwapchain xrSwapchain(void) const { return mSwapchain; };
|
2020-07-15 21:17:16 +00:00
|
|
|
XrSwapchain xrSwapchainDepth(void) const { return mSwapchainDepth; };
|
2020-06-26 21:02:48 +00:00
|
|
|
XrSwapchainSubImage xrSubImage(void) const { return mSubImage; };
|
2020-07-15 21:17:16 +00:00
|
|
|
XrSwapchainSubImage xrSubImageDepth(void) const { return mSubImageDepth; };
|
2020-06-26 21:02:48 +00:00
|
|
|
int width() const { return mWidth; };
|
|
|
|
int height() const { return mHeight; };
|
|
|
|
int samples() const { return mSamples; };
|
|
|
|
|
2020-06-28 09:33:01 +00:00
|
|
|
protected:
|
|
|
|
OpenXRSwapchainImpl(const OpenXRSwapchainImpl&) = delete;
|
|
|
|
void operator=(const OpenXRSwapchainImpl&) = delete;
|
|
|
|
|
|
|
|
void acquire(osg::GraphicsContext* gc);
|
|
|
|
void release(osg::GraphicsContext* gc);
|
|
|
|
void checkAcquired() const;
|
|
|
|
|
|
|
|
private:
|
2020-06-26 21:02:48 +00:00
|
|
|
XrSwapchain mSwapchain = XR_NULL_HANDLE;
|
2020-07-15 21:17:16 +00:00
|
|
|
XrSwapchain mSwapchainDepth = XR_NULL_HANDLE;
|
|
|
|
std::vector<XrSwapchainImageOpenGLKHR> mSwapchainColorBuffers{};
|
|
|
|
std::vector<XrSwapchainImageOpenGLKHR> mSwapchainDepthBuffers{};
|
2020-06-26 21:02:48 +00:00
|
|
|
XrSwapchainSubImage mSubImage{};
|
2020-07-15 21:17:16 +00:00
|
|
|
XrSwapchainSubImage mSubImageDepth{};
|
2020-06-26 21:02:48 +00:00
|
|
|
int32_t mWidth = -1;
|
|
|
|
int32_t mHeight = -1;
|
|
|
|
int32_t mSamples = -1;
|
|
|
|
int64_t mSwapchainColorFormat = -1;
|
|
|
|
int64_t mSwapchainDepthFormat = -1;
|
2020-08-02 10:34:46 +00:00
|
|
|
bool mHaveDepthSwapchain = false;
|
2020-06-26 21:02:48 +00:00
|
|
|
uint32_t mFBO = 0;
|
2020-06-28 09:33:01 +00:00
|
|
|
std::vector<std::unique_ptr<VRFramebuffer> > mRenderBuffers{};
|
2020-06-26 21:02:48 +00:00
|
|
|
int mRenderBuffer{ 0 };
|
|
|
|
uint32_t mAcquiredImageIndex{ 0 };
|
|
|
|
bool mIsAcquired{ false };
|
|
|
|
};
|
2020-06-24 20:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|