openTRI 0.1
triVAlloc.h
1/*
2 * triVAlloc.h: Header for VRAM allocation routines
3 * This file is part of the "tri Engine".
4 *
5 * Copyright (C) 2007 tri
6 * Copyright (C) 2007 Alexander Berl 'Raphael' <raphael@fx-world.org>
7 *
8 * $Id: $
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25
26#ifndef __TRIVALLOC_H__
27#define __TRIVALLOC_H__
28
29#include "triTypes.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35
39
40
46triVoid* vrelptr( triVoid *ptr ); // make a pointer relative to memory base address (ATTENTION: A NULL rel ptr is not illegal/invalid!)
47
53triVoid* vabsptr( triVoid *ptr ); // make a pointer absolute (default return type of valloc)
54
59triVoid* triVAlloc( triU32 size );
60
64triVoid triVFree( triVoid* ptr );
65
66
70triU32 triVMemavail();
71
76
77
78#ifdef _DEBUG
79// Debug printf (to stdout) a trace of the current Memblocks
80triVoid __memwalk();
81#endif
82
84
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif // __TRIVALLOC_H__
triU32 triVMemavail()
Return remaining unallocated VRAM.
triVoid * triVAlloc(triU32 size)
Allocate memory from VRAM.
triVoid triVFree(triVoid *ptr)
Free allocated memory from VRAM.
triU32 triVLargestblock()
Return largest free memory block in VRAM.
triVoid * vabsptr(triVoid *ptr)
Make a pointer absolute (useable by CPU).
triVoid * vrelptr(triVoid *ptr)
Make a pointer relative to VRAM base.