Go to the documentation of this file.
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();
std::string get_string()
Extracts a variable-length string.
A table of objects that are saved within the graphics context for reference by handle later.
bool dequeue_shader_buffer(ShaderBuffer *data)
Removes a buffer from the queued list of data arrays to be prepared.
void release_shader_buffer(BufferContext *bc)
Indicates that a data context, created by a previous call to prepare_shader_buffer(),...
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
A class to retrieve the individual data elements previously stored in a Datagram.
bool is_shader_buffer_queued(const ShaderBuffer *data) const
Returns true if the index buffer has been queued on this GSG, false otherwise.
This is our own Panda specialization on the default STL map.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void prepare(PreparedGraphicsObjects *prepared_objects)
Indicates that the data should be enqueued to be prepared in the indicated prepared_objects at the be...
const std::string & get_name() const
Returns the name of the PreparedGraphicsObjects structure.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is a generic buffer object that lives in graphics memory.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
Base class for objects that can be written to and read from Bam files.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
BufferContext * prepare_now(PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg)
Creates a context for the data on the particular GSG, if it does not already exist.
void add_string(const std::string &str)
Adds a variable-length string to the datagram.
TypeHandle is the identifier used to differentiate C++ class types.
BufferContext * prepare_shader_buffer_now(ShaderBuffer *data, GraphicsStateGuardianBase *gsg)
Immediately creates a new BufferContext for the indicated data and returns it.
bool release(PreparedGraphicsObjects *prepared_objects)
Frees the data context only on the indicated object, if it exists there.
bool get_bool()
Extracts a boolean value.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
bool is_prepared(PreparedGraphicsObjects *prepared_objects) const
Returns true if the data has already been prepared or enqueued for preparation on the indicated GSG,...
void add_uint64(uint64_t value)
Adds an unsigned 64-bit integer to the datagram.
int release_all()
Frees the context allocated on all objects for which the data has been declared.
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...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
size_t get_remaining_size() const
Return the bytes left in the datagram.
static void register_with_read_factory()
Tells the BamReader how to create objects of type ParamValue.
~ShaderBuffer()
Destructor.
This is a base class for those kinds of SavedContexts that occupy an easily-measured (and substantial...
void add_bool(bool value)
Adds a boolean value to the datagram.
vector_uchar extract_bytes(size_t size)
Extracts the indicated number of bytes in the datagram and returns them as a string.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
uint64_t get_uint64()
Extracts an unsigned 64-bit integer.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void append_data(const void *data, size_t size)
Appends some more raw data to the end of the datagram.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.