Leave a comment

HLSL assembly instruction slots for ps_3_0

I keep loosing my link to this page so I thought I would make a copy of it here for my purposes. I’m currently trying to optimize some shaders that use a lot of sincos. As you can see below, this is 8 instruction slots, and it only works on a scalar. And the HLSL sincos requires 3 “preample” instructions just for setup (to clamp the angle to (-π, π).

Keep in mind that these instruction slots are just estimations – the actual number may differ depending on your GPU. But this is what the fxc compiler uses for its guesses.

Instruction Set

Name Description Instruction slots Setup Arithmetic Texture Flow control New
abs – ps Absolute value 1 x
add – ps Add two vectors 1 x
break – ps Break out of a loop…endloop or rep…endrep block 1 x
break_comp – ps Conditionally break out of a loop…endloop or rep…endrep block, with a comparison 3 x
breakp – ps break out of a loop…endloop or rep…endrep block, based on a predicate 3 x
call – ps Call a subroutine 2 x
callnz bool – ps Call a subroutine if a boolean register is not zero 3 x
callnz pred – ps Call a subroutine if a predicate register is not zero 3 x
cmp – ps Compare source to 0 1 x
crs – ps Cross product 2 x
dcl_samplerType (sm2, sm3 – ps asm) Declare the texture dimension for a sampler 0 x
dcl_semantics (sm3 – ps asm) Declare input and output registers 0 x x
def – ps Define constants 0 x
defb – ps Define a Boolean constant 0 x
defi – ps Define an integer constant 0 x
dp2add – ps 2D dot product and add 2 x
dp3 – ps 3D dot product 1 x
dp4 – ps 4D dot product 1 x
dsx – ps Rate of change in the x-direction 2 x
dsy – ps Rate of change in the y direction 2 x
else – ps Begin an else block 1 x
endif – ps End an if…else block 1 x
endloop – ps End a loop 2 x x
endrep – ps End of a repeat block 2 x
exp – ps Full precision 2x 1 x
frc – ps Fractional component 1 x
if bool – ps Begin an if block 3 x
if_comp – ps Begin an if block with a comparison 3 x
if pred – ps Begin an if block with predication 3 x
label – ps Label 0 x
log – ps Full precision log2(x) 1 x
loop – ps Loop 3 x x
lrp – ps Linear interpolate 2 x
m3x2 – ps 3×2 multiply 2 x
m3x3 – ps 3×3 multiply 3 x
m3x4 – ps 3×4 multiply 4 x
m4x3 – ps 4×3 multiply 3 x
m4x4 – ps 4×4 multiply 4 x
mad – ps Multiply and add 1 x
max – ps Maximum 1 x
min – ps Minimum 1 x
mov – ps Move 1 x
mul – ps Multiply 1 x
nop – ps No operation 1 x
nrm – ps Normalize 3 x
pow – ps xy 3 x
ps Version 0 x
rcp – ps Reciprocal 1 x
rep – ps Repeat 3 x
ret – ps End of a subroutine 1 x
rsq – ps Reciprocal square root 1 x
setp_comp Set the predicate register 1 x
sincos – ps Sine and cosine 8 x
sub – ps Subtract 1 x
texkill – ps Kill pixel render 2 x
texld – ps_2_0 and up Sample a texture See note 1 x
texldb – ps Texture sampling with level-of-detail bias from w-component 6 x
texldl – ps Texture sampling with level-of-detail from w-component See note 2 x x
texldd – ps Texture sampling with user-provided gradients 3 x
texldp – ps Texture sampling with projective divide by w-component See note 3 x

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Space Quest Historian

Adventure game blogs, Let's Plays, live streams, and more

Harebrained Schemes

Developer's blog for IceFall Games

kosmonaut's blog

3d GFX and more

Halogenica

Turn up the rez!

bitsquid: development blog

Developer's blog for IceFall Games

Game Development by Sean

Developer's blog for IceFall Games

Lost Garden

Developer's blog for IceFall Games

Memories

Developer's blog for IceFall Games

Casey's Blog

Developer's blog for IceFall Games

Blog

Developer's blog for IceFall Games

Rendering Evolution

Developer's blog for IceFall Games

Simon schreibt.

Developer's blog for IceFall Games

Dev & Techno-phage

Do Computers Dream of Electric Developper?

- Woolfe -

Developer's blog for IceFall Games

Ferrara Fabio

Game & Application Developer, 3D Animator, Composer.

Clone of Duty: Stonehenge

First Person Shooter coming soon to the XBOX 360

Low Tide Productions

Games and other artsy stuff...

BadCorporateLogo

Just another WordPress.com site

Sipty's Writing

Take a look inside the mind of a game developer.

Jonas Kyratzes

Writer, game designer, filmmaker.

%d bloggers like this: