Commit Graph

374 Commits

Author SHA1 Message Date
Fatih Kilic
922992a8c2 Bug 1918690: Check canvas permission in RandomizePixels function. a=pascalc
Differential Revision: https://phabricator.services.mozilla.com/D255970
2025-07-09 08:56:36 +00:00
Fatih Kilic
8345f6ecad Bug 1966860 - Enable WEBGL_debug_renderer_info extension and spoof vendor. a=dmeehan
Original Revision: https://phabricator.services.mozilla.com/D249777

Differential Revision: https://phabricator.services.mozilla.com/D251701
2025-05-29 13:12:25 +00:00
Lee Salzman
1d18f4b2f5 Bug 1938053 - Accelerate canvas drawImage of a WebGL context. r=aosmond
Accelerated Canvas2D and WebGL both live within the GPU process and run within
the same thread. We want to avoid any kind of readbacks from the GPU process
to the content process when doing a drawImage of a WebGL context to an AC2D
canvas.

To achieve this, we pause the AC2D recording translation with an AwaitTranslationSync
event identified by a sync-id. Then we send a request over IPDL to snapshot the
WebGL context while this pause is ongoing via a SnapshotExternalCanvas IPDL message,
which uses the sync-id to identify the snapshot safely in a table of such external
snapshots and force translation to resume. Finally, we send a ResolveExternalSnapshot
event within the recording stream to lookup the snapshot based on the sync-id and
assign it an alias that can be used within the recording stream playback for drawImage.

The sync-id mechanism acts as a sequenced fence so that multiple SnapshotExternalCanvas
requests can be encountered simultaneously from IPDL without confusing the recording
playback.

Differential Revision: https://phabricator.services.mozilla.com/D243399
2025-04-15 16:44:20 +00:00
Kelsey Gilbert
ca99b03703 Bug 1956355 - Add webgl.porting.strict_readpixels_formats.non_es:true for ReadPixels/IMPLEMENTATION_COLOR_READ_FORMAT. r=gfx-reviewers,lsalzman
Pref defaults to true to match existing behavior.
Also normalize HALF_FLOAT_OES to HALF_FLOAT internally.

Differential Revision: https://phabricator.services.mozilla.com/D243017
2025-04-01 17:47:54 +00:00
Goloman Adrian
8a1d3d3bcc Backed out 2 changesets (bug 1956355) for causing build bustages @WebGLContextGL.cpp.
Backed out changeset 5e479ac652f4 (bug 1956355)
Backed out changeset 194f0fa0c62e (bug 1956355)
2025-03-28 00:14:41 +02:00
Kelsey Gilbert
68a9135d10 Bug 1956355 - Add webgl.porting.strict_readpixels_formats.non_es:true for ReadPixels/IMPLEMENTATION_COLOR_READ_FORMAT. r=gfx-reviewers,lsalzman
Pref defaults to true to match existing behavior.
Also normalize HALF_FLOAT_OES to HALF_FLOAT internally.

Differential Revision: https://phabricator.services.mozilla.com/D243017
2025-03-27 20:26:45 +00:00
Kelsey Gilbert
c1c9462c2a Bug 1955115 - Respond to GetShaderPrecisionFormat from client instead of sync IPC. r=gfx-reviewers,ipc-reviewers,mccr8,lsalzman
Also:
* Add IPC ParamTraits/QueueParamTraits for std::tuple, std::pair, and
std::unordered_map.

Differential Revision: https://phabricator.services.mozilla.com/D242221
2025-03-25 00:04:05 +00:00
Sandor Molnar
d2eabece72 Backed out changeset 7421430ae066 (bug 1955115) for causing assertion failures @ ClientWebGLContext.h CLOSED TREE 2025-03-23 13:05:17 +02:00
Kelsey Gilbert
4851878c90 Bug 1955115 - Respond to GetShaderPrecisionFormat from client instead of sync IPC. r=gfx-reviewers,ipc-reviewers,mccr8,lsalzman
Also:
* Add IPC ParamTraits/QueueParamTraits for std::tuple, std::pair, and
std::unordered_map.

Differential Revision: https://phabricator.services.mozilla.com/D242221
2025-03-23 09:04:12 +00:00
Stanca Serban
3804c21d91 Backed out changeset da6ee86afe99 (bug 1955115) for causing build bustages in QueueParamTraits.h. CLOSED TREE 2025-03-21 05:12:17 +02:00
Kelsey Gilbert
ac43712b00 Bug 1955115 - Respond to GetShaderPrecisionFormat from client instead of sync IPC. r=gfx-reviewers,ipc-reviewers,mccr8,lsalzman
Also:
* Add IPC ParamTraits/QueueParamTraits for std::tuple, std::pair, and
std::unordered_map.
* Add polyfill for c++20's std::to_array<T>({1, 2, ...}).

Differential Revision: https://phabricator.services.mozilla.com/D242221
2025-03-20 19:19:48 +00:00
Lee Salzman
19848e0190 Bug 1943241 - Use SurfaceDescriptorCanvasSurface to upload Canvas2D surface to WebGL texture. r=jgilbert
This utilizes SurfaceDescriptorCanvasSurface to send canvas recording SourceSurfaces over the process
gap, so that we don't need to query data from the canvas recording, which would incur multiple syncs
and and inter-process copies.

This does have to bypass some restrictions in BlitPreventReason, since many use-cases expect WebGL
to automatically do (un)premultiply conversions when sending Canvas2D content to WebGL.

TexUnpackBlobDesc needs to be modified so that instead of just allowing dataSurf to be stored, it
can take normal sourceSurfs, which is a superset, so that recording surfaces (which are not data
surfaces) can be traded around with the SurfaceDescriptorCanvasSurface and keep them alive with
ref-counting as appropriate.

Overall, this relies on the fact that Accelerated Canvas2D and WebGL are running from the same
CanvasRender thread when AC2D is in use. In this case, by the time WebGL executes the command
to use the SurfaceDescriptorCanvasSurface, the AC2D command queue has already been processed to
produce the surface in question, so that no blocking is required.

Differential Revision: https://phabricator.services.mozilla.com/D235263
2025-02-05 21:33:17 +00:00
Kelsey Gilbert
a57dfcc948 Bug 1932784 - Reduce #include of WebGLFormats.h in headers. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D229864
2024-12-04 11:13:49 +00:00
Sandor Molnar
0a5179c08b Backed out 4 changesets (bug 1932784) for causing build bustages @ nsWaylandDisplay.h
Backed out changeset 904eb3043370 (bug 1932784)
Backed out changeset b13e482a5c6f (bug 1932784)
Backed out changeset 22dd30bf7d5a (bug 1932784)
Backed out changeset f8762853ca6e (bug 1932784)
2024-11-23 13:38:54 +02:00
Kelsey Gilbert
d7a034c706 Bug 1932784 - Reduce #include of WebGLFormats.h in headers. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D229864
2024-11-23 04:09:00 +00:00
Andreas Pehrson
9008b25332 Bug 1920972 - Allow CC traversal of const RefPtr. r=glandium,jgilbert
For traversing an object that wraps a RefPtr and allows setting a new (copied)
value, but only has a const getter, like Canonical<RefPtr<T>> from
StateMirroring.h and Watchable<RefPtr<T>> from StateWatching.h.

Differential Revision: https://phabricator.services.mozilla.com/D224714
2024-11-15 23:19:05 +00:00
Fatih
e97ee46ab1 Bug 1922506: Implement MOZ_debug.CONTEXT_TYPE extenstion. r=tjr,jgilbert,webidl,saschanaz
WSI_INFO is also very similar to this, but WSI_INFO contains a lot of info that we already collect, also there's a note about old Android devices crashing when queried, see https://searchfox.org/mozilla-central/rev/dca2603d55b5b39d3b8ab8e93c08b42563f5aad8/gfx/gl/GLContextProviderEGL.cpp#581-585

Differential Revision: https://phabricator.services.mozilla.com/D226809
2024-11-07 21:48:52 +00:00
Stanca Serban
c497d835ca Backed out 16 changesets (bug 1922506) for causing mochitests failures in CanvasRenderingContext2DBinding.cpp. CLOSED TREE
Backed out changeset 92b3d2b856ee (bug 1922506)
Backed out changeset f2cd605cd97c (bug 1922506)
Backed out changeset c0cea90ae140 (bug 1922506)
Backed out changeset d0845b56ac6a (bug 1922506)
Backed out changeset bd50b07c6b5e (bug 1922506)
Backed out changeset cdf3f8bbee31 (bug 1922506)
Backed out changeset 4e39fe895fce (bug 1922506)
Backed out changeset 54c7bbd4ef7b (bug 1922506)
Backed out changeset 20022200a9e2 (bug 1922506)
Backed out changeset 1cd8a6b38919 (bug 1922506)
Backed out changeset f6a010cad98c (bug 1922506)
Backed out changeset 8ff25b5fa6b7 (bug 1922506)
Backed out changeset 40a9d6da9b92 (bug 1922506)
Backed out changeset 1c6bbaf3c6e3 (bug 1922506)
Backed out changeset 70c7cf0df998 (bug 1922506)
Backed out changeset 4d87de8944a9 (bug 1922506)
2024-11-07 19:25:40 +02:00
Fatih
9d2c6a3386 Bug 1922506: Implement MOZ_debug.CONTEXT_TYPE extenstion. r=tjr,jgilbert,webidl,saschanaz
WSI_INFO is also very similar to this, but WSI_INFO contains a lot of info that we already collect, also there's a note about old Android devices crashing when queried, see https://searchfox.org/mozilla-central/rev/dca2603d55b5b39d3b8ab8e93c08b42563f5aad8/gfx/gl/GLContextProviderEGL.cpp#581-585

Differential Revision: https://phabricator.services.mozilla.com/D226809
2024-11-07 13:07:25 +00:00
Butkovits Atila
45b7f3a396 Backed out 16 changesets (bug 1922506) for causing bustages at WebGLContext.cpp. CLOSED TREE
Backed out changeset 6c65c91ac5eb (bug 1922506)
Backed out changeset 436ba666d8d0 (bug 1922506)
Backed out changeset 4cc4f3c552f5 (bug 1922506)
Backed out changeset bb3750f2dd54 (bug 1922506)
Backed out changeset e2f3ebe49fcf (bug 1922506)
Backed out changeset e21674489b6c (bug 1922506)
Backed out changeset 755664733050 (bug 1922506)
Backed out changeset 0e37aed34cfd (bug 1922506)
Backed out changeset 779cc3d4d972 (bug 1922506)
Backed out changeset 355dd07c36a4 (bug 1922506)
Backed out changeset 7e1b5399826c (bug 1922506)
Backed out changeset 58ca4b4ddd1a (bug 1922506)
Backed out changeset 72a97745d6de (bug 1922506)
Backed out changeset 26717f25380d (bug 1922506)
Backed out changeset 71ad1af83798 (bug 1922506)
Backed out changeset 54f6a55f077b (bug 1922506)
2024-11-06 18:22:37 +02:00
Fatih
22f577ac29 Bug 1922506: Implement MOZ_debug.CONTEXT_TYPE extenstion. r=tjr,jgilbert,webidl,saschanaz
WSI_INFO is also very similar to this, but WSI_INFO contains a lot of info that we already collect, also there's a note about old Android devices crashing when queried, see https://searchfox.org/mozilla-central/rev/dca2603d55b5b39d3b8ab8e93c08b42563f5aad8/gfx/gl/GLContextProviderEGL.cpp#581-585

Differential Revision: https://phabricator.services.mozilla.com/D226809
2024-11-06 14:37:16 +00:00
Andrew Osmond
40d996236a Bug 1869182 - Make WebGL use SharedSurfacesChild/Parent to avoid copies with SourceSurfaceSharedData. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D196105
2024-09-24 21:00:49 +00:00
Brad Werth
ffea0be19d Bug 1885446 Part 2: Make ConvertImage do colorSpace conversion. r=jgilbert
This uses existing gl math to do colorSpace conversion between
predefined DOM colorSpaces (sRGB and Display P3). It does not yet
accurately read the inbound colorSpace of the image -- it just assumes
it is sRGB.

Differential Revision: https://phabricator.services.mozilla.com/D218362
2024-09-10 23:27:57 +00:00
Brad Werth
ed9166951f Bug 1885446 Part 1: Stub the WebGL unpackColorSpace attribute. r=jgilbert,webidl,smaug
This is a stub so webidl reviewers can review this without having to review
the implementation. This is not attempting to do anything with
unpackColorSpace other than ensure that it is get and set in the same
ways that are used for drawingBufferColorSpace.

Differential Revision: https://phabricator.services.mozilla.com/D214053
2024-09-10 23:27:57 +00:00
Tom Ritter
ffb7757eb1 Bug 1899874: Add a privileged forceSoftwareRendering attribute to Canvas Attributes. r=jgilbert,webidl,smaug
willReadFrequently does basically what we want for Canvas2D;
however it won't work on Windows _and_ it doesn't exist for WebGL

So we will just add our own (privileged) attribute we can set

Differential Revision: https://phabricator.services.mozilla.com/D212177
2024-08-07 00:31:45 +00:00
Jamie Nicol
e2c9335f53 Bug 1910516 - Treat webgl context as in-process when determining texture type if context is lost. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D218047
2024-07-30 21:03:10 +00:00
Kelsey Gilbert
74331bb704 Bug 1909019 - Use ParamTraits_TiedFields/_IsEnumCase in WebRenderMessageUtils instead of PlainOldDataSerializer. (partial) r=gw,mccr8,ahale
Differential Revision: https://phabricator.services.mozilla.com/D217508
2024-07-26 23:51:25 +00:00
Iulian Moraru
fb811cfefc Backed out 2 changesets (bug 1909019) for causing base-toolchains build bustages on Maybe.h. CLOSED TREE
Backed out changeset 6d4968c19bfe (bug 1909019)
Backed out changeset c1c101a0dde5 (bug 1909019)
2024-07-26 22:38:28 +03:00
Kelsey Gilbert
d455fa2c18 Bug 1909019 - Use ParamTraits_TiedFields/_IsEnumCase in WebRenderMessageUtils instead of PlainOldDataSerializer. (partial) r=gw,mccr8,ahale
Differential Revision: https://phabricator.services.mozilla.com/D217508
2024-07-26 16:54:46 +00:00
Kelsey Gilbert
ee4554d100 Bug 1908380 - Check for context loss in WebGLVertexArrayJS::WebGLVertexArrayJS. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D217634
2024-07-24 21:45:34 +00:00
Kelsey Gilbert
ef3160faba Bug 1909372 - Remove WebGLContextAttributes.colorSpace. r=gfx-reviewers,webidl,lsalzman,saschanaz
The WebGL spec never added this, and WebGL expects this to change via
drawingBufferColorSpace, so I don't think we should push for a spec
addition for .colorSpace.

Differential Revision: https://phabricator.services.mozilla.com/D217350
2024-07-23 18:02:41 +00:00
Jamie Nicol
33a638edb7 Bug 1898238 - Use SharedSurface_EGLImage for out-of-process webgl and accelerated canvas on Android. r=sotaro,jgilbert
Adds a pref wegb.enable-egl-image which is true by default. When
enabled, we use EGL images as the preferred texture type for
out-of-process webgl and accelerated canvas on Android. In-process
webgl will never attempt to use EGL images, regardless of the value of
the pref, as we are unable to send EGL images cross-process.

Differential Revision: https://phabricator.services.mozilla.com/D211293
2024-07-22 20:23:39 +00:00
Jamie Nicol
9526c88d05 Bug 1898238 - Don't call TexTypeForWebgl when initializing offscreen canvas. r=aosmond,jgilbert
This is only used if the OffscreenCanvas has a webgl context, in which
case it forwards the tex type to WebGLContext::PresentFrontBuffer(). A
later patch in this series will make TexTypeForWebgl() return a
different value depending on whether the webgl context is in-process
or remote, which is something that cannot be known when the
OffscreenCanvas is initialized. This patch therefore removes the field
from OffscreenCanvas and makes WebGLContext::PresentFrontBuffer() call
TexTypeForWebgl() itself.

Differential Revision: https://phabricator.services.mozilla.com/D211289
2024-07-22 20:23:37 +00:00
Iulian Moraru
724263a29c Backed out 5 changesets (bug 1898238) for causing non unified build bustages on RenderEGLImageTextureHost.cpp. CLOSED TREE
Backed out changeset ae8e94c8f819 (bug 1898238)
Backed out changeset 549abd685d11 (bug 1898238)
Backed out changeset 6359e558d765 (bug 1898238)
Backed out changeset 332c668a15bc (bug 1898238)
Backed out changeset 19fa8d4af66f (bug 1898238)
2024-07-22 20:27:45 +03:00
Jamie Nicol
5ee6cc0f0e Bug 1898238 - Use SharedSurface_EGLImage for out-of-process webgl and accelerated canvas on Android. r=sotaro,jgilbert
Adds a pref wegb.enable-egl-image which is true by default. When
enabled, we use EGL images as the preferred texture type for
out-of-process webgl and accelerated canvas on Android. In-process
webgl will never attempt to use EGL images, regardless of the value of
the pref, as we are unable to send EGL images cross-process.

Differential Revision: https://phabricator.services.mozilla.com/D211293
2024-07-22 16:02:34 +00:00
Jamie Nicol
ae417c018f Bug 1898238 - Don't call TexTypeForWebgl when initializing offscreen canvas. r=aosmond,jgilbert
This is only used if the OffscreenCanvas has a webgl context, in which
case it forwards the tex type to WebGLContext::PresentFrontBuffer(). A
later patch in this series will make TexTypeForWebgl() return a
different value depending on whether the webgl context is in-process
or remote, which is something that cannot be known when the
OffscreenCanvas is initialized. This patch therefore removes the field
from OffscreenCanvas and makes WebGLContext::PresentFrontBuffer() call
TexTypeForWebgl() itself.

Differential Revision: https://phabricator.services.mozilla.com/D211289
2024-07-22 16:02:33 +00:00
Kelsey Gilbert
2fc4d570e3 Bug 1885032 - Support EXT_depth_clamp in webgl. r=gfx-reviewers,webidl,lsalzman,smaug
Differential Revision: https://phabricator.services.mozilla.com/D215713
2024-07-17 21:12:23 +00:00
Cristian Tuns
eaf1eefde7 Backed out 2 changesets (bug 1899874) It is crashing the browser on windows and linux, Bug 1906687. CLOSED TREE
Backed out changeset cd0e7d18bbff (bug 1899874)
Backed out changeset 347c3fe4a18f (bug 1899874)
2024-07-09 17:48:05 -04:00
Kelsey Gilbert
8ee0e704a2 Bug 1892542 - Webgl e.g. createBuffer() made infallible. r=gfx-reviewers,webidl,saschanaz,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D208050
2024-07-08 17:24:12 +00:00
Kelsey Gilbert
800ebc4c42 Bug 1784338 - Clamp webgl.blendColor in no-ext webgl1. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D215672
2024-07-03 20:25:23 +00:00
Tom Ritter
e336c97393 Bug 1899874: Add a privileged forceSoftwareRendering attribute to Canvas Attributes. r=jgilbert,webidl,smaug
willReadFrequently does basically what we want for Canvas2D;
however it won't work on Windows _and_ it doesn't exist for WebGL

So we will just add our own (privileged) attribute we can set

Differential Revision: https://phabricator.services.mozilla.com/D212177
2024-07-03 08:29:51 +00:00
Stanca Serban
81b1ce4a56 Backed out 20 changesets (bug 1900828, bug 1900863, bug 1902359, bug 1901771, bug 1902671, bug 1901291, bug 1902003, bug 1901799, bug 1897271, bug 1901260, bug 1899874, bug 1903609, bug 1902086, bug 1902364) for causing multiple failures. CLOSED TREE
Backed out changeset 93cd1edda657 (bug 1900828)
Backed out changeset 693209b2919f (bug 1899874)
Backed out changeset b73df6e562de (bug 1899874)
Backed out changeset a93ca984ca88 (bug 1903609)
Backed out changeset 8303598ec6b0 (bug 1903609)
Backed out changeset e3a3c98b34fd (bug 1903609)
Backed out changeset 962fe23bb97a (bug 1903609)
Backed out changeset 00f2e924c9f2 (bug 1903609)
Backed out changeset 0ade4bbe618d (bug 1901291)
Backed out changeset a13f96530518 (bug 1901260)
Backed out changeset 510bc857cdf4 (bug 1902671)
Backed out changeset 754801e10b4b (bug 1902364)
Backed out changeset 7dc2bd362cb9 (bug 1902359)
Backed out changeset 502943b3d954 (bug 1902086)
Backed out changeset 1368337eb6d5 (bug 1902086)
Backed out changeset 0add6564e69b (bug 1902003)
Backed out changeset 929d9508ad19 (bug 1901799)
Backed out changeset 5baeea7c14f6 (bug 1901771)
Backed out changeset 8cf0f72c6a98 (bug 1897271)
Backed out changeset f32d78084462 (bug 1900863)
2024-06-25 16:08:06 +03:00
Tom Ritter
939c788e8b Bug 1899874: Add a privileged forceSoftwareRendering attribute to Canvas Attributes. r=jgilbert,webidl,smaug
willReadFrequently does basically what we want for Canvas2D;
however it won't work on Windows _and_ it doesn't exist for WebGL

So we will just add our own (privileged) attribute we can set

Differential Revision: https://phabricator.services.mozilla.com/D212177
2024-06-25 11:53:33 +00:00
Kelsey Gilbert
f72ec6e498 Bug 1885447 - Tonemap/color-manage webgl sdr/wcg output into Display profile as pre-compositor post-process. r=gfx-reviewers,webidl,smaug,ahale
Differential Revision: https://phabricator.services.mozilla.com/D207651
2024-05-06 23:36:51 +00:00
Stanca Serban
8996a6a522 Backed out changeset 995596d4362c (bug 1885447) for causing build bustages in AutoMappable.h. CLOSED TREE 2024-04-23 22:19:00 +03:00
Kelsey Gilbert
7393b7c768 Bug 1885447 - Tonemap/color-manage webgl sdr/wcg output into Display profile as pre-compositor post-process. r=gfx-reviewers,webidl,smaug,ahale
Differential Revision: https://phabricator.services.mozilla.com/D207651
2024-04-23 16:54:05 +00:00
Kelsey Gilbert
d280c37494 Bug 1887335 - ClientWaitSync max-timeout check move to child, remove from parent. r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D206381
2024-04-02 20:36:26 +00:00
Kelsey Gilbert
3590c64ad0 Bug 1887335 - ClientWaitSync warns when forgetting to flush. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D206296
2024-04-02 20:36:26 +00:00
Kelsey Gilbert
4a79a6f495 Bug 1887335 - AutoEnqueueFlush in FenceSync, EnqueueError/Warning. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D206295
2024-04-02 20:36:25 +00:00
Kelsey Gilbert
e4080e620a Bug 1887335 - Poll=4ms for WebGLSync completion, async-notify child. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D206294
2024-04-02 20:36:25 +00:00