This chapter provides cautions for using the GD library along with other graphics-related libraries and frameworks.
8.1. Cautions for Initialization
When you use the same command list with other frameworks (such as NintendoWare), make sure that you do not initialize it more than once.
For example, in Code 2-1, only the GD library's initialization function (nn::gd::System::Initialize
) is called when NintendoWare's command list-related initialization has finished.
8.2. Using nn::gd::System::ForceDirty
The GD library's internal state may lose synchronization with the GPU when some other library or framework has written 3D commands to the 3D command buffer. If this happens, call the nn::gd::System::ForceDirty
function to mark several modules as dirty and resend all 3D commands for the corresponding modules.
Modules that have been marked as dirty by the ForceDirty
function generate 3D commands when a rendering command is executed. When 3D commands have already been generated, call the nn::gd::System::FlushDirtyModule
function.
The GD library does not maintain the content of registers that are set by immediate functions. When you have used an immediate function to alter the content of a register, you must call the immediate function to reset the register, after the 3D commands have been generated.
For more information about the internal state, see 1.2.2. Managing Module States.
8.3. Duplicate Command Lists
The GD library has some functions that queue command requests. After command requests are queued in a command list, they are not executed until the command list is executed. You must avoid overwriting or deleting resources handled by those command requests before they are executed.
This caution also applies to frameworks that use two command lists, because command requests are queued in the command list that is used to create the next frame.
8.4. Inserting Dummy Commands
Dummy commands that are not recognized by the GPU as commands can be added to the command buffer by calling the nn::gd::System::AddDummyCommands
function. Dummy commands can be used when you need to wait for the next command to execute, or need to adjust the size of the command buffer.