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

Generated on Thu Apr 21 17:32:44 2005 for Sh by  doxygen 1.4.2