From 590cea27ba7a51288b81dad3de6ae44e45f0356f Mon Sep 17 00:00:00 2001 From: Speykious Date: Tue, 16 Jul 2024 12:58:05 +0200 Subject: [PATCH] Fix WASM crash caused by unsupported tex params --- inox2d-opengl/src/texture.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inox2d-opengl/src/texture.rs b/inox2d-opengl/src/texture.rs index 090b186..ba286cd 100644 --- a/inox2d-opengl/src/texture.rs +++ b/inox2d-opengl/src/texture.rs @@ -28,7 +28,11 @@ impl Texture { gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_MAG_FILTER, glow::LINEAR as i32); gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_WRAP_S, glow::CLAMP_TO_BORDER as i32); gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_WRAP_T, glow::CLAMP_TO_BORDER as i32); + + // Texture parameters for f32 slices are not supported on WASM yet. + #[cfg(not(target_arch = "wasm32"))] gl.tex_parameter_f32_slice(glow::TEXTURE_2D, glow::TEXTURE_BORDER_COLOR, &[0.0; 4]); + gl.tex_image_2d( glow::TEXTURE_2D, 0,