00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027 #ifndef SHPROGRAM_HPP
00028 #define SHPROGRAM_HPP
00029
00030 #include "ShDllExport.hpp"
00031 #include "ShProgramNode.hpp"
00032 #include "ShBackend.hpp"
00033
00034 namespace SH {
00035
00036 class ShStream;
00037 template<typename T> class ShChannel;
00038
00041 class
00042 SH_DLLEXPORT ShProgram : public ShMetaForwarder {
00043 public:
00044 ShProgram();
00045 ShProgram(const ShProgram& other);
00046 ShProgram(const std::string& target);
00047 ShProgram(const ShProgramNodePtr& node);
00048
00049 ShProgram& operator=(const ShProgram& other);
00050
00052 ShProgramNodeCPtr node() const { return m_node; }
00053
00055 ShProgramNodePtr node() { return m_node; }
00056
00062 void compile(const ShPointer<ShBackend>& backend) { m_node->compile(backend); }
00063
00066 void compile(const std::string& target, const ShPointer<ShBackend>& backend)
00067 {
00068 m_node->compile(target, backend);
00069 }
00070
00073 std::string describe_interface() const
00074 {
00075 return m_node->describe_interface();
00076 }
00077
00081 ShPointer<ShBackendCode> code() { return m_node->code(); }
00082
00086 ShPointer<ShBackendCode> code(const ShPointer<ShBackend>& backend) {
00087 return m_node->code(backend);
00088 }
00089
00091 ShPointer<ShBackendCode> code(const std::string& target, const ShPointer<ShBackend>& backend)
00092 {
00093 return m_node->code(target, backend);
00094 }
00095
00097 void updateUniform(const ShVariableNodePtr& uniform)
00098 {
00099 m_node->updateUniform(uniform);
00100 }
00101
00102 std::string target() const { return m_node->target(); }
00103
00105 std::string& target() { return m_node->target(); }
00106
00107 ShProgramNode::VarList::const_iterator inputs_begin() const { return m_node->inputs_begin(); }
00108 ShProgramNode::VarList::const_iterator inputs_end() const { return m_node->inputs_end(); }
00109 ShProgramNode::VarList::const_iterator outputs_begin() const { return m_node->outputs_begin(); }
00110 ShProgramNode::VarList::const_iterator outputs_end() const { return m_node->outputs_end(); }
00111 ShProgramNode::VarList::const_iterator temps_begin() const { return m_node->temps_begin(); }
00112 ShProgramNode::VarList::const_iterator temps_end() const { return m_node->temps_end(); }
00113 ShProgramNode::VarList::const_iterator constants_begin() const { return m_node->constants_begin(); }
00114 ShProgramNode::VarList::const_iterator constants_end() const { return m_node->constants_end(); }
00115 ShProgramNode::VarList::const_iterator uniforms_begin() const { return m_node->uniforms_begin(); }
00116 ShProgramNode::VarList::const_iterator uniforms_end() const { return m_node->uniforms_end(); }
00117 ShProgramNode::TexList::const_iterator textures_begin() const { return m_node->textures_begin(); }
00118 ShProgramNode::TexList::const_iterator textures_end() const { return m_node->textures_end(); }
00119 ShProgramNode::ChannelList::const_iterator channels_begin() const { return m_node->channels_begin(); }
00120 ShProgramNode::ChannelList::const_iterator channels_end() const { return m_node->channels_end(); }
00121 ShProgramNode::PaletteList::const_iterator palettes_begin() const { return m_node->palettes_begin(); }
00122 ShProgramNode::PaletteList::const_iterator palettes_end() const { return m_node->palettes_end(); }
00123
00124
00125
00126
00127
00128 template<typename T0>
00129 ShProgram operator()(const ShChannel<T0>& t0) const;
00130 ShProgram operator()(const ShStream& s0) const;
00131 template<typename T0, typename T1>
00132 ShProgram operator()(const ShChannel<T0>& t0,
00133 const ShChannel<T1>& t1) const;
00134 ShProgram operator()(const ShStream& s0,
00135 const ShStream& s1) const;
00136 template<typename T0, typename T1, typename T2>
00137 ShProgram operator()(const ShChannel<T0>& t0,
00138 const ShChannel<T1>& t1,
00139 const ShChannel<T2>& t2) const;
00140 ShProgram operator()(const ShStream& s0,
00141 const ShStream& s1,
00142 const ShStream& s2) const;
00143 template<typename T0, typename T1, typename T2, typename T3>
00144 ShProgram operator()(const ShChannel<T0>& t0,
00145 const ShChannel<T1>& t1,
00146 const ShChannel<T2>& t2,
00147 const ShChannel<T3>& t3) const;
00148 ShProgram operator()(const ShStream& s0,
00149 const ShStream& s1,
00150 const ShStream& s2,
00151 const ShStream& s3) const;
00152 template<typename T0, typename T1, typename T2, typename T3,
00153 typename T4>
00154 ShProgram operator()(const ShChannel<T0>& t0,
00155 const ShChannel<T1>& t1,
00156 const ShChannel<T2>& t2,
00157 const ShChannel<T3>& t3,
00158 const ShChannel<T4>& t4) const;
00159 ShProgram operator()(const ShStream& s0,
00160 const ShStream& s1,
00161 const ShStream& s2,
00162 const ShStream& s3,
00163 const ShStream& s4) const;
00164
00165 private:
00166
00167 ShProgramNodePtr m_node;
00168 };
00169
00170 }
00171
00172 #endif
00173