CopyTexture2DResourceBlockToLinear

nn::gd::CTR::Memory::CopyTexture2DResourceBlockToLinear Member Function

Syntax

static nnResult CopyTexture2DResourceBlockToLinear(
     const Texture2DResource * source,
     s32 srcMipLevelIndex,
     u32 srcOffsetY,
     u8 * dstAddr,
     u32 dstWidth,
     u32 dstHeight,
     u32 dstFormat,
     DownScalingMode downScalingMode,
     gdBool yFlip
);

Arguments

Name Description
in source Pointer to the Texture2DResource resource transfer source.
in srcMipLevelIndex Specifies the index of the mipmap level of the transfer source. If -1 is specified, the last mipmap level index is used.
in srcOffsetY Specifies the Y offset of the transfer source. This value must be a multiple of srcBlockSize and must be less than the height of the transfer source resource.
in dstAddr Specifies the address of the destination.
in dstWidth Specifies the width of the destination. This value must be equal to or less than the width of the source. (Or, a size of one half the width of the transfer source when using mipmapping in the X-direction.)
in dstHeight Specifies the height of the destination. This value must be equal to or less than the height of the transfer source minus srcOffsetY. (Or, a size of (height-srcOffsetY)/2) when using mipmapping in the Y-direction.)
in dstFormat Specifies the pixel format of the destination.
in downScalingMode Specifies antialiasing filter mode.
in yFlip The transferred image is flipped vertically when yflip is GD_TRUE. The image is not flipped when GD_FALSE.

Return Values

Returns the result of the operation.
Value Description
Result::IsSuccess Process was successful.
ResultNullParameter NULL was specified for source or dstAddr.
ResultInvalidMemoryLayout Either the transfer source resource is not LAYOUT_BLOCK_8 or LAYOUT_BLOCK_32 format, or the transfer destination is not LAYOUT_LINEAR.
ResultInvalidSubRegionResolution The height or width of the source or destination is not a multiple of the memory layout.
ResultInvalidTextureOffset srcOffsetY, srcCountRow or srcOffsetY are not multiples of the memory layout. Or, dstOffestY is larger than the transfer destination. Or, the source offset is larger than the height of the source resource, or the destination offset is larger than the height of the destination resource.
ResultInvalidTextureResolution downScalingMode is incorrect. Or, if the pixel format of the destination is 24-bit, the width of the source and/or destination is not a multiple of 16.
ResultInvalidTextureMipLevelIndex The mipmap level index of the transfer source or transfer destination is invalid.
ResultInvalidTextureFormat The pixel format of the transfer source or transfer destination is invalid.

Description

Adds a command for converting the source Texture2DResource resource from a block image to a linear image and transferring it to the specified address.

The following transfer source and destination pixel formats can be specified:
NATIVE_FORMAT_RGBA_8888
NATIVE_FORMAT_RGB_888
NATIVE_FORMAT_RGBA_4444
NATIVE_FORMAT_RGBA_5551
NATIVE_FORMAT_RGB_565

The memory layout of the transfer source must be LAYOUT_BLOCK_8 or LAYOUT_BLOCK_32. The transfer destination memory layout must be LAYOUT_LINEAR. The data transferred is automatically clipped if the source memory region (including srcMipLevelIndex and srcOffsetY) is bigger than the destination region (including downScalingMode). An error occurs if the source region is smaller than the destination region. When converting the pixel format, the source pixel size must be the same as or smaller than the destination pixel size. In other words, conversions that increase the pixel size are not possible. This process calls the nngxAddB2LTransferCommand function.
This function adds commands to the command list. Refer to the Programming Manual for details.

Revision History

2011/02/21
Initial version.

CONFIDENTIAL