关于arithmetic instruction slots

(208,15): error X5608: Compiled shader code uses too many arithmetic instruction slots (77). Max. allowed by the target (ps_2_0) is 64.


可以参考:http://msdn.microsoft.com/en-us/library/bb509626%28v=vs.85%29.aspx

我碰到的错误来自ps_2_0,所以选择了Shader Model 2-》ps_2_0 Instructions

ps_2_0 Instructions

This section contains reference information for the pixel shader version 2_0 instructions.

There are several types of pixel shader instructions, as shown in the table. Columns to the right mean the following:

  • Instruction slots - Number of instruction slots used by each instruction.
  • Setup - A pixel shader must have a version instruction and it must be the first instruction.
  • Arithmetic - These instructions provide the mathematical operations in a shader.
  • Texture - These instructions are used to load and sample texture data, and to modify texture coordinates.
  • New - These instructions are new to this version.

Instruction Set

NameDescriptionInstruction slotsSetupArithmeticTextureNew
abs - psAbsolute value1 x x
add - psAdd two vectors1 x  
cmp - psCompare source to 01 x  
crs - psCross product2 x x
dcl_samplerType (sm2, sm3 - ps asm)Declare the texture dimension for a sampler0x  x
dcl - (sm2, sm3 - ps asm)Declare the association between vertex shader output registers and pixel shader input registers.0x  x
def - psDefine constants0x   
dp2add - ps2D dot product and add2 x x
dp3 - ps3D dot product1 x  
dp4 - ps4D dot product1 x  
exp - psFull precision 2x1 x x
frc - psFractional component1 x x
log - psFull precision log2(x)1 x x
lrp - psLinear interpolate2 x  
m3x2 - ps3x2 multiply2 x x
m3x3 - ps3x3 multiply3 x x
m3x4 - ps3x4 multiply4 x x
m4x3 - ps4x3 multiply3 x x
m4x4 - ps4x4 multiply4 x x
mad - psMultiply and add1 x  
max - psMaximum1 x x
min - psMinimum1 x x
mov - psMove1 x  
mul - psMultiply1 x  
nop - psNo operation1 x  
nrm - psNormalize3 x x
pow - psxy3 x x
psVersion0x   
rcp - psReciprocal1 x x
rsq - psReciprocal square root1 x x
sincos - psSine and cosine8 x x
sub - psSubtract1 x  
texkill - psKill pixel render1  x 
texld - ps_2_0 and upSample a texture1  xx
texldb - psTexture sampling with level-of-detail bias from w-component1  xx
texldp - psTexture sampling with projective divide by w-component1  xx

 

Send comments about this topic to Microsoft

Build date: 9/6/2011







http://en.wikipedia.org/wiki/High_Level_Shader_Language

Shader model comparison

[edit] Pixel shader comparison

Pixel shader version1.0 to 1.3[2]1.4[2]2.0[2][3]2.0a[2][3]2.0b[2][3]3.0[2][4]4.0[5]
Dependent texture limit468Unlimited8UnlimitedUnlimited
Texture instruction limit46*232UnlimitedUnlimitedUnlimitedUnlimited
Position registerNoNoNoNoNoYesYes
Instruction slots8+48+432 + 64512512≥ 512≥ 65536
Executed instructions8+46*2+8*232 + 6451251265536Unlimited
Texture indirections444Unlimited4UnlimitedUnlimited
Interpolated registers2 + 82 + 82 + 82 + 82 + 81032
Instruction predicationNoNoNoYesNoYesNo
Index input registersNoNoNoNoNoYesYes
Temp registers2612 to 322232324096
Constant registers8832323222416x4096
Arbitrary swizzlingNoNoNoYesNoYesYes
Gradient instructionsNoNoNoYesNoYesYes
Loop count registerNoNoNoNoNoYesYes
Face register (2-sided lighting)NoNoNoNoNoYesYes
Dynamic flow controlNoNoNoNoNo24Yes
Bitwise OperatorsNoNoNoNoNoNoYes
Native IntegersNoNoNoNoNoNoYes
  • PS 2.0 = DirectX 9.0 original Shader Model 2 specification.
  • PS 2.0a = NVIDIA GeForce FX-optimized model.
  • PS 2.0b = ATI Radeon X700, X800, X850 shader model, DirectX 9.0b.
  • PS 3.0 = Shader Model 3.
  • PS 4.0 = Shader Model 4.

"32 + 64" for Executed Instructions means "32 texture instructions and 64 arithmetic instructions."

[edit] Vertex shader comparison

Vertex shader versionVS 1.1[6]VS 2.0[3][6]VS 2.0a[3][6]VS 3.0[4][6]VS 4.0[5]
# of instruction slots128256256≥ 5124096
Max # of instructions executedUnknown65536655366553665536
Instruction predicationNoNoYesYesYes
Temp registers121213324096
# constant registers≥ 96≥ 256≥ 256≥ 25616x4096
Static Flow Control ???YesYesYesYes
Dynamic Flow ControlNoNoYesYesYes
Dynamic Flow Control DepthNoNo2424Yes
Vertex Texture FetchNoNoNoYesYes
# of texture samplersN/AN/AN/A4128
Geometry instancing supportNoNoNoYesYes
Bitwise OperatorsNoNoNoNoYes
Native IntegersNoNoNoNoYes
  • VS 2.0 = DirectX 9.0 original Shader Model specification.
  • VS 2.0a = NVIDIA GeForce FX-optimized model.
  • VS 3.0 = Shader Model 3.
    • Note that ATI X1000 series cards (e.g. X1900) does not support Vertex Texture Fetch, hence it does not fully comply with the VS 3.0 model. Instead, they offer a feature called "Render to Vertex Buffer (R2VB)" that provides functionality that is a superset of Vertex Texture Fetch.[citation needed]
  • VS 4.0 = Shader Model 4.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值