Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/vamr/intern/Session.h')
-rw-r--r--intern/vamr/intern/Session.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/intern/vamr/intern/Session.h b/intern/vamr/intern/Session.h
new file mode 100644
index 00000000000..1ba1a1d658a
--- /dev/null
+++ b/intern/vamr/intern/Session.h
@@ -0,0 +1,82 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup VAMR
+ */
+
+#ifndef __SESSION_H__
+#define __SESSION_H__
+
+#include <map>
+#include <memory>
+
+namespace VAMR {
+
+class Session {
+ public:
+ enum eLifeExpectancy {
+ SESSION_KEEP_ALIVE,
+ SESSION_DESTROY,
+ };
+
+ Session(class Context *xr_context);
+ ~Session();
+
+ void start(const VAMR_SessionBeginInfo *begin_info);
+ void requestEnd();
+
+ eLifeExpectancy handleStateChangeEvent(const struct XrEventDataSessionStateChanged *lifecycle);
+
+ bool isRunning() const;
+
+ void unbindGraphicsContext(); /* public so context can ensure it's unbound as needed. */
+
+ void draw(void *draw_customdata);
+
+ private:
+ /** Pointer back to context managing this session. Would be nice to avoid, but needed to access
+ * custom callbacks set before session start. */
+ class Context *m_context;
+
+ std::unique_ptr<struct OpenXRSessionData> m_oxr; /* Could use stack, but PImpl is preferable */
+
+ /** Active Ghost graphic context. Owned by Blender, not VAMR. */
+ class GHOST_Context *m_gpu_ctx{nullptr};
+ std::unique_ptr<class IGraphicsBinding> m_gpu_binding;
+
+ /** Rendering information. Set when drawing starts. */
+ std::unique_ptr<struct DrawInfo> m_draw_info;
+
+ void initSystem();
+ void end();
+
+ void bindGraphicsContext();
+
+ void prepareDrawing();
+ XrCompositionLayerProjection drawLayer(
+ std::vector<XrCompositionLayerProjectionView> &proj_layer_views, void *draw_customdata);
+ void drawView(XrSwapchain swapchain,
+ XrCompositionLayerProjectionView &proj_layer_view,
+ XrView &view,
+ void *draw_customdata);
+ void beginFrameDrawing();
+ void endFrameDrawing(std::vector<XrCompositionLayerBaseHeader *> *layers);
+};
+
+} // namespace VAMR
+
+#endif /* __SESSION_H__ */