aboutsummaryrefslogtreecommitdiffstats
path: root/components/canvas/webgl_thread.rs
diff options
context:
space:
mode:
authorMátyás Mustoha <matyas.mustoha@h-lab.eu>2019-09-09 11:21:46 +0200
committerMátyás Mustoha <matyas.mustoha@h-lab.eu>2019-10-01 12:30:24 +0200
commitf2e2b3d34b5ed1afa2b937eedee4908cd5d07a05 (patch)
tree58c6677d4c3541ad5cb5e95d9b1d308c3cf2f6c1 /components/canvas/webgl_thread.rs
parent402db83b2b19f33240b0db4cf07e0c9d056b1786 (diff)
downloadservo-f2e2b3d34b5ed1afa2b937eedee4908cd5d07a05.tar.gz
servo-f2e2b3d34b5ed1afa2b937eedee4908cd5d07a05.zip
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
Diffstat (limited to 'components/canvas/webgl_thread.rs')
-rw-r--r--components/canvas/webgl_thread.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs
index c9007515ae4..6fa60d3d7c3 100644
--- a/components/canvas/webgl_thread.rs
+++ b/components/canvas/webgl_thread.rs
@@ -1593,6 +1593,23 @@ impl WebGLImpl {
depth,
stencil,
} => Self::initialize_framebuffer(ctx.gl(), state, color, depth, stencil),
+ WebGLCommand::BeginQuery(target, query_id) => {
+ ctx.gl().begin_query(target, query_id.get());
+ },
+ WebGLCommand::EndQuery(target) => {
+ ctx.gl().end_query(target);
+ },
+ WebGLCommand::DeleteQuery(query_id) => {
+ ctx.gl().delete_queries(&[query_id.get()]);
+ },
+ WebGLCommand::GenerateQuery(ref sender) => {
+ let id = ctx.gl().gen_queries(1)[0];
+ sender.send(unsafe { WebGLQueryId::new(id) }).unwrap()
+ },
+ WebGLCommand::GetQueryState(ref sender, query_id, pname) => {
+ let value = ctx.gl().get_query_object_uiv(query_id.get(), pname);
+ sender.send(value).unwrap()
+ },
}
// TODO: update test expectations in order to enable debug assertions