Browse Source

Fixed debug mode assert.
Do not build raycast work items if no worker threads.

Lasse Öörni 14 years ago
parent
commit
0da41425b5
2 changed files with 5 additions and 5 deletions
  1. 4 4
      Engine/Graphics/Octree.cpp
  2. 1 1
      Engine/Graphics/View.cpp

+ 4 - 4
Engine/Graphics/Octree.cpp

@@ -425,14 +425,14 @@ void Octree::GetDrawables(RayOctreeQuery& query) const
     
     query.result_.Clear();
     
-    // If no triangle-level testing, do not thread
-    if (query.level_ < RAY_TRIANGLE)
+    WorkQueue* queue = GetSubsystem<WorkQueue>();
+    
+    // If no worker threads or no triangle-level testing, do not create work items
+    if (!queue->GetNumThreads() || query.level_ < RAY_TRIANGLE)
         GetDrawablesInternal(query);
     else
     {
         // Threaded ray query: first get the drawables
-        WorkQueue* queue = GetSubsystem<WorkQueue>();
-        
         rayQuery_ = &query;
         rayQueryDrawables_.Clear();
         GetDrawablesOnlyInternal(query, rayQueryDrawables_);

+ 1 - 1
Engine/Graphics/View.cpp

@@ -63,7 +63,7 @@ void CheckVisibilityWork(const WorkItem* item, unsigned threadIndex)
     View* view = reinterpret_cast<View*>(item->aux_);
     Drawable** start = reinterpret_cast<Drawable**>(item->start_);
     Drawable** end = reinterpret_cast<Drawable**>(item->end_);
-    Drawable** unculledStart = &view->tempDrawables_[0][view->unculledDrawableStart_];
+    Drawable** unculledStart = &view->tempDrawables_[0][0] + view->unculledDrawableStart_;
     OcclusionBuffer* buffer = view->occlusionBuffer_;
     
     while (start != end)