Sign in to follow this  
Aqua Costa

Render Context design and pipeline management

Recommended Posts

[url="http://www.bitsquid.se/presentations/flexible-rendering-multiple-platforms.pdf"]Bitsquid engine uses something called RenderContexts[/url] (slide 24) that, for what I understand, contains the complete pipeline state (resources, render targets, blend states, etc to be bound and the appropriate draw call), I also read here on GameDev.net a post (I think it was written by Hodgman) saying that the pipeline states should not 'bleed' to the next draw calls (so every render context must know what blending mode it needs, etc).

So I'm wondering if the RenderContext struct should contain variables of all shader resource slots/render targets/etc, because that will most likely result in a waste of memory because no project will need 128 shader resources bound simultaneously...

Or is there a better way to design a RenderContext struct?

Share this post


Link to post
Share on other sites
One way to go about this would be to set up a sort of tag system. Like structure your context as a stream of data where each chunk contains a tag that represents it's usage, then bind it appropriately. For example:

ContextChunk[] =
{
{kContextAlphaTest, 0},
{kContextTextureFilterMag, kLinear},
...
};

The advantage of this is that it's platform agnostic and you can add new context chunks without having the rebuild a library or what not.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this