From e19b529aa61f2a4b786af8aaa15fc817fc74b373 Mon Sep 17 00:00:00 2001 From: icculus Date: Sat, 9 Feb 2008 18:39:45 -0500 Subject: [PATCH] [svn] Test cases... --HG-- branch : trunk --- tests/1.vsa | Bin 0 -> 60 bytes tests/1.vsh | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/2.vsa | Bin 0 -> 948 bytes tests/2.vsh | 30 +++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 tests/1.vsa create mode 100644 tests/1.vsh create mode 100644 tests/2.vsa create mode 100644 tests/2.vsh diff --git a/tests/1.vsa b/tests/1.vsa new file mode 100644 index 0000000000000000000000000000000000000000..4c53a7f7ea480fa24638b2bff2f65a5b6ba37766 GIT binary patch literal 60 zcmZQz`uAU+fq{vEfuVtcfqw#s%>`sL0@)%A49q~W0}KpLCIImQMzA{m3yeVi|NjgO E07aGzz5oCK literal 0 HcmV?d00001 diff --git a/tests/1.vsh b/tests/1.vsh new file mode 100644 index 00000000..cb0aaffc --- /dev/null +++ b/tests/1.vsh @@ -0,0 +1,109 @@ +vs_3_sw + def c3056, 1, 2, 3, 4 + +dcl_position v0 +dcl_normal v1 +dcl_normal1 v3 + +dcl_color4 o3.x +dcl_texcoord3 o3.yz +dcl_fog o3.w +dcl_tangent o4.xyz +dcl_position o7.xyzw +dcl_psize o6 + +#define oPos o7 +#define oD0 o3 + +def c76, -10.0e5, 2.0e4, 3.3e2, 4.4 +def c15, 1, 2, 3, 4 +defi i1, 1, 2, 3,0 +defb b11, true +defb b12, false + +if_le v0.x, v1.y +nop +else +nop +endif + +mova a0.yw, v0.argb +loop aL, i1 +nop +break_le v1.x, r0.y +breakp !p0.y +nop +endloop + +; Decompress position +mov r0.x, v0.x +mov r0.y, c4.w ; 1 +mov r0.z, v0.y +mov r0.w, c4.w ; 1 + +setp_ge p0.yz, v1, v1 + +callnz l1, b11 +callnz l1, !p0.w + + +if !p0.z +m3x2 r0.xy, r1, c0 ;which will be expanded to: +else +nop +endif + +call l1 + +; Debug code [start] +ret +label l1 +m3x2 r0.xy, r1, c0 ;which will be expanded to: +mov r0, r0.xz +; Debug code [end] + +; Compute theta from distance and time +mov r4.xz, r0 ; xz +mov r4.y, c4.y ; y = 0 +dp3 r4.x, r4, r4 ; d2 +rsq r4.x, r4.x +rcp r4.x, r4.x ; d +mul r4.xyz, r4, c4.x ; scale by time + +; Clamp theta to -pi..pi +add r4.x, r4.x, c7.x +mul r4.x, r4.x, c7.y +frc r4.xy, r4.x +mul r4.x, r4.x, c7.z +add r4.x, r4.x,-c7.x + +; Compute first 4 values in sin and cos series +mov r5.x, c4.w ; d^0 +mov r4.x, r4.x ; d^1 +mul r5.y, r4.x, r4.x ; d^2 +mul r4.y, r4.x, r5.y ; d^3 +mul r5.z, r5.y, r5.y ; d^4 +mul r4.z, r4.x, r5.z ; d^5 +mul r5.w, r5.y, r5.z ; d^6 +mul r4.w, r4.x, r5.w ; d^7 + +mul r4, r4, c10 ; sin +dp4 r4.x, r4, c4.w + +mul r5, r5, c11 ; cos +dp4 r5.x, r5, c4.w + +; Set color +add r5.x, -r5.x, c4.w ; + 1.0 +mul oD0, r5.x, c4.z ; * 0.5 + +; Scale height +mul r0.y, r4.x, c7.w + +; Transform position +dp4 oPos.x, r0, c0 +dp4 oPos.y, r0, c1 +dp4 oPos.z, r0, c2 +dp4 oPos.w, r0, c3 + +ret \ No newline at end of file diff --git a/tests/2.vsa b/tests/2.vsa new file mode 100644 index 0000000000000000000000000000000000000000..2643c346d8825e1c1fd6de14af9ce22199fced8c GIT binary patch literal 948 zcmZ8gJFe6~5Ulac*k+C7l}PxL5bzN^Zoo=NL?i@G5r^OaLr!3cl)wZ?Xrp(5JpdBi z!GRC3C%{zo%v(LyTCb|Qx@)?pcUS*+eGkNA*IxqZHGmyIeADg`P?0B~AB8=!J7Jf6 z!5ai(H!CN?6W4}2=6ke;YvO>$usj>|h68a;tRCK>pYZt8FYLa(1%ABw^ZUzA@m}$> z-d-`zUXG4tYLdO#b3xj*{j9j~O=1a8Q7dh97)J4D`r`AP?@P1TaQ?63J>hnt?{bv> zf_3y_&5%9<4%^|N_yfL-)6*qF`U+Q^ah);_j1MK=TKogN$F{ztH{;8Amj!OSOkKOo zR~Xy%@Wjs9A8y-NJ~5YG%XGcxJIqn-eE<&&KF`m6^sN0!4^#nBJ_W1SVQP6s;0%Fr zy^ZCGYcHzFI9gs)@-T7OQm0*F%6iUi=zGg*z4`pF?ayn!tG8(9vaYG0UwZ?CjbBd literal 0 HcmV?d00001 diff --git a/tests/2.vsh b/tests/2.vsh new file mode 100644 index 00000000..25f0fa86 --- /dev/null +++ b/tests/2.vsh @@ -0,0 +1,30 @@ +vs.2.0 + +//------------------------------------------------------------------------------ +// Simple Vertex Shader +// +// Constants Registers: +// +// c0-c3 = combined model-view-projection matrix +// c4 = constant color (defined by the application) +// +// Input Registers: +// +// v0 = per-vertex position +// v1 = per-vertex color +// +// Output Registers: +// +// oPos = homogeneous position +// oD0 = diffuse color +// +//------------------------------------------------------------------------------ + +dcl_position v0 +dcl_color v1 + +m4x4 oPos, v0, c0 // Transform the per-vertex position into clip-space +mov oD0, v1 // Use the original per-vertex color specified + +//mov oD0, c4 // Uncomment this to use the constant color stored at c4 +