Sign in to follow this  

Possible to pass arrays of data to a shader?

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

This topic is 4166 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.

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