work on ps2test
This commit is contained in:
@ -11,34 +11,15 @@
|
||||
.equ outBuf2, (outBuf1+outSize)
|
||||
|
||||
.equ lightMat, 0x3d0
|
||||
.equ lightDir, 0x3d4
|
||||
.equ ambientLight, 0x3d4
|
||||
.equ lightDir, 0x3d5
|
||||
|
||||
.equ matrix, 0x3f0
|
||||
.equ XYZScale, 0x3f7
|
||||
.equ XYZOffset, 0x3f8
|
||||
.equ gifTag, 0x3fa
|
||||
.equ matColor, 0x3fb
|
||||
.equ ambientLight, 0x3fd
|
||||
|
||||
/* This is the the projection matrix we start with:
|
||||
* 1/2w 0 ox/2w + 1/2 -ox/2w
|
||||
* 0 -1/2h -oy/2h + 1/2 oy/2h
|
||||
* 0 0 1 0
|
||||
* 0 0 1 0
|
||||
* To get rid of the +1/2 in the combined matrix we
|
||||
* subtract the z-row/2 from the x- and y-rows.
|
||||
*
|
||||
* The z-row is then set to [0 0 0 1] such that multiplication
|
||||
* by XYZscale gives [0 0 0 zScale]. After perspective division
|
||||
* and addition of XYZoffset we then get zScale/w + zShift for z.
|
||||
*
|
||||
* XYZScale scales xy to the resolution and z by zScale.
|
||||
* XYZOffset translates xy to the GS coordinate system (where
|
||||
* [2048, 2048] is the center of the frame buffer) and add zShift to z.
|
||||
*/
|
||||
|
||||
; constant:
|
||||
; VF28-VF31 transformation matrix
|
||||
; VF25 XYZ offset
|
||||
.equ surfProps, 0x3fc
|
||||
|
||||
|
||||
.balign 16,0
|
||||
@ -47,23 +28,7 @@ DMAret *
|
||||
MPG 0, *
|
||||
.vu
|
||||
Start:
|
||||
SUB.z VF28, VF28, VF28 LOI 0.5 ; right.z = 0
|
||||
SUB.z VF29, VF29, VF29 LQ VF28, matrix(VI00) ; up.z = 0 - load matrix
|
||||
SUB.z VF30, VF30, VF30 LQ VF29, matrix+1(VI00) ; at.z = 0 - load matrix
|
||||
ADDw.z VF31, VF00, VF00 LQ VF30, matrix+2(VI00) ; at.z = 1 - load matrix
|
||||
NOP LQ VF31, matrix+3(VI00) ; - load matrix
|
||||
MULi.w VF20, VF28, I LQ.xyz VF01, XYZScale(VI00) ; fix matrix - load scale
|
||||
MULi.w VF21, VF29, I NOP ; fix matrix
|
||||
MULi.w VF22, VF30, I NOP ; fix matrix
|
||||
MULi.w VF23, VF31, I NOP ; fix matrix
|
||||
SUBw.xy VF28, VF28, VF20 NOP ; fix matrix
|
||||
SUBw.xy VF29, VF29, VF21 NOP ; fix matrix
|
||||
SUBw.xy VF30, VF30, VF22 NOP ; fix matrix
|
||||
SUBw.xy VF31, VF31, VF23 NOP ; fix matrix
|
||||
MUL.xy VF28, VF28, VF01 LQ.xyz VF25, XYZOffset(VI00) ; scale matrix
|
||||
MUL.xy VF29, VF29, VF01 IADDIU VI12, VI00, outBuf1 ; scale matrix
|
||||
MUL.xy VF30, VF30, VF01 IADDIU VI13, VI00, outBuf2 ; scale matrix
|
||||
MUL.xyz VF31, VF31, VF01 NOP ; scale matrix
|
||||
#include "setup_persp.vu"
|
||||
Cnt:
|
||||
NOP XTOP VI02 ; input pointer
|
||||
NOP LQ VF01, gifTag(VI00)
|
||||
|
@ -1,94 +1,94 @@
|
||||
; Ambient light:
|
||||
NOP LQ VF26, ambientLight(VI00)
|
||||
NOP XITOP VI01
|
||||
NOP IADDIU VI03, VI12, 2
|
||||
NOP LQ VF26, ambientLight(VI00)
|
||||
NOP XITOP VI01
|
||||
NOP IADDIU VI03, VI12, 2
|
||||
Ambloop:
|
||||
NOP LQ VF03, 0(VI03) ; output color
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
ITOF0 VF03, VF03 NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
ADD VF03, VF03, VF26 NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
FTOI0 VF03, VF03 NOP
|
||||
NOP IADDI VI01, VI01, -1
|
||||
NOP IADDIU VI03, VI03, numOutAttribs
|
||||
NOP IBNE VI01, VI00, Ambloop
|
||||
NOP SQ VF03, -numOutAttribs(VI03)
|
||||
NOP LQ VF03, 0(VI03) ; output color
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
ITOF0 VF03, VF03 NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
ADD.xyz VF03, VF03, VF26 NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
FTOI0 VF03, VF03 NOP
|
||||
NOP IADDI VI01, VI01, -1
|
||||
NOP IADDIU VI03, VI03, numOutAttribs
|
||||
NOP IBNE VI01, VI00, Ambloop
|
||||
NOP SQ VF03, -numOutAttribs(VI03)
|
||||
; end amblight
|
||||
|
||||
; Direct Light
|
||||
NOP LQ VF26, lightDir(VI00)
|
||||
NOP XITOP VI01
|
||||
NOP XTOP VI02
|
||||
NOP IADDIU VI03, VI12, 2
|
||||
NOP LQ VF26, lightDir(VI00)
|
||||
NOP XITOP VI01
|
||||
NOP XTOP VI02
|
||||
NOP IADDIU VI03, VI12, 2
|
||||
SUB.xyz VF26, VF00, VF26 NOP
|
||||
Dirloop:
|
||||
NOP LQ VF01, 3(VI02); ; normal
|
||||
NOP LQ VF02, 0(VI03); ; output color
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
MUL VF03, VF01, VF26 NOP
|
||||
ITOF0 VF02, VF02 NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP LQ VF01, 3(VI02); ; normal
|
||||
NOP LQ VF02, 0(VI03); ; output color
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
MUL VF03, VF01, VF26 NOP
|
||||
ITOF0 VF02, VF02 NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
ADDy.x VF03, VF03, VF03y NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
ADDz.x VF03, VF03, VF03z NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
MAX.x VF03, VF00, VF03 NOP ; clamp to 0
|
||||
NOP[I] LOI 255
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
MULi.x VF03, VF03, I NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
MAX.x VF03, VF00, VF03 NOP ; clamp to 0
|
||||
NOP[I] LOI 255
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
MULi.x VF03, VF03, I NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
ADDx.xyz VF02, VF02, VF03x NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
FTOI0 VF02, VF02 NOP
|
||||
NOP IADDI VI01, VI01, -1
|
||||
NOP IADDIU VI02, VI02, numInAttribs
|
||||
NOP IADDIU VI03, VI03, numOutAttribs
|
||||
NOP IBNE VI01, VI00, Dirloop
|
||||
NOP SQ VF02, -numOutAttribs(VI03)
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
FTOI0 VF02, VF02 NOP
|
||||
NOP IADDI VI01, VI01, -1
|
||||
NOP IADDIU VI02, VI02, numInAttribs
|
||||
NOP IADDIU VI03, VI03, numOutAttribs
|
||||
NOP IBNE VI01, VI00, Dirloop
|
||||
NOP SQ VF02, -numOutAttribs(VI03)
|
||||
; end dirlight
|
||||
|
||||
; Material color and clamp
|
||||
NOP LQ VF27, matColor(VI00)
|
||||
NOP XITOP VI01
|
||||
NOP IADDIU VI03, VI12, 2
|
||||
NOP LQ VF27, matColor(VI00)
|
||||
NOP XITOP VI01
|
||||
NOP IADDIU VI03, VI12, 2
|
||||
Colorloop:
|
||||
NOP LQ VF03, 0(VI03)
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
ITOF0 VF03, VF03 NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
;; MUL VF03, VF03, VF27 NOP
|
||||
NOP[I] LOI 255
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
MINIi VF03, VF03, I NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
FTOI0 VF03, VF03 NOP
|
||||
NOP IADDI VI01, VI01, -1
|
||||
NOP IADDIU VI03, VI03, numOutAttribs
|
||||
NOP IBNE VI01, VI00, Colorloop
|
||||
NOP SQ VF03, -numOutAttribs(VI03)
|
||||
NOP LQ VF03, 0(VI03)
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
ITOF0 VF03, VF03 NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
MUL VF03, VF03, VF27 NOP
|
||||
NOP[I] LOI 255
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
MINIi VF03, VF03, I NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
NOP NOP
|
||||
FTOI0 VF03, VF03 NOP
|
||||
NOP IADDI VI01, VI01, -1
|
||||
NOP IADDIU VI03, VI03, numOutAttribs
|
||||
NOP IBNE VI01, VI00, Colorloop
|
||||
NOP SQ VF03, -numOutAttribs(VI03)
|
||||
; end material color
|
||||
|
39
tools/ps2test/vu/setup_persp.vu
Executable file
39
tools/ps2test/vu/setup_persp.vu
Executable file
@ -0,0 +1,39 @@
|
||||
/* This is the the projection matrix we start with:
|
||||
* 1/2w 0 ox/2w + 1/2 -ox/2w
|
||||
* 0 -1/2h -oy/2h + 1/2 oy/2h
|
||||
* 0 0 1 0
|
||||
* 0 0 1 0
|
||||
* To get rid of the +1/2 in the combined matrix we
|
||||
* subtract the z-row/2 from the x- and y-rows.
|
||||
*
|
||||
* The z-row is then set to [0 0 0 1] such that multiplication
|
||||
* by XYZscale gives [0 0 0 zScale]. After perspective division
|
||||
* and addition of XYZoffset we then get zScale/w + zShift for z.
|
||||
*
|
||||
* XYZScale scales xy to the resolution and z by zScale.
|
||||
* XYZOffset translates xy to the GS coordinate system (where
|
||||
* [2048, 2048] is the center of the frame buffer) and add zShift to z.
|
||||
*/
|
||||
|
||||
; constant:
|
||||
; VF28-VF31 transformation matrix
|
||||
; VF25 XYZ offset
|
||||
|
||||
|
||||
SUB.z VF28, VF28, VF28 LOI 0.5 ; right.z = 0
|
||||
SUB.z VF29, VF29, VF29 LQ VF28, matrix(VI00) ; up.z = 0 - load matrix
|
||||
SUB.z VF30, VF30, VF30 LQ VF29, matrix+1(VI00) ; at.z = 0 - load matrix
|
||||
ADDw.z VF31, VF00, VF00 LQ VF30, matrix+2(VI00) ; at.z = 1 - load matrix
|
||||
NOP LQ VF31, matrix+3(VI00) ; - load matrix
|
||||
MULi.w VF20, VF28, I LQ.xyz VF01, XYZScale(VI00) ; fix matrix - load scale
|
||||
MULi.w VF21, VF29, I NOP ; fix matrix
|
||||
MULi.w VF22, VF30, I NOP ; fix matrix
|
||||
MULi.w VF23, VF31, I NOP ; fix matrix
|
||||
SUBw.xy VF28, VF28, VF20 NOP ; fix matrix
|
||||
SUBw.xy VF29, VF29, VF21 NOP ; fix matrix
|
||||
SUBw.xy VF30, VF30, VF22 NOP ; fix matrix
|
||||
SUBw.xy VF31, VF31, VF23 NOP ; fix matrix
|
||||
MUL.xy VF28, VF28, VF01 LQ.xyz VF25, XYZOffset(VI00) ; scale matrix
|
||||
MUL.xy VF29, VF29, VF01 IADDIU VI12, VI00, outBuf1 ; scale matrix
|
||||
MUL.xy VF30, VF30, VF01 IADDIU VI13, VI00, outBuf2 ; scale matrix
|
||||
MUL.xyz VF31, VF31, VF01 NOP ; scale matrix
|
@ -11,34 +11,15 @@
|
||||
.equ outBuf2, (outBuf1+outSize)
|
||||
|
||||
.equ lightMat, 0x3d0
|
||||
.equ lightDir, 0x3d4
|
||||
.equ ambientLight, 0x3d4
|
||||
.equ lightDir, 0x3d5
|
||||
|
||||
.equ matrix, 0x3f0
|
||||
.equ XYZScale, 0x3f7
|
||||
.equ XYZOffset, 0x3f8
|
||||
.equ gifTag, 0x3fa
|
||||
.equ matColor, 0x3fb
|
||||
.equ ambientLight, 0x3fd
|
||||
|
||||
/* This is the the projection matrix we start with:
|
||||
* 1/2w 0 ox/2w + 1/2 -ox/2w
|
||||
* 0 -1/2h -oy/2h + 1/2 oy/2h
|
||||
* 0 0 1 0
|
||||
* 0 0 1 0
|
||||
* To get rid of the +1/2 in the combined matrix we
|
||||
* subtract the z-row/2 from the x- and y-rows.
|
||||
*
|
||||
* The z-row is then set to [0 0 0 1] such that multiplication
|
||||
* by XYZscale gives [0 0 0 zScale]. After perspective division
|
||||
* and addition of XYZoffset we then get zScale/w + zShift for z.
|
||||
*
|
||||
* XYZScale scales xy to the resolution and z by zScale.
|
||||
* XYZOffset translates xy to the GS coordinate system (where
|
||||
* [2048, 2048] is the center of the frame buffer) and add zShift to z.
|
||||
*/
|
||||
|
||||
; constant:
|
||||
; VF28-VF31 transformation matrix
|
||||
; VF25 XYZ offset
|
||||
.equ surfProps, 0x3fc
|
||||
|
||||
|
||||
.balign 16,0
|
||||
@ -47,23 +28,7 @@ DMAret *
|
||||
MPG 0, *
|
||||
.vu
|
||||
Start:
|
||||
SUB.z VF28, VF28, VF28 LOI 0.5 ; right.z = 0
|
||||
SUB.z VF29, VF29, VF29 LQ VF28, matrix(VI00) ; up.z = 0 - load matrix
|
||||
SUB.z VF30, VF30, VF30 LQ VF29, matrix+1(VI00) ; at.z = 0 - load matrix
|
||||
ADDw.z VF31, VF00, VF00 LQ VF30, matrix+2(VI00) ; at.z = 1 - load matrix
|
||||
NOP LQ VF31, matrix+3(VI00) ; - load matrix
|
||||
MULi.w VF20, VF28, I LQ.xyz VF01, XYZScale(VI00) ; fix matrix - load scale
|
||||
MULi.w VF21, VF29, I NOP ; fix matrix
|
||||
MULi.w VF22, VF30, I NOP ; fix matrix
|
||||
MULi.w VF23, VF31, I NOP ; fix matrix
|
||||
SUBw.xy VF28, VF28, VF20 NOP ; fix matrix
|
||||
SUBw.xy VF29, VF29, VF21 NOP ; fix matrix
|
||||
SUBw.xy VF30, VF30, VF22 NOP ; fix matrix
|
||||
SUBw.xy VF31, VF31, VF23 NOP ; fix matrix
|
||||
MUL.xy VF28, VF28, VF01 LQ.xyz VF25, XYZOffset(VI00) ; scale matrix
|
||||
MUL.xy VF29, VF29, VF01 IADDIU VI12, VI00, outBuf1 ; scale matrix
|
||||
MUL.xy VF30, VF30, VF01 IADDIU VI13, VI00, outBuf2 ; scale matrix
|
||||
MUL.xyz VF31, VF31, VF01 NOP ; scale matrix
|
||||
#include "setup_persp.vu"
|
||||
Cnt:
|
||||
NOP XTOP VI02 ; input pointer
|
||||
NOP LQ VF01, gifTag(VI00)
|
||||
|
@ -1,98 +0,0 @@
|
||||
.data
|
||||
.global MyDmaPacket
|
||||
.global vuLightMat
|
||||
.global vuMat
|
||||
.global vuXYZScale
|
||||
.global vuXYZOffset
|
||||
.global vuOffset
|
||||
.global vuGIFtag
|
||||
.global vuMatcolor
|
||||
.global vuSurfProps
|
||||
.global vuAmbLight
|
||||
.global mpgCall
|
||||
.global textureCall
|
||||
.global geometryCall
|
||||
|
||||
.align 4
|
||||
|
||||
MyDmaPacket:
|
||||
DMAcnt *
|
||||
.EndDmaData
|
||||
|
||||
mpgCall:
|
||||
DMAcall *, 0 ;vuProg
|
||||
.EndDmaData
|
||||
|
||||
/*
|
||||
#define vuSDLightOffset 0x3d0
|
||||
#define vuSDBlockLow 0x3c3
|
||||
#define vuSDBlockHigh 0x3f0
|
||||
#define vuSDmat0 vuSDBlockHigh
|
||||
#define vuSDmat1 vuSDBlockHigh+1
|
||||
#define vuSDmat2 vuSDBlockHigh+2
|
||||
#define vuSDmat3 vuSDBlockHigh+3
|
||||
#define vuSDnearClip vuSDBlockHigh+4
|
||||
#define vuSDfarClip vuSDBlockHigh+5
|
||||
#define vuSDxMaxyMax vuSDBlockHigh+6
|
||||
#define vuSDcamWcamHzScale vuSDBlockHigh+7
|
||||
#define vuSDoffXoffYzShift vuSDBlockHigh+8
|
||||
#define vuSDrealOffset vuSDBlockHigh+9
|
||||
#define vuSDgifTag vuSDBlockHigh+10
|
||||
#define vuSDcolScale vuSDBlockHigh+11
|
||||
#define vuSDsurfProps vuSDBlockHigh+12
|
||||
#define vuSDpingPongAddr vuSDBlockHigh+13
|
||||
#define vuSDpingPongCount vuSDBlockHigh+14
|
||||
#define vuSDClipvec1 vuSDBlockHigh+13
|
||||
#define vuSDClipvec2 vuSDBlockHigh+14
|
||||
#define vuSDVUSwitch vuSDBlockHigh+15
|
||||
*/
|
||||
|
||||
DMAcnt *
|
||||
UNPACK 4, 4, V4_32, 0x3d0, *
|
||||
vuLightMat:
|
||||
.float 1.0, 0.0, 0.0, 0.0
|
||||
.float 0.0, 1.0, 0.0, 0.0
|
||||
.float 0.0, 0.0, 1.0, 0.0
|
||||
.float 0.0, 0.0, 0.0, 1.0
|
||||
lightDir:
|
||||
.float 0.5, -0.5, -0.70710, 0.0
|
||||
.EndUnpack
|
||||
|
||||
UNPACK 4, 4, V4_32, 0x3f0, *
|
||||
vuMat:
|
||||
.float 0.0, 0.0, 0.0, 0.0
|
||||
.float 0.0, 0.0, 0.0, 0.0
|
||||
.float 0.0, 0.0, 0.0, 0.0
|
||||
.float 0.0, 0.0, 0.0, 0.0
|
||||
.EndUnpack
|
||||
|
||||
UNPACK 4, 4, V4_32, 0x3f7, *
|
||||
vuXYZScale:
|
||||
.float 0.0, 0.0, 0.0, 0.0
|
||||
vuXYZOffset:
|
||||
.float 0.0, 0.0, 0.0, 0.0
|
||||
vuOffset:
|
||||
.float 0.0, 0.0, 0.0, 0.0
|
||||
vuGIFtag:
|
||||
.int 0x00008000, 0x3005C000, 0x0000000412, 0x00000000
|
||||
vuMatcolor:
|
||||
.float 1.0, 1.0, 1.0, 0.5
|
||||
vuSurfProps:
|
||||
.float 1.0, 1.0, 1.0, 1.0
|
||||
vuAmbLight:
|
||||
.float 0, 0, 0, 0
|
||||
.EndUnpack
|
||||
.EndDmaData
|
||||
|
||||
;;textureCall:
|
||||
;;DMAcall *, 0
|
||||
;;.EndDmaData
|
||||
|
||||
geometryCall:
|
||||
DMAcall *, 0 ;vuGeometry
|
||||
BASE 0
|
||||
OFFSET 0x0
|
||||
.EndDmaData
|
||||
|
||||
DMAend
|
||||
|
Reference in New Issue
Block a user