OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreD3D9HLSLProgram.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __D3D9HLSLProgram_H__
29 #define __D3D9HLSLProgram_H__
30 
31 #include "OgreD3D9Prerequisites.h"
33 
34 namespace Ogre {
44  {
45  public:
47  class CmdEntryPoint : public ParamCommand
48  {
49  public:
50  String doGet(const void* target) const;
51  void doSet(void* target, const String& val);
52  };
54  class CmdTarget : public ParamCommand
55  {
56  public:
57  String doGet(const void* target) const;
58  void doSet(void* target, const String& val);
59  };
62  {
63  public:
64  String doGet(const void* target) const;
65  void doSet(void* target, const String& val);
66  };
69  {
70  public:
71  String doGet(const void* target) const;
72  void doSet(void* target, const String& val);
73  };
76  {
77  public:
78  String doGet(const void* target) const;
79  void doSet(void* target, const String& val);
80  };
81 
83  class CmdMicrocode : public ParamCommand
84  {
85  public:
86  String doGet(const void* target) const;
87  void doSet(void* target, const String& val);
88  };
89 
92  {
93  public:
94  String doGet(const void* target) const;
95  void doSet(void* target, const String& val);
96  };
97  protected:
98 
106 
109  void loadFromSource(void);
112  void createLowLevelImpl(void);
114  void unloadHighLevelImpl(void);
116  void buildConstantDefinitions() const;
117 
118  // Recursive utility method for buildParamNameMap
119  void processParamElement(D3DXHANDLE parent, String prefix, unsigned int index) const;
120  void populateDef(D3DXCONSTANT_DESC& d3dDesc, GpuConstantDefinition& def) const;
121 
126 
127  LPD3DXBUFFER mpMicroCode;
128  LPD3DXCONSTANTTABLE mpConstTable;
129 
130  public:
131  LPD3DXBUFFER getMicroCode();
132  public:
135  {
147  OPT_3
148  };
149  protected:
151 
152  public:
153  D3D9HLSLProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
154  const String& group, bool isManual, ManualResourceLoader* loader);
155  ~D3D9HLSLProgram();
156 
158  void setEntryPoint(const String& entryPoint) { mEntryPoint = entryPoint; }
160  const String& getEntryPoint(void) const { return mEntryPoint; }
162  void setTarget(const String& target);
164  const String& getTarget(void) const { return mTarget; }
166  void setPreprocessorDefines(const String& defines) { mPreprocessorDefines = defines; }
168  const String& getPreprocessorDefines(void) const { return mPreprocessorDefines; }
170  void setColumnMajorMatrices(bool columnMajor) { mColumnMajorMatrices = columnMajor; }
172  bool getColumnMajorMatrices(void) const { return mColumnMajorMatrices; }
176  void setOptimisationLevel(OptimisationLevel opt) { mOptimisationLevel = opt; }
177 
179  OptimisationLevel getOptimisationLevel() const { return mOptimisationLevel; }
180 
182  bool isSupported(void) const;
184  GpuProgramParametersSharedPtr createParameters(void);
186  const String& getLanguage(void) const;
187  };
188 }
189 
190 #endif
static CmdAssemblerCode msCmdAssemblerCode
OptimisationLevel getOptimisationLevel() const
Gets the optimisation level to use.
Command object for setting target assembler.
static CmdTarget msCmdTarget
bool getColumnMajorMatrices(void) const
Gets whether matrix packed in column-major order.
Command object for getting/setting assembler code.
Command object for setting matrix packing in column-major order.
Interface describing a manual resource loader.
Definition: OgreResource.h:512
OptimisationLevel mOptimisationLevel
Specialisation of HighLevelGpuProgram to provide support for D3D9 High-Level Shader Language (HLSL)...
static CmdMicrocode msCmdMicrocode
const String & getPreprocessorDefines(void) const
Sets the preprocessor defines use to compile the program.
void setEntryPoint(const String &entryPoint)
Sets the entry point for this program ie the first method called.
void setColumnMajorMatrices(bool columnMajor)
Sets whether matrix packing in column-major order.
Command object for setting entry point.
static CmdOptimisation msCmdOptimisation
#define _OgreD3D9Export
Command object for getting/setting micro code.
unsigned long long int ResourceHandle
Definition: OgreResource.h:39
const String & getEntryPoint(void) const
Gets the entry point defined for this program.
OptimisationLevel
Shader optimisation level.
static CmdEntryPoint msCmdEntryPoint
Defines a generic resource handler.
Information about predefined program constants.
_StringBase String
default - no optimisation in debug mode, OPT_1 in release mode
const String & getTarget(void) const
Gets the shader target to compile down to, e.g.
Command object for setting optimisation level.
Abstract base class representing a high-level program (a vertex or fragment program).
LPD3DXCONSTANTTABLE mpConstTable
Command object for setting macro defines.
static CmdPreprocessorDefines msCmdPreprocessorDefines
void setOptimisationLevel(OptimisationLevel opt)
Sets the optimisation level to use.
Abstract class which is command object which gets/sets parameters.
static CmdColumnMajorMatrices msCmdColumnMajorMatrices
void setPreprocessorDefines(const String &defines)
Sets the preprocessor defines use to compile the program.