HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
computeCmds.h
Go to the documentation of this file.
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_GL_COMPUTE_CMDS_H
8 #define PXR_IMAGING_HGI_GL_COMPUTE_CMDS_H
9 
10 #include "pxr/pxr.h"
13 #include "pxr/imaging/hgiGL/api.h"
14 #include "pxr/imaging/hgiGL/hgi.h"
15 #include <cstdint>
16 
18 
19 struct HgiComputeCmdsDesc;
20 
21 /// \class HgiGLComputeCmds
22 ///
23 /// OpenGL implementation of HgiComputeCmds.
24 ///
25 class HgiGLComputeCmds final : public HgiComputeCmds
26 {
27 public:
28  HGIGL_API
29  ~HgiGLComputeCmds() override;
30 
31  HGIGL_API
32  void PushDebugGroup(const char* label,
33  const GfVec4f& color = s_computeDebugColor) override;
34 
35  HGIGL_API
36  void PopDebugGroup() override;
37 
38  HGIGL_API
39  void InsertDebugMarker(
40  const char* label,
41  const GfVec4f& color = s_markerDebugColor) override;
42 
43  HGIGL_API
44  void BindPipeline(HgiComputePipelineHandle pipeline) override;
45 
46  HGIGL_API
47  void BindResources(HgiResourceBindingsHandle resources) override;
48 
49  HGIGL_API
50  void SetConstantValues(
51  HgiComputePipelineHandle pipeline,
52  uint32_t bindIndex,
53  uint32_t byteSize,
54  const void* data) override;
55 
56  HGIGL_API
57  void Dispatch(int dimX, int dimY) override;
58 
59  HGIGL_API
60  void InsertMemoryBarrier(HgiMemoryBarrier barrier) override;
61 
62  HGIGL_API
63  HgiComputeDispatch GetDispatchMethod() const override;
64 
65 protected:
66  friend class HgiGL;
67 
68  HGIGL_API
69  HgiGLComputeCmds(HgiGLDevice* device, HgiComputeCmdsDesc const& desc);
70 
71  HGIGL_API
72  bool _Submit(Hgi* hgi, HgiSubmitWaitType wait) override;
73 
74 private:
75  HgiGLComputeCmds() = delete;
76  HgiGLComputeCmds & operator=(const HgiGLComputeCmds&) = delete;
77  HgiGLComputeCmds(const HgiGLComputeCmds&) = delete;
78 
79  HgiGLOpsVector _ops;
80  int _pushStack;
81  GfVec3i _localWorkGroupSize;
82 
83  // Cmds is used only one frame so storing multi-frame state on will not
84  // survive.
85 };
86 
88 
89 #endif
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
HGIGL_API void InsertMemoryBarrier(HgiMemoryBarrier barrier) override
HGIGL_API void SetConstantValues(HgiComputePipelineHandle pipeline, uint32_t bindIndex, uint32_t byteSize, const void *data) override
HGIGL_API void BindPipeline(HgiComputePipelineHandle pipeline) override
HGIGL_API HgiComputeDispatch GetDispatchMethod() const override
Returns the dispatch method for this encoder.
HgiSubmitWaitType
Definition: enums.h:657
HGIGL_API void PopDebugGroup() override
Pop the last debug scope.
HgiComputeDispatch
Definition: enums.h:822
HGIGL_API void BindResources(HgiResourceBindingsHandle resources) override
HGIGL_API bool _Submit(Hgi *hgi, HgiSubmitWaitType wait) override
Definition: hgi.h:54
HgiBits HgiMemoryBarrier
Definition: enums.h:679
#define HGIGL_API
Definition: api.h:23
Definition: vec3i.h:43
static constexpr GfVec4f s_markerDebugColor
Definition: cmds.h:61
Definition: vec4f.h:45
*tasks wait()
Definition: hgi.h:94
GLuint color
Definition: glcorearb.h:1261
static constexpr GfVec4f s_computeDebugColor
Definition: cmds.h:55
HGIGL_API void PushDebugGroup(const char *label, const GfVec4f &color=s_computeDebugColor) override
Push a debug scope.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HGIGL_API ~HgiGLComputeCmds() override
std::vector< HgiGLOpsFn > HgiGLOpsVector
Definition: hgi.h:26
Definition: format.h:1821
HGIGL_API void Dispatch(int dimX, int dimY) override
HGIGL_API void InsertDebugMarker(const char *label, const GfVec4f &color=s_markerDebugColor) override
Insert a debug marker.