Jump to content
  • Advertisement
Sign in to follow this  
ZealousEngine

Possible to pass arrays of data to a shader?

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

Im wondering if there is anyway to pass an array of data (maybe 256x256) to a hlsl shader? I know you can declare arrays in the fx file itself, but what is the proper way to go about 'seeding' that array from your app?

Share this post


Link to post
Share on other sites
Advertisement
There is are SetFloatArray, SetMatrixArray, and SetVectorArray methods in the DirectX FX API. Not sure about OpenGL/CGFX.

Though they only take 1D data (though a 1D array of matrices can be considered a 4x4xN 3d array). I've never tried using on to set a 2D array, possibly you may have to get each element row of the array and set it separately. That said 256x256 will likely exceed the number of constant registers on the hardware. Your best bet is probably to pass the data in as a texture.


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!