Sign in to follow this  
Naruto-kun

Indexing texture arrays

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

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