From: Henri Verbeet Subject: Re: [PATCH] wined3d: Use query buffer objects for occlusion queries. Message-Id: Date: Fri, 7 Sep 2018 16:51:51 +0430 In-Reply-To: References: <1535933403-23092-1-git-send-email-awesie@gmail.com> On 6 September 2018 at 20:37, Andrew Wesie wrote: > On Thu, Sep 6, 2018 at 9:46 AM, Henri Verbeet 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.