| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- /**
- * PANDA 3D SOFTWARE
- * Copyright (c) Carnegie Mellon University. All rights reserved.
- *
- * All use of this software is subject to the terms of the revised BSD
- * license. You should have received a copy of this license along
- * with this source code in a file named "LICENSE."
- *
- * @file shaderModule.h
- * @author Mitchell Stokes
- * @date 2019-02-16
- */
- #ifndef SHADERMODULE_H
- #define SHADERMODULE_H
- #include "typedWritableReferenceCount.h"
- #include "bamCacheRecord.h"
- /**
- * Represents a single shader module in some intermediate representation for
- * passing to the driver. This could contain compiled bytecode, or in some
- * cases, preprocessed source code to be given directly to the driver.
- */
- class EXPCL_PANDA_SHADERPIPELINE ShaderModule : public TypedWritableReferenceCount {
- PUBLISHED:
- enum class Stage {
- vertex,
- tess_control,
- tess_evaluation,
- geometry,
- fragment,
- compute,
- };
- public:
- ShaderModule(Stage stage);
- virtual ~ShaderModule();
- INLINE Stage get_stage() const;
- INLINE const Filename &get_source_filename() const;
- INLINE void set_source_filename(const Filename &);
- static std::string format_stage(Stage stage);
- PUBLISHED:
- MAKE_PROPERTY(stage, get_stage);
- virtual std::string get_ir() const=0;
- protected:
- Stage _stage;
- PT(BamCacheRecord) _record;
- //std::pvector<Filename> _source_files;
- Filename _source_filename;
- //time_t _source_modified = 0;
- friend class Shader;
- public:
- virtual void write_datagram(BamWriter *manager, Datagram &dg) override;
- protected:
- void fillin(DatagramIterator &scan, BamReader *manager) override;
- public:
- static TypeHandle get_class_type() {
- return _type_handle;
- }
- static void init_type() {
- TypedWritableReferenceCount::init_type();
- register_type(_type_handle, "ShaderModule",
- TypedWritableReferenceCount::get_class_type());
- }
- virtual TypeHandle get_type() const override {
- return get_class_type();
- }
- virtual TypeHandle force_init_type() override {
- init_type();
- return get_class_type();
- }
- private:
- static TypeHandle _type_handle;
- };
- INLINE std::ostream &operator << (std::ostream &out, ShaderModule::Stage stage) {
- return out << ShaderModule::format_stage(stage);
- }
- #include "shaderModule.I"
- #endif
|