1 
2 
3 /*
4 A* -------------------------------------------------------------------
5 B* This file contains source code for the PyMOL computer program
6 C* Copyright (c) Schrodinger, LLC.
7 D* -------------------------------------------------------------------
8 E* It is unlawful to modify or remove this copyright notice.
9 F* -------------------------------------------------------------------
10 G* Please see the accompanying LICENSE file for further information.
11 H* -------------------------------------------------------------------
12 I* Additional authors of this source file include:
13 -*
14 -*
15 -*
16 Z* -------------------------------------------------------------------
17 */
18 #ifndef _H_MemoryCache
19 #define _H_MemoryCache
20 
21 
22 /* NOTE: at the present time, MemoryCaching is not compatible with a
23    running PyMOL free of global state -- it's basically just a
24    performace hack for systems with slow memory management.
25 */
26 
27 
28 /* cacheable memory blocks (really just for the ray-tracer)  */
29 
30 #define cCache_no_cache                                   0
31 #define cCache_ray_antialias_buffer                       1
32 #define cCache_ray_vert2prim                              2
33 #define cCache_ray_primitive                              3
34 
35 #define cCache_basis_vertex                               4
36 
37 #define cCache_basis_radius                               5
38 
39 #define cCache_basis_radius2                              6
40 #define cCache_basis_vert2normal                          7
41 #define cCache_basis_normal                               8
42 
43 #define cCache_basis_precomp                              9
44 
45 #define cCache_ray_basis                                 10
46 
47 #define cCache_ray_map                                   11
48 
49 #define cCache_map_head_offset                           1
50 #define cCache_map_link_offset                           2
51 #define cCache_map_ehead_offset                          3
52 #define cCache_map_emask_offset                          4
53 #define cCache_map_elist_offset                          5
54 #define cCache_map_ehead_new_offset                      6
55 #define cCache_map_elist_new_offset                      7
56 
57 #define cCache_basis_tempVertex                          31
58 #define cCache_basis_tempRef                             32
59 
60 #define cCache_basis_site                                33
61 #define cCache_basis_value                               34
62 
63 #define cCache_map_scene_cache                           40
64 #define cCache_map_shadow_cache                          44
65 #define cCache_map_cache_offset                          1
66 #define cCache_map_cache_link_offset                     2
67 
68 #define cCache_ray_edging_buffer                         50
69 
70 /* memory cache off */
71 
72 #define VLACacheCheck(G,ptr,type,rec,t,i) VLACheck(ptr,type,rec)
73 #define VLACacheAlloc(G,type,initSize,t,i) VLAlloc(type,initSize)
74 #define VLACacheFreeP(G,ptr,t,i,f) VLAFreeP(ptr)
75 #define VLACacheSize(G,ptr,type,size,t,i) VLASize(ptr,type,size)
76 #define VLACacheSizeForSure(G,ptr,type,size,t,i) VLASizeForSure(ptr,type,size)
77 #define VLACacheExpand(G,ptr,rec,thread_index,i) VLAExpand(ptr,rec)
78 
79 #define MemoryCacheReplaceBlock(G,g,o,n)
80 
81 #define VLACacheMalloc(G,a,b,c,d,t,i) VLAMalloc(a,b,c,d)
82 #define VLACacheFree(G,p,t,i,f) VLAFree(p)
83 
84 #define CacheAlloc(G,type,size,thread,id) pymol::malloc<type>(size)
85 #define CacheCalloc(G,type,size,thread,id) pymol::calloc<type>(size)
86 #define CacheRealloc(G,ptr,type,size,thread,id) pymol::realloc<type>(size)
87 #define CacheFreeP(G,ptr,thread,id,force) {if(ptr) {mfree(ptr);ptr=NULL;}}
88 
89 #endif
90