shaderFunction.h
1 //
2 // Copyright 2020 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HGI_SHADERFUNCTION_H
8 #define PXR_IMAGING_HGI_SHADERFUNCTION_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hgi/api.h"
12 #include "pxr/imaging/hgi/enums.h"
13 #include "pxr/imaging/hgi/handle.h"
14 #include "pxr/imaging/hgi/shaderFunctionDesc.h"
15 #include "pxr/imaging/hgi/types.h"
16 
17 PXR_NAMESPACE_OPEN_SCOPE
18 
31 {
32 public:
33  HGI_API
34  virtual ~HgiShaderFunction();
35 
37  HGI_API
38  HgiShaderFunctionDesc const& GetDescriptor() const;
39 
41  HGI_API
42  virtual bool IsValid() const = 0;
43 
45  HGI_API
46  virtual std::string const& GetCompileErrors() = 0;
47 
50  HGI_API
51  virtual size_t GetByteSizeOfResource() const = 0;
52 
64  HGI_API
65  virtual uint64_t GetRawResource() const = 0;
66 
67 protected:
68  HGI_API
70 
71  HgiShaderFunctionDesc _descriptor;
72 
73 private:
74  HgiShaderFunction() = delete;
75  HgiShaderFunction & operator=(const HgiShaderFunction&) = delete;
76  HgiShaderFunction(const HgiShaderFunction&) = delete;
77 };
78 
80 using HgiShaderFunctionHandleVector = std::vector<HgiShaderFunctionHandle>;
81 
82 PXR_NAMESPACE_CLOSE_SCOPE
83 
84 #endif
Represents one shader stage function (code snippet).
virtual HGI_API bool IsValid() const =0
Returns false if any shader compile errors occured.
HGI_API HgiShaderFunctionDesc const & GetDescriptor() const
The descriptor describes the object.
virtual HGI_API uint64_t GetRawResource() const =0
This function returns the handle to the Hgi backend's gpu resource, cast to a uint64_t.
virtual HGI_API std::string const & GetCompileErrors()=0
Returns shader compile errors.
virtual HGI_API size_t GetByteSizeOfResource() const =0
Returns the byte size of the GPU shader function.
Describes the properties needed to create a GPU shader function.
Handle that contains a hgi object and unique id.
Definition: handle.h:32