nn::gr::CTR::AddDummyDataForCommandBuffer Function

Syntax

bit32 * AddDummyDataForCommandBuffer(
     bit32 * command,
     const size_t addSize
);

Parameters

Name Description
in command Address of the write destination for the next command.
in addSize Command buffer size, including the command that you plan to add later.

Return Values

Returns the address that follows the end of the stored rendering command.

Description

When you add a command of the specified size, the buffer size is adjusted to a multiple of 16.

Normally, the nngx API automatically adjusts the command buffer size. However, when you create a command buffer to execute as a subroutine, the buffer size must be adjusted manually because the nngx API cannot be used.

At the end of the command buffer to execute as a subroutine, a kick command is added to return to the execution destination. By calling this function before you add that command, you guarantee that the size limitation of the command buffer is not broken, and that the buffer is a multiple of 16.

    u32* command;  // Stores the address for the next write destination of the command buffer.
    u32* head = command;

    ... // Omitted. (Write the command to execute as a subroutine.)

    // With this function, the final buffer size is adjusted to a multiple of 16.
    // Remember that the kick command to add later is 8 bytes.
    command = nn::gr::AddDummyDataForCommandBuffer( command, (command - head) * sizeof(u32) + 8 );
    // Add the kick command.
    command = nn::gr::MakeChannelKickCommand( command, nn::gr::CTR::CMD_BUF_CH1 );

    ... // Omitted.

See Also

nn::gr::CTR::MakeChannelKickCommand

Revision History

2012/06/26
Initial version.

CONFIDENTIAL