| #pragma once |
| |
| #ifndef TGLDISPLAYLISTSMANAGER_H |
| #define TGLDISPLAYLISTSMANAGER_H |
| |
| |
| #include "tgl.h" |
| |
| |
| #include "tcg/tcg_observer_notifier.h" |
| |
| |
| #include <QMutex> |
| |
| #undef DVAPI |
| #undef DVVAR |
| |
| #ifdef TGL_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class TGLDisplayListsProxy { |
| QMutex m_mutex; |
| |
| public: |
| virtual ~TGLDisplayListsProxy() {} |
| |
| virtual void makeCurrent() = 0; |
| virtual void doneCurrent() = 0; |
| |
| QMutex *mutex() { return &m_mutex; } |
| }; |
| |
| |
| |
| |
| |
| template <typename Context> |
| class TGLDisplayListsProxyT final : public TGLDisplayListsProxy { |
| Context *m_proxy; |
| |
| public: |
| TGLDisplayListsProxyT(Context *proxy) : m_proxy(proxy) {} |
| ~TGLDisplayListsProxyT() { delete m_proxy; } |
| |
| void makeCurrent() override { m_proxy->makeCurrent(); } |
| void doneCurrent() override { m_proxy->doneCurrent(); } |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI TGLDisplayListsManager final : public tcg::notifier<> { |
| public: |
| struct Observer : public tcg::observer<TGLDisplayListsManager> { |
| virtual void onDisplayListDestroyed(int dlSpaceId) = 0; |
| }; |
| |
| public: |
| static TGLDisplayListsManager *instance(); |
| |
| int storeProxy(TGLDisplayListsProxy *proxy); |
| |
| |
| |
| void attachContext(int dlSpaceId, TGlContext context); |
| |
| |
| |
| void releaseContext(TGlContext context); |
| |
| int displayListsSpaceId(TGlContext context); |
| |
| |
| |
| TGLDisplayListsProxy *dlProxy(int dlSpaceId); |
| |
| |
| |
| }; |
| |
| #endif |