Commit graph

165 commits

Author SHA1 Message Date
Istvan Miklos
4f112b1705 Add Support for WebGL Transormfeedback
Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.15
2019-11-08 15:22:52 +01:00
Mátyás Mustoha
4050b7f9ec Implement the basic WebGL2 buffer data operations
Adds support for `bufferData`, `bufferSubData`, `copyBufferSubData`
and `getBufferSubData`.

Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.3
2019-11-05 11:33:13 +01:00
Patrick Walton
a358bca766 Use surfman for managing GL surfaces
Co-authored-by: Alan Jeffrey <ajeffrey@mozilla.com>
Co-authored-by: Zakor Gyula <gyula.zakor@h-lab.eu>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2019-11-01 08:47:11 -05:00
Josh Matthews
c53680b282 webgl: Lazily clear the canvas right before the first webgl command of the next frame. 2019-10-10 09:57:20 -04:00
Josh Matthews
4d7110aca5 webgl: Clear the drawing buffer when preserveDrawingBuffer is false. 2019-10-09 10:27:47 -04:00
Mátyás Mustoha
26df1962c3 Add WebGLSampler support
Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.13
2019-10-08 16:21:43 +02:00
Istvan Miklos
248545ddda Initial implementation of WebGLSync
This patch adds initial support for WebGLSync.

Note:
There is no test for the isSync, deleteSync and waitSync functions in the `conformance2/sync/sync-webgl-specific.html`.
2019-10-02 12:51:32 +02:00
Mátyás Mustoha
f2e2b3d34b Initial implementation of WebGLQueries
This patch adds initial support for WeGLQueries. Most related WebGL
functions and objects are implemented [1]. What's still missing is
the `EXT_disjoint_timer_query_webgl2` support.

[1]: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12
2019-10-01 12:30:24 +02:00
Josh Matthews
5bd1e86d42 webxr: Use the same texture format as the original GL context's framebuffer when creating an XR GL layer. 2019-09-20 01:28:22 -04:00
Josh Matthews
0d88c13186 webgl: Support vertex array objects on macOS. 2019-09-13 16:20:41 -04:00
Josh Matthews
1cefae7181 Replace use of gleam in webgl with sparkle. 2019-09-11 11:40:04 -04:00
Alan Jeffrey
1e3b08aae8 Fallback to old extensions API if NUM_EXTENSIONS errors 2019-09-03 11:03:45 -05:00
Mátyás Mustoha
736f6859b0 Fix extension querying when using WebGL2
This patch fixes a crash caused by using a deprecated GL call.
Starting with OpenGL 3 (used by WebGL2), the `glGetString(GL_EXTENSIONS)`
call is deprecated, and some drivers produce GL_INVALID_ENUM error.
Querying can be done by checking the number of extensions first,
then getting the extensions one by one.
2019-08-26 15:12:43 +02:00
Josh Matthews
25b20ebfc6
Drop webgl main thread data during shutdown. 2019-07-29 08:15:59 -04:00
Alan Jeffrey
133a17e15c Replace use of callbacks in webxr by channels 2019-07-26 23:36:13 -05:00
Alan Jeffrey
0178fcae4e When using the WebGL external image API, use sync calls if we happen to be on the WebGL thread 2019-07-26 17:39:40 -05:00
Josh Matthews
a2ca3ddbd9 Remove extra webgl message pumping thread. 2019-07-25 23:07:23 -04:00
Josh Matthews
39d13d1fc8 Support running WebGL in its own thread or on the main thread. 2019-07-25 23:05:03 -04:00
Emilio Cobos Álvarez
3d57c22e9c Update euclid.
There are a few canvas2d-related dependencies that haven't updated, but they
only use euclid internally so that's not blocking landing the rest of the
changes.

Given the size of this patch, I think it's useful to get this landed as-is.
2019-07-23 23:09:55 +02:00
Josh Matthews
dbaed5ed92 Make GL/GLES decisions based on the API in use. 2019-07-12 13:36:44 -04:00
bors-servo
df73c71fb1
Auto merge of #23516 - pcwalton:webrenderup, r=pcwalton,jdm
Upgrade WebRender

This is against an old Servo because I can't build current Servo due to compile errors in RNG crates. I verified that it starts up.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #23516
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23516)
<!-- Reviewable:end -->
2019-07-12 08:10:31 -04:00
Manish Goregaokar
c5a0fc56ea Use separate IPC-only locking mechanism when locking from webxr 2019-07-11 11:12:59 -07:00
Patrick Walton
2f9c9cefdb WebRender units are no longer reexported. 2019-07-09 10:50:27 -04:00
Fernando Jiménez Moreno
0da87ad169 Introduce WebrenderExternalImageRegistry 2019-07-04 10:26:48 +02:00
Fernando Jiménez Moreno
ba9cf85fb3 Webrender external image handler demux 2019-07-04 10:26:47 +02:00
Mátyás Mustoha
7f0b820d4e Add initial support for WebGL compressed textures 2019-05-21 16:56:40 -04:00
bors-servo
34a5a824b8
Auto merge of #23000 - jdm:invisible-webgl, r=nox
Make webgl behave better with session history

This prevents the compositor from animating pages that are not actually visible, so pages using webgl do not needlessly impact the performance of the rest of the browser. Additionally, this fixes a problem that was alluded to in [this code](b5228c098b/src/draw_buffer.rs (L282-L285)), causing Servo to delete arbitrary resources when a GC occurred in content that used three.js.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22987 and fix #22977 and fix #20934 and fix #20953 and fix #20930 and fix #20950 and fix #20924
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23000)
<!-- Reviewable:end -->
2019-03-08 10:46:52 -05:00
Josh Matthews
056edbbd15 Ensure that removed contexts are made active before removal. 2019-03-08 09:49:52 -05:00
Josh Matthews
3121f42d52 Remove offscreen_gl_context dependency from canvas_traits and script. 2019-03-07 09:27:36 -05:00
Alan Jeffrey
8ddde7eacc Pass the GL context to the VRDisplay when rendering 2019-02-27 08:57:02 -06:00
Josh Matthews
25a61f3783 Report all messages processed by the webgl thread. 2019-01-31 14:57:38 -05:00
Josh Matthews
878f020013 Ensure that resized GL contexts do not destroy their resources while in use by WR. 2019-01-17 22:44:41 -05:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Manish Goregaokar
5413328be2 Update webrender 2018-11-27 17:33:13 -08:00
bors-servo
c96f07a0b5
Auto merge of #22234 - jdm:android-gl-crash, r=Manishearth
Fix android GL crash

There were two issues, fundamentally:
1. POINT_SPRITE is not supported on GLES, which was causing the GL_INVALID_ENUM error when using any WebGL API.
2. The version check was using the wrong version value to determine if enabling point sprites was necessary.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22162
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22234)
<!-- Reviewable:end -->
2018-11-23 12:38:24 -05:00
Josh Matthews
9c29e139b9 webgl: Don't unnecessarily enable point sprites on GLES. 2018-11-21 14:03:46 -05:00
Anthony Ramine
804d964b7d Send an IpcSharedMemory in tex_image_2d and tex_sub_image_2d
This avoids a copy in the case of textures coming from HTMLImageElement.
2018-11-20 10:14:52 +01:00
Anthony Ramine
cfca906ee2 Call rgba8_byte_swap_colors_inplace on the WebGL thread 2018-11-20 10:14:52 +01:00
Anthony Ramine
87c849c0d6 Move prepare_pixels to the canvas thread
Nothing else uses it in the whole crate graph.
2018-11-20 10:14:51 +01:00
Anthony Ramine
ca62b5c318 Call prepare_pixels on the WebGL thread 2018-11-20 10:14:50 +01:00
Anthony Ramine
2a5539caef Use Size2D in TexImage2D and TexSubImage2D messages 2018-11-20 10:14:49 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Anthony Ramine
1c89ac90b9 Send alignment info directly in TexImage2D and TexSubImage2d messages 2018-11-16 12:39:20 +01:00
Anthony Ramine
65d1b11929 Make TexImage2D and TexSubImage2D struct variants 2018-11-16 12:38:07 +01:00
Anthony Ramine
a5779ad372 Prefix some pixels functions with rgba8_ 2018-11-16 12:37:34 +01:00
Simon Sapin
9f977c5287 Remove useless use crate_name; imports.
A `crate_name::foo` path always works in 2018
2018-11-08 09:29:52 +01:00
Simon Sapin
2012be4a8b cargo fix --edition-idioms 2018-11-08 09:28:00 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00