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

Expose WEBGL_compressed_texture_astc.getSupportedProfiles() somehow #244

Closed
expenses opened this issue Apr 3, 2023 · 0 comments
Closed

Comments

@expenses
Copy link
Contributor

expenses commented Apr 3, 2023

This was pointed out to me by jasperrlz (thanks as always!). wgpu doesn't currently have any way to querying what profiles are supported by the ASTC extension (see https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_compressed_texture_astc/getSupportedProfiles) , which is currently LDR, HDR or both. We need a way to expose this information. I've been using this patch for testing:

diff --git a/src/web_sys.rs b/src/web_sys.rs
index 2b15f6c..db7b384 100644
--- a/src/web_sys.rs
+++ b/src/web_sys.rs
@@ -301,6 +301,10 @@ impl Context {
         }
     }

+    pub fn get_compressed_texture_astc_supported_profiles(&self) -> Option<Option<js_sys::Array>> {
+        self.extensions.webgl_compressed_texture_astc.as_ref().map(|ext| ext.get_supported_profiles())
+    }
+
     // These functions are defined in this order:
     //
     // - image_bitmap

but the nicest API might be to have two functions, one for checking LDR and one for HDR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant