HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cmds.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_CMDS_H
8 #define PXR_IMAGING_HGI_CMDS_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/base/gf/vec4f.h"
12 #include "pxr/imaging/hgi/api.h"
13 #include "pxr/imaging/hgi/enums.h"
14 #include <memory>
15 
17 
18 class Hgi;
19 
20 using HgiCmdsUniquePtr = std::unique_ptr<class HgiCmds>;
21 
22 
23 /// \class HgiCmds
24 ///
25 /// Graphics commands are recorded in 'cmds' objects which are later submitted
26 /// to hgi. HgiCmds is the base class for other cmds objects.
27 ///
28 class HgiCmds
29 {
30 public:
31  HGI_API
32  virtual ~HgiCmds();
33 
34  /// Returns true if the HgiCmds object has been submitted to GPU.
35  HGI_API
36  bool IsSubmitted() const;
37 
38 protected:
39  friend class Hgi;
40 
41  HGI_API
42  HgiCmds();
43 
44  // Submit can be called inside of Hgi::SubmitCmds to commit the
45  // command buffer to the GPU. Returns true if work was committed.
46  // The default implementation returns false.
47  HGI_API
48  virtual bool _Submit(Hgi* hgi, HgiSubmitWaitType wait);
49 
50  // Flags the HgiCmds object as 'submitted' to GPU.
51  HGI_API
52  void _SetSubmitted();
53 
54  static constexpr GfVec4f s_computeDebugColor
55  = { 0.855, 0.161, 0.11, 1.0 };
56  static constexpr GfVec4f s_graphicsDebugColor
57  = { 0, 0.639, 0.878, 1.0 };
58  static constexpr GfVec4f s_blitDebugColor
59  = { 0.99607843137, 0.87450980392, 0.0, 1.0 };
60  static constexpr GfVec4f s_markerDebugColor
61  = { 0.0, 0.0, 0.0, 0.0 };
62 private:
63  HgiCmds & operator=(const HgiCmds&) = delete;
64  HgiCmds(const HgiCmds&) = delete;
65 
66  bool _submitted;
67 };
68 
69 
71 
72 #endif
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
static constexpr GfVec4f s_graphicsDebugColor
Definition: cmds.h:57
HgiSubmitWaitType
Definition: enums.h:657
virtual HGI_API ~HgiCmds()
std::unique_ptr< class HgiCmds > HgiCmdsUniquePtr
Definition: cmds.h:20
static constexpr GfVec4f s_blitDebugColor
Definition: cmds.h:59
virtual HGI_API bool _Submit(Hgi *hgi, HgiSubmitWaitType wait)
static constexpr GfVec4f s_markerDebugColor
Definition: cmds.h:61
Definition: vec4f.h:45
*tasks wait()
Definition: hgi.h:94
#define HGI_API
Definition: api.h:23
HGI_API HgiCmds()
HGI_API bool IsSubmitted() const
Returns true if the HgiCmds object has been submitted to GPU.
static constexpr GfVec4f s_computeDebugColor
Definition: cmds.h:55
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HGI_API void _SetSubmitted()
Definition: cmds.h:28