Posted on 2009-11-11 13:40
cngamedev 阅读(184)
评论(0) 编辑 收藏 引用 所属分类:
DirectX
Knowledge Base
State Changes
Changing a device state, whether it's a render-state, texture-stage-state, or stream-source, can be very expensive. You should optimize your routines to avoid changing redundant states, and to reduce the number of state changes made. Here is a list of state changes, ordered from most expensive to least expensive:
(Original source)
API Call
|
Avg # of Cycles
|
SetVertexDeclaration
SetFVF
SetVertexShader
SetPixelShader
SPECULARENABLE
SetRenderTarget
SetPixelShaderConstant (1 Constant)
NORMALIZENORMALS
LightEnable
SetStreamSource
LIGHTING
DIFFUSEMATERIALSOURCE
AMBIENTMATERIALSOURCE
COLORVERTEX
SetLight
SetTransform
SetIndices
AMBIENT
SetTexture
SPECULARMATERIALSOURCE
EMISSIVEMATERIALSOURCE
SetMaterial
ZENABLE
WRAP0
MINFILTER
MAGFILTER
SetVertexShaderConstant (1 Constant)
COLOROP
COLORARG2
COLORARG1
CULLMODE
CLIPPING
DrawIndexedPrimitive
ADDRESSV
ADDRESSU
DrawPrimitive
SRGBTEXTURE
STENCILMASK
STENCILZFAIL
STENCILREF
ALPHABLENDENABLE
STENCILFUNC
STENCILWRITEMASK
STENCILFAIL
ZFUNC
ZWRITEENABLE
STENCILENABLE
STENCILPASS
SRCBLEND
TWOSIDEDSTENCILMODE
ALPHATESTENABLE
ALPHAREF
ALPHAFUNC
DESTBLEND
COLORWRITEENABLE
CCW_STENCILFAIL
CCW_STENCILPASS
CCW_STENCILZFAIL
SCISSORTESTENABLE
CCW_STENCILFUNC
SetScissorRect
|
6500 - 11250
6400 - 11200
3000 - 12100
6300 - 7000
1900 - 11200
6000 - 6250
1500 - 9000
2200 - 8100
1300 - 9000
3700 - 5800
1700 - 7500
900 - 8300
900 - 8200
800 - 7800
2200 - 5100
3200 - 3750
900 - 5600
1150 - 4800
2500 - 3100
900 - 4600
900 - 4500
1000 - 3700
700 - 3900
1600 - 2700
1700 - 2500
1700 - 2400
1000 - 2700
1500 - 2100
1300 - 2000
1300 - 1980
500 - 2570
500 - 2550
1200 - 1400
1090 - 1500
1070 - 1500
1050 - 1150
150 - 1500
570 - 700
500 - 800
550 - 700
550 - 700
560 - 680
520 - 700
500 - 750
510 - 700
520 - 680
540 - 650
560 - 630
500 - 685
450 - 590
470 - 525
460 - 530
450 - 540
475 - 510
465 - 515
340 - 560
340 - 545
330 - 495
375 - 440
250 - 480
150 - 340
|
TEXTTEXT
|