Sign in to follow this  

array of texture2d in hlsl, wont work ?

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

in a shader of mine , i am doing shadow mapping ,
and i know its bad to use for loops in shaders , but all my lights are sent in via arrays and looped through , this is because tyhe shader is done so it can expand if need be
for shadow mapping i need to send in Texture2D for the information , hls lwill not allow an array of these.

is there another way around this ?

Share this post


Link to post
Share on other sites
Support for indexing samplers using arrays only came in at Shader Model 4 (D3D10.0). In SM3/D3D9.0c you will have to manually simulate array access using dynamic branches, or move the branching out to CPU side by performing extra passes of the geometry. One other solution is to pack the shadow maps inside a single larger texture and use an indirection map to look up to the proper subrectangle in the atlas (I think nVidia had a demo about this, but I failed to google it now).

Share this post


Link to post
Share on other sites
Sign in to follow this