Sign in to follow this  
freeworld

need some advice on passing parameters to shaders

Recommended Posts

freeworld    341
Currently my render works like so (keep in my it's 2d so it doesn't need to be overly complex), it stores a list of draw calls that contains information about textures to be used, shaders to be used, where to place them and how to place them onto the screen. I really haven't had the need to pass individual information to the shaders, yet other than screen size and textures size, but I want to start focusing more on shaders, so I need to start being able to pass information to them without hard codeding what get's passed to them. So I was thinking of including this struct along with my draw call struct { int id; vector< float > values; vector< string > names; } The reason I included an id in the struct is for sorting and batching purposes, every sprite added with the same parameters, should get batched together. but I would think haveing to match even just 12 values for 2000 sprites every frame would bog things down a little. The way I would be passing the data is using the effect files interface effect->SetFloat(name, value); Is that a bad idea? or is there a better way? It's late were I am and just got done with a bunch a school work so sorry if it sounded light just ramblings.

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