Jump to content
  • Advertisement
Sign in to follow this  

Indexing texture arrays

This topic is 2180 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;
	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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!