UniShader
1.0.0a
Interface for GPGPU and working with shader programs
|
00001 #pragma once 00002 #ifndef SHADER_OUTPUT_H 00003 #define SHADER_OUTPUT_H 00004 00005 #include <UniShader/Config.h> 00006 #include <UniShader/Utility.h> 00007 #include <UniShader/ObjectBase.h> 00008 #include <UniShader/SafePtr.h> 00009 #include <UniShader/Varying.h> 00010 #include <UniShader/Buffer.h> 00011 #include <UniShader/PrimitiveType.h> 00012 00013 #include <vector> 00014 #include <deque> 00015 00016 UNISHADER_BEGIN 00017 00018 class ShaderProgram; 00019 00021 00025 class UniShader_API ShaderOutput : public SignalSender, public ObjectBase{ 00026 public: 00027 ShaderOutput(ShaderProgram& program); 00028 typedef SafePtr<ShaderOutput> Ptr; 00029 typedef SafePtr<const ShaderOutput> PtrConst; 00030 virtual const std::string& getClassName() const; 00031 ~ShaderOutput(); 00032 00034 00037 class SignalID{ 00038 public: 00039 enum Types{ CHANGED, 00040 INTERLEAVED, 00041 DEINTERLEAVED 00042 }; 00043 }; 00044 00046 00052 Varying::Ptr addVarying(std::string name); 00053 00055 00061 Varying::Ptr getVarying(std::string name); 00062 00064 00069 void removeVarying(std::string name); 00070 00072 00077 void interleave(bool interl); 00078 00080 00084 bool isInterleaved(); 00085 00087 00092 template <typename T> typename Buffer<T>::PtrConst getInterleavedBuffer(); 00093 00095 00099 void setUp(); 00100 00102 00107 bool prepare(unsigned int primitiveCount); 00108 00110 00113 void activate(PrimitiveType primitiveType); 00114 00116 00120 bool isActive(); 00121 00123 00126 void deactivate(); 00127 private: 00128 ShaderProgram& m_program; 00129 std::deque< std::shared_ptr<Varying> > m_varyings; 00130 std::vector<const char*> m_names; 00131 BufferBase::Ptr m_interleavedBuffer; 00132 size_t m_overallSize; 00133 unsigned int m_query; 00134 int m_primitivesProcessed; 00135 bool m_interleaved; 00136 bool m_prepared; 00137 bool m_active; 00138 }; 00139 00140 UNISHADER_END 00141 00142 #include <UniShader/ShaderOutput.inl> 00143 00144 #endif