//3DS platform in Pascal // // Copyright (c) 2013, 2015, 2017 Kenneth Dwayne Lee Bsc. // all rights reserved // // If the Box didn't have a bow; twats that never felt or what it is to sexlive, for whom & why ... prude reasons? //!! poster sized is optional, Pix sideways of before & after on the doors of any & all Christ's churches !! {$ifdef 3dsintf} {$i registers.inc} {$i enums.inc} {/ Creates a GPU command header from its write increments, mask, and register. } function GPUCMD_HEADER(incremental,mask,reg : longint) : longint; var gpuCmdBuf : ^u32;cvar;external; {/< GPU command buffer. } gpuCmdBufSize : u32;cvar;external; {/< GPU command buffer size. } gpuCmdBufOffset : u32;cvar;external; {/< GPU command buffer offset. } {* * @brief Sets the GPU command buffer to use. * @param adr Pointer to the command buffer. * @param size Size of the command buffer. * @param offset Offset of the command buffer. } procedure GPUCMD_SetBuffer(adr:pu32; size:u32; offset:u32);cdecl;external; {* * @brief Sets the offset of the GPU command buffer. * @param offset Offset of the command buffer. } procedure GPUCMD_SetBufferOffset(offset:u32);cdecl;external; {* * @brief Gets the current GPU command buffer. * @param adr Pointer to output the command buffer to. * @param size Pointer to output the size of the command buffer to. * @param offset Pointer to output the offset of the command buffer to. } type ppu32 = ^pu32; // procedure GPUCMD_GetBuffer(adr:ppu32; size:pu32; offset:pu32);cdecl;external; {* * @brief Adds raw GPU commands to the current command buffer. * @param cmd Buffer containing commands to add. * @param size Size of the buffer. } procedure GPUCMD_AddRawCommands(cmd:pu32; size:u32);cdecl;external; {/ Executes the GPU command buffer. } procedure GPUCMD_Run;cdecl;external; {/ Flushes linear memory and executes the GPU command buffer. } procedure GPUCMD_FlushAndRun;cdecl;external; {* * @brief Adds a GPU command to the current command buffer. * @param header Header of the command. * @param param Parameters of the command. * @param paramlength Size of the parameter buffer. } procedure GPUCMD_Add(header:u32; param:Pu32; paramlength:u32);cdecl;external; {/ Finalizes the GPU command buffer. } procedure GPUCMD_Finalize;cdecl;external; {* * @brief Converts a 32-bit float to a 16-bit float. * @param f Float to convert. * @return The converted float. } function f32tof16(f:double):u32;cdecl;external; {* * @brief Converts a 32-bit float to a 20-bit float. * @param f Float to convert. * @return The converted float. } function f32tof20(f:double):u32;cdecl;external; {* * @brief Converts a 32-bit float to a 24-bit float. * @param f Float to convert. * @return The converted float. } function f32tof24(f:double):u32;cdecl;external; {* * @brief Converts a 32-bit float to a 31-bit float. * @param f Float to convert. * @return The converted float. } function f32tof31(f:double):u32;cdecl;external; {/ Adds a command with a single parameter to the current command buffer. } procedure GPUCMD_AddSingleParam(header, param:u32); // procedure GPUCMD_Add(header:u32; param:pu32; paramlength:u32);cdecl;external; {/ Adds a masked register write to the current command buffer. } { was #define dname(params) para_def_expr } function GPUCMD_AddMaskedWrite(reg,mask,val : longint) : longint; {/ Adds a register write to the current command buffer. } { was #define dname(params) para_def_expr } function GPUCMD_AddWrite(reg,val : longint) : longint; {/ Adds multiple masked register writes to the current command buffer. } { was #define dname(params) para_def_expr } function GPUCMD_AddMaskedWrites(reg,mask,vals,num : longint) : longint; {/ Adds multiple register writes to the current command buffer. } { was #define dname(params) para_def_expr } function GPUCMD_AddWrites(reg,vals,num : longint) : longint; {/ Adds multiple masked incremental register writes to the current command buffer. } { was #define dname(params) para_def_expr } function GPUCMD_AddMaskedIncrementalWrites(reg,mask,vals,num : longint) : longint; {/ Adds multiple incremental register writes to the current command buffer. } { was #define dname(params) para_def_expr } function GPUCMD_AddIncrementalWrites(reg,vals,num : longint) : longint; {$endif 3dsintf} {$ifdef 3dsimpl} {$i enums.inc} procedure GPUCMD_AddSingleParam(header, param:u32); begin GPUCMD_Add(header, @param, 1); end; function GPUCMD_HEADER(incremental,mask,reg : longint) : longint; begin GPUCMD_HEADER:=((incremental shl 31) or ((mask and $F) shl 16) or (reg and $3FF)); // GPUCMD_HEADER:=((incremental shl 31) or ((mask(@($F))) shl 16)) or (reg(@($3FF))); end; function GPUCMD_AddMaskedWrite(reg,mask,val : longint) : longint; begin //GPUCMD_AddMaskedWrite:= GPUCMD_AddSingleParam(GPUCMD_HEADER(0,mask,reg),val); end; function GPUCMD_AddWrite(reg,val : longint) : longint; begin GPUCMD_AddWrite:=GPUCMD_AddMaskedWrite(reg,$F,val); end; function GPUCMD_AddMaskedWrites(reg,mask,vals,num : longint) : longint; begin //GPUCMD_AddMaskedWrites:= GPUCMD_Add(GPUCMD_HEADER(0,mask,reg),@vals,num); end; function GPUCMD_AddWrites(reg,vals,num : longint) : longint; begin GPUCMD_AddWrites:=GPUCMD_AddMaskedWrites(reg,$F,vals,num); end; function GPUCMD_AddMaskedIncrementalWrites(reg,mask,vals,num : longint) : longint; begin //GPUCMD_AddMaskedIncrementalWrites:= GPUCMD_Add(GPUCMD_HEADER(1,mask,reg),@vals,num); end; function GPUCMD_AddIncrementalWrites(reg,vals,num : longint) : longint; begin GPUCMD_AddIncrementalWrites:=GPUCMD_AddMaskedIncrementalWrites(reg,$F,vals,num); end; {$endif 3dsimpl}