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

Add two functions to query the astc profiles #245

Merged
merged 4 commits into from
May 31, 2023
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
26 changes: 26 additions & 0 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,32 @@ impl Context {
RawRenderingContext::WebGl2(ref gl) => gl.bind_framebuffer(target, Some(framebuffer)),
}
}

// Returns true if the `WEBGL_compressed_texture_astc` extension is enabled and the "ldr"
// profile is supported.
pub fn compressed_texture_astc_supports_ldr_profile(&self) -> bool {
self.extensions
.webgl_compressed_texture_astc
.as_ref()
.map(|ext| {
expenses marked this conversation as resolved.
Show resolved Hide resolved
let profiles = ext.get_supported_profiles().unwrap_or_default();
profiles.includes(&"ldr".into(), 0)
})
.unwrap_or(false)
}

// Returns true if the `WEBGL_compressed_texture_astc` extension is enabled and the "hdr"
// profile is supported.
pub fn compressed_texture_astc_supports_hdr_profile(&self) -> bool {
self.extensions
.webgl_compressed_texture_astc
.as_ref()
.map(|ext| {
let profiles = ext.get_supported_profiles().unwrap_or_default();
profiles.includes(&"hdr".into(), 0)
})
.unwrap_or(false)
}
}

new_key_type! { pub struct WebShaderKey; }
Expand Down