   GLSL Compiler optimisations.
  HiSince the other (proprietary)languages have different levels of compiler optimisation I looked into finding some for GLSL.I found the following for Nvidias compiler:#pragma optionNV(fastmath on)#pragma optionNV(fastprecision on)#pragma optionNV(ifcvt none)#pragma optionNV(inline all)#pragma optionNV(strict on)#pragma optionNV(unroll all)The speed up on some of my more complex shaders was profound. I had a ssao pass hitting a bottleneck and bringing my framerate down to 30fps, with the compiler optimisations alone I managed to get to get 60fps!Are there also Ati specific pragmas somewhere or some generic GLSL ones coming in with opengl4? I don't have a Ati card to test so maybe they might optimise automatically? I don't particularly want to make an Nvidia graphics card a requirement of my higher graphics settings. :p-Si   
  I'm not aware of anything like that for ATI (thought my knowledge is limited). You might want to check their site for some kind of developer center, I believe NV has a lot of stuff like this on their website.You might want to explore your shader a little more and try to find out why you're getting such a difference. If it is because of loop unrolling, then just try to unroll it yourself and maybe you will get the speedup on both platforms. I don't know if you'll be able to work out what the compiler is doing, but you may get lucky.I don't know if you were joking about making nvidia a requirement, but you should just itemitize your settings and let players select what they want to use. If their card can't run the feature at an acceptable framerate, then they can turn it off.   ;Quote:Original post by karwostsI'm not aware of anything like that for ATI (thought my knowledge is limited). You might want to check their site for some kind of developer center, I believe NV has a lot of stuff like this on their website.Yeah, but I couldn't dig up much for this. These pragmas are straight out of their CG compilers documentation. (The GLSL compiler was just converting into CG and then compiling for the hardware)I had a look at Ati's stuff. The compiler does apparently optimise and unroll, but I have no idea to what extent. I'm also doubting that it will change the fp precision like this pragmas can.Annoyingly all my searches now have this thread at the top!Quote:You might want to explore your shader a little more and try to find out why you're getting such a difference. If it is because of loop unrolling, then just try to unroll it yourself and maybe you will get the speedup on both platforms. I don't know if you'll be able to work out what the compiler is doing, but you may get lucky.Oh indeed. The precision and unrolling are the main gains here. But the issue is I want to keep my code readable and self documenting. I can butcher it for the gains, but then fixing it/tweaking at later points will become more painful. I'm rapidly prototyping things so don't want to waste time with premature hand optimisation.Quote:I don't know if you were joking about making nvidia a requirement, but you should just itemitize your settings and let players select what they want to use. If their card can't run the feature at an acceptable framerate, then they can turn it off.Lol yeah. I will most likely have a full range of settings for the user and an autodectect system that runs some profiling on cpu, memory, vertex shaders, pixel shaders, texture sampling and gpu memory.[Edited by - Simon_Roth on May 21, 2010 6:22:52 AM]