BRL-CAD
Loading...
Searching...
No Matches
global.h
Go to the documentation of this file.
1
/* G L O B A L . H
2
* BRL-CAD
3
*
4
* Copyright (c) 1993-2025 United States Government as represented by
5
* the U.S. Army Research Laboratory.
6
*
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public License
9
* version 2.1 as published by the Free Software Foundation.
10
*
11
* This library is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this file; see the file named COPYING for more
18
* information.
19
*/
20
/** @file rt/global.h
21
*
22
* TODO - rather than completely eliminating the rt_vlfree global, a better
23
* approach might be to make it optional - i.e., have our code fall back on it
24
* automatically if a user doesn't supply their own vlfree. That would allow
25
* user code to "just work" in all cases, but allow applications to manage
26
* their vlfree containers if they so choose (right now, once vlist memory is
27
* allocated, it generally gets added to rt_vlfree and memory usage grows until
28
* the app is shut down. This may be fine, but if an app wants to discard
29
* their vlfree memory for a particular use case to reduce memory footprint, or
30
* use different vlfree lists for multithreading situations, they should be
31
* able to manage their own vlfree to do so:
32
*
33
* struct bu_list usr_vlfree;
34
* BU_LIST_INIT(&usr_vlfree);
35
*
36
*
37
* rt_uniresource is a similar case in point - the convenience is very useful,
38
* but there are situations where applications want/need to manage their own
39
* resources for more demanding scenarios.
40
*
41
* NOTE for developers - for library initialization reasons, the globals
42
* documented here are located in the source file src/librt/rt_init.cpp
43
*/
44
45
#ifndef RT_GLOBAL_H
46
#define RT_GLOBAL_H
47
48
#include "
common.h
"
49
50
#include "
vmath.h
"
51
#include "
rt/defines.h
"
52
53
__BEGIN_DECLS
54
55
/**
56
* Definitions for librt.a which are global to the library regardless
57
* of how many different models are being worked on
58
*/
59
60
/**
61
* Global container for holding reusable vlist elements. This is an
62
* acceleration mechanism for things like GED drawing, which would otherwise
63
* need to (re)allocate massive numbers of individual vlists. */
64
RT_EXPORT
extern
struct
bu_list
rt_vlfree
;
65
66
/**
67
* Default librt-supplied resource structure for uniprocessor cases. Because
68
* only one of these structures can be used with each thread of execution (see
69
* struct resource documentation), rt_uniresource cannot be used for parallel
70
* (i.e. multithreaded/multiple CPU) raytracing. It is a convenient way to
71
* supply a resource to single-threaded functions without requiring the client
72
* code to create and manage their own resource.
73
*
74
* Unlike user-declared struct resource instances, rt_uniresource does not need
75
* to be initialized with rt_init_resource - that is handled by LIBRT.
76
*/
77
struct
resource
;
78
RT_EXPORT
extern
struct
resource
rt_uniresource
;
79
80
__END_DECLS
81
82
#endif
/* RT_GLOBAL_H */
83
84
/*
85
* Local Variables:
86
* tab-width: 8
87
* mode: C
88
* indent-tabs-mode: t
89
* c-file-style: "stroustrup"
90
* End:
91
* ex: shiftwidth=4 tabstop=8
92
*/
dvec
Definition
dvec.h:74
common.h
Header file for the BRL-CAD common definitions.
rt_uniresource
struct resource rt_uniresource
rt_vlfree
struct bu_list rt_vlfree
defines.h
bu_list
Definition
list.h:132
resource
Definition
resource.h:62
vmath.h
fundamental vector, matrix, quaternion math macros
include
rt
global.h
Generated on Sat Jul 5 2025 01:23:51 for BRL-CAD by
1.9.8