Loading...
Searching...
No Matches
shaderProgram.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_SHADERPROGRAM_H
8#define PXR_IMAGING_HGI_SHADERPROGRAM_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/shaderFunction.h"
15#include "pxr/imaging/hgi/types.h"
16
17#include <vector>
18
19
20PXR_NAMESPACE_OPEN_SCOPE
21
22
35{
36 HGI_API
38
39 std::string debugName;
40 HgiShaderFunctionHandleVector shaderFunctions;
41};
42
43HGI_API
44bool operator==(
45 const HgiShaderProgramDesc& lhs,
46 const HgiShaderProgramDesc& rhs);
47
48HGI_API
49bool operator!=(
50 const HgiShaderProgramDesc& lhs,
51 const HgiShaderProgramDesc& rhs);
52
53
64{
65public:
66 HGI_API
67 virtual ~HgiShaderProgram();
68
70 HGI_API
72
74 HGI_API
75 virtual bool IsValid() const = 0;
76
78 HGI_API
79 virtual std::string const& GetCompileErrors() = 0;
80
82 HGI_API
83 virtual HgiShaderFunctionHandleVector const& GetShaderFunctions() const = 0;
84
89 HGI_API
90 virtual size_t GetByteSizeOfResource() const = 0;
91
101 HGI_API
102 virtual uint64_t GetRawResource() const = 0;
103
104protected:
105 HGI_API
107
108 HgiShaderProgramDesc _descriptor;
109
110private:
111 HgiShaderProgram() = delete;
112 HgiShaderProgram & operator=(const HgiShaderProgram&) = delete;
113 HgiShaderProgram(const HgiShaderProgram&) = delete;
114};
115
117using HgiShaderProgramHandleVector = std::vector<HgiShaderProgramHandle>;
118
119
120PXR_NAMESPACE_CLOSE_SCOPE
121
122#endif
Represents a collection of shader functions.
Definition: shaderProgram.h:64
virtual HGI_API bool IsValid() const =0
Returns false if any shader compile errors occured.
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.
HGI_API HgiShaderProgramDesc const & GetDescriptor() const
The descriptor describes the object.
virtual HGI_API HgiShaderFunctionHandleVector const & GetShaderFunctions() const =0
Returns the shader functions that are part of this program.
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 program.
Describes the properties needed to create a GPU shader program.
Definition: shaderProgram.h:35