GteHLSLResource.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>
10 using namespace gte;
11 
12 
14 {
15 }
16 
18  unsigned int numBytes)
19  :
20  mNumBytes(numBytes)
21 {
22  mDesc.name = std::string(desc.Name);
23  mDesc.bindPoint = desc.BindPoint;
24  mDesc.bindCount = desc.BindCount;
25  mDesc.type = desc.Type;
26  mDesc.flags = desc.uFlags;
27  mDesc.returnType = desc.ReturnType;
28  mDesc.dimension = desc.Dimension;
29  mDesc.numSamples = desc.NumSamples;
30 }
31 
33  unsigned int index, unsigned int numBytes)
34  :
35  mNumBytes(numBytes)
36 {
37  mDesc.name = std::string(desc.Name) + "[" + std::to_string(index) + "]";
38  mDesc.bindPoint = desc.BindPoint + index;
39  mDesc.bindCount = 1;
40  mDesc.type = desc.Type;
41  mDesc.flags = desc.uFlags;
42  mDesc.returnType = desc.ReturnType;
43  mDesc.dimension = desc.Dimension;
44  mDesc.numSamples = desc.NumSamples;
45 }
46 
48 {
49  return mDesc.name;
50 }
51 
52 D3D_SHADER_INPUT_TYPE HLSLResource::GetType() const
53 {
54  return mDesc.type;
55 }
56 
57 unsigned int HLSLResource::GetBindPoint() const
58 {
59  return mDesc.bindPoint;
60 }
61 
62 unsigned int HLSLResource::GetBindCount() const
63 {
64  return mDesc.bindCount;
65 }
66 
67 unsigned int HLSLResource::GetFlags() const
68 {
69  return mDesc.flags;
70 }
71 
72 D3D_RESOURCE_RETURN_TYPE HLSLResource::GetReturnType() const
73 {
74  return mDesc.returnType;
75 }
76 
77 D3D_SRV_DIMENSION HLSLResource::GetDimension() const
78 {
79  return mDesc.dimension;
80 }
81 
82 unsigned int HLSLResource::GetNumSamples() const
83 {
84  return mDesc.numSamples;
85 }
86 
87 unsigned int HLSLResource::GetNumBytes() const
88 {
89  return mNumBytes;
90 }
91 
92 void HLSLResource::Print(std::ofstream& output) const
93 {
94  output << "name = " << mDesc.name << std::endl;
95  output << "shader input type = " << msSIType[mDesc.type] << std::endl;
96  output << "bind point = " << mDesc.bindPoint << std::endl;
97  output << "bind count = " << mDesc.bindCount << std::endl;
98  output << "flags = " << mDesc.flags << std::endl;
99  output << "return type = " << msReturnType[mDesc.returnType] << std::endl;
100  output << "dimension = " << msSRVDimension[mDesc.dimension] << std::endl;
101  if (mDesc.numSamples == 0xFFFFFFFFu)
102  {
103  output << "samples = -1" << std::endl;
104  }
105  else
106  {
107  output << "samples = " << mDesc.numSamples << std::endl;
108  }
109  output << "number of bytes = " << mNumBytes << std::endl;
110 }
111 
112 
114 {
115  "D3D_SIT_CBUFFER",
116  "D3D_SIT_TBUFFER",
117  "D3D_SIT_TEXTURE",
118  "D3D_SIT_SAMPLER",
119  "D3D_SIT_UAV_RWTYPED",
120  "D3D_SIT_STRUCTURED",
121  "D3D_SIT_UAV_RWSTRUCTURED",
122  "D3D_SIT_BYTEADDRESS",
123  "D3D_SIT_UAV_RWBYTEADDRESS",
124  "D3D_SIT_UAV_APPEND_STRUCTURED",
125  "D3D_SIT_UAV_CONSUME_STRUCTURED",
126  "D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER"
127 };
128 
130 {
131  "none", // There is no D3D_RESOURCE_RETURN_TYPE for value 0.
132  "D3D_RETURN_TYPE_UNORM",
133  "D3D_RETURN_TYPE_SNORM",
134  "D3D_RETURN_TYPE_SINT",
135  "D3D_RETURN_TYPE_UINT",
136  "D3D_RETURN_TYPE_FLOAT",
137  "D3D_RETURN_TYPE_MIXED",
138  "D3D_RETURN_TYPE_DOUBLE",
139  "D3D_RETURN_TYPE_CONTINUED"
140 };
141 
143 {
144  "D3D_SRV_DIMENSION_UNKNOWN",
145  "D3D_SRV_DIMENSION_BUFFER",
146  "D3D_SRV_DIMENSION_TEXTURE1D",
147  "D3D_SRV_DIMENSION_TEXTURE1DARRAY",
148  "D3D_SRV_DIMENSION_TEXTURE2D",
149  "D3D_SRV_DIMENSION_TEXTURE2DARRAY",
150  "D3D_SRV_DIMENSION_TEXTURE2DMS",
151  "D3D_SRV_DIMENSION_TEXTURE2DMSARRAY",
152  "D3D_SRV_DIMENSION_TEXTURE3D",
153  "D3D_SRV_DIMENSION_TEXTURECUBE",
154  "D3D_SRV_DIMENSION_TEXTURECUBEARRAY",
155  "D3D_SRV_DIMENSION_BUFFEREX"
156 };
unsigned int GetBindCount() const
static std::string const msSRVDimension[]
unsigned int mNumBytes
static std::string const msReturnType[]
D3D_SRV_DIMENSION GetDimension() const
unsigned int GetNumBytes() const
static std::string const msSIType[]
std::string const & GetName() const
D3D_SHADER_INPUT_TYPE GetType() const
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
unsigned int GetNumSamples() const
#define D3D_SHADER_INPUT_BIND_DESC
virtual void Print(std::ofstream &output) const
unsigned int GetFlags() const
HLSLResource(D3D_SHADER_INPUT_BIND_DESC const &desc, unsigned int numBytes)
D3D_SHADER_INPUT_TYPE type
GLuint index
Definition: glcorearb.h:781
D3D_RESOURCE_RETURN_TYPE returnType
unsigned int GetBindPoint() const
D3D_RESOURCE_RETURN_TYPE GetReturnType() const


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