Jump to content
  • Advertisement
Sign in to follow this  

understanding asm shaders

This topic is 2150 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
The reference for asm shaders is here. 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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!