Sign in to follow this  
mlt

Instruction limit of 128 exceeded

Recommended Posts

When I compile my vertex shader I get the error: (0) : error C6002: Instruction limit of 128 exceeded; 162 instructions needed to compile program 178 lines, 1 errors. It contains two functions that gets called in a loop that runs 3 times. I am writing on a Nvidia 9800 GTX+. Will it help to put each function in a seperate file? Any ideas on how to solve this problem?

Share this post


Link to post
Share on other sites
Coming from a D3D background...

The maximum number of instructions a VS 1.1 shader can have is 128. Your code is presumably longer than that, because your loops will be getting unrolled, and the function calls inlined.

You could move up to VS 2.0, which has a limit of 256 instructions per shader, or make your shader simpler in some other way (Which would speed up execution too).

Share this post


Link to post
Share on other sites
Quote:
Original post by mlt
How do I move to VS 2.0? I thought it was a matter of hardware support?
In D3D (I'm not sure about OpenGL, but I imagine it's similar or the same), you compile a shader for a vertex shader version. You can compile a VS 3.0 shader on a card that can't even do vertex shaders in hardware, but you can only run a VS 3.0 shader on hardware that supports VS 3.0. The same goes for VS 2.0 and VS 1.1.

If your card can't do VS 2.0, then the only option you have is to simplify your shader somehow - it's just too complicated for VS 1.1.

Share this post


Link to post
Share on other sites
Hi.

If you are using GLSL then you do not get to pick the shader model (unlike in the DirectX world, and the GLSL spec requires functionality that really needs SM3 hardware). As you are on a NVidia card, you could run NVemulate and make sure that your advanced hardware features are turned on.

Share this post


Link to post
Share on other sites
Quote:
Original post by HuntsMan
Quote:
Original post by mlt
How do I move to VS 2.0? I thought it was a matter of hardware support?


What shading language are you using?




I am using Cg.

Share this post


Link to post
Share on other sites
Change the Cg profile to fp40/vp40 or gp4fp/gp4vp. Both will make your shader not work on ATi. If ATi support is important, try compiling with Ashli and load somehow the resulting ARB-asm into Cg.

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