Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ArbReg.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright (c) 2003 University of Waterloo Computer Graphics Laboratory
00004 // Project administrator: Michael D. McCool
00005 // Authors: Zheng Qin, Stefanus Du Toit, Kevin Moule, Tiberiu S. Popa,
00006 //          Michael D. McCool
00007 // 
00008 // This software is provided 'as-is', without any express or implied
00009 // warranty. In no event will the authors be held liable for any damages
00010 // arising from the use of this software.
00011 // 
00012 // Permission is granted to anyone to use this software for any purpose,
00013 // including commercial applications, and to alter it and redistribute it
00014 // freely, subject to the following restrictions:
00015 // 
00016 // 1. The origin of this software must not be misrepresented; you must
00017 // not claim that you wrote the original software. If you use this
00018 // software in a product, an acknowledgment in the product documentation
00019 // would be appreciated but is not required.
00020 // 
00021 // 2. Altered source versions must be plainly marked as such, and must
00022 // not be misrepresented as being the original software.
00023 // 
00024 // 3. This notice may not be removed or altered from any source
00025 // distribution.
00027 #ifndef ARBREG_HPP
00028 #define ARBREG_HPP
00029 
00030 #include <string>
00031 #include <iosfwd>
00032 
00033 #include "ShRefCount.hpp"
00034 
00035 namespace shgl {
00036 
00039 enum ArbRegType {
00040   SH_ARB_REG_ATTRIB,
00041   SH_ARB_REG_PARAM,
00042   SH_ARB_REG_TEMP,
00043   SH_ARB_REG_HALF_TEMP, // @todo type may want to rethink this
00044   SH_ARB_REG_ADDRESS,
00045   SH_ARB_REG_OUTPUT,
00046   SH_ARB_REG_CONST,
00047   SH_ARB_REG_TEXTURE
00048 };
00049 
00052 enum ArbRegBinding {
00053   // VERTEX and FRAGMENT
00054   // Parameter
00055   SH_ARB_REG_PROGRAMLOC,
00056   SH_ARB_REG_PROGRAMENV,
00057   SH_ARB_REG_STATE,
00058   // Output
00059   SH_ARB_REG_RESULTCOL,
00060 
00061   // VERTEX
00062   // Input
00063   SH_ARB_REG_VERTEXPOS,
00064   SH_ARB_REG_VERTEXWGT,
00065   SH_ARB_REG_VERTEXNRM,
00066   SH_ARB_REG_VERTEXCOL,
00067   SH_ARB_REG_VERTEXFOG,
00068   SH_ARB_REG_VERTEXTEX,
00069   SH_ARB_REG_VERTEXMAT,
00070   SH_ARB_REG_VERTEXATR,
00071   // Output
00072   SH_ARB_REG_RESULTPOS,
00073   SH_ARB_REG_RESULTFOG,
00074   SH_ARB_REG_RESULTPTS, 
00075   SH_ARB_REG_RESULTTEX,
00076 
00077   // FRAGMENT
00078   // Input
00079   SH_ARB_REG_FRAGMENTCOL,
00080   SH_ARB_REG_FRAGMENTTEX,
00081   SH_ARB_REG_FRAGMENTFOG,
00082   SH_ARB_REG_FRAGMENTPOS,
00083   // Output
00084   SH_ARB_REG_RESULTDPT,
00085 
00086   SH_ARB_REG_NONE
00087 };
00088 
00091 struct ArbReg : public SH::ShRefCountable {
00092   ArbReg();
00093   ArbReg(ArbRegType type, int index, std::string name = "");
00094 
00095   ArbRegType type;
00096   int index;
00097   std::string name; //< variable name (if any) associated with the register
00098 
00099   struct BindingInfo
00100     {
00101     ArbRegBinding type;
00102     int index;
00103     int count;
00104     std::string name;
00105     float values[4];
00106     };
00107   BindingInfo binding;
00108 
00109   friend std::ostream& operator<<(std::ostream& out, const ArbReg& reg);
00110   
00112   std::ostream& printDecl(std::ostream& out) const;
00113 };
00114 
00115 
00116 }
00117 
00118 #endif

Generated on Mon Jan 24 18:36:29 2005 for Sh by  doxygen 1.4.1