It is currently Mon Jun 26, 2017 10:44 am

All times are UTC - 5 hours




 Page 1 of 1 [ 4 posts ] 
Author Message
 Post subject: Shader VMK 53 - Debug BatchManager
PostPosted: Mon Sep 15, 2014 5:17 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
The Settings class is updated in this video so that we have a way to mark when we want to debug render calls. The BatchManager and Batch classes are then updated to output information to the console window.


Offline
 Profile  
 
 Post subject: Re: Shader VMK 53 - Debug BatchManager
PostPosted: Mon Nov 10, 2014 9:18 am 

Joined: Mon Mar 24, 2014 2:25 pm
Posts: 69
Good morning, I'm running into some issues with the priority_queue system. While emptying all batches, the queue is re-ordering itself when completing a Queue.top() and Queue.pop() which doesn't make sense after the queue is built.

While stepping through this loop, I took two pictures of the queue's contents. First one shows the two Batch3D at the top of the queue. But after popping the first Batch3D a Batch2D gets re-ordered to the top. Been looking at this error for awhile now and can't figure out the bug. Any help would be greatly appreciated.

while (!Queue.empty())
   {
      FBatch* Batch = Queue.top();
      Batch->Render();
      Queue.pop();
   }


Start of loop to empty batches (Two Batch3D at top):
Image

After first Batch3D pop (Batch2D moves to top over remaining Batch3D):
Image


Offline
 Profile  
 
 Post subject: Re: Shader VMK 53 - Debug BatchManager
PostPosted: Mon Nov 10, 2014 10:21 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
After the pop call is made, the queue is once again "sorted". The sorting code uses the CompareBatch functor which only compares the batch priority values. Since all your priority values are equal to zero the result you see is completely valid. You do not get a guarantee from the queue that the order of items will stay the same as they were before the pop.

If you want to enforce that the all your Batch3D come before Batch2D objects then you'll need to update the CompareBatch code accordingly to enforce this ordering.


Offline
 Profile  
 
 Post subject: Re: Shader VMK 53 - Debug BatchManager
PostPosted: Mon Nov 10, 2014 2:54 pm 

Joined: Mon Mar 24, 2014 2:25 pm
Posts: 69
Ahh thanks for the follow-up Marek. I guess I blanked that the priority_queue is sorted after each call. I've went ahead and implemented priority for certain batches.

Thanks again,

Mebourne


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron