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_HGIGL_SHADERPROGRAM_H
8#define PXR_IMAGING_HGIGL_SHADERPROGRAM_H
9
10#include "pxr/imaging/hgi/shaderProgram.h"
11
12#include "pxr/imaging/hgiGL/api.h"
13#include "pxr/imaging/hgiGL/shaderFunction.h"
14
15#include <vector>
16
17PXR_NAMESPACE_OPEN_SCOPE
18
19
26{
27public:
28 HGIGL_API
29 ~HgiGLShaderProgram() override;
30
31 HGIGL_API
32 bool IsValid() const override;
33
34 HGIGL_API
35 std::string const& GetCompileErrors() override;
36
37 HGIGL_API
38 HgiShaderFunctionHandleVector const& GetShaderFunctions() const override;
39
40 HGIGL_API
41 size_t GetByteSizeOfResource() const override;
42
43 HGIGL_API
44 uint64_t GetRawResource() const override;
45
47 HGIGL_API
48 uint32_t GetProgramId() const;
49
56 HGIGL_API
57 uint32_t GetUniformBuffer(size_t sizeHint);
58
59protected:
60 friend class HgiGL;
61
62 HGIGL_API
64
65private:
66 HgiGLShaderProgram() = delete;
67 HgiGLShaderProgram & operator=(const HgiGLShaderProgram&) = delete;
69
70private:
71 std::string _errors;
72 uint32_t _programId;
73 size_t _programByteSize;
74 uint32_t _uniformBuffer;
75 size_t _uboByteSize;
76};
77
78
79PXR_NAMESPACE_CLOSE_SCOPE
80
81#endif
OpenGL implementation of the Hydra Graphics Interface.
Definition: hgi.h:55
OpenGL implementation of HgiShaderProgram.
Definition: shaderProgram.h:26
HGIGL_API uint32_t GetProgramId() const
Returns the gl resource id of the program.
HGIGL_API HgiShaderFunctionHandleVector const & GetShaderFunctions() const override
Returns the shader functions that are part of this program.
HGIGL_API std::string const & GetCompileErrors() override
Returns shader compile errors.
HGIGL_API uint32_t GetUniformBuffer(size_t sizeHint)
Returns the gl resource for the uniform block of this shader program.
HGIGL_API bool IsValid() const override
Returns false if any shader compile errors occured.
HGIGL_API size_t GetByteSizeOfResource() const override
Returns the byte size of the GPU shader program.
HGIGL_API uint64_t GetRawResource() const override
This function returns the handle to the Hgi backend's gpu resource, cast to a uint64_t.
Represents a collection of shader functions.
Definition: shaderProgram.h:64
Describes the properties needed to create a GPU shader program.
Definition: shaderProgram.h:35