Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5353 → Rev 5352

/programs/develop/libraries/TinyGL/asm_fork/arrays.asm
174,23 → 174,18
add esi,[edx+offs_cont_color_array] ;esi = &context.color_array[i]
mov edi,ebp
sub edi,28 ;edi = &p[1]
mov ebx,[esi+8]
mov [edi],ebx ;p[1].f = context.color_array[i+2]
mov ebx,[esi+4]
mov [edi+4],ebx ;p[2].f = context.color_array[i+1]
mov ebx,[esi]
mov [edi+8],ebx ;p[3].f = context.color_array[i]
add edi,12
movsd ;p[1].f = context.color_array[i]
movsd
movsd
cmp dword[size],3
jle .e1
add esi,12
movsd
sub edi,20 ;&p[0]
jmp .e2
.e1:
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
sub edi,16 ;&p[0]
.e2:
mov edi,ebp
sub edi,32 ;edi = &p[0]
mov ebx,ebp
sub ebx,12 ;ebp-12 = &p[5]
push ebx
261,7 → 256,6
.e6:
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
add edi,4
jmp .e8 ;и 4-й тоже ставим по умолчанию
.e7:
cmp dword[size],3
jle .e8
308,7 → 302,7
align 4
proc glopDrawElements uses eax ebx edx, context:dword, param:dword
locals
p rd 8
p rd 5
endl
 
mov edx,[context]
324,7 → 318,7
mov eax,[ebx+4]
mov [p+4],eax ;p[1].i = param[1].i
mov eax,ebp
sub eax,32 ;=sizeof(dd)*8
sub eax,20 ;=sizeof(dd)*5
stdcall glopBegin, edx,eax
 
; for (int ii=0; ii<count; ii++) {
366,7 → 360,7
; }
; }
mov eax,ebp
sub eax,32 ;=sizeof(dd)*8
sub eax,20 ;=sizeof(dd)*5
stdcall glopEnd, edx,eax
ret
endp
/programs/develop/libraries/TinyGL/asm_fork/examples/test_array0.asm
192,7 → 192,7
;--------------------------------------------------
 
i_end:
rb 4096
rb 1024
stacktop:
cur_dir_path:
rb 4096
/programs/develop/libraries/TinyGL/asm_fork/clip.asm
13,10 → 13,6
offs_Z equ 8
offs_W equ 12
 
if DEBUG
f_ttv db ' gl_transform_to_viewport',0
end if
 
align 4
proc gl_transform_to_viewport uses eax ebx ecx, context:dword,v:dword
locals
73,8 → 69,8
.end_if:
; texture
cmp dword[eax+offs_cont_texture_2d_enabled],0
je @f
bt dword[eax+offs_cont_texture_2d_enabled],0
jnc @f
mov dword[point],dword(ZB_POINT_S_MAX - ZB_POINT_S_MIN)
fild dword[point]
fmul dword[ebx+offs_vert_tex_coord] ;st0 *= v.tex_coord.X
88,7 → 84,7
add dword[ebx+offs_vert_zp+offs_zbup_s],ZB_POINT_T_MIN
@@:
if DEBUG ;gl_transform_to_viewport
pushad
push edi
mov ecx,80
mov eax,[ebx+offs_vert_zp]
lea edi,[buf_param]
110,7 → 106,7
 
stdcall str_n_cat,edi,txt_nl,2
stdcall dbg_print,f_ttv,buf_param
popad
pop edi
end if
ret
endp
174,11 → 170,11
fld dword[t]
 
; интерполяция по координатам
fld dword[ecx+offs_vert_pc]
fsub dword[ebx+offs_vert_pc]
fld dword[ecx+offs_vert_pc+offs_X]
fsub dword[ebx+offs_vert_pc+offs_X]
fmul st0,st1
fadd dword[ebx+offs_vert_pc]
fstp dword[eax+offs_vert_pc] ;q.pc.X = p0.pc.X + (p1.pc.X - p0.pc.X) * t
fadd dword[ebx+offs_vert_pc+offs_X]
fstp dword[eax+offs_vert_pc+offs_X]
 
fld dword[ecx+offs_vert_pc+offs_Y]
fsub dword[ebx+offs_vert_pc+offs_Y]
667,8 → 663,8
stdcall gl_clipcode, [ebx+offs_vert_pc+offs_X],[ebx+offs_vert_pc+offs_Y],\
[ebx+offs_vert_pc+offs_Z],[ebx+offs_vert_pc+offs_W]
mov dword[ebx+offs_vert_clip_code],eax
or eax,eax ;if (q.clip_code==0)
jnz @f
cmp eax,0 ;if (q.clip_code==0)
jne @f
stdcall gl_transform_to_viewport,[context],ebx
mov eax,ebx
add eax,offs_vert_zp+offs_zbup_b
693,6 → 689,7
mov ebx,[p0]
mov ecx,[p1]
mov edx,[p2]
 
mov edi,[ebx+offs_vert_clip_code]
mov dword[cc],edi
mov eax,[ecx+offs_vert_clip_code]
703,9 → 700,8
or edi,eax ;co = cc[0] | cc[1] | cc[2]
 
; we handle the non clipped case here to go faster
;or edi,___ - было выше
jnz .els_0
;if (co==0)
cmp edi,0 ;if (co==0)
jne .els_0
mov edi,dword[edx+offs_vert_zp+offs_zbup_x]
sub edi,dword[ebx+offs_vert_zp+offs_zbup_x]
mov dword[norm],edi
732,12 → 728,13
fstsw ax
sahf
je .end_f
jbe @f ;jb @f ???
jb @f
inc dword[front] ;front = 0.0 > norm
@@:
mov edi,[context]
mov eax,dword[edi+offs_cont_current_front_face]
xor dword[front],eax ;front ^= context.current_front_face
 
; back face culling
cmp dword[edi+offs_cont_cull_face_enabled],0
je .els_1
768,8 → 765,8
;eax = cc[2]
and eax,[cc]
and eax,[cc+4] ;eax = c_and = cc[0] & cc[1] & cc[2]
or eax,eax ;if (c_and==0)
jnz .end_f
cmp eax,0 ;if (c_and==0)
jne .end_f
stdcall gl_draw_triangle_clip, [context],ebx,ecx,edx,0
.end_f:
popad
802,8 → 799,8
or edi,eax
mov [co],edi ;co = cc[0] | cc[1] | cc[2]
 
or edi,edi ;if (co == 0)
jnz .els_0
cmp edi,0 ;if (co == 0)
jne .els_0
stdcall gl_draw_triangle, [context],ebx,ecx,edx
jmp .end_f
.els_0:
812,8 → 809,8
and eax,[cc+4] ;c_and = cc[0] & cc[1] & cc[2]
 
; the triangle is completely outside
or eax,eax ;if (c_and!=0) return
jnz .end_f
cmp eax,0 ;if (c_and!=0) return
jne .end_f
 
; find the next direction to clip
.cycle_0: ;while (clip_bit < 6 && (co & (1 << clip_bit)) == 0)
824,8 → 821,8
mov ecx,[clip_bit]
shl eax,cl
and eax,[co]
or eax,eax
jnz .cycle_0_end
cmp eax,0
jne .cycle_0_end
inc dword[clip_bit]
jmp .cycle_0
.cycle_0_end:
857,13 → 854,13
 
mov ecx,[p1] ;востанавливаем после shl ___,cl
 
or eax,eax ;if (co1)
jz .els_1
cmp eax,0 ;if (co1)
je .els_1
; one point outside
mov eax,[cc]
and eax,[clip_mask]
or eax,eax ;if (cc[0] & clip_mask)
jz .els_2
cmp eax,0 ;if (cc[0] & clip_mask)
je .els_2
;q[0]=p0 q[1]=p1 q[2]=p2
mov [q],ebx
mov [q+4],ecx
872,8 → 869,8
.els_2:
mov eax,[cc+4]
and eax,[clip_mask]
or eax,eax ;else if (cc[1] & clip_mask)
jz .els_3
cmp eax,0 ;else if (cc[1] & clip_mask)
je .els_3
;q[0]=p1 q[1]=p2 q[2]=p0
mov [q],ecx
mov [q+4],edx
920,7 → 917,7
stdcall updateTmp,[context],edi,ebx,edx,eax ;updateTmp(c,&tmp2,q[0],q[2],tt)
 
mov eax,[ebx+offs_vert_edge_flag]
mov [tmp1.edge_flag],eax ;q[0].edge_flag
mov [tmp1+offs_vert_edge_flag],eax ;q[0].edge_flag
mov eax,[edx+offs_vert_edge_flag]
mov [edge_flag_tmp],eax ;q[2].edge_flag
mov dword[edx+offs_vert_edge_flag],0 ;q[2].edge_flag=0
995,9 → 992,11
sub edi,offs_vert_pc
stdcall updateTmp,[context],edi,[q],[q+8],eax
 
mov dword[tmp1.edge_flag],1
mov eax,[edx+offs_vert_edge_flag-offs_vert_pc]
mov dword[tmp2.edge_flag],eax ;tmp2.edge_flag = q[2].edge_flag
mov edx,[q+8]
 
mov dword[tmp1+offs_vert_edge_flag],1
mov eax,[edx+offs_vert_edge_flag]
mov dword[tmp1+offs_vert_edge_flag],eax ;tmp2.edge_flag = q[2].edge_flag
mov eax,[clip_bit]
inc eax
push eax
/programs/develop/libraries/TinyGL/asm_fork/matrix.asm
384,13 → 384,11
loop @b
 
if DEBUG ;glopScale
pushad
stdcall dbg_print,txt_gl_scal,txt_nl
mov ebx,[eax+offs_cont_matrix_mode]
shl ebx,2
add ebx,eax
stdcall gl_print_matrix,[ebx+offs_cont_matrix_stack_ptr],4
popad
end if
gl_matrix_update eax,ebx
ret
431,13 → 429,11
fincstp
 
if DEBUG ;glopTranslate
pushad
stdcall dbg_print,txt_gl_tran,txt_nl
mov ebx,[eax+offs_cont_matrix_mode]
shl ebx,2
add ebx,eax
stdcall gl_print_matrix,[ebx+offs_cont_matrix_stack_ptr],4
popad
end if
gl_matrix_update eax,ebx
ret
/programs/develop/libraries/TinyGL/asm_fork/vertex.asm
1,6 → 1,3
if DEBUG
f_vt db ' gl_vertex_transform',0
end if
 
align 4
proc glopNormal uses ecx esi edi, context:dword, p:dword
120,7 → 117,7
locals
tmp M4
endl
;assert(context.in_begin == 0)
; assert(c->in_begin == 0);
 
mov edx,[context]
mov ebx,[p]
140,7 → 137,7
end if
; precompute inverse modelview
mov ebx,ebp
sub ebx,sizeof.M4
sub ebx,64
stdcall gl_M4_Inv, ebx,dword[edx+offs_cont_matrix_stack_ptr]
if DEBUG ;tmp
stdcall dbg_print,txt_sp,txt_nl
168,21 → 165,18
fcomp st1
fstsw ax
sahf
jne @f
jne .end_if_0
fld dword[ecx+13*4]
fcomp st1
fstsw ax
sahf
jne @f
jne .end_if_0
fld dword[ecx+14*4]
fcomp st1
fstsw ax
sahf
jne @f
jne .end_if_0
mov dword[edx+offs_cont_matrix_model_projection_no_w_transform],1
@@:
ffree st0 ;0.0
fincstp
.end_if_0:
 
; test if the texture matrix is not Identity
/programs/develop/libraries/TinyGL/asm_fork/zmath.asm
3,11 → 3,6
 
; ******* Gestion des matrices 4x4 ******
 
if DEBUG
f_m4m db 'gl_M4_Mul',0
f_m4ml db 'gl_M4_MulLeft',0
end if
 
align 4
proc gl_M4_Id uses eax ecx edi, a:dword
mov edi,[a]
120,13 → 115,14
 
mov edx,[c]
mov dword[i],0
mov eax,ebp
sub eax,sizeof.M4
.cycle_0: ;i
xor ebx,ebx ;j=0
xor ebx,ebx
.cycle_1: ;j
finit
fldz ;sum=0
xor ecx,ecx ;k=0
xor ecx,ecx
mov eax,ebp
sub eax,sizeof.M4
M4_reg edi,eax,dword[i],0
.cycle_2: ;k
fld dword[edi]
133,8 → 129,9
add edi,4
M4_reg esi,[b],ecx,ebx
fmul dword[esi]
faddp ;sum += a[i][k] * b[k][j]
fadd st0,st1 ;sum += a[i][k] * b[k][j]
inc ecx
add eax,4
cmp ecx,4
jl .cycle_2
fstp dword[edx] ;c[i][j] = sum
145,6 → 142,7
inc dword[i]
cmp dword[i],4
jl .cycle_0
finit
if DEBUG ;gl_M4_MulLeft
stdcall dbg_print,f_m4ml,txt_nl
stdcall gl_print_matrix,[c],4
/programs/develop/libraries/TinyGL/asm_fork/tinygl.asm
12,9 → 12,9
include 'clip.asm'
include 'vertex.asm'
include 'api.asm'
include 'list.asm' ;gl_add_op
include 'list.asm'
include 'init.asm'
include 'matrix.asm' ;gl_print_matrix
include 'matrix.asm'
include 'texture.asm'
include 'misc.asm'
include 'clear.asm'
36,7 → 36,42
 
if DEBUG
include 'info_fun_float.inc'
end if
 
; ***
glVertex2d: ;(double ,double)
glVertex2fv: ;(float *)
glVertex2dv: ;(double *)
glVertex3d: ;(double ,double ,double)
glVertex3dv: ;(double *)
glVertex4d: ;(double ,double ,double, double )
glVertex4fv: ;(float *)
glVertex4dv: ;(double *)
glColor3d: ;(double ,double ,double)
glColor3dv: ;(double *)
glColor4d: ;(double ,double ,double, double )
glColor4dv: ;(double *)
glNormal3d: ;(double ,double ,double)
glNormal3dv: ;(double *)
glTexCoord1f: ;(float)
glTexCoord1d: ;(double)
glTexCoord1fv: ;(float *)
glTexCoord1dv: ;(double *)
glTexCoord2d: ;(double ,double)
glTexCoord2dv: ;(double *)
glTexCoord3f: ;(float ,float ,float)
glTexCoord3d: ;(double ,double ,double)
glTexCoord3fv: ;(float *)
glTexCoord3dv: ;(double *)
glTexCoord4d: ;(double ,double ,double, double )
glTexCoord4fv: ;(float *)
glTexCoord4dv: ;(double *)
glGenTextures: ;(int n, unsigned int *textures)
glDeleteTextures: ;(int n, const unsigned int *textures)
glGetIntegerv: ;(int pname,int *params)
glGetFloatv: ;(int pname, float *v)
 
if DEBUG
align 4
txt_nl db 13,10,0
txt_sp db ' ',0
105,37 → 140,6
ret ;пока в стеке храниться кол-во вызовов то столько раз мы и будем вызываться
end if
 
; ***
glVertex2d: ;(double ,double)
glVertex2dv: ;(double *)
glVertex3d: ;(double ,double ,double)
glVertex3dv: ;(double *)
glVertex4d: ;(double ,double ,double, double )
glVertex4dv: ;(double *)
glColor3d: ;(double ,double ,double)
glColor3dv: ;(double *)
glColor4d: ;(double ,double ,double, double )
glColor4dv: ;(double *)
glNormal3d: ;(double ,double ,double)
glNormal3dv: ;(double *)
glTexCoord1f: ;(float)
glTexCoord1d: ;(double)
glTexCoord1fv: ;(float *)
glTexCoord1dv: ;(double *)
glTexCoord2d: ;(double ,double)
glTexCoord2dv: ;(double *)
glTexCoord3f: ;(float ,float ,float)
glTexCoord3d: ;(double ,double ,double)
glTexCoord3fv: ;(float *)
glTexCoord3dv: ;(double *)
glTexCoord4d: ;(double ,double ,double, double )
glTexCoord4fv: ;(float *)
glTexCoord4dv: ;(double *)
glGenTextures: ;(int n, unsigned int *textures)
glDeleteTextures: ;(int n, const unsigned int *textures)
glGetIntegerv: ;(int pname,int *params)
glGetFloatv: ;(int pname, float *v)
 
align 4
f_kosgl_1 db 'kosglMakeCurrent',0
err_0 db 'Error while initializing Z buffer',13,10,0
147,13 → 151,20
err_4 db 'error while resizing display',13,10,0
err_5 db 'size too small',13,10,0
f_clipcode db ' gl_clipcode',0
f_ttv db ' gl_transform_to_viewport',0
f_vt db ' gl_vertex_transform',0
f_ev db ' gl_eval_viewport',0
f_zbz db ' ZB_line_z',0
f_zb db ' ZB_line',0
f_m4m db 'gl_M4_Mul',0
f_m4ml db 'gl_M4_MulLeft',0
f_find_l db 'find_list',0
f_alloc_l db 'alloc_list',0
f_is_l db 'glIsList',0
f_gen_l db 'glGenLists',0
f_end_l db 'glEndList',0
;f_fill_trf db 'ZB_fillTriangleFlat',0
;f_fill_trrgb db 'ZB_fillTriangleSmooth',0
f_fill_tr db 'ZB_fillTriangle...',0
f_fill_tr_nl db ' lines',0
f_fill_tr_nll db ' len',0
/programs/develop/libraries/TinyGL/asm_fork/api.asm
28,13 → 28,6
endp
 
align 4
proc glVertex2fv uses eax, v:dword
mov eax,[v]
stdcall glVertex4f,[eax],[eax+4],0.0,1.0
ret
endp
 
align 4
proc glVertex3f, x:dword, y:dword, z:dword
stdcall glVertex4f,[x],[y],[z],1.0
ret
47,13 → 40,6
ret
endp
 
align 4
proc glVertex4fv uses eax, v:dword
mov eax,[v]
stdcall glVertex4f,[eax],[eax+4],[eax+8],[eax+12]
ret
endp
 
; glNormal
 
align 4
562,7 → 548,7
ret
endp
 
; lightening
;/* lightening */
 
align 4
proc glMaterialfv uses eax ecx, mode:dword, type:dword, v:dword
735,7 → 721,7
ret
endp
 
; clear
;/* clear */
 
align 4
proc glClear uses eax, mask:dword
789,7 → 775,7
ret
endp
 
; textures
;/* textures */
 
align 4
proc glTexImage2D uses ecx edi esi,\
893,7 → 879,7
ret
endp
 
; selection
;/* selection */
 
align 4
proc glInitNames uses eax
968,7 → 954,7
ret
endp
 
; Special Functions
;/* Special Functions */
 
align 4
proc glCallList uses eax, list:dword