summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmopenglcontext.h
Commit message (Collapse)AuthorAgeFilesLines
* wasm: don't recreate WebGL context on surface changeMorten Sørvig2025-06-121-13/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The native WebGL context is tied to a single canvas, and can only be used with that canvas. (Qt creates one canvas per QPlatformWindow). This means that we need new native contexts in cases where a QWindow is repeatedly created and destroyed. It can be tempting to just create a new WebGL context "behind the scenes" on the makeCurrent() call in this case, but this does not work since GL resources created by user code with the original WebGL context in place are now invalid. Inform user code that this has happened by signaling a context loss. This is done by returning false from makeCurrent(), and then making sure isValid() returns false as well. The context becomes invalid whenever the owning platform window is destroyed; add a call from ~QWasmWindow() which handles that bookkeeping. Pick-to: 6.10 Task-number: QTBUG-120138 Change-Id: I929b9bb51153007c16630b1a991399f01ebffa62 Reviewed-by: Morten Johan Sørvig <[email protected]>
* wasm: make opengles3 (webgl2) default surface formatLorn Potter2024-02-211-1/+1
| | | | | | | | | | | All major browsers support webgl2 out of the box. [ChangeLog][WebAssmebly] Default OpenGL ES version raised to 3.0 Fixes: QTBUG-110686 Pick-to: 6.7 Change-Id: I875b55c2e0f6e955249f121d92214cf10ed416d7 Reviewed-by: Morten Johan Sørvig <[email protected]> Reviewed-by: Laszlo Agocs <[email protected]>
* Add the missing include guardAmir Masoud Abdol2023-04-131-0/+4
| | | | | | | | Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I6a46784fa65aecd48a7f59021c4942ed52321742 Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Alexey Edelev <[email protected]>
* Reuse the existing canvas context for offscreen surfacesMikolaj Boc2023-03-121-3/+12
| | | | | | | | | | | | | Due to the nature of WebGL contexts, which cannot be reassigned to targets other than they were created for, we will now reuse the created canvas context for offscreen surfaces, since those (hopefully) mostly operate on textures anyway. If this is not done, any switch to an offscreen surface for the main RHI context invalidates resources on contexts in a share group with it. Fixes: QTBUG-111617 Change-Id: I9752f7eec396a3ef11414881f5f79f26e1e2c859 Reviewed-by: Morten Johan Sørvig <[email protected]>
* Quasi-support for offscreen surface on WASMMikolaj Boc2023-01-301-2/+4
| | | | | | | | | | | | | | | | | | 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 <[email protected]>
* Use the browser compositor for drawing windows on WASMMikolaj Boc2022-11-261-2/+3
| | | | | | | | | | | | | | | | Make the browser compositor draw the window non-client area (using css + html). Get rid of OpenGL usage in non-OpenGL windows and use canvas 2d context instead to blit the texture (QImage). Also, as part of the change, remove the deprecated canvas element support in QScreen. Fixes: QTBUG-107116 Fixes: QTBUG-107219 Change-Id: I65f0d91831c806315685ca681ac0e416673f5cd5 Reviewed-by: Morten Johan Sørvig <[email protected]> Reviewed-by: Aleksandr Reviakin <[email protected]> Reviewed-by: David Skoland <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-05-161-28/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Jörg Bornemann <[email protected]>
* wasm: Add OpenGL version checkMorten Johan Sørvig2020-03-241-0/+1
| | | | | | | | | | | | | QtQuick3D probes for the supported OpenGL level by testing multiple OpenGL versions in descending order. Context creation must fail for versions not supported by WebGL. It does not appear that Emscripten does this for the 3.x minor versions, at least. Add version check which allows OpenGL (ES) 3.0 and 2.0. Change-Id: Ide8745dd79e69af86812a8d6f5d6cc16ecdd099a Reviewed-by: Lorn Potter <[email protected]>
* wasm: rewrite/simplify OpenglContextMorten Johan Sørvig2019-05-141-3/+3
| | | | | | | | | | | | | | | | | | We don’t need the contextLost callback since we can poll for the “lost” status in isValid() Recreating the native context is not very helpful, since it destroys all current context state. Remove this logic. Support makeCurrent() on different surfaces, as long as they refer to the same screen. Create the native context (and record which screen) on the first call to makeCurrent() Task-number: QTBUG-75463 Change-Id: I6eb830df14578ffdbed5b0505fe860ce433e4f9b Reviewed-by: Lorn Potter <[email protected]>
* wasm: make wasm platform target a specific canvas instead of defaultLorn Potter2019-03-081-1/+1
| | | | | | | | This allows for multi canvas use Task-number: QTBUG-64079 Change-Id: I69c998aa4c2869bb5b7f14ba65bb63284365ad70 Reviewed-by: Morten Johan Sørvig <[email protected]>
* WebAssembly for QtBaseMorten Johan Sørvig2018-08-301-0/+63
This is the squashed diff from wip/webassembly to dev. Done-with: Peng Wu <[email protected]> Done-with: Sami Enne <[email protected]> Done-with: Morten Johan Sørvig <[email protected]> Started-by: Andrew Knight <[email protected]> Change-Id: I6562433c0a38d6ec49ab675e0f104f2665f3392d Reviewed-by: Lorn Potter <[email protected]> Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>