xtk renderer3D 的 pick() 在启用 webgl2 的浏览器中产生错误

xtk renderer3D's pick() produce errors in webgl2 enabled browsers

有没有人使用 xtk 和 webgl2 进行 pick() 调用?具体来说 renderer3d 的。

错误:WebGL:drawArrays:检测到反馈回路...renderer3D.js:1977:7

错误:WebGL:readPixels:使用 readPixels 的越界读取已弃用,并且可能会很慢。 renderer3D.js:1445:5

对于第一个错误,反馈循环一直是无效的,是WebGL中的一个错误。来自 WebGL 1 spec section 6.26

6.26 Feedback Loops Between Textures and the Framebuffer

In the OpenGL ES 2.0 API, it's possible to make calls that both write to and read from the same texture, creating a feedback loop. It specifies that where these feedback loops exist, undefined behavior results.

In the WebGL API, such operations that would cause such feedback loops (by the definitions in the OpenGL ES 2.0 spec) will instead generate an INVALID_OPERATION error.

至于第二个错误,它不是有效的 WebGL 错误。哪个浏览器的哪个版本生成该错误?

这是 WebGL 一致性测试,以确保您可以越界读取

https://www.khronos.org/registry/webgl/sdk/tests/conformance/reading/read-pixels-test.html?webglVersion=1&quiet=0

这里有一个片段显示越界读取不会产生错误。

['webgl', 'webgl2'].forEach(check);

function check(version) {
  log(`checking ${version}`);
  
  const gl = document.createElement("canvas").getContext(version);
  if (!gl) {
    log(`${version} not supported`);
    return;
  }
  const pixel = new Uint8Array(4);
  // read off the left bottom
  gl.readPixels(-10, -10, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
  // read off the right top
  gl.readPixels(400, 300, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
  //
  const error = gl.getError();
  log(error ? `error was ${error} reading out of bounds` 
            : "there were no errors reading out of bounds");
}

function log(...args) {
  const elem = document.createElement("pre");
  elem.textContent = [...args].join();
  document.body.appendChild(elem);
}

Maybe file bugs with xtk?