<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 6, 2018 at 9:46 AM, Henri Verbeet <span dir="ltr"><<a href="mailto:hverbeet@gmail.com" target="_blank">hverbeet@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
While at least for occlusion queries this would be a very unlikely<br>
result, it's not in general an invalid query result. I think ideally<br>
we'd write QUERY_RESULT_AVAILABLE to the buffer object as well, but<br>
based on the language in the extension spec, I don't see the<br>
requirement that that should flush lifted. On the other hand, based on<br>
a quick look at the Mesa source, it's not obvious to me that it<br>
actually does flush. Perhaps this is ok in practice, and just an<br>
oversight in the spec language.<br>
<br></blockquote><div><br></div><div>We could do something closer to "Example 2" in ARB_query_buffer_object spec.  At a high level:<br> - after glEndQuery, query on both GL_QUERY_RESULT_AVAILABLE and GL_QUERY_RESULT_NO_WAIT</div><div> - in wined3d_query_buffer_poll, if available flag in the query buffer is set, return the result</div><div> - else: emit WINED3D_CS_OP_QUERY_RESULT<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> to cs thread, return result not available</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> - in wined3d_cs_exec_query_result, query on both <span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">GL_QUERY_RESULT_AVAILABLE and GL_QUERY_RESULT_NO_WAIT</span></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">This avoids the default value problem and also avoids the main thread directly blocking on the cs thread and a GPU flush. It may result in a lot more work on the CPU side, though, compared to the current implementation.</span></span></div></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">I will not be near my testing machine for a while, so I can't easily benchmark and compare the performance.</div></div></div></div></div></div>