nn::gd::CTR::Resource::Helper::GenerateMipMapsCPU Member Functionstatic nnResult GenerateMipMapsCPU( NativeFormat format, u32 width, u32 height, const u8 * dataSrc, u8 * dataDst, u32 countMipLevelToGenerate );
| Name | Description | |
|---|---|---|
| in | format |
Specifies the source data format. |
| in | width |
Specifies the source data width. Must be a power of 2 that is 8 or greater. |
| in | height |
Specifies the source data height. Must be a power of 2 that is 8 or greater. |
| in | dataSrc |
Specifies the address of the source data for generating the mipmap. |
| in | dataDst |
Specifies a pointer to the address where the generated mipmap data is stored. |
| in | countMipLevelToGenerate |
Specifies the number of mipmaps to generate. |
| Value | Description |
|---|---|
Result::IsSuccess |
Process was successful. |
ResultNullParameter |
NULL was specified in an argument. |
ResultInvalidTextureResolution |
The resolution of the source data must be 8x8 or better and a multiple of 2. |
ResultInvalidTextureMipLevelIndex |
Invalid number of mipmaps to generate. |
ResultInvalidTextureFormat |
The source data has an invalid pixel format. |
This helper function generates mipmaps using the CPU.
This function is used the same way as the MemoryGenerateMipMaps function. However, the MemoryGenerateMipMaps function executes the mipmap generation request command using the GPU, but the ResourceHelper::GenerateMipMapsCPU function performs mipmap calculations on the CPU. The drawback is that the MemoryGenerateMipMaps function.ResourceHelper::GenerateMipMapsCPU function is executed. Advantages: For the Memory::GenerateMipMaps function, the resolution of the generated mipmap must be 32 or better. However, for the ResourceHelper::GenerateMipMapsCPU function, the minimum generated mipmap resolution is 8. The memory layout of the data source is LAYOUT_BLOCK_8 and the format of the data source is native format. The formats that can be used are:
NATIVE_FORMAT_RGBA_8888
All mipmaps are created contiguously in memory. You must allocate enough memory to the address area for mipmap generation to store all the mipmaps. The memory area size required to store one mipmap level is as follows: memSize = (srcWidth >> 1) * (srcHeight >> 1) * formatBppmemSize is the size of the memory in bytes; srcWidth and srcHeight are the source resolution. formatBpp is the number of pixel bytes used for pixel encoding. For example, if the number of mipmaps to generate is 2, then you must allocate at least enough memory for mipmap generation to hold the size calculated below.memSize = ((srcWidth >> 1) * (srcHeight >> 1) * formatBpp) + ((srcWidth >> 2) * (srcHeight >> 2) * formatBpp)
CONFIDENTIAL