33class EXPCL_PANDA_GOBJ ShaderBuffer :
public TypedWritableReferenceCount,
public Namable,
public GeomEnums {
35 INLINE ShaderBuffer() =
default;
40 INLINE
explicit ShaderBuffer(
const std::string &name, uint64_t size, UsageHint usage_hint);
41 INLINE
explicit ShaderBuffer(
const std::string &name, vector_uchar initial_data, UsageHint usage_hint);
48 virtual void output(std::ostream &out)
const;
54 void prepare(PreparedGraphicsObjects *prepared_objects);
55 bool is_prepared(PreparedGraphicsObjects *prepared_objects)
const;
59 bool release(PreparedGraphicsObjects *prepared_objects);
63 void clear_prepared(PreparedGraphicsObjects *prepared_objects);
66 uint64_t _data_size_bytes;
67 UsageHint _usage_hint;
68 vector_uchar _initial_data;
70 typedef pmap<PreparedGraphicsObjects *, BufferContext *> Contexts;
71 Contexts *_contexts =
nullptr;
78 static TypedWritable *make_from_bam(
const FactoryParams ¶ms);
83 return get_class_type();
85 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
86 static TypeHandle get_class_type() {
89 static void init_type() {
90 TypedWritableReferenceCount::init_type();
93 TypedWritableReferenceCount::get_class_type(),
94 Namable::get_class_type());
98 static TypeHandle _type_handle;
100 friend class PreparedGraphicsObjects;
103INLINE std::ostream &operator << (std::ostream &out,
const ShaderBuffer &m) {
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
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.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
void output(std::ostream &out) const
Outputs the Namable.
A table of objects that are saved within the graphics context for reference by handle later.
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.
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.
const unsigned char * get_initial_data() const
Returns a pointer to the initial buffer data, or NULL if not specified.
void prepare(PreparedGraphicsObjects *prepared_objects)
Indicates that the data should be enqueued to be prepared in the indicated prepared_objects at the be...
get_usage_hint
Returns the buffer usage hint.
get_data_size_bytes
Returns the buffer size in bytes.
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.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.