Advertisement Jump to content
Sign in to follow this  
Paul C Skertich

Quick quesiton on constant buffers

This topic is 1250 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Each mesh asset either static or skeletal has different constants, texture samplers, depth stencil states and vertex shaders, pixel shaders and the whole 9 yard.


I created a interface for Mesh which allows opening to StaticMesh, SkeletalMesh, Billboard, EditorPlacementMarker, MeshLight etc..


Maybe I'm over thinking this and I have a cat jumping on my desk annoying the hell out of me.


A billboard is different from static, skeletal mesh and a screen quad - I wouldn't use the same constant buffers over and over again in the shaders. Perhaps the mesh interface will alleviate   most of my issues.


The most common constant buffer like WorldViewProj, View, Proj can stay - for each model uses them.


In general there wouldn't be a huge constant buffer because that would be a waste of space - so I would imagine there would be at least somewhere each constant gets initialized for the particular shader for that particular mesh to be drawn on screen. Right?

Share this post

Link to post
Share on other sites

Every shader will require some set of constants. You need to make sure a buffer with the right values in the right places is bound to all binding points as required by the shader before each draw. Sometimes these bindings can stay put from draw to draw. Often you will need to change them. This could add up to a fairly substantial amount of buffer space.


How you generate these bits is your engine's business. I would recommend trying to copy from where-ever the matrices are computed in to the ubo memory per frame. It's best if you can fill the ubo sequentially. You may need to double buffer the ubos.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!