nn::gr::CTR::CommandBufferJumpHelper Classclass CommandBufferJumpHelper
This class aids in the generation of a series of commands to jump to a different command buffer and then return to the original command buffer.
The CommandBufferJumpHelper class aids in the creation of a series of commands to allow command buffer jumping by using the GR library.
Before you make the command buffer into a subroutine, add a channel 1 kick command at the end of the buffer.
The following pseudocode demonstrates how to use this class.
void Draw()
{
bit32* command;
nngxGetCmdlistParameteri( NN_GX_CMDLIST_CURRENT_BUFADDR, reinterpret_cast( &command ) );
// Specify the start address of the command buffer.
nn::gr::CommandBufferJumpHelper cbjh(command);
// Add the render command (example).
nn::gr::Texture texture;
texture.unit0.texType = PICA_DATA_TEXTURE0_SAMPLER_TYPE_TEXTURE_2D;
... // Parameter settings for other textures.
// Generate commands with the nn::gr::Texture class, and then reset the address.
cbjh.Put( texture.MakeCommand(cbjh.GetCurrentPtr()));
// Add the command to jump to the subroutine.
/*
Specify subAddr as the start address of the command buffer to make into a subroutine, and subSize as the size of that buffer.
The addition of the kick command, adjustment of the command buffer size, and similar tasks are all performed in the Jump function.
*/
cbjh.Jump(subAddr, subSize);
... // Add the render command.
// Before adding the segmentation command, synchronize the pointer to the write destination of the command buffer.
nngxMoveCommandbufferPointer( cbjh.GetSize() );
// Add the segmentation command.
/*
Because this class maintains the command buffer size from the start of the command buffer to the first jump,
it should be fine to specify that value.
*/
nngxFlush3DCommandPartially( cbjh.GetSizeToFirstJump() );
// Writes the buffer size from the first jump command to the segmentation command.
nngxGetCmdlistParameteri( NN_GX_CMDLIST_CURRENT_BUFADDR, reinterpret_cast( &command ) );
cbjh.FinalizeJump(command);
}
CommandBufferJumpHelper
|
Constructor. | |
|---|---|---|
~CommandBufferJumpHelper
|
Destructor. | |
GetSize
|
Gets the size of the generated command. | |
GetSizeToFirstJump
|
Gets the size from the start of the command buffer to the first jump command. | |
GetStartPtr
|
Gets the starting address of the command buffer. | |
GetCurrentPtr
|
Gets the address of the write destination of the next command. | |
Put
|
Sets the address of the write destination of the next command in the specified address. | |
CopyFrom
|
Copies and writes the command in the specified range. | |
Jump
|
Generates a series of commands to jump to a different command buffer. | |
FinalizeJump
|
Completes the process of jumping to a command buffer by using the Jump function. |
CONFIDENTIAL