Browse Source

wait for occlusion

David Rose 18 years ago
parent
commit
9dbd150169
1 changed files with 7 additions and 5 deletions
  1. 7 5
      panda/src/dxgsg9/dxOcclusionQueryContext9.cxx

+ 7 - 5
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;
   }