# NNS_GfdAllocLnkTexVram

## Syntax

      #include <nnsys/gfd.h>

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

## Arguments

szByte | Size of the region to allocate (16 to 524272 bytes).
is4x4comp | TRUE should be set if the texture type is a 4x4 compressed texture.
opt | Option. Not currently used.

## Return Values

Returns a texture key that shows the allocated VRAM region.

## Description

Allocates the texture memory in VRAM according to the size specified in `szByte` and returns a texture key that represents the VRAM region. If the allocation fails, it returns `NNS_GFD_ALLOC_ERROR_TEXKEY`, which indicates an error.
If `is4x4comp` is TRUE, texture memory is allocated for a 4x4 texel compressed texture. (The region for the index palette is allocated at the same time.)

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 will not be performed and an error key will be returned.
With linked list type of managers, memory fragmentation can be avoided and memory can be used more efficiently by adjusting the allocation order (for example, allocating textures in the descending order of size).

## See Also

`NNS_GfdFreeLnkTexVram`

## 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/10/12 Initial version.

CONFIDENTIAL