9.1. List of Immediate Functions
The following table lists the immediate functions.
Class | Function |
---|---|
nn::gd::CombinerStage |
SetTextureCombinerUnitConstantColor |
nn::gd::FogStage |
UploadFogLookUpTableFloat |
UploadFogLookUpTableNative |
|
UploadGasLookUpTableFloat |
|
UploadGasLookUpTableNative |
|
nn::gd::LightingStage |
SetGlobalColorAmbient |
UploadGasLookUpTableFloat |
|
UploadLookUpTableNative |
|
nn::gd::Light |
SetColorAmbient |
SetColorDiffuse |
|
SetColorSpecular0 |
|
SetColorSpecular1 |
|
SetPosition |
|
SetDirection |
|
SetSpotDirection |
|
SetLightType |
|
SetDistanceAttenuationScaleBias |
|
EnableTwoSideDiffuse |
|
EnableGeomFactor0 |
|
EnableGeomFactor1 |
|
UploadLookUpTableFloat |
|
UploadLookUpTableNative |
|
nn::gd::ProceduralTextureStage |
UploadLookUpTableRgbMapFloat |
UploadLookUpTableRgbMapNative |
|
UploadLookUpTableAlphaMapFloat |
|
UploadLookUpTableAlphaMapNative |
|
UploadLookUpTableNoiseMapFloat |
|
UploadLookUpTableNoiseMapNative |
|
UploadLookUpTableColorMapFloat |
|
UploadLookUpTableColorMapNative |
|
nn::gd::ShaderStage |
SetFloatConstantBuffer |
nn::gd::OutputStage |
SetPenumbraScaleBias |
nn::gd::RasterizerStage |
SetCulling |
SetViewport |
|
EnableClippingPlane |
|
SetClippingPlane |
|
EnableScissor |
|
SetScissor |
9.2. Memory Allocation Within Functions
The sizes in the following table are passed to the allocator that is specified when the GX library is initialized.
Unless specified otherwise in the Comments column, memory is allocated as a system buffer (NN_GX_MEM_SYSTEM
) from device memory (NN_GX_MEM_FCRAM
).
Function | Size | Comments |
---|---|---|
System::Initialize |
24 bytes | Management information |
12 bytes | Management information | |
12 bytes | Management information | |
28 bytes | Management information | |
12 bytes | Management information | |
1536 bytes | Management information | |
52 bytes | Management information | |
28 bytes | Management information | |
12 bytes | Management information | |
1664 bytes | Management information | |
56 bytes | Management information | |
28 bytes | Management information | |
12 bytes | Management information | |
2688 bytes | Management information | |
28 bytes | Management information | |
12 bytes | Management information | |
14,208 bytes | Management information | |
616 bytes | Management information | |
28 bytes | Management information | |
12 bytes | Management information | |
1664 bytes | Management information | |
60 bytes | Management information | |
28 bytes | Management information | |
12 bytes | Management information | |
640 bytes | Management information | |
328 bytes | 3D command (Changes the shared processor settings to use the geometry shader.) |
|
328 bytes | 3D command (Changes the shared processor settings to not use the geometry shader.) |
|
Resource::CreateTexture2DResource |
52 bytes | Management information |
16 bytes | Management information | |
Data-dependent | Allocated with NN_GX_MEM_TEXTURE in the specified memory as long as there is initial data and copies are made. |
|
Resource:: |
64 bytes | Management information |
Resource::Helper:: |
Data-dependent | This memory is allocated for a temporary buffer used by the conversion and is released when the function exits. |
Resource::Helper::ConvertCompressed |
Data-dependent | This memory is allocated for a temporary buffer used by the conversion and is released when the function exits. |
Resource::CreateRenderTarget |
48 bytes | Management information |
Resource::CreateDepthStecilTarget |
52 bytes | Management information |
TextureStage::CreateTexture2D |
64 bytes | Management information |
TextureStage::CreateTextureCube |
112 bytes | Management information |
ShaderStage::CreateShaderBinary |
28 bytes | Management information |
Data-dependent | Management information | |
Data-dependent | Management information | |
Data-dependent | Management information | |
Data-dependent | Management information | |
Data-dependent | Management information | |
Data-dependent | Management information | |
20 bytes | Management information | |
Data-dependent | 3D commands | |
Data-dependent | 3D commands | |
ShaderStage::CreateShader |
20 bytes | Management information |
Data-dependent | 3D commands | |
ShaderStage::CreateShaderPipeline |
148 bytes | Management information |
Data-dependent | 3D commands | |
Data-dependent | Uniform setting values (vertex shader) |
|
Data-dependent | Uniform setting values (geometry shader) | |
VertexInputStage::CreateInputLayout |
204 bytes | Management information |
Data-dependent | InputElementDescription classes |
|
Resource::CreateVertexBufferResource |
24 bytes | Management information |
Data-dependent | Allocated with NN_GX_MEM_VERTEXBUFFER in the specified memory as long as there is initial data and copies are made. |
|
CombinerStage:: |
616 bytes | Management information |
92 bytes | Management information | |
TextureStage::CreateSamplerState |
60 bytes | Management information |
OutputStage::CreateDepthStecilState |
52 bytes | Management information |
OutputStage::CreateBlendState |
56 bytes | Management information |
System::StartRecordingPackets |
36 bytes | Management information |
System::StopRecordingPackets |
Data-dependent | Recorded 3D commands |
9.3. Debugging Support Features
The GD library provides various functions that are useful for debugging, such as filter features that modify the rendering behavior. Filter functions are only enabled when compiled with Debug
or Development
.
9.3.1. Filter Features
Filter features allow the rendering behavior to be modified by setting various flags. Filter features are only enabled when compiled with Debug
or Development
.
static nnResult nn::gd::System::Debug::SetFilter( u32 filterFlag, u32 drawStartIndex, s32 drawCount);
The filter features are enabled after the number of rendering operations specified by drawStartIndex
, and are enabled for the number of render operations specified by drawCount
.
The filters to be enabled are specified in filterFlag
by logically ORing flag values from the following table.
Flag | Description |
---|---|
FILTER_NONE |
Specifying this flag by itself disables all filter features. |
FILTER_TEXTURE_8X8 |
Convert all textures used in rendering to 8x8 textures. |
FILTER_TEXTURE_CUSTOM |
Convert all textures used in rendering to the custom textures specified using the SetCustomTexture() function. A fixed 8×8 texture is used if no custom textures have been specified. |
FILTER_SAMPLER_STATE_FILTER_ |
Forces the filter setting for texture shrinking to GL_NEAREST_MIPMAP_NEAREST . |
FILTER_SAMPLER_STATE_FILTER_ |
Forces the filter setting for texture shrinking to GL_LINEAR_MIPMAP_NEAREST . |
FILTER_VIEWPORT_1X1 |
Changes the viewport setting to 1×1. |
FILTER_SIMPLE_COMBINER |
Changes the combiner settings so that all pixels are output as green. |
FILTER_DISABLE_BLENDING |
Disables blending. |
FILTER_DISABLE_DEPTH_STENCIL_TEST |
Disables depth stencil testing. |
FILTER_DISABLE_ALPHA_TEST |
Disables alpha testing. |
FILTER_LIGHTING_STAGE_1_LIGHT_MAX |
Sets the maximum number of light sources to 1. If multiple lights have been configured, only the first light that is enabled will be enabled. |
FILTER_LIGHTING_STAGE_SIMPLE_ |
Changes to the layer configuration requiring the smallest number of cycles. |
FILTER_DISABLE_DRAW |
Disables rendering. |
FILTER_VISUALIZE_OVERDRAW |
Adds a blending configuration so that rendered pixels gradually go white, allowing pixels that are rendered repetitively to be visualized. Using this together with the filter disabling depth stencils allows pixels discarded (or not discarded) in testing to be checked. |
FILTER_DISABLE_CULLING |
Disables culling. |
FILTER_ENABLE_CULLING_CLOCKWISE |
Changes culling to clockwise. |
FILTER_ENABLE_CULLING_COUNTERCLOCKWISE |
Changes culling to counterclockwise. |
9.3.2. Mipmap Level Visualization
The nn::gd::System::Debug::ColorizeMipmaps()
function supports the visualization of mipmap levels by filling in each mipmap level specified in the texture source with a specified color.
static nnResult nn::gd::System::Debug::ColorizeMipmaps( nn::gd::Texture2DResource* texture2DResource, s32 minMipLevelIndex, s32 maxMipLevelIndex, u8 colors[][4]);
The minimum and maximum indices of the mipmap levels to be filled in are specified in minMipLevelIndex
and maxMipLevelIndex
respectively. When -1
is specified for either of these parameters, the maximum mipmap level of the texture resource specified by texture2DResource
is specified.
The colors specified in colors
are used for the mipmap levels, starting at minMipLevelIndex
. In other words, the texture of the mipmap level specified by minMipLevelIndex
is filled in with the color specified by colors[0]
, and the texture of the next mipmap level is filled in with the color specified by colors[1]
.
If NULL
is specified for colors
, a default color array is used to fill in the textures. For information about the default color array, see the API Reference.