We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
我们在 WebGL 的实现中使用了 OES_texture_float 扩展进行浮点数纹理的读写。 https://www.khronos.org/registry/webgl/extensions/OES_texture_float/
但是该扩展存在一定兼容性问题,尤其是在移动端 和 Safari 中: http://webglstats.com/webgl/extension/OES_texture_float
经测试:
因此我们需要提供判断方法,或者采用其他兼容方案。
提供一个 isFloatSupported 方法,开发者调用后可以自行决定,例如切换到 CPU 算法: regl-project/regl#487 regl-project/regl@6afda7c
isFloatSupported
另外也可以尝试兼容方案: https://github.com/mikolalysenko/glsl-read-float 在 Shader 中通过 pack 把一个浮点数压缩成 ivec4 渲染到纹理,从纹理中读取数据时进行 unpack
The text was updated successfully, but these errors were encountered:
这个判断应该和具体渲染引擎有关,而且由于 WebGL 具体实现中需要尝试读取浮点纹理,通过是否报错判断,因此需要在引擎初始化完成后。最终决定加在 onInit 回调内:
onInit
const world = new World(canvas, { engineOptions: { supportCompute: true, }, onInit: (engine) => { console.log(engine.isFloatSupported()); }, });
Sorry, something went wrong.
feat: 支持判断 isFloatSupported,便于开发者切换到 CPU 实现 #26
cdaf24f
tfjs 遇到不支持的浏览器例如低版本的 Safari:
WebGL: INVALID_ENUM: readPixels: invalid type
tensorflow/tfjs#287 (comment)
xiaoiver
No branches or pull requests
问题背景
我们在 WebGL 的实现中使用了 OES_texture_float 扩展进行浮点数纹理的读写。
https://www.khronos.org/registry/webgl/extensions/OES_texture_float/
但是该扩展存在一定兼容性问题,尤其是在移动端 和 Safari 中:
http://webglstats.com/webgl/extension/OES_texture_float
经测试:
因此我们需要提供判断方法,或者采用其他兼容方案。
解决方案
提供一个
isFloatSupported
方法,开发者调用后可以自行决定,例如切换到 CPU 算法:regl-project/regl#487
regl-project/regl@6afda7c
另外也可以尝试兼容方案:
https://github.com/mikolalysenko/glsl-read-float
在 Shader 中通过 pack 把一个浮点数压缩成 ivec4 渲染到纹理,从纹理中读取数据时进行 unpack
The text was updated successfully, but these errors were encountered: