#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2013 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_GRAPHICS_INTROSPECTION_INPUTPARAMETER_H #define NUCLEX_GRAPHICS_INTROSPECTION_INPUTPARAMETER_H #include "Nuclex/Graphics/Config.h" #include "BuiltInSemantic.h" #include "ParameterType.h" #include #include namespace Nuclex { namespace Graphics { namespace Introspection { // ------------------------------------------------------------------------------------------- // /// Describes an input parameter the shader is expecting struct InputParameter { /// Indicates how the input parameter is going to be used /// /// This is used for mapping of vertex elements to shader parameters. Commonly /// used semantics are "POSITION" or "COLOR". The semantic /// name is merely used for lookup purposes and could really be anything. /// public: std::string Semantic; /// Used to differentiate between parameters with the same semantic /// /// It may happen that there are multiple parameters with the same semantic, such /// as when working with multiple texture coordinate pairs. Via the index it is /// possible to differentiate between these parameters. Shaders usually declare /// such inputs as "TEXTURECOORDINATES0", "TEXTURECOORDINATES1" /// and so on. /// public: std::size_t SemanticIndex; /// Index of the register that is holding this parameter /// /// Which shader register this input parameter will be stored in. On the machine /// code level, shaders have a number of "slots" in which inputs are /// stored. Shader model 2.0 requires 16 such slots to be available. /// public: std::size_t RegisterIndex; /// Semantic of the parameter in a machine-understandable format /// /// This is a special indication of the parameter's semantic for the pipeline which /// can be used to adjust the behavior accordingly (whereas the semantic name /// stored as a string is free of any interpretation). /// public: BuiltInSemantic::Enum BuiltInSemantic; /// The type of the parameter /// /// /// Each shader parameter consists of 4 components, each holding a separate value /// (though not all components may be used). A 3D position wouldn't be passed as /// 3 separate parameters but as one parameter with 3 components (x, y, z). /// Similarly a color would be passed as 1 parameter with 4 components (r, g, b, a). /// /// /// All components are required to be of the same type. Mixing integers and /// floating point values in the components of a single parameter is not /// allowed, thus the type is a property of the parameter, not the component. /// /// public: ParameterType::Enum Type; /// Which components of this parameter get used /// /// As described in the field, each parameter can carry up /// to 4 distinct values usually used to transport either x, y, z, w for positions /// or r, g, b, a for colors. Not all of the components may be used all the time, /// however, so this mask indicates which components the shader actually consumes. /// public: std::size_t UsedComponents; }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Graphics::Introspection #endif // NUCLEX_GRAPHICS_INTROSPECTION_INPUTPARAMETER_H