📄 matvectorrect.fp
字号:
!!FP1.0
#Date:2003/10/23
#try to compute General Matrix - Vector Multiplication Just For TEXRECT
#So this fragment program is shorter than TEX2D
# Vector X ----TEX0
# Vector result ----TEX1
# Matrix Ai ----TEX2(Diagonal Data)
#TexPARA.X = Width;
#TexPARA.Y = 1.0/Width;
#TexPARA.Z = DimensionS;
#TexPARA.W = 1.0/DimensionS;
DECLARE TexPARA ={0, 0, 0, 0};
#PassNo = I
DECLARE PassNo ={0, 0, 0, 0};
#Find the correct texel pos in tex0---X
#Tex0.y*Width + Tex0.x + i
FLR R1, f[WPOS];
MAD R0.x, R1.y, TexPARA.x, R1.x;
#if R0.x = Tex0.y*Width + Tex0.x >= DimensionS, then kill this fragment
SUBC R1.x, R0.x, TexPARA.z;
KIL GE.x;
ADD R0.x, R0.x, PassNo.x;
# a = (Tex0.y*Width + Tex0.x + i)%DimensionS -->R0.x
MUL R1.x, R0.x, TexPARA.w;
FLR R1.x, R1.x;
MUL R1.x, R1.x, TexPARA.z;
SUB R0.x, R0.x, R1.x;
#Integer m = a/Width --->R1.y
#Integer n = a%Width --->R1.x
MUL R1.y, R0.x, TexPARA.y;
FLR R1.y, R1.y;
MUL R1.x, R1.y, TexPARA.x;
SUB R1.x, R0.x, R1.x;
#Fetch Current Texture Position
#x
TEX R0, R1, TEX0, RECT;
#Ai
TEX R1, f[WPOS], TEX2, RECT;
#previous
TEX R2, f[WPOS], TEX1, RECT;
#Multiply these two elements
MAD o[COLR], R0, R1, R2;
#ADD o[COLR], R0, R2;
END
#instuctions 17
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -