diff --git a/d912pxy/d912pxy_query_occlusion.cpp b/d912pxy/d912pxy_query_occlusion.cpp index bb18a438..8dd9c9ed 100644 --- a/d912pxy/d912pxy_query_occlusion.cpp +++ b/d912pxy/d912pxy_query_occlusion.cpp @@ -233,6 +233,16 @@ void d912pxy_query_occlusion::FreePendingQueryObjects() void d912pxy_query_occlusion::DeInitOccQueryEmulation() { + //finish outstanding queres so thery are properly freed on exit + d912pxy_query_occlusion_gpu_stack* readStack = &g_gpuStack[!g_writeStack]; + if (readStack->count) + { + for (int i = 0; i != readStack->count; ++i) + readStack->stack[i]->SetQueryResult(0); + + readStack->count = 0; + } + if (!g_occQueryHeap) return;