00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef GPUPROGRAMDESCRIPTOR_H 00011 #define GPUPROGRAMDESCRIPTOR_H 00012 00013 #include "EnumWrapper.h" 00014 #include <string> 00015 #include <vector> 00016 00017 class DataVariant; 00018 class DynamicObject; 00019 00020 /** 00021 * This class describes a GPU program including I/O parameters. 00022 */ 00023 class GpuProgramDescriptor 00024 { 00025 public: 00026 /** 00027 * This type specifies the GPU shader type 00028 */ 00029 enum GpuProgramTypeEnum 00030 { 00031 VERTEX_PROGRAM, /**< The program should run on the GPU's vertex processor */ 00032 FRAGMENT_PROGRAM /**< The program should run on the GPU's fragment processor */ 00033 }; 00034 00035 /** 00036 * @EnumWrapper ::GpuProgramTypeEnum. 00037 */ 00038 typedef EnumWrapper<GpuProgramTypeEnum> GpuProgramType; 00039 00040 /** 00041 * Mutate the name of this GPU program. 00042 * 00043 * @param name 00044 * The new name 00045 */ 00046 virtual void setName(const std::string &name) = 0; 00047 00048 /** 00049 * Access the name of this GPU program. 00050 * 00051 * @return The name 00052 */ 00053 virtual const std::string& getName() const = 0; 00054 00055 /** 00056 * Mutate the type of this GPU program. 00057 * 00058 * @param type 00059 * The new type 00060 */ 00061 virtual void setType(GpuProgramType type) = 0; 00062 00063 /** 00064 * Access the type of this GPU program. 00065 * 00066 * @return The type 00067 */ 00068 virtual GpuProgramType getType() const = 0; 00069 00070 /** 00071 * Remove a parameter from this GPU program's parameter specification. 00072 * 00073 * @param name 00074 * The name of the parameter to remove 00075 * 00076 * @return True if successful, false if the parameter does not exist 00077 */ 00078 virtual bool removeParameter(const std::string &name) = 0; 00079 00080 /** 00081 * Set the value of a parameter in this GPU program's parameter specification. 00082 * 00083 * @param name 00084 * The name of the parameter to set 00085 * 00086 * @param value 00087 * The new value of the parameter 00088 * 00089 * @return True if the parameter's value was set, false if the parameter does not exist 00090 */ 00091 virtual bool setParameter(const std::string &name, const DataVariant &value) = 0; 00092 00093 /** 00094 * Get all the parameters and values in this GPU program's parameter specification. 00095 * 00096 * @return A DynamicObject containing the parameter names and values 00097 */ 00098 virtual const DynamicObject *getParameters() const = 0; 00099 00100 /** 00101 * Get the value of a parameter in this GPU program's parameter specification. 00102 * 00103 * @param name 00104 * The name of the parameter to get 00105 * 00106 * @return The value of the parameter. If the parameter does not exist, this will 00107 * be an invalid DataVariant. 00108 */ 00109 virtual const DataVariant& getParameter(const std::string &name) const = 0; 00110 00111 /** 00112 * Create a cloned copy of this GpuProgramDescriptor. 00113 * 00114 * @return A copy of this GpuProgramDescriptor or NULL if there was an 00115 * error creating the copy. 00116 */ 00117 virtual GpuProgramDescriptor *copy() const = 0; 00118 00119 protected: 00120 /** 00121 * This is automatically destroyed by the application. 00122 */ 00123 virtual ~GpuProgramDescriptor() {} 00124 }; 00125 00126 #endif