[80] | 1 | /********************************************************************** <BR>
|
---|
| 2 | This file is part of Crack dot Com's free source code release of
|
---|
| 3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
| 4 | information about compiling & licensing issues visit this URL</a>
|
---|
| 5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
| 6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
| 7 | ***********************************************************************/
|
---|
| 8 |
|
---|
| 9 | #ifndef _TEX_HEAP_HH_
|
---|
| 10 | #define _TEX_HEAP_HH_
|
---|
| 11 |
|
---|
| 12 | #include "time/profile.hh"
|
---|
| 13 |
|
---|
| 14 | extern i4_profile_class pf_tex_heap_alloc;
|
---|
| 15 | extern i4_profile_class pf_tex_heap_free;
|
---|
| 16 | extern i4_profile_class pf_tex_heap_cleanup;
|
---|
| 17 |
|
---|
| 18 | #define R1_TEX_HEAP_FREE_NODE_DATA w32 start,size; r1_tex_heap_free_node *next; r1_miplevel_t *mip;
|
---|
| 19 |
|
---|
| 20 | #define R1_TEX_HEAP_USED_NODE_DATA r1_tex_heap_free_node *node; r1_tex_heap_used_node *next; r1_tex_heap_used_node *last;
|
---|
| 21 |
|
---|
| 22 | #define R1_TEX_HEAP_DONT_LIST 1
|
---|
| 23 |
|
---|
| 24 | class r1_tex_heap_free_node
|
---|
| 25 | {
|
---|
| 26 | public:
|
---|
| 27 | R1_TEX_HEAP_FREE_NODE_DATA
|
---|
| 28 | };
|
---|
| 29 |
|
---|
| 30 | class r1_tex_heap_used_node
|
---|
| 31 | {
|
---|
| 32 | public:
|
---|
| 33 | R1_TEX_HEAP_USED_NODE_DATA
|
---|
| 34 | };
|
---|
| 35 |
|
---|
| 36 |
|
---|
| 37 | class r1_texture_heap_class
|
---|
| 38 | {
|
---|
| 39 | public:
|
---|
| 40 |
|
---|
| 41 | r1_tex_heap_free_node *first_free;
|
---|
| 42 | r1_tex_heap_used_node *first_used;
|
---|
| 43 | r1_tex_heap_used_node *oldest_used;
|
---|
| 44 |
|
---|
| 45 | i4_linear_allocator *free_node_alloc;
|
---|
| 46 | i4_linear_allocator *used_node_alloc;
|
---|
| 47 |
|
---|
| 48 | r1_texture_heap_class(w32 heap_size, w32 heap_start, w32 free_node_size, w32 used_node_size, sw32 *frame_count);
|
---|
| 49 | ~r1_texture_heap_class();
|
---|
| 50 |
|
---|
| 51 | sw32 *frame_count_ptr;
|
---|
| 52 | sw32 num_ram_misses;
|
---|
| 53 | sw32 max_fail_size;
|
---|
| 54 |
|
---|
| 55 | i4_bool needs_cleanup;
|
---|
| 56 |
|
---|
| 57 | void free_really_old();
|
---|
| 58 | void update_usage(r1_tex_heap_used_node *u);
|
---|
| 59 |
|
---|
| 60 | r1_tex_heap_used_node *alloc(w32 need_size, w8 flags=0);
|
---|
| 61 |
|
---|
| 62 | void merge_into_free_list(w32 _start, w32 _size);
|
---|
| 63 | void free(r1_tex_heap_used_node *u);
|
---|
| 64 | };
|
---|
| 65 |
|
---|
| 66 | #endif
|
---|