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
00026
00027
00028
00029
00030
00031
00033
00034 #ifndef SH_SHATTRIBIMPL_HPP
00035 #define SH_SHATTRIBIMPL_HPP
00036
00037 #include "ShAttrib.hpp"
00038 #include "ShContext.hpp"
00039 #include "ShStatement.hpp"
00040 #include "ShEnvironment.hpp"
00041 #include "ShDebug.hpp"
00042
00043 namespace SH {
00044
00045 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00046 inline
00047 ShAttrib<N, Binding, T, Swizzled>::ShAttrib()
00048 : ShGeneric<N, T>(new ShVariableNode(Binding, N, ShStorageTypeInfo<T>::value_type))
00049 {
00050 }
00051
00052 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00053 template<typename T2>
00054 inline
00055 ShAttrib<N, Binding, T, Swizzled>::ShAttrib(const ShGeneric<N, T2>& other)
00056 : ShGeneric<N, T>(new ShVariableNode(Binding, N, ShStorageTypeInfo<T>::value_type))
00057 {
00058 shASN(*this, other);
00059 }
00060
00061 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00062 inline
00063 ShAttrib<N, Binding, T, Swizzled>::ShAttrib(const ShAttrib<N, Binding, T, Swizzled>& other)
00064 : ShGeneric<N, T>(new ShVariableNode(Binding, N, ShStorageTypeInfo<T>::value_type))
00065 {
00066 shASN(*this, other);
00067 }
00068
00069 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00070 template<typename T2>
00071 inline
00072 ShAttrib<N, Binding, T, Swizzled>::ShAttrib(const ShAttrib<N, Binding, T2, Swizzled>& other)
00073 : ShGeneric<N, T>(new ShVariableNode(Binding, N, ShStorageTypeInfo<T>::value_type))
00074 {
00075 shASN(*this, other);
00076 }
00077
00078 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00079 inline
00080 ShAttrib<N, Binding, T, Swizzled>::ShAttrib(const ShVariableNodePtr& node,
00081 const ShSwizzle& swizzle, bool neg)
00082 : ShGeneric<N, T>(node, swizzle, neg)
00083 {
00084 }
00085
00086 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00087 inline
00088 ShAttrib<N, Binding, T, Swizzled>::ShAttrib(host_type data[N])
00089 : ShGeneric<N, T>(new ShVariableNode(Binding, N, ShStorageTypeInfo<T>::value_type))
00090 {
00091 if (Binding == SH_CONST) {
00092 for (int i = 0; i < N; i++) setValue(i, data[i]);
00093 } else {
00094 (*this) = ShAttrib<N, SH_CONST, T>(data);
00095 }
00096 }
00097
00098 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00099 inline
00100 ShAttrib<N, Binding, T, Swizzled>::~ShAttrib()
00101 {
00102 }
00103
00104 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00105 template<typename T2>
00106 inline
00107 ShAttrib<N, Binding, T, Swizzled>&
00108 ShAttrib<N, Binding, T, Swizzled>::operator=(const ShGeneric<N, T2>& other)
00109 {
00110 ParentType::operator=(other);
00111 return *this;
00112 }
00113
00114 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00115 inline
00116 ShAttrib<N, Binding, T, Swizzled>&
00117 ShAttrib<N, Binding, T, Swizzled>::operator=(const ShAttrib<N, Binding, T, Swizzled>& other)
00118 {
00119 ParentType::operator=(other);
00120 return *this;
00121 }
00122
00123 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00124 template<typename T2>
00125 inline
00126 ShAttrib<N, Binding, T, Swizzled>&
00127 ShAttrib<N, Binding, T, Swizzled>::operator=(const ShAttrib<N, Binding, T2, Swizzled>& other)
00128 {
00129 ParentType::operator=(other);
00130 return *this;
00131 }
00132
00133 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00134 inline
00135 ShAttrib<N, Binding, T, Swizzled>&
00136 ShAttrib<N, Binding, T, Swizzled>::operator=(const ShProgram& prg)
00137 {
00138 ParentType::operator=(prg);
00139 return *this;
00140 }
00141
00142 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00143 template<typename T2>
00144 inline
00145 ShAttrib<N, Binding, T, Swizzled>&
00146 ShAttrib<N, Binding, T, Swizzled>::operator+=(const ShGeneric<N, T2>& right)
00147 {
00148 ParentType::operator+=(right);
00149 return *this;
00150 }
00151
00152 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00153 template<typename T2>
00154 inline
00155 ShAttrib<N, Binding, T, Swizzled>&
00156 ShAttrib<N, Binding, T, Swizzled>::operator-=(const ShGeneric<N, T2>& right)
00157 {
00158 ParentType::operator-=(right);
00159 return *this;
00160 }
00161
00162 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00163 template<typename T2>
00164 inline
00165 ShAttrib<N, Binding, T, Swizzled>&
00166 ShAttrib<N, Binding, T, Swizzled>::operator*=(const ShGeneric<N, T2>& right)
00167 {
00168 ParentType::operator*=(right);
00169 return *this;
00170 }
00171
00172 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00173 template<typename T2>
00174 inline
00175 ShAttrib<N, Binding, T, Swizzled>&
00176 ShAttrib<N, Binding, T, Swizzled>::operator/=(const ShGeneric<N, T2>& right)
00177 {
00178 ParentType::operator/=(right);
00179 return *this;
00180 }
00181
00182 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00183 template<typename T2>
00184 inline
00185 ShAttrib<N, Binding, T, Swizzled>&
00186 ShAttrib<N, Binding, T, Swizzled>::operator%=(const ShGeneric<N, T2>& right)
00187 {
00188 ParentType::operator%=(right);
00189 return *this;
00190 }
00191
00192 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00193 inline
00194 ShAttrib<N, Binding, T, Swizzled>&
00195 ShAttrib<N, Binding, T, Swizzled>::operator+=(host_type right)
00196 {
00197 ParentType::operator+=(right);
00198 return *this;
00199 }
00200
00201 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00202 inline
00203 ShAttrib<N, Binding, T, Swizzled>&
00204 ShAttrib<N, Binding, T, Swizzled>::operator-=(host_type right)
00205 {
00206 ParentType::operator-=(right);
00207 return *this;
00208 }
00209
00210 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00211 inline
00212 ShAttrib<N, Binding, T, Swizzled>&
00213 ShAttrib<N, Binding, T, Swizzled>::operator*=(host_type right)
00214 {
00215 ParentType::operator*=(right);
00216 return *this;
00217 }
00218
00219 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00220 inline
00221 ShAttrib<N, Binding, T, Swizzled>&
00222 ShAttrib<N, Binding, T, Swizzled>::operator/=(host_type right)
00223 {
00224 ParentType::operator/=(right);
00225 return *this;
00226 }
00227
00228 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00229 inline
00230 ShAttrib<N, Binding, T, Swizzled>&
00231 ShAttrib<N, Binding, T, Swizzled>::operator%=(host_type right)
00232 {
00233 ParentType::operator%=(right);
00234 return *this;
00235 }
00236
00237 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00238 template<typename T2>
00239 inline
00240 ShAttrib<N, Binding, T, Swizzled>&
00241 ShAttrib<N, Binding, T, Swizzled>::operator+=(const ShGeneric<1, T2>& right)
00242 {
00243 ParentType::operator+=(right);
00244 return *this;
00245 }
00246
00247 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00248 template<typename T2>
00249 inline
00250 ShAttrib<N, Binding, T, Swizzled>&
00251 ShAttrib<N, Binding, T, Swizzled>::operator-=(const ShGeneric<1, T2>& right)
00252 {
00253 ParentType::operator-=(right);
00254 return *this;
00255 }
00256
00257 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00258 template<typename T2>
00259 inline
00260 ShAttrib<N, Binding, T, Swizzled>&
00261 ShAttrib<N, Binding, T, Swizzled>::operator*=(const ShGeneric<1, T2>& right)
00262 {
00263 ParentType::operator*=(right);
00264 return *this;
00265 }
00266
00267 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00268 template<typename T2>
00269 inline
00270 ShAttrib<N, Binding, T, Swizzled>&
00271 ShAttrib<N, Binding, T, Swizzled>::operator/=(const ShGeneric<1, T2>& right)
00272 {
00273 ParentType::operator/=(right);
00274 return *this;
00275 }
00276
00277 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00278 template<typename T2>
00279 inline
00280 ShAttrib<N, Binding, T, Swizzled>&
00281 ShAttrib<N, Binding, T, Swizzled>::operator%=(const ShGeneric<1, T2>& right)
00282 {
00283 ParentType::operator%=(right);
00284 return *this;
00285 }
00286
00287 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00288 inline
00289 ShAttrib<1, Binding, T, true>
00290 ShAttrib<N, Binding, T, Swizzled>::operator()(int s0) const
00291 {
00292 return ShAttrib<1, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(N, s0), this->m_neg);
00293 }
00294
00295 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00296 inline
00297 ShAttrib<2, Binding, T, true>
00298 ShAttrib<N, Binding, T, Swizzled>::operator()(int s0, int s1) const
00299 {
00300 return ShAttrib<2, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(N, s0, s1), this->m_neg);
00301 }
00302
00303 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00304 inline
00305 ShAttrib<3, Binding, T, true>
00306 ShAttrib<N, Binding, T, Swizzled>::operator()(int s0, int s1, int s2) const
00307 {
00308 return ShAttrib<3, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(N, s0, s1, s2), this->m_neg);
00309 }
00310
00311 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00312 inline
00313 ShAttrib<4, Binding, T, true>
00314 ShAttrib<N, Binding, T, Swizzled>::operator()(int s0, int s1, int s2, int s3) const
00315 {
00316 return ShAttrib<4, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(N, s0, s1, s2, s3), this->m_neg);
00317 }
00318
00319 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00320 template<int N2>
00321 ShAttrib<N2, Binding, T, true>
00322 ShAttrib<N, Binding, T, Swizzled>::swiz(int indices[]) const
00323 {
00324 return ShAttrib<N2, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(N, N2, indices), this->m_neg);
00325 }
00326
00327 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00328 inline
00329 ShAttrib<1, Binding, T, true>
00330 ShAttrib<N, Binding, T, Swizzled>::operator[](int s0) const
00331 {
00332 return ShAttrib<1, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(N, s0), this->m_neg);
00333 }
00334
00335 template<int N, ShBindingType Binding, typename T, bool Swizzled>
00336 ShAttrib<N, Binding, T, Swizzled>
00337 ShAttrib<N, Binding, T, Swizzled>::operator-() const
00338 {
00339 return ShAttrib<N, Binding, T, Swizzled>(this->m_node, this->m_swizzle, !this->m_neg);
00340 }
00341
00342 template<ShBindingType Binding, typename T, bool Swizzled>
00343 inline
00344 ShAttrib<1, Binding, T, Swizzled>::ShAttrib()
00345 : ShGeneric<1, T>(new ShVariableNode(Binding, 1, ShStorageTypeInfo<T>::value_type))
00346 {
00347 }
00348
00349 template<ShBindingType Binding, typename T, bool Swizzled>
00350 template<typename T2>
00351 inline
00352 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(const ShGeneric<1, T2>& other)
00353 : ShGeneric<1, T>(new ShVariableNode(Binding, 1, ShStorageTypeInfo<T>::value_type))
00354 {
00355 shASN(*this, other);
00356 }
00357
00358 template<ShBindingType Binding, typename T, bool Swizzled>
00359 inline
00360 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(const ShAttrib<1, Binding, T, Swizzled>& other)
00361 : ShGeneric<1, T>(new ShVariableNode(Binding, 1, ShStorageTypeInfo<T>::value_type))
00362 {
00363 shASN(*this, other);
00364 }
00365
00366 template<ShBindingType Binding, typename T, bool Swizzled>
00367 template<typename T2>
00368 inline
00369 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(const ShAttrib<1, Binding, T2, Swizzled>& other)
00370 : ShGeneric<1, T>(new ShVariableNode(Binding, 1, ShStorageTypeInfo<T>::value_type))
00371 {
00372 shASN(*this, other);
00373 }
00374
00375 template<ShBindingType Binding, typename T, bool Swizzled>
00376 inline
00377 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(const ShVariableNodePtr& node,
00378 const ShSwizzle& swizzle, bool neg)
00379 : ShGeneric<1, T>(node, swizzle, neg)
00380 {
00381 }
00382
00383 template<ShBindingType Binding, typename T, bool Swizzled>
00384 inline
00385 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(host_type data[1])
00386 : ShGeneric<1, T>(new ShVariableNode(Binding, 1, ShStorageTypeInfo<T>::value_type))
00387 {
00388 if (Binding == SH_CONST) {
00389 for (int i = 0; i < 1; i++) setValue(i, data[i]);
00390 } else {
00391 (*this) = ShAttrib<1, SH_CONST, T>(data);
00392 }
00393 }
00394
00395 template<ShBindingType Binding, typename T, bool Swizzled>
00396 inline
00397 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(host_type s0)
00398 : ShGeneric<1, T>(new ShVariableNode(Binding, 1, ShStorageTypeInfo<T>::value_type))
00399 {
00400 if (Binding == SH_CONST) {
00401 setValue(0, s0);
00402 } else {
00403 (*this)[0] = s0;
00404 }
00405 }
00406
00407 template<ShBindingType Binding, typename T, bool Swizzled>
00408 inline
00409 ShAttrib<1, Binding, T, Swizzled>::~ShAttrib()
00410 {
00411 }
00412
00413 template<ShBindingType Binding, typename T, bool Swizzled>
00414 template<typename T2>
00415 inline
00416 ShAttrib<1, Binding, T, Swizzled>&
00417 ShAttrib<1, Binding, T, Swizzled>::operator=(const ShGeneric<1, T2>& other)
00418 {
00419 ParentType::operator=(other);
00420 return *this;
00421 }
00422
00423 template<ShBindingType Binding, typename T, bool Swizzled>
00424 inline
00425 ShAttrib<1, Binding, T, Swizzled>&
00426 ShAttrib<1, Binding, T, Swizzled>::operator=(const ShAttrib<1, Binding, T, Swizzled>& other)
00427 {
00428 ParentType::operator=(other);
00429 return *this;
00430 }
00431
00432 template<ShBindingType Binding, typename T, bool Swizzled>
00433 template<typename T2>
00434 inline
00435 ShAttrib<1, Binding, T, Swizzled>&
00436 ShAttrib<1, Binding, T, Swizzled>::operator=(const ShAttrib<1, Binding, T2, Swizzled>& other)
00437 {
00438 ParentType::operator=(other);
00439 return *this;
00440 }
00441
00442 template<ShBindingType Binding, typename T, bool Swizzled>
00443 inline
00444 ShAttrib<1, Binding, T, Swizzled>&
00445 ShAttrib<1, Binding, T, Swizzled>::operator=(host_type other)
00446 {
00447 ParentType::operator=(other);
00448 return *this;
00449 }
00450
00451 template<ShBindingType Binding, typename T, bool Swizzled>
00452 inline
00453 ShAttrib<1, Binding, T, Swizzled>&
00454 ShAttrib<1, Binding, T, Swizzled>::operator=(const ShProgram& prg)
00455 {
00456 ParentType::operator=(prg);
00457 return *this;
00458 }
00459
00460 template<ShBindingType Binding, typename T, bool Swizzled>
00461 template<typename T2>
00462 inline
00463 ShAttrib<1, Binding, T, Swizzled>&
00464 ShAttrib<1, Binding, T, Swizzled>::operator+=(const ShGeneric<1, T2>& right)
00465 {
00466 ParentType::operator+=(right);
00467 return *this;
00468 }
00469
00470 template<ShBindingType Binding, typename T, bool Swizzled>
00471 template<typename T2>
00472 inline
00473 ShAttrib<1, Binding, T, Swizzled>&
00474 ShAttrib<1, Binding, T, Swizzled>::operator-=(const ShGeneric<1, T2>& right)
00475 {
00476 ParentType::operator-=(right);
00477 return *this;
00478 }
00479
00480 template<ShBindingType Binding, typename T, bool Swizzled>
00481 template<typename T2>
00482 inline
00483 ShAttrib<1, Binding, T, Swizzled>&
00484 ShAttrib<1, Binding, T, Swizzled>::operator*=(const ShGeneric<1, T2>& right)
00485 {
00486 ParentType::operator*=(right);
00487 return *this;
00488 }
00489
00490 template<ShBindingType Binding, typename T, bool Swizzled>
00491 template<typename T2>
00492 inline
00493 ShAttrib<1, Binding, T, Swizzled>&
00494 ShAttrib<1, Binding, T, Swizzled>::operator/=(const ShGeneric<1, T2>& right)
00495 {
00496 ParentType::operator/=(right);
00497 return *this;
00498 }
00499
00500 template<ShBindingType Binding, typename T, bool Swizzled>
00501 template<typename T2>
00502 inline
00503 ShAttrib<1, Binding, T, Swizzled>&
00504 ShAttrib<1, Binding, T, Swizzled>::operator%=(const ShGeneric<1, T2>& right)
00505 {
00506 ParentType::operator%=(right);
00507 return *this;
00508 }
00509
00510 template<ShBindingType Binding, typename T, bool Swizzled>
00511 inline
00512 ShAttrib<1, Binding, T, Swizzled>&
00513 ShAttrib<1, Binding, T, Swizzled>::operator+=(host_type right)
00514 {
00515 ParentType::operator+=(right);
00516 return *this;
00517 }
00518
00519 template<ShBindingType Binding, typename T, bool Swizzled>
00520 inline
00521 ShAttrib<1, Binding, T, Swizzled>&
00522 ShAttrib<1, Binding, T, Swizzled>::operator-=(host_type right)
00523 {
00524 ParentType::operator-=(right);
00525 return *this;
00526 }
00527
00528 template<ShBindingType Binding, typename T, bool Swizzled>
00529 inline
00530 ShAttrib<1, Binding, T, Swizzled>&
00531 ShAttrib<1, Binding, T, Swizzled>::operator*=(host_type right)
00532 {
00533 ParentType::operator*=(right);
00534 return *this;
00535 }
00536
00537 template<ShBindingType Binding, typename T, bool Swizzled>
00538 inline
00539 ShAttrib<1, Binding, T, Swizzled>&
00540 ShAttrib<1, Binding, T, Swizzled>::operator/=(host_type right)
00541 {
00542 ParentType::operator/=(right);
00543 return *this;
00544 }
00545
00546 template<ShBindingType Binding, typename T, bool Swizzled>
00547 inline
00548 ShAttrib<1, Binding, T, Swizzled>&
00549 ShAttrib<1, Binding, T, Swizzled>::operator%=(host_type right)
00550 {
00551 ParentType::operator%=(right);
00552 return *this;
00553 }
00554
00555 template<ShBindingType Binding, typename T, bool Swizzled>
00556 inline
00557 ShAttrib<1, Binding, T, true>
00558 ShAttrib<1, Binding, T, Swizzled>::operator()(int s0) const
00559 {
00560 return ShAttrib<1, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(1, s0), this->m_neg);
00561 }
00562
00563 template<ShBindingType Binding, typename T, bool Swizzled>
00564 inline
00565 ShAttrib<2, Binding, T, true>
00566 ShAttrib<1, Binding, T, Swizzled>::operator()(int s0, int s1) const
00567 {
00568 return ShAttrib<2, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(1, s0, s1), this->m_neg);
00569 }
00570
00571 template<ShBindingType Binding, typename T, bool Swizzled>
00572 inline
00573 ShAttrib<3, Binding, T, true>
00574 ShAttrib<1, Binding, T, Swizzled>::operator()(int s0, int s1, int s2) const
00575 {
00576 return ShAttrib<3, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(1, s0, s1, s2), this->m_neg);
00577 }
00578
00579 template<ShBindingType Binding, typename T, bool Swizzled>
00580 inline
00581 ShAttrib<4, Binding, T, true>
00582 ShAttrib<1, Binding, T, Swizzled>::operator()(int s0, int s1, int s2, int s3) const
00583 {
00584 return ShAttrib<4, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(1, s0, s1, s2, s3), this->m_neg);
00585 }
00586
00587 template<ShBindingType Binding, typename T, bool Swizzled>
00588 template<int N2>
00589 ShAttrib<N2, Binding, T, true>
00590 ShAttrib<1, Binding, T, Swizzled>::swiz(int indices[]) const
00591 {
00592 return ShAttrib<N2, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(1, N2, indices), this->m_neg);
00593 }
00594
00595 template<ShBindingType Binding, typename T, bool Swizzled>
00596 inline
00597 ShAttrib<1, Binding, T, true>
00598 ShAttrib<1, Binding, T, Swizzled>::operator[](int s0) const
00599 {
00600 return ShAttrib<1, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(1, s0), this->m_neg);
00601 }
00602
00603 template<ShBindingType Binding, typename T, bool Swizzled>
00604 ShAttrib<1, Binding, T, Swizzled>
00605 ShAttrib<1, Binding, T, Swizzled>::operator-() const
00606 {
00607 return ShAttrib<1, Binding, T, Swizzled>(this->m_node, this->m_swizzle, !this->m_neg);
00608 }
00609
00610 template<ShBindingType Binding, typename T, bool Swizzled>
00611 inline
00612 ShAttrib<2, Binding, T, Swizzled>::ShAttrib()
00613 : ShGeneric<2, T>(new ShVariableNode(Binding, 2, ShStorageTypeInfo<T>::value_type))
00614 {
00615 }
00616
00617 template<ShBindingType Binding, typename T, bool Swizzled>
00618 template<typename T2>
00619 inline
00620 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(const ShGeneric<2, T2>& other)
00621 : ShGeneric<2, T>(new ShVariableNode(Binding, 2, ShStorageTypeInfo<T>::value_type))
00622 {
00623 shASN(*this, other);
00624 }
00625
00626 template<ShBindingType Binding, typename T, bool Swizzled>
00627 inline
00628 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(const ShAttrib<2, Binding, T, Swizzled>& other)
00629 : ShGeneric<2, T>(new ShVariableNode(Binding, 2, ShStorageTypeInfo<T>::value_type))
00630 {
00631 shASN(*this, other);
00632 }
00633
00634 template<ShBindingType Binding, typename T, bool Swizzled>
00635 template<typename T2>
00636 inline
00637 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(const ShAttrib<2, Binding, T2, Swizzled>& other)
00638 : ShGeneric<2, T>(new ShVariableNode(Binding, 2, ShStorageTypeInfo<T>::value_type))
00639 {
00640 shASN(*this, other);
00641 }
00642
00643 template<ShBindingType Binding, typename T, bool Swizzled>
00644 inline
00645 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(const ShVariableNodePtr& node,
00646 const ShSwizzle& swizzle, bool neg)
00647 : ShGeneric<2, T>(node, swizzle, neg)
00648 {
00649 }
00650
00651 template<ShBindingType Binding, typename T, bool Swizzled>
00652 inline
00653 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(host_type data[2])
00654 : ShGeneric<2, T>(new ShVariableNode(Binding, 2, ShStorageTypeInfo<T>::value_type))
00655 {
00656 if (Binding == SH_CONST) {
00657 for (int i = 0; i < 2; i++) setValue(i, data[i]);
00658 } else {
00659 (*this) = ShAttrib<2, SH_CONST, T>(data);
00660 }
00661 }
00662
00663 template<ShBindingType Binding, typename T, bool Swizzled>
00664 inline
00665 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(host_type s0, host_type s1)
00666 : ShGeneric<2, T>(new ShVariableNode(Binding, 2, ShStorageTypeInfo<T>::value_type))
00667 {
00668 if (Binding == SH_CONST) {
00669 setValue(0, s0);
00670 setValue(1, s1);
00671 } else {
00672 (*this)[0] = s0;
00673 (*this)[1] = s1;
00674 }
00675 }
00676
00677 template<ShBindingType Binding, typename T, bool Swizzled>
00678 template<typename T2, typename T3>
00679 inline
00680 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(const ShGeneric<1, T2>& s0, const ShGeneric<1, T3>& s1)
00681 : ShGeneric<2, T>(new ShVariableNode(Binding, 2, ShStorageTypeInfo<T>::value_type))
00682 {
00683 if (Binding == SH_CONST) {
00684 SH_DEBUG_ASSERT(s0.hasValues());
00685 setValue(0, s0.getValue(0));
00686 SH_DEBUG_ASSERT(s1.hasValues());
00687 setValue(1, s1.getValue(0));
00688 } else {
00689 (*this)[0] = s0;
00690 (*this)[1] = s1;
00691 }
00692 }
00693
00694 template<ShBindingType Binding, typename T, bool Swizzled>
00695 inline
00696 ShAttrib<2, Binding, T, Swizzled>::~ShAttrib()
00697 {
00698 }
00699
00700 template<ShBindingType Binding, typename T, bool Swizzled>
00701 template<typename T2>
00702 inline
00703 ShAttrib<2, Binding, T, Swizzled>&
00704 ShAttrib<2, Binding, T, Swizzled>::operator=(const ShGeneric<2, T2>& other)
00705 {
00706 ParentType::operator=(other);
00707 return *this;
00708 }
00709
00710 template<ShBindingType Binding, typename T, bool Swizzled>
00711 inline
00712 ShAttrib<2, Binding, T, Swizzled>&
00713 ShAttrib<2, Binding, T, Swizzled>::operator=(const ShAttrib<2, Binding, T, Swizzled>& other)
00714 {
00715 ParentType::operator=(other);
00716 return *this;
00717 }
00718
00719 template<ShBindingType Binding, typename T, bool Swizzled>
00720 template<typename T2>
00721 inline
00722 ShAttrib<2, Binding, T, Swizzled>&
00723 ShAttrib<2, Binding, T, Swizzled>::operator=(const ShAttrib<2, Binding, T2, Swizzled>& other)
00724 {
00725 ParentType::operator=(other);
00726 return *this;
00727 }
00728
00729 template<ShBindingType Binding, typename T, bool Swizzled>
00730 inline
00731 ShAttrib<2, Binding, T, Swizzled>&
00732 ShAttrib<2, Binding, T, Swizzled>::operator=(const ShProgram& prg)
00733 {
00734 ParentType::operator=(prg);
00735 return *this;
00736 }
00737
00738 template<ShBindingType Binding, typename T, bool Swizzled>
00739 template<typename T2>
00740 inline
00741 ShAttrib<2, Binding, T, Swizzled>&
00742 ShAttrib<2, Binding, T, Swizzled>::operator+=(const ShGeneric<2, T2>& right)
00743 {
00744 ParentType::operator+=(right);
00745 return *this;
00746 }
00747
00748 template<ShBindingType Binding, typename T, bool Swizzled>
00749 template<typename T2>
00750 inline
00751 ShAttrib<2, Binding, T, Swizzled>&
00752 ShAttrib<2, Binding, T, Swizzled>::operator-=(const ShGeneric<2, T2>& right)
00753 {
00754 ParentType::operator-=(right);
00755 return *this;
00756 }
00757
00758 template<ShBindingType Binding, typename T, bool Swizzled>
00759 template<typename T2>
00760 inline
00761 ShAttrib<2, Binding, T, Swizzled>&
00762 ShAttrib<2, Binding, T, Swizzled>::operator*=(const ShGeneric<2, T2>& right)
00763 {
00764 ParentType::operator*=(right);
00765 return *this;
00766 }
00767
00768 template<ShBindingType Binding, typename T, bool Swizzled>
00769 template<typename T2>
00770 inline
00771 ShAttrib<2, Binding, T, Swizzled>&
00772 ShAttrib<2, Binding, T, Swizzled>::operator/=(const ShGeneric<2, T2>& right)
00773 {
00774 ParentType::operator/=(right);
00775 return *this;
00776 }
00777
00778 template<ShBindingType Binding, typename T, bool Swizzled>
00779 template<typename T2>
00780 inline
00781 ShAttrib<2, Binding, T, Swizzled>&
00782 ShAttrib<2, Binding, T, Swizzled>::operator%=(const ShGeneric<2, T2>& right)
00783 {
00784 ParentType::operator%=(right);
00785 return *this;
00786 }
00787
00788 template<ShBindingType Binding, typename T, bool Swizzled>
00789 inline
00790 ShAttrib<2, Binding, T, Swizzled>&
00791 ShAttrib<2, Binding, T, Swizzled>::operator+=(host_type right)
00792 {
00793 ParentType::operator+=(right);
00794 return *this;
00795 }
00796
00797 template<ShBindingType Binding, typename T, bool Swizzled>
00798 inline
00799 ShAttrib<2, Binding, T, Swizzled>&
00800 ShAttrib<2, Binding, T, Swizzled>::operator-=(host_type right)
00801 {
00802 ParentType::operator-=(right);
00803 return *this;
00804 }
00805
00806 template<ShBindingType Binding, typename T, bool Swizzled>
00807 inline
00808 ShAttrib<2, Binding, T, Swizzled>&
00809 ShAttrib<2, Binding, T, Swizzled>::operator*=(host_type right)
00810 {
00811 ParentType::operator*=(right);
00812 return *this;
00813 }
00814
00815 template<ShBindingType Binding, typename T, bool Swizzled>
00816 inline
00817 ShAttrib<2, Binding, T, Swizzled>&
00818 ShAttrib<2, Binding, T, Swizzled>::operator/=(host_type right)
00819 {
00820 ParentType::operator/=(right);
00821 return *this;
00822 }
00823
00824 template<ShBindingType Binding, typename T, bool Swizzled>
00825 inline
00826 ShAttrib<2, Binding, T, Swizzled>&
00827 ShAttrib<2, Binding, T, Swizzled>::operator%=(host_type right)
00828 {
00829 ParentType::operator%=(right);
00830 return *this;
00831 }
00832
00833 template<ShBindingType Binding, typename T, bool Swizzled>
00834 template<typename T2>
00835 inline
00836 ShAttrib<2, Binding, T, Swizzled>&
00837 ShAttrib<2, Binding, T, Swizzled>::operator+=(const ShGeneric<1, T2>& right)
00838 {
00839 ParentType::operator+=(right);
00840 return *this;
00841 }
00842
00843 template<ShBindingType Binding, typename T, bool Swizzled>
00844 template<typename T2>
00845 inline
00846 ShAttrib<2, Binding, T, Swizzled>&
00847 ShAttrib<2, Binding, T, Swizzled>::operator-=(const ShGeneric<1, T2>& right)
00848 {
00849 ParentType::operator-=(right);
00850 return *this;
00851 }
00852
00853 template<ShBindingType Binding, typename T, bool Swizzled>
00854 template<typename T2>
00855 inline
00856 ShAttrib<2, Binding, T, Swizzled>&
00857 ShAttrib<2, Binding, T, Swizzled>::operator*=(const ShGeneric<1, T2>& right)
00858 {
00859 ParentType::operator*=(right);
00860 return *this;
00861 }
00862
00863 template<ShBindingType Binding, typename T, bool Swizzled>
00864 template<typename T2>
00865 inline
00866 ShAttrib<2, Binding, T, Swizzled>&
00867 ShAttrib<2, Binding, T, Swizzled>::operator/=(const ShGeneric<1, T2>& right)
00868 {
00869 ParentType::operator/=(right);
00870 return *this;
00871 }
00872
00873 template<ShBindingType Binding, typename T, bool Swizzled>
00874 template<typename T2>
00875 inline
00876 ShAttrib<2, Binding, T, Swizzled>&
00877 ShAttrib<2, Binding, T, Swizzled>::operator%=(const ShGeneric<1, T2>& right)
00878 {
00879 ParentType::operator%=(right);
00880 return *this;
00881 }
00882
00883 template<ShBindingType Binding, typename T, bool Swizzled>
00884 inline
00885 ShAttrib<1, Binding, T, true>
00886 ShAttrib<2, Binding, T, Swizzled>::operator()(int s0) const
00887 {
00888 return ShAttrib<1, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(2, s0), this->m_neg);
00889 }
00890
00891 template<ShBindingType Binding, typename T, bool Swizzled>
00892 inline
00893 ShAttrib<2, Binding, T, true>
00894 ShAttrib<2, Binding, T, Swizzled>::operator()(int s0, int s1) const
00895 {
00896 return ShAttrib<2, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(2, s0, s1), this->m_neg);
00897 }
00898
00899 template<ShBindingType Binding, typename T, bool Swizzled>
00900 inline
00901 ShAttrib<3, Binding, T, true>
00902 ShAttrib<2, Binding, T, Swizzled>::operator()(int s0, int s1, int s2) const
00903 {
00904 return ShAttrib<3, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(2, s0, s1, s2), this->m_neg);
00905 }
00906
00907 template<ShBindingType Binding, typename T, bool Swizzled>
00908 inline
00909 ShAttrib<4, Binding, T, true>
00910 ShAttrib<2, Binding, T, Swizzled>::operator()(int s0, int s1, int s2, int s3) const
00911 {
00912 return ShAttrib<4, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(2, s0, s1, s2, s3), this->m_neg);
00913 }
00914
00915 template<ShBindingType Binding, typename T, bool Swizzled>
00916 template<int N2>
00917 ShAttrib<N2, Binding, T, true>
00918 ShAttrib<2, Binding, T, Swizzled>::swiz(int indices[]) const
00919 {
00920 return ShAttrib<N2, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(2, N2, indices), this->m_neg);
00921 }
00922
00923 template<ShBindingType Binding, typename T, bool Swizzled>
00924 inline
00925 ShAttrib<1, Binding, T, true>
00926 ShAttrib<2, Binding, T, Swizzled>::operator[](int s0) const
00927 {
00928 return ShAttrib<1, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(2, s0), this->m_neg);
00929 }
00930
00931 template<ShBindingType Binding, typename T, bool Swizzled>
00932 ShAttrib<2, Binding, T, Swizzled>
00933 ShAttrib<2, Binding, T, Swizzled>::operator-() const
00934 {
00935 return ShAttrib<2, Binding, T, Swizzled>(this->m_node, this->m_swizzle, !this->m_neg);
00936 }
00937
00938 template<ShBindingType Binding, typename T, bool Swizzled>
00939 inline
00940 ShAttrib<3, Binding, T, Swizzled>::ShAttrib()
00941 : ShGeneric<3, T>(new ShVariableNode(Binding, 3, ShStorageTypeInfo<T>::value_type))
00942 {
00943 }
00944
00945 template<ShBindingType Binding, typename T, bool Swizzled>
00946 template<typename T2>
00947 inline
00948 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(const ShGeneric<3, T2>& other)
00949 : ShGeneric<3, T>(new ShVariableNode(Binding, 3, ShStorageTypeInfo<T>::value_type))
00950 {
00951 shASN(*this, other);
00952 }
00953
00954 template<ShBindingType Binding, typename T, bool Swizzled>
00955 inline
00956 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(const ShAttrib<3, Binding, T, Swizzled>& other)
00957 : ShGeneric<3, T>(new ShVariableNode(Binding, 3, ShStorageTypeInfo<T>::value_type))
00958 {
00959 shASN(*this, other);
00960 }
00961
00962 template<ShBindingType Binding, typename T, bool Swizzled>
00963 template<typename T2>
00964 inline
00965 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(const ShAttrib<3, Binding, T2, Swizzled>& other)
00966 : ShGeneric<3, T>(new ShVariableNode(Binding, 3, ShStorageTypeInfo<T>::value_type))
00967 {
00968 shASN(*this, other);
00969 }
00970
00971 template<ShBindingType Binding, typename T, bool Swizzled>
00972 inline
00973 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(const ShVariableNodePtr& node,
00974 const ShSwizzle& swizzle, bool neg)
00975 : ShGeneric<3, T>(node, swizzle, neg)
00976 {
00977 }
00978
00979 template<ShBindingType Binding, typename T, bool Swizzled>
00980 inline
00981 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(host_type data[3])
00982 : ShGeneric<3, T>(new ShVariableNode(Binding, 3, ShStorageTypeInfo<T>::value_type))
00983 {
00984 if (Binding == SH_CONST) {
00985 for (int i = 0; i < 3; i++) setValue(i, data[i]);
00986 } else {
00987 (*this) = ShAttrib<3, SH_CONST, T>(data);
00988 }
00989 }
00990
00991 template<ShBindingType Binding, typename T, bool Swizzled>
00992 inline
00993 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(host_type s0, host_type s1, host_type s2)
00994 : ShGeneric<3, T>(new ShVariableNode(Binding, 3, ShStorageTypeInfo<T>::value_type))
00995 {
00996 if (Binding == SH_CONST) {
00997 setValue(0, s0);
00998 setValue(1, s1);
00999 setValue(2, s2);
01000 } else {
01001 (*this)[0] = s0;
01002 (*this)[1] = s1;
01003 (*this)[2] = s2;
01004 }
01005 }
01006
01007 template<ShBindingType Binding, typename T, bool Swizzled>
01008 template<typename T2, typename T3, typename T4>
01009 inline
01010 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(const ShGeneric<1, T2>& s0, const ShGeneric<1, T3>& s1, const ShGeneric<1, T4>& s2)
01011 : ShGeneric<3, T>(new ShVariableNode(Binding, 3, ShStorageTypeInfo<T>::value_type))
01012 {
01013 if (Binding == SH_CONST) {
01014 SH_DEBUG_ASSERT(s0.hasValues());
01015 setValue(0, s0.getValue(0));
01016 SH_DEBUG_ASSERT(s1.hasValues());
01017 setValue(1, s1.getValue(0));
01018 SH_DEBUG_ASSERT(s2.hasValues());
01019 setValue(2, s2.getValue(0));
01020 } else {
01021 (*this)[0] = s0;
01022 (*this)[1] = s1;
01023 (*this)[2] = s2;
01024 }
01025 }
01026
01027 template<ShBindingType Binding, typename T, bool Swizzled>
01028 inline
01029 ShAttrib<3, Binding, T, Swizzled>::~ShAttrib()
01030 {
01031 }
01032
01033 template<ShBindingType Binding, typename T, bool Swizzled>
01034 template<typename T2>
01035 inline
01036 ShAttrib<3, Binding, T, Swizzled>&
01037 ShAttrib<3, Binding, T, Swizzled>::operator=(const ShGeneric<3, T2>& other)
01038 {
01039 ParentType::operator=(other);
01040 return *this;
01041 }
01042
01043 template<ShBindingType Binding, typename T, bool Swizzled>
01044 inline
01045 ShAttrib<3, Binding, T, Swizzled>&
01046 ShAttrib<3, Binding, T, Swizzled>::operator=(const ShAttrib<3, Binding, T, Swizzled>& other)
01047 {
01048 ParentType::operator=(other);
01049 return *this;
01050 }
01051
01052 template<ShBindingType Binding, typename T, bool Swizzled>
01053 template<typename T2>
01054 inline
01055 ShAttrib<3, Binding, T, Swizzled>&
01056 ShAttrib<3, Binding, T, Swizzled>::operator=(const ShAttrib<3, Binding, T2, Swizzled>& other)
01057 {
01058 ParentType::operator=(other);
01059 return *this;
01060 }
01061
01062 template<ShBindingType Binding, typename T, bool Swizzled>
01063 inline
01064 ShAttrib<3, Binding, T, Swizzled>&
01065 ShAttrib<3, Binding, T, Swizzled>::operator=(const ShProgram& prg)
01066 {
01067 ParentType::operator=(prg);
01068 return *this;
01069 }
01070
01071 template<ShBindingType Binding, typename T, bool Swizzled>
01072 template<typename T2>
01073 inline
01074 ShAttrib<3, Binding, T, Swizzled>&
01075 ShAttrib<3, Binding, T, Swizzled>::operator+=(const ShGeneric<3, T2>& right)
01076 {
01077 ParentType::operator+=(right);
01078 return *this;
01079 }
01080
01081 template<ShBindingType Binding, typename T, bool Swizzled>
01082 template<typename T2>
01083 inline
01084 ShAttrib<3, Binding, T, Swizzled>&
01085 ShAttrib<3, Binding, T, Swizzled>::operator-=(const ShGeneric<3, T2>& right)
01086 {
01087 ParentType::operator-=(right);
01088 return *this;
01089 }
01090
01091 template<ShBindingType Binding, typename T, bool Swizzled>
01092 template<typename T2>
01093 inline
01094 ShAttrib<3, Binding, T, Swizzled>&
01095 ShAttrib<3, Binding, T, Swizzled>::operator*=(const ShGeneric<3, T2>& right)
01096 {
01097 ParentType::operator*=(right);
01098 return *this;
01099 }
01100
01101 template<ShBindingType Binding, typename T, bool Swizzled>
01102 template<typename T2>
01103 inline
01104 ShAttrib<3, Binding, T, Swizzled>&
01105 ShAttrib<3, Binding, T, Swizzled>::operator/=(const ShGeneric<3, T2>& right)
01106 {
01107 ParentType::operator/=(right);
01108 return *this;
01109 }
01110
01111 template<ShBindingType Binding, typename T, bool Swizzled>
01112 template<typename T2>
01113 inline
01114 ShAttrib<3, Binding, T, Swizzled>&
01115 ShAttrib<3, Binding, T, Swizzled>::operator%=(const ShGeneric<3, T2>& right)
01116 {
01117 ParentType::operator%=(right);
01118 return *this;
01119 }
01120
01121 template<ShBindingType Binding, typename T, bool Swizzled>
01122 inline
01123 ShAttrib<3, Binding, T, Swizzled>&
01124 ShAttrib<3, Binding, T, Swizzled>::operator+=(host_type right)
01125 {
01126 ParentType::operator+=(right);
01127 return *this;
01128 }
01129
01130 template<ShBindingType Binding, typename T, bool Swizzled>
01131 inline
01132 ShAttrib<3, Binding, T, Swizzled>&
01133 ShAttrib<3, Binding, T, Swizzled>::operator-=(host_type right)
01134 {
01135 ParentType::operator-=(right);
01136 return *this;
01137 }
01138
01139 template<ShBindingType Binding, typename T, bool Swizzled>
01140 inline
01141 ShAttrib<3, Binding, T, Swizzled>&
01142 ShAttrib<3, Binding, T, Swizzled>::operator*=(host_type right)
01143 {
01144 ParentType::operator*=(right);
01145 return *this;
01146 }
01147
01148 template<ShBindingType Binding, typename T, bool Swizzled>
01149 inline
01150 ShAttrib<3, Binding, T, Swizzled>&
01151 ShAttrib<3, Binding, T, Swizzled>::operator/=(host_type right)
01152 {
01153 ParentType::operator/=(right);
01154 return *this;
01155 }
01156
01157 template<ShBindingType Binding, typename T, bool Swizzled>
01158 inline
01159 ShAttrib<3, Binding, T, Swizzled>&
01160 ShAttrib<3, Binding, T, Swizzled>::operator%=(host_type right)
01161 {
01162 ParentType::operator%=(right);
01163 return *this;
01164 }
01165
01166 template<ShBindingType Binding, typename T, bool Swizzled>
01167 template<typename T2>
01168 inline
01169 ShAttrib<3, Binding, T, Swizzled>&
01170 ShAttrib<3, Binding, T, Swizzled>::operator+=(const ShGeneric<1, T2>& right)
01171 {
01172 ParentType::operator+=(right);
01173 return *this;
01174 }
01175
01176 template<ShBindingType Binding, typename T, bool Swizzled>
01177 template<typename T2>
01178 inline
01179 ShAttrib<3, Binding, T, Swizzled>&
01180 ShAttrib<3, Binding, T, Swizzled>::operator-=(const ShGeneric<1, T2>& right)
01181 {
01182 ParentType::operator-=(right);
01183 return *this;
01184 }
01185
01186 template<ShBindingType Binding, typename T, bool Swizzled>
01187 template<typename T2>
01188 inline
01189 ShAttrib<3, Binding, T, Swizzled>&
01190 ShAttrib<3, Binding, T, Swizzled>::operator*=(const ShGeneric<1, T2>& right)
01191 {
01192 ParentType::operator*=(right);
01193 return *this;
01194 }
01195
01196 template<ShBindingType Binding, typename T, bool Swizzled>
01197 template<typename T2>
01198 inline
01199 ShAttrib<3, Binding, T, Swizzled>&
01200 ShAttrib<3, Binding, T, Swizzled>::operator/=(const ShGeneric<1, T2>& right)
01201 {
01202 ParentType::operator/=(right);
01203 return *this;
01204 }
01205
01206 template<ShBindingType Binding, typename T, bool Swizzled>
01207 template<typename T2>
01208 inline
01209 ShAttrib<3, Binding, T, Swizzled>&
01210 ShAttrib<3, Binding, T, Swizzled>::operator%=(const ShGeneric<1, T2>& right)
01211 {
01212 ParentType::operator%=(right);
01213 return *this;
01214 }
01215
01216 template<ShBindingType Binding, typename T, bool Swizzled>
01217 inline
01218 ShAttrib<1, Binding, T, true>
01219 ShAttrib<3, Binding, T, Swizzled>::operator()(int s0) const
01220 {
01221 return ShAttrib<1, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(3, s0), this->m_neg);
01222 }
01223
01224 template<ShBindingType Binding, typename T, bool Swizzled>
01225 inline
01226 ShAttrib<2, Binding, T, true>
01227 ShAttrib<3, Binding, T, Swizzled>::operator()(int s0, int s1) const
01228 {
01229 return ShAttrib<2, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(3, s0, s1), this->m_neg);
01230 }
01231
01232 template<ShBindingType Binding, typename T, bool Swizzled>
01233 inline
01234 ShAttrib<3, Binding, T, true>
01235 ShAttrib<3, Binding, T, Swizzled>::operator()(int s0, int s1, int s2) const
01236 {
01237 return ShAttrib<3, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(3, s0, s1, s2), this->m_neg);
01238 }
01239
01240 template<ShBindingType Binding, typename T, bool Swizzled>
01241 inline
01242 ShAttrib<4, Binding, T, true>
01243 ShAttrib<3, Binding, T, Swizzled>::operator()(int s0, int s1, int s2, int s3) const
01244 {
01245 return ShAttrib<4, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(3, s0, s1, s2, s3), this->m_neg);
01246 }
01247
01248 template<ShBindingType Binding, typename T, bool Swizzled>
01249 template<int N2>
01250 ShAttrib<N2, Binding, T, true>
01251 ShAttrib<3, Binding, T, Swizzled>::swiz(int indices[]) const
01252 {
01253 return ShAttrib<N2, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(3, N2, indices), this->m_neg);
01254 }
01255
01256 template<ShBindingType Binding, typename T, bool Swizzled>
01257 inline
01258 ShAttrib<1, Binding, T, true>
01259 ShAttrib<3, Binding, T, Swizzled>::operator[](int s0) const
01260 {
01261 return ShAttrib<1, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(3, s0), this->m_neg);
01262 }
01263
01264 template<ShBindingType Binding, typename T, bool Swizzled>
01265 ShAttrib<3, Binding, T, Swizzled>
01266 ShAttrib<3, Binding, T, Swizzled>::operator-() const
01267 {
01268 return ShAttrib<3, Binding, T, Swizzled>(this->m_node, this->m_swizzle, !this->m_neg);
01269 }
01270
01271 template<ShBindingType Binding, typename T, bool Swizzled>
01272 inline
01273 ShAttrib<4, Binding, T, Swizzled>::ShAttrib()
01274 : ShGeneric<4, T>(new ShVariableNode(Binding, 4, ShStorageTypeInfo<T>::value_type))
01275 {
01276 }
01277
01278 template<ShBindingType Binding, typename T, bool Swizzled>
01279 template<typename T2>
01280 inline
01281 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(const ShGeneric<4, T2>& other)
01282 : ShGeneric<4, T>(new ShVariableNode(Binding, 4, ShStorageTypeInfo<T>::value_type))
01283 {
01284 shASN(*this, other);
01285 }
01286
01287 template<ShBindingType Binding, typename T, bool Swizzled>
01288 inline
01289 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(const ShAttrib<4, Binding, T, Swizzled>& other)
01290 : ShGeneric<4, T>(new ShVariableNode(Binding, 4, ShStorageTypeInfo<T>::value_type))
01291 {
01292 shASN(*this, other);
01293 }
01294
01295 template<ShBindingType Binding, typename T, bool Swizzled>
01296 template<typename T2>
01297 inline
01298 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(const ShAttrib<4, Binding, T2, Swizzled>& other)
01299 : ShGeneric<4, T>(new ShVariableNode(Binding, 4, ShStorageTypeInfo<T>::value_type))
01300 {
01301 shASN(*this, other);
01302 }
01303
01304 template<ShBindingType Binding, typename T, bool Swizzled>
01305 inline
01306 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(const ShVariableNodePtr& node,
01307 const ShSwizzle& swizzle, bool neg)
01308 : ShGeneric<4, T>(node, swizzle, neg)
01309 {
01310 }
01311
01312 template<ShBindingType Binding, typename T, bool Swizzled>
01313 inline
01314 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(host_type data[4])
01315 : ShGeneric<4, T>(new ShVariableNode(Binding, 4, ShStorageTypeInfo<T>::value_type))
01316 {
01317 if (Binding == SH_CONST) {
01318 for (int i = 0; i < 4; i++) setValue(i, data[i]);
01319 } else {
01320 (*this) = ShAttrib<4, SH_CONST, T>(data);
01321 }
01322 }
01323
01324 template<ShBindingType Binding, typename T, bool Swizzled>
01325 inline
01326 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(host_type s0, host_type s1, host_type s2, host_type s3)
01327 : ShGeneric<4, T>(new ShVariableNode(Binding, 4, ShStorageTypeInfo<T>::value_type))
01328 {
01329 if (Binding == SH_CONST) {
01330 setValue(0, s0);
01331 setValue(1, s1);
01332 setValue(2, s2);
01333 setValue(3, s3);
01334 } else {
01335 (*this)[0] = s0;
01336 (*this)[1] = s1;
01337 (*this)[2] = s2;
01338 (*this)[3] = s3;
01339 }
01340 }
01341
01342 template<ShBindingType Binding, typename T, bool Swizzled>
01343 template<typename T2, typename T3, typename T4, typename T5>
01344 inline
01345 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(const ShGeneric<1, T2>& s0, const ShGeneric<1, T3>& s1, const ShGeneric<1, T4>& s2, const ShGeneric<1, T5>& s3)
01346 : ShGeneric<4, T>(new ShVariableNode(Binding, 4, ShStorageTypeInfo<T>::value_type))
01347 {
01348 if (Binding == SH_CONST) {
01349 SH_DEBUG_ASSERT(s0.hasValues());
01350 setValue(0, s0.getValue(0));
01351 SH_DEBUG_ASSERT(s1.hasValues());
01352 setValue(1, s1.getValue(0));
01353 SH_DEBUG_ASSERT(s2.hasValues());
01354 setValue(2, s2.getValue(0));
01355 SH_DEBUG_ASSERT(s3.hasValues());
01356 setValue(3, s3.getValue(0));
01357 } else {
01358 (*this)[0] = s0;
01359 (*this)[1] = s1;
01360 (*this)[2] = s2;
01361 (*this)[3] = s3;
01362 }
01363 }
01364
01365 template<ShBindingType Binding, typename T, bool Swizzled>
01366 inline
01367 ShAttrib<4, Binding, T, Swizzled>::~ShAttrib()
01368 {
01369 }
01370
01371 template<ShBindingType Binding, typename T, bool Swizzled>
01372 template<typename T2>
01373 inline
01374 ShAttrib<4, Binding, T, Swizzled>&
01375 ShAttrib<4, Binding, T, Swizzled>::operator=(const ShGeneric<4, T2>& other)
01376 {
01377 ParentType::operator=(other);
01378 return *this;
01379 }
01380
01381 template<ShBindingType Binding, typename T, bool Swizzled>
01382 inline
01383 ShAttrib<4, Binding, T, Swizzled>&
01384 ShAttrib<4, Binding, T, Swizzled>::operator=(const ShAttrib<4, Binding, T, Swizzled>& other)
01385 {
01386 ParentType::operator=(other);
01387 return *this;
01388 }
01389
01390 template<ShBindingType Binding, typename T, bool Swizzled>
01391 template<typename T2>
01392 inline
01393 ShAttrib<4, Binding, T, Swizzled>&
01394 ShAttrib<4, Binding, T, Swizzled>::operator=(const ShAttrib<4, Binding, T2, Swizzled>& other)
01395 {
01396 ParentType::operator=(other);
01397 return *this;
01398 }
01399
01400 template<ShBindingType Binding, typename T, bool Swizzled>
01401 inline
01402 ShAttrib<4, Binding, T, Swizzled>&
01403 ShAttrib<4, Binding, T, Swizzled>::operator=(const ShProgram& prg)
01404 {
01405 ParentType::operator=(prg);
01406 return *this;
01407 }
01408
01409 template<ShBindingType Binding, typename T, bool Swizzled>
01410 template<typename T2>
01411 inline
01412 ShAttrib<4, Binding, T, Swizzled>&
01413 ShAttrib<4, Binding, T, Swizzled>::operator+=(const ShGeneric<4, T2>& right)
01414 {
01415 ParentType::operator+=(right);
01416 return *this;
01417 }
01418
01419 template<ShBindingType Binding, typename T, bool Swizzled>
01420 template<typename T2>
01421 inline
01422 ShAttrib<4, Binding, T, Swizzled>&
01423 ShAttrib<4, Binding, T, Swizzled>::operator-=(const ShGeneric<4, T2>& right)
01424 {
01425 ParentType::operator-=(right);
01426 return *this;
01427 }
01428
01429 template<ShBindingType Binding, typename T, bool Swizzled>
01430 template<typename T2>
01431 inline
01432 ShAttrib<4, Binding, T, Swizzled>&
01433 ShAttrib<4, Binding, T, Swizzled>::operator*=(const ShGeneric<4, T2>& right)
01434 {
01435 ParentType::operator*=(right);
01436 return *this;
01437 }
01438
01439 template<ShBindingType Binding, typename T, bool Swizzled>
01440 template<typename T2>
01441 inline
01442 ShAttrib<4, Binding, T, Swizzled>&
01443 ShAttrib<4, Binding, T, Swizzled>::operator/=(const ShGeneric<4, T2>& right)
01444 {
01445 ParentType::operator/=(right);
01446 return *this;
01447 }
01448
01449 template<ShBindingType Binding, typename T, bool Swizzled>
01450 template<typename T2>
01451 inline
01452 ShAttrib<4, Binding, T, Swizzled>&
01453 ShAttrib<4, Binding, T, Swizzled>::operator%=(const ShGeneric<4, T2>& right)
01454 {
01455 ParentType::operator%=(right);
01456 return *this;
01457 }
01458
01459 template<ShBindingType Binding, typename T, bool Swizzled>
01460 inline
01461 ShAttrib<4, Binding, T, Swizzled>&
01462 ShAttrib<4, Binding, T, Swizzled>::operator+=(host_type right)
01463 {
01464 ParentType::operator+=(right);
01465 return *this;
01466 }
01467
01468 template<ShBindingType Binding, typename T, bool Swizzled>
01469 inline
01470 ShAttrib<4, Binding, T, Swizzled>&
01471 ShAttrib<4, Binding, T, Swizzled>::operator-=(host_type right)
01472 {
01473 ParentType::operator-=(right);
01474 return *this;
01475 }
01476
01477 template<ShBindingType Binding, typename T, bool Swizzled>
01478 inline
01479 ShAttrib<4, Binding, T, Swizzled>&
01480 ShAttrib<4, Binding, T, Swizzled>::operator*=(host_type right)
01481 {
01482 ParentType::operator*=(right);
01483 return *this;
01484 }
01485
01486 template<ShBindingType Binding, typename T, bool Swizzled>
01487 inline
01488 ShAttrib<4, Binding, T, Swizzled>&
01489 ShAttrib<4, Binding, T, Swizzled>::operator/=(host_type right)
01490 {
01491 ParentType::operator/=(right);
01492 return *this;
01493 }
01494
01495 template<ShBindingType Binding, typename T, bool Swizzled>
01496 inline
01497 ShAttrib<4, Binding, T, Swizzled>&
01498 ShAttrib<4, Binding, T, Swizzled>::operator%=(host_type right)
01499 {
01500 ParentType::operator%=(right);
01501 return *this;
01502 }
01503
01504 template<ShBindingType Binding, typename T, bool Swizzled>
01505 template<typename T2>
01506 inline
01507 ShAttrib<4, Binding, T, Swizzled>&
01508 ShAttrib<4, Binding, T, Swizzled>::operator+=(const ShGeneric<1, T2>& right)
01509 {
01510 ParentType::operator+=(right);
01511 return *this;
01512 }
01513
01514 template<ShBindingType Binding, typename T, bool Swizzled>
01515 template<typename T2>
01516 inline
01517 ShAttrib<4, Binding, T, Swizzled>&
01518 ShAttrib<4, Binding, T, Swizzled>::operator-=(const ShGeneric<1, T2>& right)
01519 {
01520 ParentType::operator-=(right);
01521 return *this;
01522 }
01523
01524 template<ShBindingType Binding, typename T, bool Swizzled>
01525 template<typename T2>
01526 inline
01527 ShAttrib<4, Binding, T, Swizzled>&
01528 ShAttrib<4, Binding, T, Swizzled>::operator*=(const ShGeneric<1, T2>& right)
01529 {
01530 ParentType::operator*=(right);
01531 return *this;
01532 }
01533
01534 template<ShBindingType Binding, typename T, bool Swizzled>
01535 template<typename T2>
01536 inline
01537 ShAttrib<4, Binding, T, Swizzled>&
01538 ShAttrib<4, Binding, T, Swizzled>::operator/=(const ShGeneric<1, T2>& right)
01539 {
01540 ParentType::operator/=(right);
01541 return *this;
01542 }
01543
01544 template<ShBindingType Binding, typename T, bool Swizzled>
01545 template<typename T2>
01546 inline
01547 ShAttrib<4, Binding, T, Swizzled>&
01548 ShAttrib<4, Binding, T, Swizzled>::operator%=(const ShGeneric<1, T2>& right)
01549 {
01550 ParentType::operator%=(right);
01551 return *this;
01552 }
01553
01554 template<ShBindingType Binding, typename T, bool Swizzled>
01555 inline
01556 ShAttrib<1, Binding, T, true>
01557 ShAttrib<4, Binding, T, Swizzled>::operator()(int s0) const
01558 {
01559 return ShAttrib<1, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(4, s0), this->m_neg);
01560 }
01561
01562 template<ShBindingType Binding, typename T, bool Swizzled>
01563 inline
01564 ShAttrib<2, Binding, T, true>
01565 ShAttrib<4, Binding, T, Swizzled>::operator()(int s0, int s1) const
01566 {
01567 return ShAttrib<2, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(4, s0, s1), this->m_neg);
01568 }
01569
01570 template<ShBindingType Binding, typename T, bool Swizzled>
01571 inline
01572 ShAttrib<3, Binding, T, true>
01573 ShAttrib<4, Binding, T, Swizzled>::operator()(int s0, int s1, int s2) const
01574 {
01575 return ShAttrib<3, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(4, s0, s1, s2), this->m_neg);
01576 }
01577
01578 template<ShBindingType Binding, typename T, bool Swizzled>
01579 inline
01580 ShAttrib<4, Binding, T, true>
01581 ShAttrib<4, Binding, T, Swizzled>::operator()(int s0, int s1, int s2, int s3) const
01582 {
01583 return ShAttrib<4, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(4, s0, s1, s2, s3), this->m_neg);
01584 }
01585
01586 template<ShBindingType Binding, typename T, bool Swizzled>
01587 template<int N2>
01588 ShAttrib<N2, Binding, T, true>
01589 ShAttrib<4, Binding, T, Swizzled>::swiz(int indices[]) const
01590 {
01591 return ShAttrib<N2, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(4, N2, indices), this->m_neg);
01592 }
01593
01594 template<ShBindingType Binding, typename T, bool Swizzled>
01595 inline
01596 ShAttrib<1, Binding, T, true>
01597 ShAttrib<4, Binding, T, Swizzled>::operator[](int s0) const
01598 {
01599 return ShAttrib<1, Binding, T, true>(this->m_node, this->m_swizzle * ShSwizzle(4, s0), this->m_neg);
01600 }
01601
01602 template<ShBindingType Binding, typename T, bool Swizzled>
01603 ShAttrib<4, Binding, T, Swizzled>
01604 ShAttrib<4, Binding, T, Swizzled>::operator-() const
01605 {
01606 return ShAttrib<4, Binding, T, Swizzled>(this->m_node, this->m_swizzle, !this->m_neg);
01607 }
01608
01609
01610 }
01611
01612 #endif // SH_SHATTRIBIMPL_HPP