Panda3D
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Enumerations
panda
src
gobj
bufferResidencyTracker.h
1
// Filename: bufferResidencyTracker.h
2
// Created by: drose (16Mar06)
3
//
4
////////////////////////////////////////////////////////////////////
5
//
6
// PANDA 3D SOFTWARE
7
// Copyright (c) Carnegie Mellon University. All rights reserved.
8
//
9
// All use of this software is subject to the terms of the revised BSD
10
// license. You should have received a copy of this license along
11
// with this source code in a file named "LICENSE."
12
//
13
////////////////////////////////////////////////////////////////////
14
15
#ifndef BUFFERRESIDENCYTRACKER_H
16
#define BUFFERRESIDENCYTRACKER_H
17
18
#include "pandabase.h"
19
#include "bufferContextChain.h"
20
#include "pStatCollector.h"
21
22
class
BufferContext
;
23
24
////////////////////////////////////////////////////////////////////
25
// Class : BufferResidencyTracker
26
// Description : This class is used to keep track of the current state
27
// of all the BufferContexts for a particular graphics
28
// context: whether each one is active (rendered this
29
// frame) or inactive (not rendered this frame), and
30
// whether it is resident or nonresident in video
31
// memory.
32
//
33
// The primary purpose of this class is to facilitate
34
// PStats reporting of video card memory usage.
35
////////////////////////////////////////////////////////////////////
36
class
EXPCL_PANDA_GOBJ
BufferResidencyTracker
{
37
public
:
38
BufferResidencyTracker
(
const
string
&pgo_name,
const
string
&type_name);
39
~
BufferResidencyTracker
();
40
41
void
begin_frame(
Thread
*current_thread);
42
void
end_frame(
Thread
*current_thread);
43
void
set_levels();
44
45
INLINE
BufferContextChain
&get_inactive_nonresident();
46
INLINE
BufferContextChain
&get_active_nonresident();
47
INLINE
BufferContextChain
&get_inactive_resident();
48
INLINE
BufferContextChain
&get_active_resident();
49
50
void
write(ostream &out,
int
indent_level)
const
;
51
52
private
:
53
void
move_inactive(
BufferContextChain
&inactive,
BufferContextChain
&active);
54
55
private
:
56
enum
State {
57
// Individual bits.
58
S_active = 0x01,
59
S_resident = 0x02,
60
61
// Aggregate bits: unions of the above.
62
S_inactive_nonresident = 0x00,
63
S_active_nonresident = 0x01,
64
S_inactive_resident = 0x02,
65
S_active_resident = 0x03,
66
67
// The total number of different states.
68
S_num_states = 4,
69
};
70
71
// One chain for each of the possible states, ordered as above.
72
BufferContextChain
_chains[S_num_states];
73
74
// A couple of PStatCollectors just to organize names.
75
static
PStatCollector
_gmem_collector;
76
PStatCollector
_pgo_collector;
77
78
// One PStatCollector for each state. These are ordered in reverse
79
// order that we would like them to appear in the PStats graph.
80
PStatCollector
_active_resident_collector;
81
PStatCollector
_active_nonresident_collector;
82
PStatCollector
_inactive_resident_collector;
83
PStatCollector
_inactive_nonresident_collector;
84
85
// The frame number currently considered "active".
86
int
_active_frame;
87
friend
class
BufferContext
;
88
};
89
90
#include "bufferResidencyTracker.I"
91
92
#endif
BufferContext
This is a base class for those kinds of SavedContexts that occupy an easily-measured (and substantial...
Definition:
bufferContext.h:41
BufferResidencyTracker
This class is used to keep track of the current state of all the BufferContexts for a particular grap...
Definition:
bufferResidencyTracker.h:36
BufferContextChain
This class maintains a linked list of BufferContexts that might be allocated on the graphics card in ...
Definition:
bufferContextChain.h:34
PStatCollector
A lightweight class that represents a single element that may be timed and/or counted via stats...
Definition:
pStatCollector.h:49
Thread
A thread; that is, a lightweight process.
Definition:
thread.h:51
Generated on Mon Feb 1 2016 13:44:26 for Panda3D by
1.8.5