Skip to content

Commit

Permalink
gspgpu: fix const correctness issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TuxSH authored and fincs committed Dec 19, 2020
1 parent 02f5161 commit dcf8390
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions libctru/include/3ds/services/gspgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ GSPGPU_Event gspWaitForAnyEvent(void);
* @brief Submits a GX command.
* @param gxCommand GX command to execute.
*/
Result gspSubmitGxCommand(u32 gxCommand[0x8]);
Result gspSubmitGxCommand(const u32 gxCommand[0x8]);

/**
* @brief Acquires GPU rights.
Expand All @@ -171,7 +171,7 @@ Result GSPGPU_ReleaseRight(void);
* @brief Retrieves display capture info.
* @param captureinfo Pointer to output capture info to.
*/
Result GSPGPU_ImportDisplayCaptureInfo(GSPGPU_CaptureInfo*captureinfo);
Result GSPGPU_ImportDisplayCaptureInfo(GSPGPU_CaptureInfo* captureinfo);

/// Saves the VRAM sys area.
Result GSPGPU_SaveVramSysArea(void);
Expand All @@ -193,7 +193,7 @@ Result GSPGPU_SetLcdForceBlack(u8 flags);
* @param screenid ID of the screen to update.
* @param framebufinfo Framebuffer information to update with.
*/
Result GSPGPU_SetBufferSwap(u32 screenid, GSPGPU_FramebufferInfo*framebufinfo);
Result GSPGPU_SetBufferSwap(u32 screenid, const GSPGPU_FramebufferInfo* framebufinfo);

/**
* @brief Flushes memory from the data cache.
Expand All @@ -215,7 +215,7 @@ Result GSPGPU_InvalidateDataCache(const void* adr, u32 size);
* @param data Data to write.
* @param size Size of the data to write.
*/
Result GSPGPU_WriteHWRegs(u32 regAddr, u32* data, u8 size);
Result GSPGPU_WriteHWRegs(u32 regAddr, const u32* data, u8 size);

/**
* @brief Writes to GPU hardware registers with a mask.
Expand All @@ -225,7 +225,7 @@ Result GSPGPU_WriteHWRegs(u32 regAddr, u32* data, u8 size);
* @param maskdata Data of the mask.
* @param masksize Size of the mask.
*/
Result GSPGPU_WriteHWRegsWithMask(u32 regAddr, u32* data, u8 datasize, u32* maskdata, u8 masksize);
Result GSPGPU_WriteHWRegsWithMask(u32 regAddr, const u32* data, u8 datasize, const u32* maskdata, u8 masksize);

/**
* @brief Reads from GPU hardware registers.
Expand Down
12 changes: 6 additions & 6 deletions libctru/source/services/gspgpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ GSPGPU_Event gspWaitForAnyEvent(void)
return (GSPGPU_Event)x;
}

static int popInterrupt()
static int popInterrupt(void)
{
int curEvt;
bool strexFailed;
Expand Down Expand Up @@ -379,7 +379,7 @@ void gspEventThreadMain(void *arg)
//essentially : get commandIndex and totalCommands, calculate offset of new command, copy command and update totalCommands
//use LDREX/STREX because this data may also be accessed by the GSP module and we don't want to break stuff
//(mostly, we could overwrite the buffer header with wrong data and make the GSP module reexecute old commands)
Result gspSubmitGxCommand(u32 gxCommand[0x8])
Result gspSubmitGxCommand(const u32 gxCommand[0x8])
{
u32* sharedGspCmdBuf = (u32*)((u8*)gspSharedMem + 0x800 + gspThreadId*0x200);
u32 cmdBufHeader = __ldrex((s32*)sharedGspCmdBuf);
Expand Down Expand Up @@ -410,7 +410,7 @@ Result gspSubmitGxCommand(u32 gxCommand[0x8])
return 0;
}

Result GSPGPU_WriteHWRegs(u32 regAddr, u32* data, u8 size)
Result GSPGPU_WriteHWRegs(u32 regAddr, const u32* data, u8 size)
{
if(size>0x80 || !data)return -1;

Expand All @@ -427,7 +427,7 @@ Result GSPGPU_WriteHWRegs(u32 regAddr, u32* data, u8 size)
return cmdbuf[1];
}

Result GSPGPU_WriteHWRegsWithMask(u32 regAddr, u32* data, u8 datasize, u32* maskdata, u8 masksize)
Result GSPGPU_WriteHWRegsWithMask(u32 regAddr, const u32* data, u8 datasize, const u32* maskdata, u8 masksize)
{
if(datasize>0x80 || !data)return -1;

Expand Down Expand Up @@ -463,7 +463,7 @@ Result GSPGPU_ReadHWRegs(u32 regAddr, u32* data, u8 size)
return cmdbuf[1];
}

Result GSPGPU_SetBufferSwap(u32 screenid, GSPGPU_FramebufferInfo*framebufinfo)
Result GSPGPU_SetBufferSwap(u32 screenid, const GSPGPU_FramebufferInfo*framebufinfo)
{
u32 *cmdbuf = getThreadCommandBuffer();

Expand Down Expand Up @@ -590,7 +590,7 @@ Result GSPGPU_ReleaseRight(void)
return cmdbuf[1];
}

Result GSPGPU_ImportDisplayCaptureInfo(GSPGPU_CaptureInfo*captureinfo)
Result GSPGPU_ImportDisplayCaptureInfo(GSPGPU_CaptureInfo* captureinfo)
{
u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=IPC_MakeHeader(0x18,0,0); // 0x180000
Expand Down

0 comments on commit dcf8390

Please sign in to comment.