   Lots of textures in one shader
  I was thinking...Is there a maximum amount of textures that you can load into one shader?So that means having alot of lines like:uniform extern texture gTexture;in one effect.If there is a limit, what's that limit?And wil it significantly influence the performance, if I load lots of textures of say 256^2 instead of one 2048^2?Is so, about how much would that performance impact be? And no, i can't devide the effect into mutiple different effects that will use less textures each :PThanks in advance,TigranBTW, is there a limit of other (uniform extern) variables a shader can have? I know I should keep it to a minimum, but is there a limit (hardware or software)?   
  D3D11 and D3D10: 128 active resources (buffers or textures) per shader stage.D3D9: Varies by hardware, see MaxSimultaneousTextures capability; common value on modern hardware is 8, which is coincidentally the API limit due to fixed texture pipeline having 8 stages.Reading from textures causes data to be transferred from GPU "mass" memory to registers; therefore, the more reads you do, the more pressure you put to the memory bandwidth. The performance characteristics of memory accesses vary wildly between different hardware.Using many textures means many state changes, which can be expensive if:-The system stalls due to said changes-The CPU is already working at full load.For performance, it is best to use large textures that are shared between multiple objects.The only way to assess your app's real-world performance is to profile it with as many hardware configurations as possible; armed with the data you get from profiling, you can perform intelligent optimization to remove the worst bottlenecks of your code. There is no ready-made all-encompassing optimization strategy, since each and every app as well as environment is different on PC.The number of available shader uniforms is directly related to the number of available constant registers on your shader model. D3D10 and D3D11 encapsulate constants in banks (constant buffers) and the memory limits are much greater than in D3D9. On D3D9 hardware, the shader profiles define the minimum constant register counts, but the hardware may have more than that (which can be queried from the caps).[Edited by - Nik02 on May 22, 2010 6:20:01 AM];  MaxSimultaneousTextures is only for the fixed function pipeline.If you use shaders with DX9 the number of textures per pass depends on the shader model.1.1-1.3: 4 textures1.4: 6 textures2.0 – 3.0: 16 textures. ;Quote:Original post by DemirugMaxSimultaneousTextures is only for the fixed function pipeline.I forgot that the limit is different on shaders. Thanks for the correction!   ;  Thanks for the fast replies,My question is answered.   