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 SHVARIABLE_HPP
00028 #define SHVARIABLE_HPP
00029
00030 #include "ShDllExport.hpp"
00031 #include "ShRefCount.hpp"
00032 #include "ShSwizzle.hpp"
00033 #include "ShUtility.hpp"
00034 #include "ShMetaForwarder.hpp"
00035 #include "ShVariant.hpp"
00036 #include "ShVariableNode.hpp"
00037
00038 namespace SH {
00039
00040 class ShProgram;
00041
00048 class
00049 SH_DLLEXPORT ShVariable : public ShMetaForwarder {
00050 public:
00051 ShVariable();
00052 ShVariable(const ShVariableNodePtr& node);
00053 ShVariable(const ShVariableNodePtr& node, const ShSwizzle& swizzle, bool neg);
00054
00055 ~ShVariable() {}
00056
00057 ShVariable& operator=(const ShProgram& prg);
00058
00059 bool null() const;
00060
00061 bool uniform() const;
00062 bool hasValues() const;
00063
00064
00065 int size() const;
00066
00067
00068 ShValueType valueType() const;
00069
00075
00076
00078
00079 void rangeVariant(const ShVariant* low, const ShVariant* high);
00080
00082
00083 ShVariantPtr lowBoundVariant() const;
00084
00086 ShVariantPtr highBoundVariant() const;
00087
00089
00091 const ShSwizzle& swizzle() const;
00092
00094 const ShVariableNodePtr& node() const;
00095
00097 bool neg() const;
00098
00099 bool& neg();
00100
00102
00104 ShVariantPtr getVariant() const;
00105 ShVariantPtr getVariant(int index) const;
00106
00122 bool loadVariant(ShVariant *&result) const;
00123 void updateVariant();
00124
00125
00126
00131 void setVariant(const ShVariant* other, bool neg, const ShSwizzle &writemask);
00132 void setVariant(ShVariantCPtr other, bool neg, const ShSwizzle &writemask);
00133
00134
00138 void setVariant(const ShVariant* other, int index);
00139 void setVariant(ShVariantCPtr other, int index);
00140
00141
00145 void setVariant(const ShVariant* other);
00146 void setVariant(ShVariantCPtr other);
00147
00148
00149
00150 ShVariable operator()() const;
00151 ShVariable operator()(int) const;
00152 ShVariable operator()(int, int) const;
00153 ShVariable operator()(int, int, int) const;
00154 ShVariable operator()(int, int, int, int) const;
00155 ShVariable operator()(int size, int indices[]) const;
00156
00157 ShVariable operator-() const;
00158
00159 bool operator==(const ShVariable& other) const;
00160 bool operator!=(const ShVariable& other) const { return !((*this) == other); }
00161
00165 void clone(const ShVariable& other);
00166
00167 protected:
00168
00169 ShVariableNodePtr m_node;
00170 ShSwizzle m_swizzle;
00171 bool m_neg;
00172
00173 friend SH_DLLEXPORT std::ostream& operator<<(std::ostream& out, const ShVariable& shVariableToPrint);
00174 };
00175
00176 }
00177
00178 #endif