On 6 September 2018 at 20:37, Andrew Wesie awesie@gmail.com wrote:
On Thu, Sep 6, 2018 at 9:46 AM, Henri Verbeet hverbeet@gmail.com wrote:
While at least for occlusion queries this would be a very unlikely result, it's not in general an invalid query result. I think ideally we'd write QUERY_RESULT_AVAILABLE to the buffer object as well, but based on the language in the extension spec, I don't see the requirement that that should flush lifted. On the other hand, based on a quick look at the Mesa source, it's not obvious to me that it actually does flush. Perhaps this is ok in practice, and just an oversight in the spec language.
We could do something closer to "Example 2" in ARB_query_buffer_object spec. At a high level:
- after glEndQuery, query on both GL_QUERY_RESULT_AVAILABLE and
GL_QUERY_RESULT_NO_WAIT
The issue I see with that example is that I think there's a potential race condition there, although it probably won't race in practice because of driver internals. I.e., consider the result of the query becoming available between retrieving QUERY_RESULT_AVAILABLE and QUERY_RESULT_NO_WAIT. On the other hand, if we were to retrieve QUERY_RESULT_AVAILABLE first, the application thread may read it before we retrieve QUERY_RESULT_NO_WAIT. It may still be possible to make it work somehow though.