Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In my rendering system each renderable object implements the following interface (at minimum):

interface IRenderableComponent
{
  void CreateRenderOperations(RenderOperationList);
}

Render operations implement the following interface.

interface IRenderOperation
{
  RenderPasses RenderPass; // Bit mask field for passes it is included in.
  bool IntersectsWith(CameraBounds);
  void Apply(RenderContext);
}

The idea is that the RenderContext will traverse the scene graph and ask each node for its render operations - nodes would take this opportunity to calculate as much as possible before handing off their render operations (e.g. calculate the final world matrix).

Each pass (currently, shadow casting, shadowed, post-shadow) is then given the collection and can use it to render the scene or portions of it (e.g. taking shadow mapping as an example it would be used to render the scene from the perspective of a spotlight). A side-effect of this is that the entire scene does need to be dumped to the list.

The collection is currently implemented using a skip list; where each 'list' in the skip list represents a render pass - this allows me to quickly enumerate possible operations in the current pass (after profiling my original implementation I found I was spending quite some time iterating over every single operation). However, because a skip list is a linked list I need to instantiate a huge amount of Node objects and this is adding pressure to the garbage collector (where a clean list is nice because you can keep the allocated array and just zero it).

Do you have any thoughts on a better structure to hold this information; or alternatively a way to implement a skip list in a more memory-friendly fashion?

This is C# (which is irrelevant) as well as 2D (also irrelevant).

share|improve this question
1  
I'm a bit confused why you don't just have N lists for N render passes then? Why do you need the complexity of a skip list? – Josh Petrie Oct 21 '11 at 15:39
@JoshPetrie true. I'll have a go at and see how it performs. – Jonathan Dickinson Oct 22 '11 at 8:06

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.