library speed optimize, fix gears

git-svn-id: svn://kolibrios.org@6126 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-02-01 23:20:41 +00:00
parent 4ab605b8d3
commit b4dae617cd
3 changed files with 29 additions and 42 deletions

View File

@ -805,16 +805,16 @@ endl
; draw inside radius cylinder ; draw inside radius cylinder
stdcall [glBegin], GL_QUAD_STRIP stdcall [glBegin], GL_QUAD_STRIP
mov dword[i],0 mov dword[i],0
finit
@@: @@:
cmp dword[i],ebx cmp dword[i],ebx
jg @f jg @f
finit
fld1 fld1
fld1 fld1
faddp faddp
fldpi fldpi
fmulp fmul st0,st1
fimul dword[i] fimul dword[i]
fidiv dword[teeth] fidiv dword[teeth]
fst dword[angle] ;angle = i * 2.0*M_PI / teeth fst dword[angle] ;angle = i * 2.0*M_PI / teeth
@ -849,6 +849,8 @@ endl
call [glNormal3f];, -cos(angle), -sin(angle), 0.0 call [glNormal3f];, -cos(angle), -sin(angle), 0.0
call [glVertex3f];, r0*cos(angle), r0*sin(angle), -width*0.5 call [glVertex3f];, r0*cos(angle), r0*sin(angle), -width*0.5
call [glVertex3f];, r0*cos(angle), r0*sin(angle), width*0.5 call [glVertex3f];, r0*cos(angle), r0*sin(angle), width*0.5
ffree st0 ;2.0
fincstp
inc dword[i] inc dword[i]
jmp @b jmp @b
@@: @@:

View File

@ -12,7 +12,7 @@ if TGL_FEATURE_RENDER_BITS eq 24
mov eax,[ecx+offs_zbup_b] mov eax,[ecx+offs_zbup_b]
mov [colorB],ah ;colorB=p2.b>>8 mov [colorB],ah ;colorB=p2.b>>8
;else ;else
; color=RGB_TO_PIXEL(p2->r,p2->g,p2->b); ;color=RGB_TO_PIXEL(p2.r,p2.g,p2.b)
end if end if
} }
@ -20,13 +20,11 @@ macro PUT_PIXEL _a
{ {
local .end_0 local .end_0
mov eax,[z] mov eax,[z]
shr eax, ZB_POINT_Z_FRAC_BITS shr eax,ZB_POINT_Z_FRAC_BITS
mov [zz],eax cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
mov ebx,[pz]
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
jl .end_0 jl .end_0
;edi = pp ;edi = pp
mov word[ebx+2*_a],ax ;пишем в буфер глубины новое значение mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
if TGL_FEATURE_RENDER_BITS eq 24 if TGL_FEATURE_RENDER_BITS eq 24
mov al,[colorR] mov al,[colorR]
mov ah,[colorG] mov ah,[colorG]
@ -34,7 +32,7 @@ if TGL_FEATURE_RENDER_BITS eq 24
mov al,[colorB] mov al,[colorB]
mov byte[edi+3*_a +2],al mov byte[edi+3*_a +2],al
;else ;else
; pp[_a]=color; ;pp[_a]=color
end if end if
.end_0: .end_0:
mov eax,[dzdx] mov eax,[dzdx]
@ -70,12 +68,10 @@ macro PUT_PIXEL _a
local .end_0 local .end_0
mov eax,[z] mov eax,[z]
shr eax,ZB_POINT_Z_FRAC_BITS shr eax,ZB_POINT_Z_FRAC_BITS
mov [zz],eax cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
mov ebx,[pz]
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
jl .end_0 jl .end_0
;edi = pp ;edi = pp
mov word[ebx+2*_a],ax ;пишем в буфер глубины новое значение mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
if TGL_FEATURE_RENDER_BITS eq 24 if TGL_FEATURE_RENDER_BITS eq 24
mov ebx,[or1] mov ebx,[or1]
mov eax,[og1] mov eax,[og1]
@ -85,7 +81,7 @@ if TGL_FEATURE_RENDER_BITS eq 24
mov byte[edi+3*_a +2],ah mov byte[edi+3*_a +2],ah
end if end if
;if TGL_FEATURE_RENDER_BITS eq 32 ;if TGL_FEATURE_RENDER_BITS eq 32
; pp[_a] = RGB_TO_PIXEL(or1, og1, ob1); ;pp[_a] = RGB_TO_PIXEL(or1, og1, ob1)
;end if ;end if
.end_0: .end_0:
mov eax,[dzdx] mov eax,[dzdx]
@ -126,12 +122,10 @@ macro PUT_PIXEL _a
local .end_0 local .end_0
mov eax,[z] mov eax,[z]
shr eax,ZB_POINT_Z_FRAC_BITS shr eax,ZB_POINT_Z_FRAC_BITS
mov [zz],eax cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
mov ebx,[pz]
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
jl .end_0 jl .end_0
;edi = pp ;edi = pp
mov word[ebx+2*_a],ax ;пишем в буфер глубины новое значение mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
if TGL_FEATURE_RENDER_BITS eq 24 if TGL_FEATURE_RENDER_BITS eq 24
mov ebx,[t] mov ebx,[t]
and ebx,0x3fc00000 and ebx,0x3fc00000
@ -144,7 +138,7 @@ if TGL_FEATURE_RENDER_BITS eq 24
mov al,byte[ebx+2] mov al,byte[ebx+2]
mov byte[edi+3*_a +2],al ;pp[3 * _a + 2]= ptr[2] mov byte[edi+3*_a +2],al ;pp[3 * _a + 2]= ptr[2]
else else
; pp[_a]=texture[((t & 0x3FC00000) | s) >> 14]; ;pp[_a]=texture[((t & 0x3FC00000) | s) >> 14]
end if end if
.end_0: .end_0:
mov eax,[dzdx] mov eax,[dzdx]
@ -196,12 +190,10 @@ macro PUT_PIXEL _a
local .end_0 local .end_0
mov eax,[z] mov eax,[z]
shr eax,ZB_POINT_Z_FRAC_BITS shr eax,ZB_POINT_Z_FRAC_BITS
mov [zz],eax cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
mov ebx,[pz]
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
jl .end_0 jl .end_0
;edi = pp ;edi = pp
mov word[ebx+2*_a],ax ;пишем в буфер глубины новое значение mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
if TGL_FEATURE_RENDER_BITS eq 24 if TGL_FEATURE_RENDER_BITS eq 24
mov ebx,[t] mov ebx,[t]
and ebx,0x3fc00000 and ebx,0x3fc00000
@ -246,10 +238,9 @@ fld1
fstp dword[zinv] ;zinv = 1.0 / fz fstp dword[zinv] ;zinv = 1.0 / fz
imul edi,PSZB imul edi,PSZB
add edi,[pp1] ;pp = (pp1 + x1 * PSZB) add edi,[pp1] ;pp = (pp1 + x1 * PSZB)
mov eax,[x1] mov esi,[x1]
shl eax,1 shl esi,1
add eax,[pz1] add esi,[pz1] ;pz = pz1 + x1
mov [pz],eax ;pz = pz1 + x1
mov eax,[z1] mov eax,[z1]
mov [z],eax ;z = z1 mov [z],eax ;z = z1
mov eax,[sz1] mov eax,[sz1]
@ -291,7 +282,7 @@ fld1
PUT_PIXEL 5 PUT_PIXEL 5
PUT_PIXEL 6 PUT_PIXEL 6
PUT_PIXEL 7 PUT_PIXEL 7
add dword[pz],2*NB_INTERP ;pz += NB_INTERP add esi,2*NB_INTERP ;pz += NB_INTERP
add edi,NB_INTERP*PSZB ;pp += NB_INTERP * PSZB add edi,NB_INTERP*PSZB ;pp += NB_INTERP * PSZB
sub dword[n],NB_INTERP ;n -= NB_INTERP sub dword[n],NB_INTERP ;n -= NB_INTERP
fld dword[ndszdx] fld dword[ndszdx]
@ -323,7 +314,7 @@ align 4
cmp dword[n],0 cmp dword[n],0
jl .cycle_3_end jl .cycle_3_end
PUT_PIXEL 0 PUT_PIXEL 0
add dword[pz],2 ;pz += 1 add esi,2 ;pz += 1
add edi,PSZB ;pp += PSZB add edi,PSZB ;pp += PSZB
dec dword[n] dec dword[n]
jmp .cycle_3 jmp .cycle_3
@ -365,12 +356,10 @@ macro PUT_PIXEL _a
local .end_0 local .end_0
mov eax,[z] mov eax,[z]
shr eax,ZB_POINT_Z_FRAC_BITS shr eax,ZB_POINT_Z_FRAC_BITS
mov [zz],eax cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
mov ebx,[pz]
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
jl .end_0 jl .end_0
;edi = pp ;edi = pp
mov word[ebx+2*_a],ax ;пишем в буфер глубины новое значение mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
fild dword[z] fild dword[z]
fld dword[s_z] fld dword[s_z]
fdiv st0,st1 fdiv st0,st1

View File

@ -52,10 +52,7 @@
x2 dd ? ;int x2 dd ? ;int
dx2dy2 dd ? ;int dx2dy2 dd ? ;int
pz dd ? ;unsigned short *
z dd ? ;uint z dd ? ;uint
zz dd ? ;uint
n dd ? ;int - длинна горизонтальной линии в пикселях n dd ? ;int - длинна горизонтальной линии в пикселях
if INTERP_Z eq 1 if INTERP_Z eq 1
@ -693,10 +690,9 @@ else
add edi,[pp1] ;pp = pp1 + x1 * PSZB add edi,[pp1] ;pp = pp1 + x1 * PSZB
if INTERP_Z eq 1 if INTERP_Z eq 1
mov eax,[x1] mov esi,[x1]
shl eax,1 shl esi,1
add eax,[pz1] add esi,[pz1]
mov [pz],eax
mov eax,[z1] mov eax,[z1]
mov [z],eax mov [z],eax
end if end if
@ -759,7 +755,7 @@ end if
PUT_PIXEL 2 PUT_PIXEL 2
PUT_PIXEL 3 PUT_PIXEL 3
if INTERP_Z eq 1 if INTERP_Z eq 1
add dword[pz],8 ;=4*sizeof(uint) add esi,8 ;=4*sizeof(uint)
end if end if
add edi,4*PSZB add edi,4*PSZB
sub dword[n],4 sub dword[n],4
@ -799,7 +795,7 @@ if INTERP_RGB eq 1
end if end if
PUT_PIXEL 0 PUT_PIXEL 0
if INTERP_Z eq 1 if INTERP_Z eq 1
add dword[pz],2 ;=sizeof(uint) add esi,2 ;=sizeof(uint)
end if end if
add edi,PSZB add edi,PSZB
dec dword[n] dec dword[n]