GteHLSLShaderType.cpp
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.1 (2016/09/12)
7 
8 #include <GTEnginePCH.h>
9 #include <LowLevel/GteLogger.h>
11 using namespace gte;
12 
13 
15  :
16  mName("")
17 {
18 }
19 
21 {
22  mDesc.varClass = desc.Class;
23  mDesc.varType = desc.Type;
24  mDesc.numRows = desc.Rows;
25  mDesc.numColumns = desc.Columns;
26  mDesc.numElements = desc.Elements;
27  mDesc.numChildren = desc.Members;
28  mDesc.offset = desc.Offset;
29  mDesc.typeName = std::string(desc.Name ? desc.Name : "");
30 
31  if (desc.Members > 0)
32  {
33  mChildren.resize(desc.Members);
34  }
35  else
36  {
37  mChildren.clear();
38  }
39 }
40 
42 {
43  mName = name;
44 }
45 
47 {
48  LogAssert(i < mDesc.numChildren, "Invalid index.");
49  return mChildren[i];
50 }
51 
52 HLSLShaderType const& HLSLShaderType::GetChild(unsigned int i) const
53 {
54  LogAssert(i < mDesc.numChildren, "Invalid index.");
55  return mChildren[i];
56 }
57 
59 {
60  return mName;
61 }
62 
63 D3D_SHADER_VARIABLE_CLASS HLSLShaderType::GetClass() const
64 {
65  return mDesc.varClass;
66 }
67 
68 D3D_SHADER_VARIABLE_TYPE HLSLShaderType::GetType() const
69 {
70  return mDesc.varType;
71 }
72 
73 unsigned int HLSLShaderType::GetNumRows() const
74 {
75  return mDesc.numRows;
76 }
77 
78 unsigned int HLSLShaderType::GetNumColumns() const
79 {
80  return mDesc.numColumns;
81 }
82 
83 unsigned int HLSLShaderType::GetNumElements() const
84 {
85  return mDesc.numElements;
86 }
87 
88 unsigned int HLSLShaderType::GetNumChildren() const
89 {
90  return mDesc.numChildren;
91 }
92 
93 unsigned int HLSLShaderType::GetOffset() const
94 {
95  return mDesc.offset;
96 }
97 
99 {
100  return mDesc.typeName;
101 }
102 
103 std::vector<HLSLShaderType> const& HLSLShaderType::GetChildren() const
104 {
105  return mChildren;
106 }
107 
108 void HLSLShaderType::Print(std::ofstream& output, int indent) const
109 {
110  std::string prefix = "";
111  for (int i = 0; i < indent; ++i)
112  {
113  prefix += " ";
114  }
115 
116  output << prefix << "name = " << mName << std::endl;
117  output << prefix << "variable class = " << msVarClass[mDesc.varClass]
118  << std::endl;
119  output << prefix << "variable type = " << msVarType[mDesc.varType]
120  << std::endl;
121  output << prefix << "rows = " << mDesc.numRows << std::endl;
122  output << prefix << "columns = " << mDesc.numColumns << std::endl;
123  output << prefix << "elements = " << mDesc.numElements << std::endl;
124  output << prefix << "children = " << mDesc.numChildren << std::endl;
125  output << prefix << "offset = " << mDesc.offset << std::endl;
126  output << prefix << "type name = " << mDesc.typeName << std::endl;
127 
128  ++indent;
129  for (auto const& child : mChildren)
130  {
131  child.Print(output, indent);
132  }
133 }
134 
135 
137 {
138  "D3D_SVC_SCALAR",
139  "D3D_SVC_VECTOR",
140  "D3D_SVC_MATRIX_ROWS",
141  "D3D_SVC_MATRIX_COLUMNS",
142  "D3D_SVC_OBJECT",
143  "D3D_SVC_STRUCT",
144  "D3D_SVC_INTERFACE_CLASS",
145  "D3D_SVC_INTERFACE_POINTER"
146 };
147 
149 {
150  "D3D_SVT_VOID",
151  "D3D_SVT_BOOL",
152  "D3D_SVT_INT",
153  "D3D_SVT_FLOAT",
154  "D3D_SVT_STRING",
155  "D3D_SVT_TEXTURE",
156  "D3D_SVT_TEXTURE1D",
157  "D3D_SVT_TEXTURE2D",
158  "D3D_SVT_TEXTURE3D",
159  "D3D_SVT_TEXTURECUBE",
160  "D3D_SVT_SAMPLER",
161  "D3D_SVT_SAMPLER1D",
162  "D3D_SVT_SAMPLER2D",
163  "D3D_SVT_SAMPLER3D",
164  "D3D_SVT_SAMPLERCUBE",
165  "D3D_SVT_PIXELSHADER",
166  "D3D_SVT_VERTEXSHADER",
167  "D3D_SVT_PIXELFRAGMENT",
168  "D3D_SVT_VERTEXFRAGMENT",
169  "D3D_SVT_UINT",
170  "D3D_SVT_UINT8",
171  "D3D_SVT_GEOMETRYSHADER",
172  "D3D_SVT_RASTERIZER",
173  "D3D_SVT_DEPTHSTENCIL",
174  "D3D_SVT_BLEND",
175  "D3D_SVT_BUFFER",
176  "D3D_SVT_CBUFFER",
177  "D3D_SVT_TBUFFER",
178  "D3D_SVT_TEXTURE1DARRAY",
179  "D3D_SVT_TEXTURE2DARRAY",
180  "D3D_SVT_RENDERTARGETVIEW",
181  "D3D_SVT_DEPTHSTENCILVIEW",
182  "D3D_SVT_TEXTURE2DMS",
183  "D3D_SVT_TEXTURE2DMSARRAY",
184  "D3D_SVT_TEXTURECUBEARRAY",
185  "D3D_SVT_HULLSHADER",
186  "D3D_SVT_DOMAINSHADER",
187  "D3D_SVT_INTERFACE_POINTER",
188  "D3D_SVT_COMPUTESHADER",
189  "D3D_SVT_DOUBLE",
190  "D3D_SVT_RWTEXTURE1D",
191  "D3D_SVT_RWTEXTURE1DARRAY",
192  "D3D_SVT_RWTEXTURE2D",
193  "D3D_SVT_RWTEXTURE2DARRAY",
194  "D3D_SVT_RWTEXTURE3D",
195  "D3D_SVT_RWBUFFER",
196  "D3D_SVT_BYTEADDRESS_BUFFER",
197  "D3D_SVT_RWBYTEADDRESS_BUFFER",
198  "D3D_SVT_STRUCTURED_BUFFER",
199  "D3D_SVT_RWSTRUCTURED_BUFFER",
200  "D3D_SVT_APPEND_STRUCTURED_BUFFER",
201  "D3D_SVT_CONSUME_STRUCTURED_BUFFER",
202  "D3D_SVT_MIN8FLOAT",
203  "D3D_SVT_MIN10FLOAT",
204  "D3D_SVT_MIN16FLOAT",
205  "D3D_SVT_MIN12INT",
206  "D3D_SVT_MIN16INT",
207  "D3D_SVT_MIN16UINT"
208 };
void SetDescription(D3D_SHADER_TYPE_DESC const &desc)
D3D_SHADER_VARIABLE_CLASS varClass
std::string const & GetTypeName() const
static std::string const msVarClass[]
#define LogAssert(condition, message)
Definition: GteLogger.h:86
#define D3D_SHADER_TYPE_DESC
D3D_SHADER_VARIABLE_TYPE varType
D3D_SHADER_VARIABLE_CLASS GetClass() const
HLSLShaderType & GetChild(unsigned int i)
GLuint const GLchar * name
Definition: glcorearb.h:781
std::vector< HLSLShaderType > mChildren
unsigned int GetNumRows() const
static std::string const msVarType[]
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
D3D_SHADER_VARIABLE_TYPE GetType() const
std::string const & GetName() const
unsigned int GetOffset() const
unsigned int GetNumElements() const
void Print(std::ofstream &output, int indent) const
unsigned int GetNumColumns() const
unsigned int GetNumChildren() const
std::vector< HLSLShaderType > const & GetChildren() const
void SetName(std::string const &name)


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00