]> Chaos Git - corbenik/ctrulib.git/commitdiff
GX : GX_SetTextureCopy
authorsmea <smealum@gmail.com>
Tue, 11 Mar 2014 18:08:45 +0000 (19:08 +0100)
committersmea <smealum@gmail.com>
Tue, 11 Mar 2014 18:08:45 +0000 (19:08 +0100)
gpu/source/test.vsh [new file with mode: 0644]
libctru/include/ctr/GX.h
libctru/source/GX.c
libctru/source/SHDR.c

diff --git a/gpu/source/test.vsh b/gpu/source/test.vsh
new file mode 100644 (file)
index 0000000..e674bcd
--- /dev/null
@@ -0,0 +1,43 @@
+; setup constants
+       .const 5, 0.0, 1.0, 2.0, 3.0
+
+; setup outmap
+       .out o0, result.position
+       .out o1, result.color
+       .out o2, result.texcoord0
+       .out o3, result.texcoord1
+       .out o4, result.texcoord2
+
+; setup uniform map (not required)
+       .uniform 0x10, 0x13, mdlvMtx
+       .uniform 0x14, 0x17, projMtx
+
+;code
+       main:
+               ; result.pos = mdlvMtx * in.pos
+               dp4 d40, d40, d00 (0x0)
+               dp4 d40, d41, d00 (0x1)
+               dp4 d40, d42, d00 (0x2)
+               mov d40, d25 (0x4)
+               ; result.pos = projMtx * in.pos
+               dp4 d00, d44, d40 (0x0)
+               dp4 d00, d45, d40 (0x1)
+               dp4 d00, d46, d40 (0x2)
+               dp4 d00, d47, d40 (0x3)
+               ; result.color = in.pos
+               mov d04, d25 (0x5)
+               ; result.texcoord = const
+               mov d08, d25 (0x5)
+               mov d0C, d25 (0x5)
+               mov d10, d25 (0x5)
+               flush
+               end
+       endmain:
+
+;operand descriptors
+       .opdesc x___, xyzw, xyzw ; 0x0
+       .opdesc _y__, xyzw, xyzw ; 0x1
+       .opdesc __z_, xyzw, xyzw ; 0x2
+       .opdesc ___w, xyzw, xyzw ; 0x3
+       .opdesc ___w, yyyy, xyzw ; 0x4
+       .opdesc xyzw, xyzw, xyzw ; 0x5
index 35b04285449a9f43789b3b3eaab4390b49e3deab..45e3e3cea313834252599146667244a805dd63ff 100644 (file)
@@ -7,6 +7,7 @@ Result GX_RequestDma(u32* gxbuf, u32* src, u32* dst, u32 length);
 Result GX_SetCommandList_Last(u32* gxbuf, u32* buf0a, u32 buf0s, u8 flags);
 Result GX_SetMemoryFill(u32* gxbuf, u32* buf0a, u32 buf0s, u32 buf0d, u16 width0, u32* buf1a, u32 buf1s, u32 buf1d, u16 width1);
 Result GX_SetDisplayTransfer(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags);
+Result GX_SetTextureCopy(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags);
 Result GX_SetCommandList_First(u32* gxbuf, u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s);
 
 #endif
index 18ac5dd89a95dd028cc27ce02836a61d6329fed1..1767b1f050175156fdc89884efce45dd8e3654a3 100644 (file)
@@ -61,6 +61,21 @@ Result GX_SetDisplayTransfer(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32
        return GSPGPU_submitGxCommand(gxbuf, gxCommand, NULL);
 }
 
+Result GX_SetTextureCopy(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags)
+{
+       u32 gxCommand[0x8];
+       gxCommand[0]=0x04; //CommandID
+       gxCommand[1]=(u32)inadr;
+       gxCommand[2]=(u32)outadr;
+       gxCommand[3]=size;
+       gxCommand[4]=indim;
+       gxCommand[5]=outdim;
+       gxCommand[6]=flags;
+       gxCommand[7]=0x0;
+
+       return GSPGPU_submitGxCommand(gxbuf, gxCommand, NULL);
+}
+
 Result GX_SetCommandList_First(u32* gxbuf, u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s)
 {
        u32 gxCommand[0x8];
index 1b04e76a112ab1c4ad3b488a6f83d538acdbd65a..e04d5d35244f6fa256ffbdb3ade28ea349230c4d 100644 (file)
@@ -53,12 +53,12 @@ DVLB_s* SHDR_ParseSHBIN(u32* shbinData, u32 shbinSize)
 }
 
 //hm
-static inline minu8(u8 a, u8 b)
+static inline u8 minu8(u8 a, u8 b)
 {
        if(a<b)return a;
        return b;
 }
-static inline maxu8(u8 a, u8 b)
+static inline u8 maxu8(u8 a, u8 b)
 {
        if(a<b)return b;
        return a;