Sign in to follow this  
Anddos

understanding asm shaders

Recommended Posts

Anddos    588
this is the asm shader

vs_2_x
dcl_position v0 //postion register
dcl_blendweight v1 //were working with animated models
dcl_blendindices v2 //were working with animated models
dcl_normal v3 //normals for lighting
dcl_texcoord v5 //model textures..
mova a0.xyz, v2 //all this code below i dont know what it means, please could someone comment what each line is doing ..
mul r8, v1.x, c8[a0.x]
mul r9, v1.x, c9[a0.x]
mul r10, v1.x, c10[a0.x]
mad r8, v1.y, c8[a0.y], r8
mad r9, v1.y, c9[a0.y], r9
mad r10, v1.y, c10[a0.y], r10
mad r8, v1.z, c8[a0.z], r8
mad r9, v1.z, c9[a0.z], r9
mad r10, v1.z, c10[a0.z], r10
m4x3 r3.xyz, v0, r8
m3x3 r5.xyz, v3, r8
mov r3.w, v0.w
m4x4 oPos, r3, c0
dp4 r0.w, r3, c3
mad oFog, r0.w, c7.x, c7.y
dp3 r5.w, r5, r5
rsq r5.w, r5.w
mul r5.xyz, r5, r5.w
mov r11, c4
dp3 r6.x, c5, r5
max r6.x, c5.w, -r6.x
mad oD0, c6, r6.x, r11
mov oT0.xy, v5

// approximately 31 instruction slots used

Share this post


Link to post
Share on other sites
MJP    19789
The reference for asm shaders is [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb219840%28v=vs.85%29.aspx"]here[/url]. You should read through the relevant sections on vs_2_x for information on registers and instructions.

From a quick glance at that code, it appears to be doing basic vertex skinning. The vertex has 3 indices in v2 that indicate which matrices to use from an array of matrices loaded into shader constants, and 3 weights in v1 that are multiplied with the contribution from each matrix. The shader also rotates normals into world space, transforms the position into projection space, and does a few other standard vertex shader operations.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this