Jump to content

  • Log In with Google      Sign In   
  • Create Account


understanding asm shaders


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Anddos   Members   -  Reputation: 485

Like
0Likes
Like

Posted 01 July 2012 - 08:51 PM

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
:)

Sponsor:

#2 MJP   Moderators   -  Reputation: 11038

Like
2Likes
Like

Posted 01 July 2012 - 10:23 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS