All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
shaderFunctionDesc.h
1 //
2 // Copyright 2020 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 
25 #ifndef PXR_IMAGING_HGI_SHADERFUNCTIONDESC_H
26 #define PXR_IMAGING_HGI_SHADERFUNCTIONDESC_H
27 
28 #include "pxr/pxr.h"
29 #include "pxr/imaging/hgi/api.h"
30 #include "pxr/imaging/hgi/enums.h"
31 #include "pxr/imaging/hgi/types.h"
32 
33 #include <string>
34 #include <vector>
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 
54 {
55  HGI_API
57 
58  std::string nameInShader;
59  uint32_t dimensions;
60  HgiFormat format;
61 };
62 
63 using HgiShaderFunctionTextureDescVector =
64  std::vector<HgiShaderFunctionTextureDesc>;
65 
66 HGI_API
67 bool operator==(
69  const HgiShaderFunctionTextureDesc& rhs);
70 
71 HGI_API
72 bool operator!=(
74  const HgiShaderFunctionTextureDesc& rhs);
75 
88 {
89  HGI_API
91 
92  std::string nameInShader;
93  std::string type;
94 };
95 
96 using HgiShaderFunctionBufferDescVector =
97  std::vector<HgiShaderFunctionBufferDesc>;
98 
99 HGI_API
100 bool operator==(
101  const HgiShaderFunctionBufferDesc& lhs,
102  const HgiShaderFunctionBufferDesc& rhs);
103 
104 HGI_API
105 bool operator!=(
106  const HgiShaderFunctionBufferDesc& lhs,
107  const HgiShaderFunctionBufferDesc& rhs);
108 
127 {
128  HGI_API
130 
131  std::string nameInShader;
132  std::string type;
133  std::string role;
134  std::string attribute;
135  std::string attributeIndex;
136 };
137 
138 using HgiShaderFunctionParamDescVector =
139  std::vector<HgiShaderFunctionParamDesc>;
140 
141 HGI_API
142 bool operator==(
143  const HgiShaderFunctionParamDesc& lhs,
144  const HgiShaderFunctionParamDesc& rhs);
145 
146 HGI_API
147 bool operator!=(
148  const HgiShaderFunctionParamDesc& lhs,
149  const HgiShaderFunctionParamDesc& rhs);
150 
175 {
176  HGI_API
178  std::string debugName;
179  HgiShaderStage shaderStage;
180  const char* shaderCode;
181  std::vector<HgiShaderFunctionTextureDesc> textures;
182  std::vector<HgiShaderFunctionBufferDesc> buffers;
183  std::vector<HgiShaderFunctionParamDesc> constantParams;
184  std::vector<HgiShaderFunctionParamDesc> stageInputs;
185  std::vector<HgiShaderFunctionParamDesc> stageOutputs;
186 };
187 
188 using HgiShaderFunctionDescVector =
189  std::vector<HgiShaderFunctionDesc>;
190 
191 HGI_API
192 bool operator==(
193  const HgiShaderFunctionDesc& lhs,
194  const HgiShaderFunctionDesc& rhs);
195 
196 HGI_API
197 bool operator!=(
198  const HgiShaderFunctionDesc& lhs,
199  const HgiShaderFunctionDesc& rhs);
200 
202 HGI_API
203 void
204 HgiShaderFunctionAddTexture(
205  HgiShaderFunctionDesc *desc,
206  const std::string &nameInShader,
207  uint32_t dimensions = 2,
208  const HgiFormat &format = HgiFormatFloat32Vec4);
209 
211 HGI_API
212 void
213 HgiShaderFunctionAddBuffer(
214  HgiShaderFunctionDesc *desc,
215  const std::string &nameInShader,
216  const std::string &type);
217 
220 HGI_API
221 void
222 HgiShaderFunctionAddConstantParam(
223  HgiShaderFunctionDesc *desc,
224  const std::string &nameInShader,
225  const std::string &type,
226  const std::string &role = std::string(),
227  const std::string &attribute = std::string(),
228  const std::string &attributeIndex = std::string());
229 
232 HGI_API
233 void
234 HgiShaderFunctionAddStageInput(
235  HgiShaderFunctionDesc *desc,
236  const std::string &nameInShader,
237  const std::string &type,
238  const std::string &role = std::string(),
239  const std::string &attribute = std::string(),
240  const std::string &attributeIndex = std::string());
241 
244 HGI_API
245 void
246 HgiShaderFunctionAddStageOutput(
247  HgiShaderFunctionDesc *desc,
248  const std::string &nameInShader,
249  const std::string &type,
250  const std::string &role = std::string(),
251  const std::string &attribute = std::string(),
252  const std::string &attributeIndex = std::string());
253 
254 PXR_NAMESPACE_CLOSE_SCOPE
255 
256 #endif
Describes a buffer to be passed into a shader.
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
Describes a constant param passed into a shader.
Describes a texture to be passed into a shader.
Describes the properties needed to create a GPU shader function.