grovesNL/glow

Expose `WEBGL_compressed_texture_astc.getSupportedProfiles()` somehow

expenses opened this issue · 0 comments

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.