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/imaging/hgi/api.h"
12 #include "pxr/imaging/hgi/enums.h"
13 #include <memory>
14 
16 
17 class Hgi;
18 
19 using HgiCmdsUniquePtr = std::unique_ptr<class HgiCmds>;
20 
21 
22 /// \class HgiCmds
23 ///
24 /// Graphics commands are recorded in 'cmds' objects which are later submitted
25 /// to hgi. HgiCmds is the base class for other cmds objects.
26 ///
27 class HgiCmds
28 {
29 public:
30  HGI_API
31  virtual ~HgiCmds();
32 
33  /// Returns true if the HgiCmds object has been submitted to GPU.
34  HGI_API
35  bool IsSubmitted() const;
36 
37 protected:
38  friend class Hgi;
39 
40  HGI_API
41  HgiCmds();
42 
43  // Submit can be called inside of Hgi::SubmitCmds to commit the
44  // command buffer to the GPU. Returns true if work was committed.
45  // The default implementation returns false.
46  HGI_API
47  virtual bool _Submit(Hgi* hgi, HgiSubmitWaitType wait);
48 
49  // Flags the HgiCmds object as 'submitted' to GPU.
50  HGI_API
51  void _SetSubmitted();
52 
53 private:
54  HgiCmds & operator=(const HgiCmds&) = delete;
55  HgiCmds(const HgiCmds&) = delete;
56 
57  bool _submitted;
58 };
59 
60 
62 
63 #endif
HgiSubmitWaitType
Definition: enums.h:650
virtual HGI_API ~HgiCmds()
std::unique_ptr< class HgiCmds > HgiCmdsUniquePtr
Definition: cmds.h:19
virtual HGI_API bool _Submit(Hgi *hgi, HgiSubmitWaitType wait)
*tasks wait()
Definition: hgi.h:93
#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.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HGI_API void _SetSubmitted()
Definition: cmds.h:27