Passing shader parameters from a scene node to the renderer

Started by
9 comments, last by ATC 11 years, 6 months ago
+1 for phantom... Very informative and well thought-out post, for which I must thank you...

I'm aware that there is indeed a penalty for virtual calls in both C# and C++. I know about V-tables and the likes, and how it is resolved by the CLR in C#. However, these "hierarchies" of mine are very shallow and the penalty is very small. So small, in fact, that is one of the least costly things the engine does each frame. The engine takes a brief fraction of a second to load up and then it's full speed ahead after the first frame; with everything JIT'ed and ready to rock.

Pretty much everything you say is correct and I'm with you on it. For instance, having to reflect on vertex data each frame would be very inefficient. Therefore when a new "Mesh" instance is created it pre-processes everything for the underlying renderer... when I call, say, Mesh10.CreateFromMeshData( ... ), the HLSL and GLSL input bindings are automatically resolved, stored in an easily-accessible array that can be bound to the device / input assembler immediately. The process of reflecting on vertex data and figuring out how to describe it to the underlying API and GPU happens only when a mesh is loaded/created; or if the application suddenly wants to change to another, completely different rendering API (e.g., a software renderer or something 3rd party).

Thank you again for your post; there is much wisdom in it. I will be over-looking some of our code during this coming week and will try to apply your advice on things!

Regards,

ATC
_______________________________________________________________________________
CEO & Lead Developer at ATCWARE™
"Project X-1"; a 100% managed, platform-agnostic game & simulation engine

Please visit our new forums and help us test them and break the ice!
___________________________________________________________________________________

This topic is closed to new replies.

Advertisement