Sign in to follow this  

Indexing texture arrays

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

Hi guys

 

I am having a little problem with a loop in my pixel shader

int i = start;
do
{
	i ++;

	if(lt[i] != 0)
	{
		color1 = shaderTextures[i].SampleLevel(SampleType, input.tex, 0)*lt[i];
		//
		//image processing
	}			
}while(i < 8);

When i try to compile i get the error X3512: sampler array index must be a literal expression

for the line where the texture is sampled. Does this mean that I cant use a loop counter variable in the array? How can i get around this so i can prevent textures from being sampled when not necessary without going into a brute force method using a whole string of if/else statements?

Share this post


Link to post
Share on other sites

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