31 output(std::ostream &out)
const {
32 out <<
"buffer " << get_name() <<
", " << _data_size_bytes <<
"B, " << _usage_hint;
54 if (_contexts ==
nullptr) {
57 Contexts::const_iterator ci;
58 ci = _contexts->find(prepared_objects);
59 if (ci != _contexts->end()) {
79 if (_contexts ==
nullptr) {
82 Contexts::const_iterator ci;
83 ci = _contexts->find(prepared_objects);
84 if (ci != _contexts->end()) {
90 (*_contexts)[prepared_objects] = vbc;
101 if (_contexts !=
nullptr) {
102 Contexts::iterator ci;
103 ci = _contexts->find(prepared_objects);
104 if (ci != _contexts->end()) {
123 if (_contexts !=
nullptr) {
129 num_freed = (int)_contexts->size();
131 Contexts::const_iterator ci;
132 for (ci = temp.begin(); ci != temp.end(); ++ci) {
140 nassertr(_contexts ==
nullptr, num_freed);
154 nassertv(_contexts !=
nullptr);
156 Contexts::iterator ci;
157 ci = _contexts->find(prepared_objects);
158 if (ci != _contexts->end()) {
159 _contexts->erase(ci);
160 if (_contexts->empty()) {
167 nassert_raise(
"unknown PreparedGraphicsObjects");
188 dg.
add_bool(!_initial_data.empty());
189 dg.
append_data(_initial_data.data(), _initial_data.size());
204 param->fillin(scan, manager);
217 _usage_hint = (UsageHint)scan.
get_uint8();
219 if (scan.
get_bool() && _data_size_bytes > 0) {
221 _initial_data.resize((_data_size_bytes + 15u) & ~15u);
224 _initial_data.clear();
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is a base class for those kinds of SavedContexts that occupy an easily-measured (and substantial...
A class to retrieve the individual data elements previously stored in a Datagram.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
uint64_t get_uint64()
Extracts an unsigned 64-bit integer.
vector_uchar extract_bytes(size_t size)
Extracts the indicated number of bytes in the datagram and returns them as a string.
bool get_bool()
Extracts a boolean value.
std::string get_string()
Extracts a variable-length string.
size_t get_remaining_size() const
Return the bytes left in the datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
void add_bool(bool value)
Adds a boolean value to the datagram.
void append_data(const void *data, size_t size)
Appends some more raw data to the end of the datagram.
void add_uint64(uint64_t value)
Adds an unsigned 64-bit integer to the datagram.
void add_string(const std::string &str)
Adds a variable-length string to the datagram.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A table of objects that are saved within the graphics context for reference by handle later.
bool is_shader_buffer_queued(const ShaderBuffer *data) const
Returns true if the index buffer has been queued on this GSG, false otherwise.
void release_shader_buffer(BufferContext *bc)
Indicates that a data context, created by a previous call to prepare_shader_buffer(),...
bool dequeue_shader_buffer(ShaderBuffer *data)
Removes a buffer from the queued list of data arrays to be prepared.
BufferContext * prepare_shader_buffer_now(ShaderBuffer *data, GraphicsStateGuardianBase *gsg)
Immediately creates a new BufferContext for the indicated data and returns it.
void enqueue_shader_buffer(ShaderBuffer *data)
Indicates that a buffer would like to be put on the list to be prepared when the GSG is next ready to...
This is a generic buffer object that lives in graphics memory.
bool is_prepared(PreparedGraphicsObjects *prepared_objects) const
Returns true if the data has already been prepared or enqueued for preparation on the indicated GSG,...
bool release(PreparedGraphicsObjects *prepared_objects)
Frees the data context only on the indicated object, if it exists there.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
BufferContext * prepare_now(PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg)
Creates a context for the data on the particular GSG, if it does not already exist.
static void register_with_read_factory()
Tells the BamReader how to create objects of type ParamValue.
void prepare(PreparedGraphicsObjects *prepared_objects)
Indicates that the data should be enqueued to be prepared in the indicated prepared_objects at the be...
~ShaderBuffer()
Destructor.
int release_all()
Frees the context allocated on all objects for which the data has been declared.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
This is our own Panda specialization on the default STL map.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.