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

Quick quesiton on constant buffers

This topic is 1071 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
Advertisement

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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!