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
This commit is contained in:
Mátyás Mustoha 2019-09-09 11:21:46 +02:00
parent 402db83b2b
commit f2e2b3d34b
12 changed files with 542 additions and 165 deletions

View file

@ -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