View3DS v0.60 from Macgub

git-svn-id: svn://kolibrios.org@2192 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2011-09-16 11:23:46 +00:00
parent b13687630b
commit ffc2e1f7ca
7 changed files with 778 additions and 900 deletions

View File

@ -81,10 +81,10 @@ bump_triangle_z:
.cz2 equ [ebp-108]
.cbx1 equ dword[ebp-112]
.cby1 equ [ebp-116]
.cbx2 equ dword[ebp-120]
.cby2 equ [ebp-124]
.cex1 equ dword[ebp-128]
.cey1 equ [ebp-132]
.cex1 equ dword[ebp-120]
.cey1 equ [ebp-124]
.cbx2 equ dword[ebp-128]
.cby2 equ [ebp-132]
.cex2 equ dword[ebp-136]
.cey2 equ [ebp-140]
@ -533,8 +533,25 @@ end if
jge .loop12_done
.loop12:
call .call_bump_line
if Ext >= SSE2
movups xmm0,.cey2
movups xmm1,.cey1
movups xmm2,.dey12
movups xmm3,.dey13
paddd xmm0,xmm2
paddd xmm1,xmm3
movups .cey2,xmm0
movups .cey1,xmm1
movq mm4,.cz1
movq mm5,.cz2
paddd mm4,.dz13
paddd mm5,.dz12
movq .cz1,mm4
movq .cz2,mm5
end if
if Ext >= MMX
if (Ext = MMX) | (Ext = SSE)
movq mm0,.cby2
movq mm1,.cby1
movq mm2,.cey2
@ -553,7 +570,7 @@ if Ext >= MMX
movq .cey2,mm2
movq .cz1,mm4
movq .cz2,mm5
else
else if Ext = NON
mov edx,.dbx13
add .cbx1,edx
mov eax,.dbx12
@ -617,8 +634,23 @@ end if
.loop23:
call .call_bump_line
if Ext >= MMX
if Ext >= SSE2
movups xmm0,.cey2
movups xmm1,.cey1
movups xmm2,.dey23
movups xmm3,.dey13
paddd xmm0,xmm2
paddd xmm1,xmm3
movups .cey2,xmm0
movups .cey1,xmm1
movq mm4,.cz1
movq mm5,.cz2
paddd mm4,.dz13
paddd mm5,.dz23
movq .cz1,mm4
movq .cz2,mm5
end if
if (Ext = MMX) | (Ext = SSE)
movq mm0,.cby2
movq mm1,.cby1
movq mm2,.cey2
@ -637,7 +669,7 @@ if Ext >= MMX
movq .cey2,mm2
movq .cz1,mm4
movq .cz2,mm5
else
else if Ext = NON
mov eax,.dx13
add .cx1,eax
mov ebx,.dx23

View File

@ -292,24 +292,6 @@ if Ext>=SSE
cvtps2pi mm1,xmm1
movq .dty12,mm0
movq .dz12,mm1
;temporaly conversion to keep upside down
; fninit
; fld .dx12
; fistp .dx12
; fld dword .dz12
; fistp dword .dz12
; fld .dbx12
; fistp .dbx12
; fld dword .dby12
; fistp dword .dby12
; fld .dex12
; fistp .dex12
; fld dword .dey12
; fistp dword .dey12
; fld .dtx12
; fistp .dtx12
; fld dword .dty12
; fistp dword .dty12
;----
; mov ax,.z2
; sub ax,.z1
@ -518,25 +500,6 @@ if Ext>=SSE
movq .dty13,mm0
movq .dz13,mm1
;temporaly conversion to keep upside down
; fninit
; fld .dx13
; fistp .dx13
; fld dword .dz13
; fistp dword .dz13
; fld .dbx13
; fistp .dbx13
; fld dword .dby13
; fistp dword .dby13
; fld .dex13
; fistp .dex13
; fld dword .dey13
; fistp dword .dey13
; fld .dtx13
; fistp .dtx13
; fld dword .dty13
; fistp dword .dty13
else
mov ax,.x3
@ -699,24 +662,6 @@ if Ext>=SSE
movq .dz23,mm1
;temporaly conversion to keep upside down
; fninit
; fld .dx23
; fistp .dx23
; fld dword .dz23
; fistp dword .dz23
; fld .dbx23
; fistp .dbx23
; fld dword .dby23
; fistp dword .dby23
; fld .dex23
; fistp .dex23
; fld dword .dey23
; fistp dword .dey23
; fld .dtx23
; fistp .dtx23
; fld dword .dty23
; fistp dword .dty23
else
mov ax,.x3
sub ax,.x2
@ -794,57 +739,6 @@ end if
; sub esp,40
.bt_dx23_done:
sub esp,64
;if Ext>=SSE
; movsx eax,.x1
; shl eax,ROUND
; cvtsi2ss xmm0,eax
; movss .cx1,xmm0
; movss .cx2,xmm0
;
; movsx ebx,word[.b_x1]
; shl ebx,ROUND
; cvtsi2ss xmm0,ebx
; movss .cbx1,xmm0
; movss .cbx2,xmm0
;
; movsx ecx,word[.b_y1]
; shl ecx,ROUND
; cvtsi2ss xmm0,ecx
; movss .cby1,xmm0
; movss .cby2,xmm0
; movsx edx,word[.e_x1]
; shl edx,ROUND
; cvtsi2ss xmm0,edx
; movss .cex1,xmm0
; movss .cex2,xmm0
;
; movsx eax,word[.e_y1]
; shl eax,ROUND
; cvtsi2ss xmm0,eax
; movss .cey1,xmm0
; movss .cey2,xmm0
;
; movsx ebx,.z1
; shl ebx,CATMULL_SHIFT
; cvtsi2ss xmm0,ebx
; movss .cz1,xmm0
; movss .cz2,xmm0
;
; movsx ecx,word[.t_x1]
; shl ecx,ROUND
; cvtsi2ss xmm0,ecx
; movss .ctx1,xmm0
; movss .ctx2,xmm0
; movsx edx,word[.t_y1]
; shl edx,ROUND
; cvtsi2ss xmm0,edx
; movss .cty1,xmm0
; movss .cty2,xmm0
;else
movsx eax,.x1
shl eax,ROUND
@ -902,14 +796,8 @@ end if
mov .cty2,edx
; push edx
; push edx
;end if
movsx ecx,.y1
cmp cx,.y2
jge .loop12_done
.loop12:
call .call_line
;if Ext >= SSE
;if Ext >= SSE2
; movups xmm0,.cby1
; movups xmm1,.cty1
; movups xmm2,.cby2
@ -918,22 +806,36 @@ end if
; movups xmm5,.dty13
; movups xmm6,.dby12
; movups xmm7,.dty12
; addps xmm0,xmm4
; addps xmm1,xmm5
; addps xmm2,xmm6
; addps xmm3,xmm7
;
;; addps xmm0,.dby12
;; addps xmm1,.dty12
;; addps xmm2,.dby13
;; addps xmm3,.dty13
; movups .cby1,xmm0
; movups .cty1,xmm1
; movups .cby2,xmm2
; movups .cty2,xmm3
;end if
movsx ecx,.y1
cmp cx,.y2
jge .loop12_done
.loop12:
;if Ext >= SSE2
; fxsave [sse_repository]
;end if
call .call_line
if Ext >= SSE2
; fxrstor [sse_repository]
movups xmm0,.cby1
movups xmm1,.cty1
movups xmm2,.cby2
movups xmm3,.cty2
movups xmm4,.dby13
movups xmm5,.dty13
movups xmm6,.dby12
movups xmm7,.dty12
paddd xmm0,xmm4
paddd xmm1,xmm5
paddd xmm2,xmm6
paddd xmm3,xmm7
movups .cby1,xmm0
movups .cty1,xmm1
movups .cby2,xmm2
movups .cty2,xmm3
end if
if Ext >= MMX
if (Ext = MMX) | (Ext = SSE)
movq mm0,.cby2
movq mm1,.cby1
movq mm2,.cey2
@ -1005,7 +907,6 @@ end if
cmp cx,.y3
jge .loop23_done
;if Ext < SSE
movsx eax,.z2
shl eax,CATMULL_SHIFT
@ -1038,54 +939,7 @@ end if
movzx ebx,word[.t_y2]
shl ebx,ROUND
mov .cty2,ebx
;else
; movsx eax,.z2
; shl eax,CATMULL_SHIFT
; cvtsi2ss xmm0,eax
; movss .cz2,xmm0
;
; movsx ebx,.x2
; shl ebx,ROUND
; cvtsi2ss xmm1,ebx
; movss .cx2,xmm1
;
; movzx edx,word[.b_x2]
; shl edx,ROUND
; cvtsi2ss xmm2,edx
; movss .cbx2,xmm2
;
; movzx eax,word[.b_y2]
; shl eax,ROUND
; cvtsi2ss xmm0,eax
; movss .cby2,xmm0
;
; movzx ebx,word[.e_x2]
; shl ebx,ROUND
; cvtsi2ss xmm1,ebx
; movss .cex2,xmm1
;
; movzx edx,word[.e_y2]
; shl edx,ROUND
; cvtsi2ss xmm2,edx
; movss .cey2,xmm2
;
; movzx eax,word[.t_x2]
; shl eax,ROUND
; cvtsi2ss xmm0,eax
; movss .ctx2,xmm0
;
; movzx ebx,word[.t_y2]
; shl ebx,ROUND
; cvtsi2ss xmm1,ebx
; movss .cty2,xmm1
;end if
.loop23:
call .call_line
;if Ext >= SSE
;if Ext >= SSE2
; movups xmm0,.cby1
; movups xmm1,.cty1
; movups xmm2,.cby2
@ -1094,21 +948,34 @@ end if
; movups xmm5,.dty13
; movups xmm6,.dby23
; movups xmm7,.dty23
; addps xmm0,xmm4
; addps xmm1,xmm5
; addps xmm2,xmm6
; addps xmm3,xmm7
; ; addps xmm0,.dby13
; ; addps xmm1,.dty13
; ; addps xmm2,.dby23
; ; addps xmm3,.dty23
; movups .cby1,xmm0
; movups .cty1,xmm1
; movups .cby2,xmm2
; movups .cty2,xmm3
;
;end if
if Ext >= MMX
.loop23:
;if Ext >= SSE2
; fxsave [sse_repository]
;end if
call .call_line
if Ext >= SSE2
; fxrstor [sse_repository]
movups xmm0,.cby1
movups xmm1,.cty1
movups xmm2,.cby2
movups xmm3,.cty2
movups xmm4,.dby13
movups xmm5,.dty13
movups xmm6,.dby23
movups xmm7,.dty23
paddd xmm0,xmm4
paddd xmm1,xmm5
paddd xmm2,xmm6
paddd xmm3,xmm7
movups .cby1,xmm0
movups .cty1,xmm1
movups .cby2,xmm2
movups .cty2,xmm3
;
end if
if (Ext = MMX) | (Ext = SSE)
movq mm0,.cby2
movq mm1,.cby1
movq mm2,.cey2
@ -1180,90 +1047,7 @@ end if
ret 50
.call_line:
;if Ext >= SSE
; pushad
; push .tex_ptr
; fninit
; fld dword .cty1
; fistp dword [esp-4]
; sub esp,4
;; push dword .cty1
; fld .ctx1
; fistp dword [esp-4]
; sub esp,4
;; push .ctx1
; fld dword .cz1
; fistp dword [esp-4]
; sub esp,4
; ; push dwod .cz1
; fld dword .cty2
; fistp dword [esp-4]
; sub esp,4
; ; push .cty2
; fld .ctx2
; fistp dword [esp-4]
; sub esp,4
; ; push dword .ctx2
; fld dword .cz2
; fistp dword [esp-4]
; sub esp,4
;; push dword .cz2
;
; push .z_buff
; push .t_emap
; push .t_bmap
;--------------------------------------
; fld dword .cey2
; fistp dword [esp-4]
; sub esp,4
;; push dword .cey2
;
; fld .cex2
; fistp dword [esp-4]
; sub esp,4
;; push .cex2
;
; fld dword .cby2
; fistp dword [esp-4]
; sub esp,4
; ; push dword .cby2
; fld .cbx2
; fistp dword [esp-4]
; sub esp,4
; push .cbx2
;------------------------------------
; fld dword .cey1
; fistp dword [esp-4]
; sub esp,4
;; push dword .cey1
; fld .cex1
; fistp dword [esp-4]
; sub esp,4
; ; push .cex1
; fld dword .cby1
; fistp dword [esp-4]
; sub esp,4
;; push dword .cby1
; fld .cbx1
; fistp dword [esp-4]
; sub esp,4
;; push .cbx1
; push ecx
; fld .cx1
; fistp dword [esp-4]
; mov eax,[esp-4]
; sar eax,ROUND
; fld .cx2
; fistp dword [esp-4]
; mov ebx,[esp-4]
; sar ebx,ROUND
; call bump_tex_line_z
;
; popad
;else
pushad
push .tex_ptr
push dword .cty1
@ -1281,8 +1065,16 @@ ret 50
push .cbx2
push dword .cey1
push .cex1
;if Ext >= SSE2
; sub esp,8
; shufps xmm0,xmm0,10110100b
; movhps [esp],xmm0 ;================================
;else
push dword .cby1
push .cbx1
;end if
push ecx
mov eax,.cx1

View File

@ -271,7 +271,7 @@ base_vector:
if Ext=SSE2
db ' (SSE2)'
end if
db ' 0.059',0
db ' 0.060',0
labellen:
STRdata db '-1 '

View File

@ -486,7 +486,7 @@ end if
; pop ebp ebx eax
popad
if Ext >= MMX
if (Ext = MMX)|(Ext=SSE)
movq mm0,.cur1b
movq mm1,.cur1r
movq mm2,.scan_y1
@ -505,7 +505,25 @@ if Ext >= MMX
movq .cur2b,mm3
movq .cur2r,mm4
movq .scan_y2,mm5
else
end if
if Ext >= SSE2
movups xmm0,.cur1b
movups xmm1,.dc13b
movups xmm2,.cur2b
movups xmm3,.dc12b
movq mm2,.scan_y1
movq mm5,.scan_y2
paddd xmm0,xmm1
paddd xmm2,xmm3
paddd mm2,.tex_dy13
paddd mm5,.tex_dy12
movq .scan_y1,mm2
movq .scan_y2,mm5
movups .cur1b,xmm0
movups .cur2b,xmm2
end if
if Ext = NON
mov edx,.dc13b
add .cur1b,edx
mov esi,.dc13g
@ -602,7 +620,7 @@ end if
popad
if Ext >= MMX
if (Ext = MMX)|(Ext=SSE)
movq mm0,.cur1b
movq mm1,.cur1r
movq mm2,.scan_y1
@ -621,7 +639,24 @@ if Ext >= MMX
movq .cur2b,mm3
movq .cur2r,mm4
movq .scan_y2,mm5
else
end if
if Ext >= SSE2
movups xmm0,.cur1b
movups xmm1,.dc13b
movups xmm2,.cur2b
movups xmm3,.dc23b
movq mm2,.scan_y1
movq mm5,.scan_y2
paddd xmm0,xmm1
paddd xmm2,xmm3
paddd mm2,.tex_dy13
paddd mm5,.tex_dy23
movq .scan_y1,mm2
movq .scan_y2,mm5
movups .cur1b,xmm0
movups .cur2b,xmm2
end if
if Ext = NON
mov edx,.dc13b
add .cur1b,edx
mov esi,.dc13g
@ -740,8 +775,8 @@ if Ext=NON
mov ecx,dword .z1
xchg ecx, .z2
mov dword .z1, ecx
else
end if
if (Ext=MMX)
movq mm0,.b1 ; b, g
movq mm1,.b2
movq .b1, mm1
@ -755,6 +790,16 @@ else
movq .tex_x1,mm5
movq .tex_x2,mm4
end if
if Ext>=SSE
movups xmm0,.b1
movups xmm1,.b2
movups .b1,xmm1
movups .b2,xmm0
movq mm4,.tex_x1 ; x, z
movq mm5,.tex_x2
movq .tex_x1,mm5
movq .tex_x2,mm4
end if
@@:

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
; application : View3ds ver. 0.059 - tiny .3ds files viewer.
; application : View3ds ver. 0.060 - tiny .3ds files viewer.
; compiler : FASM
; system : KolibriOS
; author : Macgub aka Maciej Guba
@ -35,7 +35,7 @@ NON = 0 ; -/ \-
MMX = 1
SSE = 2
SSE2 = 3
Ext = MMX ;Ext={ NON | MMX | SSE | SSE2 }
Ext = MMX ;Ext={ NON | MMX | SSE | SSE2 }
; 0 for short names (Menuet-compatible), 1 for long names (Kolibri features)
USE_LFN = 1

View File

@ -1,11 +1,8 @@
View3ds 0.059 - tiny viewer to .3ds files.
View3ds 0.060 - tiny viewer to .3ds files.
What's new?
1. Bump and pararell two texture mapping functions optimizations.
(files bump_cat.inc & two_tex.inc)
On my P4 changes are rather non visable, but on dual core in KlbrInWin
optimizations runs preety nice.
1. Header fix by Leency.
2. SSE2 optimizations by me. (Most visable in BUMP_TEX mode.)
Buttons description:
1. rotary: choosing rotary axle: x, y, x+y.
@ -33,4 +30,4 @@ Buttons description:
18. re-map tex -> re-map texture and bump map coordinates, to change spherical mapping
around axle use 'xchg' and 'mirror' buttons, then press 're-map tex' button.
Macgub Jun 2011
Macgub Aug 2011