All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
shaderProgram.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 #ifndef PXR_IMAGING_HGI_SHADERPROGRAM_H
25 #define PXR_IMAGING_HGI_SHADERPROGRAM_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hgi/api.h"
29 #include "pxr/imaging/hgi/enums.h"
30 #include "pxr/imaging/hgi/handle.h"
31 #include "pxr/imaging/hgi/shaderFunction.h"
32 #include "pxr/imaging/hgi/types.h"
33 
34 #include <vector>
35 
36 
37 PXR_NAMESPACE_OPEN_SCOPE
38 
39 
52 {
53  HGI_API
55 
56  std::string debugName;
57  HgiShaderFunctionHandleVector shaderFunctions;
58 };
59 
60 HGI_API
61 inline bool operator==(
62  const HgiShaderProgramDesc& lhs,
63  const HgiShaderProgramDesc& rhs);
64 
65 HGI_API
66 inline bool operator!=(
67  const HgiShaderProgramDesc& lhs,
68  const HgiShaderProgramDesc& rhs);
69 
70 
81 {
82 public:
83  HGI_API
84  virtual ~HgiShaderProgram();
85 
87  HGI_API
88  HgiShaderProgramDesc const& GetDescriptor() const;
89 
91  HGI_API
92  virtual bool IsValid() const = 0;
93 
95  HGI_API
96  virtual std::string const& GetCompileErrors() = 0;
97 
99  HGI_API
100  virtual HgiShaderFunctionHandleVector const& GetShaderFunctions() const = 0;
101 
106  HGI_API
107  virtual size_t GetByteSizeOfResource() const = 0;
108 
118  HGI_API
119  virtual uint64_t GetRawResource() const = 0;
120 
121 protected:
122  HGI_API
124 
125  HgiShaderProgramDesc _descriptor;
126 
127 private:
128  HgiShaderProgram() = delete;
129  HgiShaderProgram & operator=(const HgiShaderProgram&) = delete;
130  HgiShaderProgram(const HgiShaderProgram&) = delete;
131 };
132 
134 using HgiShaderProgramHandleVector = std::vector<HgiShaderProgramHandle>;
135 
136 
137 PXR_NAMESPACE_CLOSE_SCOPE
138 
139 #endif
HGI_API HgiShaderProgramDesc const & GetDescriptor() const
The descriptor describes the object.
virtual HGI_API size_t GetByteSizeOfResource() const =0
Returns the byte size of the GPU shader program.
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
virtual HGI_API HgiShaderFunctionHandleVector const & GetShaderFunctions() const =0
Returns the shader functions that are part of this program.
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
virtual HGI_API uint64_t GetRawResource() const =0
This function returns the handle to the Hgi backend&#39;s gpu resource, cast to a uint64_t.
virtual HGI_API std::string const & GetCompileErrors()=0
Returns shader compile errors.
Describes the properties needed to create a GPU shader program.
Definition: shaderProgram.h:51
Represents a collection of shader functions.
Definition: shaderProgram.h:80
virtual HGI_API bool IsValid() const =0
Returns false if any shader compile errors occured.