Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disjoint Timer Query #307

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -5413,8 +5413,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
Loading