# NNS_GfdAllocFrmTexVram

## Syntax

      #include <nnsys/gfd.h>

      NNSGfdTexKey NNS_GfdAllocFrmTexVram(u32 szByte, BOOL is4x4comp, u32 opt);

## Arguments

`szByte` | Size of the texture-use memory you want to allocate (16 to 524272 bytes).
`is4x4comp` | `TRUE` if 4x4 texel compressed texture data is being allocated.
`opt` | VRAM Memory Manager options (not used).

## Return Values

The key data showing the texture-use memory.

## Description

Allocates texture-use memory of the size specified by `szByte` from VRAM and returns the key showing the texture-use memory. If an error occurs when the texture-use memory is being allocated, the function returns `NNS_GFD_ALLOC_ERROR_TEXKEY`, which is a key indicating that an error has occurred. The `opt` parameter is not used with the `NNS_GfdAllocFrmTexVram` function.

If `TRUE` is specified in the `is4x4comp` argument, texture-use memory is allocated for a 4x4 texel compressed texture. In this case, a region is allocated for the palette index in addition to a region for the texture image. The `NNS_GfdAllocFrmTexVram` function is successful only if both a texture image region and palette index region are allocated.
If there are no empty regions when allocating a region for regular textures, this function attempts to allocate a palette region for 4x4 textures.
If the palette region is used for regular textures, a 4x4 texture region twice as large becomes unusable because allocation of the palette region fails.
Allocating memory for all 4x4 textures first and then for all normal textures can reduce the risk that the palette region will be used by normal textures and allows more efficient memory use.

If an allocation request is made for a size below the minimum that can be expressed for the key, the request size is rounded up to the minimum. If an allocation request is made for a size larger than the maximum that can be expressed for the key, the allocation process is not performed, and an error key is returned.

## See Also

`NNS_GfdInitFrmTexVramManager`
`NNS_GfdFreeFrmTexVram`

## Revision History

2007/08/24 Added a warning explaining the function's internal operations and more efficient use.

2005/01/31 Added a warning about the size range.

2004/07/16 Initial version.

CONFIDENTIAL