From 2aae159782c34a6fb14a9d864616ccd70c569358 Mon Sep 17 00:00:00 2001 From: smea Date: Tue, 27 May 2014 20:47:53 +0200 Subject: [PATCH] minifix test.vsh --- gpu/Makefile | 2 +- gpu/source/test.vsh | 50 +++++++++++++++++++++++---------------- libctru/include/ctr/GSP.h | 2 ++ libctru/include/ctr/srv.h | 2 +- libctru/source/GSP.c | 17 +++++++++++++ libctru/source/srv.c | 4 ++-- 6 files changed, 52 insertions(+), 25 deletions(-) diff --git a/gpu/Makefile b/gpu/Makefile index 6591a65..2a72d5a 100644 --- a/gpu/Makefile +++ b/gpu/Makefile @@ -44,7 +44,7 @@ $(PROJECTNAME).bin: $(PROJECTNAME).elf $(PROJECTNAME).elf: $(SHBINFILES) $(OFILES) # $(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(filter-out build/crt0.o, $(OFILES)) -lctru -lc -lgcc - $(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(filter-out build/crt0.o, $(OFILES)) -g -lctru -lm -lc -lg + $(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(filter-out build/crt0.o, $(OFILES)) -g -lctru -lm clean: @rm -f build/*.o build/*.d diff --git a/gpu/source/test.vsh b/gpu/source/test.vsh index 4e83c5c..8501c47 100644 --- a/gpu/source/test.vsh +++ b/gpu/source/test.vsh @@ -1,5 +1,7 @@ +; make sure you update aemstro_as for this (27/05/14) + ; setup constants - .const 5, 0.0, 1.0, 2.0, 3.0 + .const 5, 0.0, 0.0, -0.99, 1.0 ; setup outmap .out o0, result.position @@ -14,22 +16,28 @@ ;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.texcoord = const - mov d08, d25 (0x5) - mov d0C, d25 (0x5) - mov d10, d25 (0x5) - ; result.color = in.pos - mov d04, d00 (0x5) + mov d1A, d00 (0x4) + mov d1A, d25 (0x3) + ; tempreg = mdlvMtx * in.pos + dp4 d10, d40, d1A (0x0) + dp4 d10, d41, d1A (0x1) + dp4 d10, d42, d1A (0x2) + mov d10, d25 (0x3) + ; result.pos = projMtx * tempreg + dp4 d00, d20, d10 (0x0) + dp4 d00, d21, d10 (0x1) + dp4 d00, d22, d10 (0x2) + dp4 d00, d23, d10 (0x3) + ; result.texcoord = in.texcoord + mov d02, d01 (0x5) + mov d03, d25 (0x7) + mov d04, d25 (0x7) + ; result.color = crappy lighting + dp3 d1A, d40, d02 (0x0) + dp3 d1A, d41, d02 (0x1) + dp3 d1A, d42, d02 (0x2) + dp4 d01, d00, d1A (0x6) + mov d01, d25 (0x3) flush end endmain: @@ -39,8 +47,8 @@ .opdesc _y__, xyzw, xyzw ; 0x1 .opdesc __z_, xyzw, xyzw ; 0x2 .opdesc ___w, xyzw, xyzw ; 0x3 - .opdesc ___w, wwww, wwww ; 0x4 + .opdesc xyz_, xyzw, xyzw ; 0x4 .opdesc xyzw, xyzw, xyzw ; 0x5 - .opdesc __z_, xyzw, xyzw ; 0x6 - .opdesc ___w, xyzw, xyzw ; 0x7 - .opdesc xyzw, xyzw, xyzw ; 0x8 + .opdesc xyz_, xyzw, xyzw ; 0x6 + .opdesc xyzw, yyyw, xyzw ; 0x7 + .opdesc xyzw, wwww, wwww ; 0x8 diff --git a/libctru/include/ctr/GSP.h b/libctru/include/ctr/GSP.h index b38bd23..166fedb 100644 --- a/libctru/include/ctr/GSP.h +++ b/libctru/include/ctr/GSP.h @@ -10,12 +10,14 @@ Result GSPGPU_AcquireRight(Handle *handle, u8 flags); Result GSPGPU_ReleaseRight(Handle *handle); Result GSPGPU_SetLcdForceBlack(Handle *handle, u8 flags); Result GSPGPU_FlushDataCache(Handle *handle, u8* adr, u32 size); +Result GSPGPU_InvalidateDataCache(Handle* handle, u8* adr, u32 size); Result GSPGPU_WriteHWRegs(Handle *handle, u32 regAddr, u32* data, u8 size); Result GSPGPU_WriteHWRegsWithMask(Handle* handle, u32 regAddr, u32* data, u8 datasize, u32* maskdata, u8 masksize); Result GSPGPU_ReadHWRegs(Handle *handle, u32 regAddr, u32* data, u8 size); Result GSPGPU_RegisterInterruptRelayQueue(Handle *handle, Handle eventHandle, u32 flags, Handle* outMemHandle, u8* threadID); Result GSPGPU_UnregisterInterruptRelayQueue(Handle* handle); Result GSPGPU_TriggerCmdReqQueue(Handle *handle); + Result GSPGPU_submitGxCommand(u32* sharedGspCmdBuf, u32 gxCommand[0x8], Handle* handle); #endif diff --git a/libctru/include/ctr/srv.h b/libctru/include/ctr/srv.h index 2ff4aa7..43ae29f 100644 --- a/libctru/include/ctr/srv.h +++ b/libctru/include/ctr/srv.h @@ -3,7 +3,7 @@ Result initSrv(); Result exitSrv(); -Result srv_Initialize(Handle* handleptr); +Result srv_RegisterClient(Handle* handleptr); Result srv_getServiceHandle(Handle* handleptr, Handle* out, char* server); #endif diff --git a/libctru/source/GSP.c b/libctru/source/GSP.c index c71e107..fc4d886 100644 --- a/libctru/source/GSP.c +++ b/libctru/source/GSP.c @@ -78,6 +78,23 @@ Result GSPGPU_FlushDataCache(Handle* handle, u8* adr, u32 size) return cmdbuf[1]; } +Result GSPGPU_InvalidateDataCache(Handle* handle, u8* adr, u32 size) +{ + if(!handle)handle=&gspGpuHandle; + + u32* cmdbuf=getThreadCommandBuffer(); + cmdbuf[0]=0x90082; //request header code + cmdbuf[1]=(u32)adr; + cmdbuf[2]=size; + cmdbuf[3]=0x0; + cmdbuf[4]=0xffff8001; + + Result ret=0; + if((ret=svc_sendSyncRequest(*handle)))return ret; + + return cmdbuf[1]; +} + Result GSPGPU_WriteHWRegs(Handle* handle, u32 regAddr, u32* data, u8 size) { if(!handle)handle=&gspGpuHandle; diff --git a/libctru/source/srv.c b/libctru/source/srv.c index cdc6af9..cadf5f8 100644 --- a/libctru/source/srv.c +++ b/libctru/source/srv.c @@ -11,7 +11,7 @@ Result initSrv() { Result ret=0; if(svc_connectToPort(&srvHandle, "srv:"))return ret; - return srv_Initialize(&srvHandle); + return srv_RegisterClient(&srvHandle); } Result exitSrv() @@ -19,7 +19,7 @@ Result exitSrv() if(srvHandle)svc_closeHandle(srvHandle); } -Result srv_Initialize(Handle* handleptr) +Result srv_RegisterClient(Handle* handleptr) { if(!handleptr)handleptr=&srvHandle; u32* cmdbuf=getThreadCommandBuffer();