Torque 3D Beta 3 Bug: running out of arithmetic instruction slots for terrain shaders
by Stephane Conde · in Torque 3D Professional · 07/12/2009 (1:34 am) · 9 replies
I am getting the following errors when running the Warrior Camp mission:
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/1f705b4eb49cb113_P.hlsl(222,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (131). Max. allowed by the target (ps_2_0) is 64.
(1,1): error X5609: Compiled shader code uses too many instruction slots (140). Max. allowed by the target (ps_2_0) is 96.
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/ba840826411a15e8_P.hlsl(186,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (77). Max. allowed by the target (ps_2_0) is 64.
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/3f477450a726d566_P.hlsl(198,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (95). Max. allowed by the target (ps_2_0) is 64.
(1,1): error X5609: Compiled shader code uses too many instruction slots (102). Max. allowed by the target (ps_2_0) is 96.
Mapping string: LocalClientConnection to index: 30
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/3f477450a726d566_P.hlsl(198,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (95). Max. allowed by the target (ps_2_0) is 64.
(1,1): error X5609: Compiled shader code uses too many instruction slots (102). Max. allowed by the target (ps_2_0) is 96.
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/51cba227319b3d09_P.hlsl(210,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (113). Max. allowed by the target (ps_2_0) is 64.
(1,1): error X5609: Compiled shader code uses too many instruction slots (121). Max. allowed by the target (ps_2_0) is 96.
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/ba840826411a15e8_P.hlsl(186,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (77). Max. allowed by the target (ps_2_0) is 64.
As far as I can see, these errors are for the generated terrain shaders.
As you can see in the following screenshot, I am missing certain detail textures on the terrain. I suspect the above error is related to the missing detail textures.

I am using an ATI Radeon X1250 on-board graphics card with 700MB of VRAM allocated to it from main memory.
I do not get these erros in Beta 2 (detail textures also all show up in Beta 2).
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/1f705b4eb49cb113_P.hlsl(222,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (131). Max. allowed by the target (ps_2_0) is 64.
(1,1): error X5609: Compiled shader code uses too many instruction slots (140). Max. allowed by the target (ps_2_0) is 96.
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/ba840826411a15e8_P.hlsl(186,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (77). Max. allowed by the target (ps_2_0) is 64.
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/3f477450a726d566_P.hlsl(198,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (95). Max. allowed by the target (ps_2_0) is 64.
(1,1): error X5609: Compiled shader code uses too many instruction slots (102). Max. allowed by the target (ps_2_0) is 96.
Mapping string: LocalClientConnection to index: 30
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/3f477450a726d566_P.hlsl(198,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (95). Max. allowed by the target (ps_2_0) is 64.
(1,1): error X5609: Compiled shader code uses too many instruction slots (102). Max. allowed by the target (ps_2_0) is 96.
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/51cba227319b3d09_P.hlsl(210,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (113). Max. allowed by the target (ps_2_0) is 64.
(1,1): error X5609: Compiled shader code uses too many instruction slots (121). Max. allowed by the target (ps_2_0) is 96.
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
shadergen:/ba840826411a15e8_P.hlsl(186,16): error X5608: Compiled shader code uses too many arithmetic instruction slots (77). Max. allowed by the target (ps_2_0) is 64.
As far as I can see, these errors are for the generated terrain shaders.
As you can see in the following screenshot, I am missing certain detail textures on the terrain. I suspect the above error is related to the missing detail textures.

I am using an ATI Radeon X1250 on-board graphics card with 700MB of VRAM allocated to it from main memory.
I do not get these erros in Beta 2 (detail textures also all show up in Beta 2).
About the author
Recent Threads
#2
What is the number you get there?
07/12/2009 (4:13 pm)
Oh... if you look in the console.log you'll see a line like this...Quote:Pix version detected: XX.XX
What is the number you get there?
#3
07/12/2009 (4:37 pm)
@Tom: They're different errors. 64 is just arithmetic instructions, 96 is all instructions (arithmetic + texture lookup, etc.) The terrain shaders appear to be blowing past both limits, e.g. 131 arithmetic instructions and 140 total instructions.
#4
In this case the terrain's use of ShaderGen would have it split up those shaders that fail to compile into 2 or more passes. I see no simple and accurate way to know ahead of time if the shader will fail to compile because of instruction limits... we just have to try it and fallback. I have code in there to disable the error spew, but i left it on during the beta and was planning to disable it before RC1.
In this case there isn't a real error... when a real failure to generate the terrain shader occurs you would get...
Still Stephane is hitting some sort of bug as it seems he is missing some detail texturing.
@Stephane - I assume that is the WarriorCamp mission completely unaltered?
07/12/2009 (5:53 pm)
@Alex - Ah... yea... that makese sense. In this case the terrain's use of ShaderGen would have it split up those shaders that fail to compile into 2 or more passes. I see no simple and accurate way to know ahead of time if the shader will fail to compile because of instruction limits... we just have to try it and fallback. I have code in there to disable the error spew, but i left it on during the beta and was planning to disable it before RC1.
In this case there isn't a real error... when a real failure to generate the terrain shader occurs you would get...
Quote:TerrainCellMaterial::init - Failed to create pass!
Still Stephane is hitting some sort of bug as it seems he is missing some detail texturing.
@Stephane - I assume that is the WarriorCamp mission completely unaltered?
#5
Here is an excerpt from the console.log running in a completely unaltered WarriorCamp mission:
I first noticed the missing detail texturing in my own project that is a mish-mash of TGE, TGEA and T3D and just figured it was something I had done until I noticed the same issue in a vanilla version of Beta 3 T3D WarriorCamp.
Let me know if there's anything else I can do to help sort this one out.
07/13/2009 (12:04 am)
Thanks for the quick replies. Following are some answers to your questions...Here is an excerpt from the console.log running in a completely unaltered WarriorCamp mission:
Quote:
DirectX 9 version - 9.0c
Attempting to create GFX device: ATI Radeon X1200 Series (D3D9)
GFXD3D9EnumTranslate: Unassigned value in GFXD3D9TextureFormat: 11
GFXD3D9EnumTranslate: Unassigned value in GFXD3D9TextureFormat: 19
Device created, setting adapter and enumerating modes
GFXD3D9Device - using 'd3dx9_41.dll' for dynamic linking.
Cur. D3DDevice ref count=1
Pix version detected: 2.000000
Vert version detected: 2.000000
Maximum number of simultaneous samplers: 16
Hardware occlusion query detected: Yes
WMIVideoInfo: DxDiag initialized
Initializing GFXCardProfiler (D3D9)
o Chipset : 'ATI Technologies Inc.'
o Card : 'Radeon X1200'
o Version : '6.14.0010.6925'
- Scanning card capabilities...
GFXCardProfiler (D3D9) - Setting capability 'autoMipMapLevel' to 1.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureWidth' to 2048.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureHeight' to 2048.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureSize' to 2048.
GFXCardProfiler (D3D9) - Setting capability 'lerpDetailBlend' to 1.
GFXCardProfiler (D3D9) - Setting capability 'fourStageDetailBlend' to 1.
- Loading card profiles...
- Loaded card profile core/profile/D3D9.cs
- Loaded card profile core/profile/D3D9.ATITechnologiesInc.cs
- No card profile core/profile/D3D9.ATITechnologiesInc.RadeonX1200.cs exists
- No card profile core/profile/D3D9.ATITechnologiesInc.RadeonX1200.61400106925.cs exists
Texture Manager
- Approx. Available VRAM: 644.00 MB
- Threshold VRAM: 64 MB
- Quality mode: high
I first noticed the missing detail texturing in my own project that is a mish-mash of TGE, TGEA and T3D and just figured it was something I had done until I noticed the same issue in a vanilla version of Beta 3 T3D WarriorCamp.
Let me know if there's anything else I can do to help sort this one out.
#6
I hope the issue can be found (be it T3D or ATI)
07/13/2009 (2:27 am)
Interesting "behavior" actuallyI hope the issue can be found (be it T3D or ATI)
#8
07/30/2009 (11:30 pm)
The issue of missing detail textures on terrain has been resolved. Please see the following thread for a fix: www.garagegames.com/community/forums/viewthread/95415/1.
#9
This issue still remains in 1.1beta
Graphic cards using pixel shader 2.0 continue to fail if pixel specular is turned on (1).
"FAIL: An undetermined error occurred (80004005)
C:/Torque/Torque 3D 2009 Pro 1.1 Beta 1/My Projects/New Project/game/shaders/procedural/9f86c46ff260fc71_P.hlsl(74,12): error X5608: Compiled shader code uses too many arithmetic instruction slots (74). Max. allowed by the target (ps_2_0) is 64."
The following happens when running with card profile:
Attempting to create GFX device: ATI Radeon Xpress 1150 (D3D9)
Device created, setting adapter and enumerating modes
Cur. D3DDevice ref count=1
Pix version detected: 2.000000
Vert version detected: 2.000000
Maximum number of simultaneous samplers: 16
Number of simultaneous render targets: 4
Hardware occlusion query detected: Yes
Using Direct3D9Ex: No
WMIVideoInfo: DxDiag initialized
Initializing GFXCardProfiler (D3D9)
o Chipset : 'ATI Technologies Inc.'
o Card : 'Radeon Xpress 1150 '
o Version : '7.14.0010.0449'
- Scanning card capabilities...
GFXCardProfiler (D3D9) - Setting capability 'autoMipMapLevel' to 1.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureWidth' to 2048.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureHeight' to 2048.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureSize' to 2048.
GFXCardProfiler (D3D9) - Setting capability 'lerpDetailBlend' to 1.
GFXCardProfiler (D3D9) - Setting capability 'fourStageDetailBlend' to 1.
03/10/2010 (12:51 pm)
what about for not terrain objects with specular maps?This issue still remains in 1.1beta
Graphic cards using pixel shader 2.0 continue to fail if pixel specular is turned on (1).
"FAIL: An undetermined error occurred (80004005)
C:/Torque/Torque 3D 2009 Pro 1.1 Beta 1/My Projects/New Project/game/shaders/procedural/9f86c46ff260fc71_P.hlsl(74,12): error X5608: Compiled shader code uses too many arithmetic instruction slots (74). Max. allowed by the target (ps_2_0) is 64."
The following happens when running with card profile:
Attempting to create GFX device: ATI Radeon Xpress 1150 (D3D9)
Device created, setting adapter and enumerating modes
Cur. D3DDevice ref count=1
Pix version detected: 2.000000
Vert version detected: 2.000000
Maximum number of simultaneous samplers: 16
Number of simultaneous render targets: 4
Hardware occlusion query detected: Yes
Using Direct3D9Ex: No
WMIVideoInfo: DxDiag initialized
Initializing GFXCardProfiler (D3D9)
o Chipset : 'ATI Technologies Inc.'
o Card : 'Radeon Xpress 1150 '
o Version : '7.14.0010.0449'
- Scanning card capabilities...
GFXCardProfiler (D3D9) - Setting capability 'autoMipMapLevel' to 1.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureWidth' to 2048.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureHeight' to 2048.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureSize' to 2048.
GFXCardProfiler (D3D9) - Setting capability 'lerpDetailBlend' to 1.
GFXCardProfiler (D3D9) - Setting capability 'fourStageDetailBlend' to 1.
Associate Tom Spilman
Sickhead Games
Whats interesting there is that your card is reporting both...
... from my research your card can do ps_2_x which would mean the 96 instruction limit is the correct one. So why is it quoting us the 64 limit when the instruction count is under 96?
I'll do some poking around in the code and see what i can find.
I would suggest you ensure you have the latest video drivers for that card.