Skip to content

Commit

Permalink
Disjoint Timer Query
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored and grovesNL committed Oct 1, 2024
1 parent ba888d1 commit 08257cf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct Extensions {
pub ext_color_buffer_float: Option<web_sys::ExtColorBufferFloat>,
pub ext_color_buffer_half_float: Option<web_sys::ExtColorBufferHalfFloat>,
pub ext_disjoint_timer_query: Option<web_sys::ExtDisjointTimerQuery>,
pub ext_disjoint_timer_query_webgl2: Option<()>,
pub ext_disjoint_timer_query_webgl2: Option<web_sys::ExtDisjointTimerQuery>,
pub ext_float_blend: Option<()>,
pub ext_frag_depth: Option<web_sys::ExtFragDepth>,
pub ext_shader_texture_lod: Option<web_sys::ExtShaderTextureLod>,
Expand Down Expand Up @@ -129,7 +129,7 @@ macro_rules! build_extensions {
&$context,
"EXT_disjoint_timer_query",
),
ext_disjoint_timer_query_webgl2: get_extension_no_object(
ext_disjoint_timer_query_webgl2: get_extension::<web_sys::ExtDisjointTimerQuery>(
&$context,
"EXT_disjoint_timer_query_webgl2",
),
Expand Down Expand Up @@ -5425,8 +5425,13 @@ impl HasContext for Context {
}
}

unsafe fn query_counter(&self, _query: Self::Query, _target: u32) {
panic!("Query counters are not supported");
unsafe fn query_counter(&self, query: Self::Query, target: u32) {
let queries = self.queries.borrow();
let raw_query = queries.get_unchecked(query);
match self.extensions.ext_disjoint_timer_query_webgl2 {
Some(ref ext) => ext.query_counter_ext(raw_query, target),
None => panic!("Query counters are not supported without EXT_disjoint_timer_query_webgl2"),
}
}

unsafe fn get_query_parameter_u32(&self, query: Self::Query, parameter: u32) -> u32 {
Expand Down

0 comments on commit 08257cf

Please sign in to comment.