User:MaxDZ8/Shader model Proto

From Wikipedia, the free encyclopedia

Shader models are functionality sets introduced in the various Direct3D releases. Because the term has seen widespread use and is often cited to final users, using the term to identify a specific hardware class is now commonplace.

This page actually covers only the effects of different shader models on shaders programming but a shader model usually introduces other functionalities as well, such as better precision, or instancing. Providing description of those features is left to a future revision of this document.

More information Version, Instruction slots ...
Shader versions and resource limits
VersionInstruction slotsConstant count
vs 1.196(4)
vs 2.0256(4)
vs 2.a256(4)
vs 3.0(1)(4)
ps 1.1 - ps 1.38 - 128
ps 1.428 (two phases)8
ps 2.09632
ps 2.a(2)32
ps 2.b(2)32
ps 3.0(3)224

(1): D3DCAPS9.MaxVertexShader30InstructionSlots
(2): D3DCAPS9.D3DPSHADERCAPS2_0.NumInstructionSlots
(3): D3DCAPS9.MaxPixelShader30InstructionSlots
(4): D3DCAPS9.MaxVertexShaderConst

Close

Hardware support for shading models

More information Card (chip), Vertex shader ...
Card (chip)Vertex shaderPixel shader
GeForce 3 (NV20)1.11.1
Radeon 8500 up to 9200 (R200)1.11.4
GeForce 4 Ti (NV25)1.11.3
Parhelia2.01.3
Radeon 9500 and later (R3xx)2.02.0
Wildcat VP 101.11.2
GeForce FX (NV30)2.a2.a
GeForce 6xxx (NV4x)3.03.0
Radeon X800 (R4xx)2.02.b (1)

(1): The 2.b pixel shader model is actually a subset of 2.a thus providing less functionality.

Close

Arithmetic instructions

How to read this table: dark gray means not available in this profile.

More information Instruction mnemonic, Description ...
Instruction mnemonicDescriptionUsed slots
Vertex shaderPixel shader
1.1-1.31.42.02.x3.01.1-1.31.42.03.0
addAdd two vector registers1
absAbsolute value1
crsCross product2
dp3, dp4Dot product of 3D or 4D vectors1
dstCompute distance vector (???)1
exp/expp2x, full and partial precision.10/11/1
frcFractional part31
lrpLinear interpolation of values.2
lit???13???
log/logplog2(x), full and partial precision.10/11/1
m3x2/m3x3/m3x4Multiply two 3xn matrices.2/3/4
m4x3/m4x4Multiply two 4xn matrices.3/4
madMultiply first two vectors, then add third one.1
min/maxReturn component-wise min/max vector.1
movMove ??first?? to ??second??1
movaMove float value to address register. 1
mulComponent-wise multiply1
nopNo operation.1
nrmNormalize vector3
powxy3
rcpReciprocal.1
rsqReciprocal SQuare root.1
sincosOptimized computation of both sine and cosine.8
sgeSet if greater or equal than.1
sgnSign3
sltSet if less than.1
subSubtract.1
Close


Flow instructions

More information Instruction mnemonic, Description ...
Instruction mnemonicDescriptionUsed slots
Vertex shaderPixel shader
2.02.x3.01.1-1.31.42.03.0
call"Push IP and jump" to subroutine.2
callnz boolConditional jump to subroutine if boolean register is not zero.3
retReturn from subroutine.1
if boolExecute block if condition is met.3
elseExecute block if condition is not met.1
endifEnd of if/else instructions.1
loopBegin loop instruction block.3
endloopEnd of loop instruction block.2
repBegin rep instruction block2
endrepEnd of rep instruction block.2
Close

Setup instructions

All setup instructions take 0 slots.

More information Instruction mnemonic, Description ...
Instruction mnemonicDescriptionNotes
dcl_usage_inputBind vertex stream to input register.
defDefine constant.
defbDefine boolean constant (for static flow control).Introduced in vs2.0
defiDefine integer constant (for static flow control).Introduced in vs2.0
label???Introduced in vs2.0
vsDeclare profile, must be first instruction.VS only
Close


Vertex shader registers

All registers are four-component wide, unless otherwise noted. RIVEDERE QUESTA TABELLA

More information Register mnemonic, Description ...
Register mnemonicDescriptionCountRead/WriteRelative addressingNotes
1.1In a0Address register14RWNoOnly .x write mask allowed in vs1.x, all 4 comps available on vs2
aLLoop register1RoNoOnly .x write mask allowed in vs1.x, all 4 comps available on vs2
cnFloat constant register>96 (1)RoUse a0.xDefault 0,0,0,0., INF read/ist in vs1.x, 2read/inst in vs2
vnInput register from vertex stream16RoNoDefault 0,0,0,1.
rnTemporary register12RWNoUndefined, will cause error if read before initialization.
Out??????????????????
Close


Pixel shader registers

All registers are four-component wide, unless otherwise noted.

More information Register mnemonic, Description ...
Register mnemonicDescriptionCountRead/WriteDimensionalityNotes
1.1 In??????????????????
Out oPosPosition register1Wo4D
oFogFog density register1Wo1D
oDnColor register2Wo4DoD0 is diffuse color, oD1 is specular.
oTnTexcoord register8Wo4DIndexable as oT[a0.x+n].
Close


http://msdn.microsoft.com/library/default.asp?url?/library/en-us/directx9_c/dx9_graphics_reference_asm.asp

1.1 first released

2.0 static flow control, 4 cmp address reg, new ops, new regs

2.x dyn flow cntr, nesting, more temps, predication, new ops, new regs

3.0 tex lookups (samplers), indexable regs, 32tmps, new ops.


  1. ^ "Programming vertex and pixel shaders" by Wolfgang Engel, ISBN 1-58450-349-1.
  2. ^ Microsoft MSDN, Direct3D reference, the D3DCAPS9 and D3DPSHADERCAPS2_0 structures.

Related Articles

Wikiwand AI