From 9dbd150169cd9528b0ff78f58af613bda41dda4b Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 4 Jun 2007 18:39:33 +0000 Subject: [PATCH] wait for occlusion --- panda/src/dxgsg9/dxOcclusionQueryContext9.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/panda/src/dxgsg9/dxOcclusionQueryContext9.cxx b/panda/src/dxgsg9/dxOcclusionQueryContext9.cxx index e9675ef6b0..50b754f630 100755 --- a/panda/src/dxgsg9/dxOcclusionQueryContext9.cxx +++ b/panda/src/dxgsg9/dxOcclusionQueryContext9.cxx @@ -62,9 +62,7 @@ is_answer_ready() const { //////////////////////////////////////////////////////////////////// void DXOcclusionQueryContext9:: waiting_for_answer() { - DWORD result; - PStatTimer timer(DXGraphicsStateGuardian9::_wait_occlusion_pcollector); - HRESULT hr = _query->GetData(&result, sizeof(result), D3DGETDATA_FLUSH); + get_num_fragments(); } //////////////////////////////////////////////////////////////////// @@ -89,12 +87,16 @@ get_num_fragments() const { { // The answer is not ready; this call will block. PStatTimer timer(DXGraphicsStateGuardian9::_wait_occlusion_pcollector); - hr = _query->GetData(&result, sizeof(result), D3DGETDATA_FLUSH); + while (hr == S_FALSE) { + hr = _query->GetData(&result, sizeof(result), D3DGETDATA_FLUSH); + } } - if (hr != S_OK) { + if (FAILED(hr)) { // Some failure, e.g. devicelost. Return a nonzero value as a // worst-case answer. + dxgsg9_cat.info() + << "occlusion query failed " << D3DERRORSTRING(hr); return 1; }