| Home
| Previous
| Next
| Up

AlignLinearBuffer

Aligns the linear start address to a hardware required boundary

Declaration

ibool NAPI GA_initFuncs::AlignLinearBuffer(
N_int32 height,
N_int32 *stride,
N_int32 *offset,
N_int32 *size,
N_int32 growUp)

Prototype In

snap/graphics.h

Parameters

height | Height of the buffer to align
stride | Stride of the buffer to align (modified)
offset | Starting offset of the buffer to align (modified)
size | Place to return the size of the resulting buffer
growUp | True if the buffer is allocated on a heap that grows up in memory

Return Value

True if the buffer was successfully aligned in video memory, false if not.

Description

This optional function is used to align a buffer in offscreen video memory as necessary for the hardware. If this function is not implemented, it is assumed the hardware can work with simple fixed alignment requirements, and the buffers should be aligned as per the alignment boundaries described by the BitmapStartAlign and BitmapStridePad members of the GA_modeInfo structure. However some hardware has special alignment requirements that cannot be easily desrcibed with a simple fixed alignment factor, so in those cases this function will need to be called to align the offscreen memory buffer appropriately.

If the growUp flag is true, the buffer is aligned such that the memory grows up in memory above the initial value passed in the offset parameter. If the growUp flag is false, the buffer is aligned such that the memory grows down from the initial value passed in the offset parameter. The value returned in the offset parameter is always the value at the start of the buffer in memory (ie: lowest memory address).

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com