[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Queries in WebGL 2.0



I think using ES6 Promise would be most reliable way to stop people using aforementioned snippet:

gl.getQueryParameter(query, gl.QUERY_RESULT).then((result) => /* ... */);

But it may be too big of a change and, if I understand correctly, can introduce some problems with coming WebAssembly.

21.04.2016, 15:31, "Gregg Tavares" <khronos@greggman.com>:
> I didn't follow any public discussion of this feature but ... I'm already seeing people posting bad code which will just keep propagating forever
>
> Example from SO
>
> var query = gl.createQuery(); gl.beginQuery(gl.ANY_SAMPLES_PASSED, query); // ... draw a small quad at the specified 3d position ... gl.endQuery(gl.ANY_SAMPLES_PASSED); // some time later, typically a few frames later (after a fraction of a second) gl.getQueryParameter(query, gl.QUERY_RESULT);
>
> Shouldn't the spec require correct behavior? Basically you have to call
>
>      gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE)
>
> and it has to return true or
>
>      gl.getQueryParameter(query, gl.QUERY_RESULT);
>
> should generate INVALID_OPERATION
>
> I suppose that doesn't really fix the issue because people can just put
>
>      gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE)   // ignore result and pray
>      gl.getQueryParameter(query, gl.QUERY_RESULT)
>
> If WebGL 2 is supposed to be an API that works everywhere shouldn't the API at least try to help people not write code that won't actually work everywhere?


--
Kirill Dmitrenko
Yandex Maps Team

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------