Jump to content
  • Advertisement
Sign in to follow this  

need some advice on passing parameters to shaders

This topic is 3052 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

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!