This project is read-only.

Is passing the device context faster than storing it?

Jan 11, 2014 at 1:29 AM
In the pipeline stage classes in the method ApplyDesired you pass a pointer of the owning pipeline's context.Would having a pointer of the pipeline(or the context) stored inside the stage object have better performance?I mean I realize we're talking about nanoseconds here, maybe then it's more of a design question
Jan 13, 2014 at 4:47 PM
I didn't use performance as a consideration when designing that particular feature. In general it is probably not possible to know which method is faster unless you profiled it, and like you already mentioned, any difference is likely to be very minor compared to other things...

The primary reason I passed it in is that I was considering having the stages be available to other objects which may or may not own a context itself. In addition, for handling multi-threaded rendering I wanted to be able to swap in and out device contexts easily for deferred rendering.

In the next iteration of the engine, I am currently including the context with the state just to simplify the interface some. That may or may not stay the same way in the future, but for now that is the direction I'm heading in.