Subversion Repositories Kolibri OS

Rev

Rev 1931 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1931 Rev 1979
Line 803... Line 803...
803
	jle	.bl_end
803
	jle	.bl_end
Line 804... Line 804...
804
 
804
 
805
	mov	ebx,.x2
805
	mov	ebx,.x2
Line 806... Line 806...
806
	sub	ebx,.x1
806
	sub	ebx,.x1
Line 807... Line 807...
807
 
807
 
808
if Ext >= SSE
808
if  0 ;Ext >= SSE
809
 
809
 
Line 911... Line 911...
911
	push	dword .ex1
911
	push	dword .ex1
912
	push	.ey1
912
	push	.ey1
Line 913... Line 913...
913
 
913
 
914
	push	.z1		 ; current z shl CATMULL_SHIFT
914
	push	.z1		 ; current z shl CATMULL_SHIFT
915
	push	esi
-
 
916
; It's my first attempt at MMX :), have mercy - Macgub
-
 
917
 
915
	push	esi
918
;;     if Ext = MMX
916
;if Ext = SSE2
919
;      mov     dword[.temp1],esi
-
 
920
;      mov     dword[.temp1+4],esi
-
 
921
;;        movq    mm0,.cbyq          ; mm0 - current bump coords
-
 
922
;;        movq    mm1,.ceyq          ; mm1 - current env  coords
-
 
923
;;        movq    mm2,.dbyq          ; mm2 - delta bump
-
 
924
;;        movq    mm3,.deyq          ; mm3 - delta env
-
 
925
;     movd    mm6,.z1            ; mm6 - cur z
-
 
926
;     movq    mm7,qword.[temp1]  ; mm7 = lo = hi dword = current z buff
917
;        movups  xmm1,.dey
927
;;        mov     dword [.temp2],1
918
;end if
928
;;        mov     dword [.temp2+4],-1
-
 
929
;;        mov     dword [.temp3],TEXTURE_SIZE
-
 
930
;;        mov     dword [.temp3+4],TEXTURE_SIZE
919
if Ext>=MMX
931
;;        mov     esi,.bmap
920
	movq	mm0,.cby
932
;;        mov     dword [.temp4],esi
-
 
933
;;        mov     dword [.temp4+4],esi
-
 
934
;;        mov     dword [.temp5],TEX_X
-
 
935
;;        mov     dword [.temp5+4],- TEX_X
921
	movq	mm1,.cey
936
;     mov     dword [.temp1],TEX_SHIFT
922
	movq	mm2,.dby
937
;     mov     dword [.temp1+4],0
923
	movq	mm3,.dey
Line 938... Line 924...
938
;;     end if
924
end if
939
 
925
 
940
     .draw:
926
     .draw:
941
    ; if TEX = SHIFTING   ;bump drawing only in shifting mode
927
    ; if TEX = SHIFTING   ;bump drawing only in shifting mode
942
	mov	esi,.czbuff	 ; .czbuff current address in buffer
928
	mov	esi,.czbuff	 ; .czbuff current address in buffer
943
	mov	ebx,.cz 	 ; .cz - cur z position
929
	mov	ebx,.cz 	 ; .cz - cur z position
-
 
930
	cmp	ebx,dword[esi]
944
	cmp	ebx,dword[esi]
931
	jge	.skip
-
 
932
 
-
 
933
if Ext>=MMX
-
 
934
	movq	mm6,mm0
-
 
935
	psrld	mm6,ROUND
-
 
936
	movd	eax,mm6
-
 
937
	psrlq	mm6,32
945
	jge	.skip
938
	movd	esi,mm6
946
;;      if Ext=NON
939
else
947
	mov	eax,.cby
940
	mov	eax,.cby
948
	sar	eax,ROUND
941
	sar	eax,ROUND
949
	mov	esi,.cbx
-
 
950
	sar	esi,ROUND
-
 
951
;;      else
-
 
952
;;        movq    mm4,mm0          ; mm4 - copies of cur bump coords
-
 
953
;;        psrad   mm4,ROUND        ; mm4 =  lo dword = y b coord, hi dword = x b coord
-
 
954
;;        movd    eax,mm4    ; -
-
 
955
;;        psrlq   mm4,32     ; -
-
 
956
;;        movd    esi,mm4    ; -
-
 
957
;;
-
 
958
;;;       punpckldq  mm5,mm4     ;
-
 
959
;;;       psllq   mm5,TEX_SHIFT
-
 
960
;;;       paddq   mm4,mm5   ; mm4 - lo dword index to b. map
-
 
961
;;
-
 
962
;; ;       packqd  mm4,mm5
-
 
963
 ;       movq    mm5,mm4       ; mm5 ~~ current bump map index?
942
	mov	esi,.cbx
964
 
943
	sar	esi,ROUND
965
;;      end if
944
end if
966
	shl	eax,TEX_SHIFT	;-
-
 
-
 
945
	shl	eax,TEX_SHIFT	;-
967
	add	esi,eax 	;-  ; esi - current bump map index
946
	add	esi,eax 	;-  ; esi - current bump map index
968
;;     if  Ext = NON
947
 
969
	mov	ebx,esi
948
	mov	ebx,esi
970
	dec	ebx
949
	dec	ebx
971
	and	ebx,TEXTURE_SIZE
950
	and	ebx,TEXTURE_SIZE
Line 975... Line 954...
975
	mov	ebx,esi
954
	mov	ebx,esi
976
	inc	ebx
955
	inc	ebx
977
	and	ebx,TEXTURE_SIZE
956
	and	ebx,TEXTURE_SIZE
978
	add	ebx,.bmap
957
	add	ebx,.bmap
979
	movzx	ebx,byte [ebx]
958
	movzx	ebx,byte [ebx]
980
;;      else                   ;-------------------------------------------
-
 
981
;;        mov     dword [.temp1],esi       ;-
-
 
982
;;        mov     dword [.temp1+4],esi     ;-
-
 
983
;;        movq    mm5, qword[.temp1]       ;-
-
 
984
;;        paddd   mm5, qword[.temp2]  ; .temp2 == low dword = 1, high dword = -1
-
 
985
;;        pand    mm5, qword[.temp3]  ; .temp3 == low = high dword = TEX_SIZE
-
 
986
;;        paddd   mm5, qword[.temp4]  ; .temp4 == low = high dword = .bmap
-
 
987
;;        movd    ebx,mm5
-
 
988
;;        psrlq   mm5,32
-
 
989
;;        movd    eax,mm5
-
 
990
;;        movzx   ebx,byte[ebx]
-
 
991
;;        movzx   eax,byte[eax]
-
 
992
;;     end if
959
 
993
	sub	eax,ebx
960
	sub	eax,ebx
994
;;     if Ext=NON
-
 
-
 
961
 
995
	mov	ebx,esi
962
	mov	ebx,esi
996
	sub	ebx,TEX_X
963
	sub	ebx,TEX_X
997
	and	ebx,TEXTURE_SIZE
964
	and	ebx,TEXTURE_SIZE
998
	add	ebx,.bmap
965
	add	ebx,.bmap
999
	movzx	edx,byte [ebx]
966
	movzx	edx,byte [ebx]
Line 1001... Line 968...
1001
	mov	ebx,esi
968
	mov	ebx,esi
1002
	add	ebx,TEX_X
969
	add	ebx,TEX_X
1003
	and	ebx,TEXTURE_SIZE
970
	and	ebx,TEXTURE_SIZE
1004
	add	ebx,.bmap
971
	add	ebx,.bmap
1005
	movzx	ebx,byte [ebx]
972
	movzx	ebx,byte [ebx]
1006
;;     else
973
 
1007
;;        movq    mm5, qword[.temp1]  ;-
-
 
1008
;;        paddd   mm5, qword[.temp5]  ; .temp5 == low dword = TEX_X, high dword = -TEX_X
-
 
1009
;;        pand    mm5, qword[.temp3]  ; .temp3 == low = high dword = TEX_SIZE
-
 
1010
;;        paddd   mm5, qword[.temp4]  ; .temp4 == low = high dword = offset .bmap
-
 
1011
;;        movd    ebx,mm5
-
 
1012
;;        psrlq   mm5,32
-
 
1013
;;        movd    edx,mm5
-
 
1014
;;        movzx   ebx,byte[ebx]
-
 
1015
;;        movzx   edx,byte[edx]
-
 
1016
;;     end if
-
 
1017
	sub	edx,ebx
974
	sub	edx,ebx
1018
     ;  eax - horizontal sub
975
     ;  eax - horizontal sub
1019
     ;  edx - vertical   sub
976
     ;  edx - vertical   sub
1020
;;    if Ext=NON
977
if Ext = NON
1021
	mov	ebx,.cex       ;.cex - current env map X
978
	mov	ebx,.cex       ;.cex - current env map X
1022
	sar	ebx,ROUND
979
	sar	ebx,ROUND
1023
	add	eax,ebx        ; eax - modified x coord
980
	add	eax,ebx        ; eax - modified x coord
Line 1024... Line 981...
1024
 
981
 
1025
	mov	ebx,.cey       ;.cey - current  env map y
982
	mov	ebx,.cey       ;.cey - current  env map y
1026
	sar	ebx,ROUND
983
	sar	ebx,ROUND
1027
	add	edx,ebx        ; edx - modified y coord
984
	add	edx,ebx        ; edx - modified y coord
1028
;;    else
985
else
1029
;;        movq    mm5,mm1        ; mm5 - copy of cur env coords
986
	movq	mm6,mm1        ; mm5 - copy of cur env coords
1030
;;        psrad   mm5,ROUND
987
	psrld	mm6,ROUND
1031
;;        movq    qword[.temp1],mm5
-
 
1032
;;        add     eax,dword [.temp1]
-
 
1033
;;        add     edx,dword [.temp1+4]
988
	movd	ebx,mm6
1034
;;      ;  movd    ebx,mm5
989
	psrlq	mm6,32
1035
;;      ;  add     eax,ebx
-
 
1036
;;      ;  psrlq   mm5,32
990
	add	eax,ebx
1037
;;      ;  movd    ebx,mm5
991
	movd	ebx,mm6
1038
      ;  add     edx,ebx
992
	add	edx,ebx
1039
;;    end if
-
 
1040
 
993
end if
1041
	or	eax,eax
994
	or	eax,eax
1042
	jl	.black
995
	jl	.black
1043
	cmp	eax,TEX_X
996
	cmp	eax,TEX_X
1044
	jg	.black
997
	jg	.black
Line 1047... Line 1000...
1047
	cmp	edx,TEX_Y
1000
	cmp	edx,TEX_Y
1048
	jg	.black
1001
	jg	.black
Line 1049... Line 1002...
1049
 
1002
 
1050
	shl	edx,TEX_SHIFT
1003
	shl	edx,TEX_SHIFT
1051
	add	edx,eax
1004
	add	edx,eax
1052
	lea	edx,[edx*3]
1005
	lea	esi,[edx*3]
1053
	add	edx,.emap
1006
	add	esi,.emap
1054
	mov	eax,dword[edx]
1007
	lodsd
1055
	jmp	.put_pixel
1008
	jmp	.put_pixel
1056
     .black:
1009
     .black:
1057
	xor	eax,eax
1010
	xor	eax,eax
1058
     .put_pixel:
1011
     .put_pixel:
Line 1064... Line 1017...
1064
	jmp	.no_skip
1017
	jmp	.no_skip
1065
     .skip:
1018
     .skip:
1066
	add	edi,3
1019
	add	edi,3
1067
     .no_skip:
1020
     .no_skip:
1068
	add	.czbuff,4
1021
	add	.czbuff,4
-
 
1022
 
1069
;;   if Ext = NON
1023
;if Ext = SSE2
-
 
1024
;        movups  xmm0,.cey
-
 
1025
;        paddd   xmm0,xmm1
-
 
1026
;        movups  .cey,xmm0
-
 
1027
;
-
 
1028
;end if
1070
if Ext >= MMX
1029
if Ext >= MMX
1071
	movq	mm0,.cby
-
 
1072
	movq	mm1,.cey
-
 
1073
	paddd	mm0,.dby
1030
	paddd	mm0,mm2
1074
	paddd	mm1,.dey
1031
	paddd	mm1,mm3
1075
	movq	.cby,mm0
-
 
1076
	movq	.cey,mm1
1032
end if
1077
else
1033
 
-
 
1034
if Ext=NON
1078
	mov	eax,.dbx
1035
	mov	eax,.dbx
1079
	add	.cbx,eax
1036
	add	.cbx,eax
1080
	mov	eax,.dby
1037
	mov	eax,.dby
1081
	add	.cby,eax
1038
	add	.cby,eax
1082
	mov	eax,.dex
1039
	mov	eax,.dex
1083
	add	.cex,eax
1040
	add	.cex,eax
1084
	mov	eax,.dey
1041
	mov	eax,.dey
1085
	add	.cey,eax
1042
	add	.cey,eax
1086
end if
1043
end if
1087
;;    else
-
 
1088
;;        paddd   mm0,mm2
-
 
1089
;;        paddd   mm1,mm3
-
 
1090
;;    end if
-
 
1091
	mov	eax,.dz
1044
	mov	eax,.dz
1092
	add	.cz,eax
1045
	add	.cz,eax
Line 1093... Line 1046...
1093
 
1046
 
1094
	dec	ecx
1047
	dec	ecx