# NNS_GfdAllocTexVram

## C Specification

      #include <nnsys/gfd.h>

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

## Arguments

szByte | The size of texture-use memory you want to allocate (16 to 524272 bytes)
is4x4comp | TRUE if a 4x4 texel compressed texture-use region is being allocated
opt | Options for the VRAM Memory Manager

## Return Values

The key data showing the texture-use memory.

## Description

Allocates texture-use memory of the size specified by `szByte` from VRAM. The NITRO-System library uses this function to allocate texture-use memory from VRAM.

The `NNS_GfdAllocTexVram` function is defined as shown below. The only process this function conducts internally is to call the function set in the global function pointer `NNS_GfdDefaultFuncAllocTexVram`.

    static inline NNSGfdTexKey
    NNS_GfdAllocTexVram(u32 szByte, BOOL is4x4comp, u32 opt)
    {
    return (*NNS_GfdDefaultFuncAllocTexVram)(szByte, is4x4comp, opt );
    }

`NNS_GfdAllocTexVram` functions by registering the appropriate function for allocating texture-use memory in this function pointer. With this setup, the user can control the acquisition of texture-use memory from the library. In the initial state, the function that is set in `NNS_GfdDefaultFuncAllocTexVram` does nothing and returns an error. If an error occurs when texture-use memory is being allocated, the key `NNS_GFD_ALLOC_ERROR_TEXKEY` is returned, indicating an error.

The `opt` parameter enables you to freely select how to use the function set in `NNS_GfdDefaultFuncAllocTexVram` for allocating texture-use memory.

There is a restriction for the size that can be specified due to the specification of the bit expression inside the palette key.

## See Also

`NNS_GfdFreeTexVram`

## Revision History

01/31/2005 Added a cautionary statement regarding the size range.

07/16/2004 Initial version.