summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmoffscreensurface.h
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-11-28 16:35:24 +0100
committerMikolaj Boc <mikolaj.boc@qt.io>2023-01-30 20:10:25 +0100
commit0eea2238f37a5eaa83ada6cd262eceaed20e415c (patch)
tree02f88e6033c5bb4ef08ebe4bc88b932725a576f4 /src/plugins/platforms/wasm/qwasmoffscreensurface.h
parent39daa368d47bc676efb19a8e7478ef1c270ae959 (diff)
Quasi-support for offscreen surface on WASM
Since context sharing is not currently supported with WebGL, offscreen contexts have a limited usability on Qt for WASM. If a context is shared, use the same underlaying WebGL context so that the two can actually share resources. This is not full-blown context sharing by any means but it makes e.g. the Open GL widget work as the readback texture for it is 'shared' between the virtual Qt contexts. If no sharing is desired, we use an OffscreenCanvas and actually create a separate WebGL context. Fixes: QTBUG-107558 Pick-to: 6.5 Change-Id: If57e44739ddb57c167d5f8881a74d8dee52531f6 Reviewed-by: MikoĊ‚aj Boc <Mikolaj.Boc@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmoffscreensurface.h')
-rw-r--r--src/plugins/platforms/wasm/qwasmoffscreensurface.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/platforms/wasm/qwasmoffscreensurface.h b/src/plugins/platforms/wasm/qwasmoffscreensurface.h
index 88a64b775a..38a991f4ce 100644
--- a/src/plugins/platforms/wasm/qwasmoffscreensurface.h
+++ b/src/plugins/platforms/wasm/qwasmoffscreensurface.h
@@ -6,6 +6,10 @@
#include <qpa/qplatformoffscreensurface.h>
+#include <emscripten/val.h>
+
+#include <string>
+
QT_BEGIN_NAMESPACE
class QOffscreenSurface;
@@ -14,8 +18,12 @@ class QWasmOffscreenSurface final : public QPlatformOffscreenSurface
public:
explicit QWasmOffscreenSurface(QOffscreenSurface *offscreenSurface);
~QWasmOffscreenSurface() final;
-private:
+ const std::string &id() const { return m_specialTargetId; }
+
+private:
+ std::string m_specialTargetId;
+ emscripten::val m_offscreenCanvas;
};
QT_END_NAMESPACE