diff --git a/gpu/source/test.vsh b/gpu/source/test.vsh new file mode 100644 index 0000000..e674bcd --- /dev/null +++ b/gpu/source/test.vsh @@ -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 diff --git a/libctru/include/ctr/GX.h b/libctru/include/ctr/GX.h index 35b0428..45e3e3c 100644 --- a/libctru/include/ctr/GX.h +++ b/libctru/include/ctr/GX.h @@ -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 diff --git a/libctru/source/GX.c b/libctru/source/GX.c index 18ac5dd..1767b1f 100644 --- a/libctru/source/GX.c +++ b/libctru/source/GX.c @@ -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]; diff --git a/libctru/source/SHDR.c b/libctru/source/SHDR.c index 1b04e76..e04d5d3 100644 --- a/libctru/source/SHDR.c +++ b/libctru/source/SHDR.c @@ -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