HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
blitCmds.h
Go to the documentation of this file.
1 //
2 // Copyright 2019 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_BLIT_CMDS_H
8 #define PXR_IMAGING_HGI_BLIT_CMDS_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hgi/api.h"
12 #include "pxr/imaging/hgi/buffer.h"
13 #include "pxr/imaging/hgi/cmds.h"
15 #include <memory>
16 
18 
21 struct HgiBufferGpuToGpuOp;
22 struct HgiBufferCpuToGpuOp;
23 struct HgiBufferGpuToCpuOp;
26 struct HgiResolveImageOp;
27 
28 using HgiBlitCmdsUniquePtr = std::unique_ptr<class HgiBlitCmds>;
29 
30 
31 /// \class HgiBlitCmds
32 ///
33 /// A graphics API independent abstraction of resource copy commands.
34 /// HgiBlitCmds is a lightweight object that cannot be re-used after it has
35 /// been submitted. A new cmds object should be acquired for each frame.
36 ///
37 class HgiBlitCmds : public HgiCmds
38 {
39 public:
40  HGI_API
41  ~HgiBlitCmds() override;
42 
43  /// Push a debug marker.
44  HGI_API
45  virtual void PushDebugGroup(const char* label) = 0;
46 
47  /// Pop the lastest debug.
48  HGI_API
49  virtual void PopDebugGroup() = 0;
50 
51  /// Copy a texture resource from GPU to CPU.
52  /// Synchronization between GPU writes and CPU reads must be managed by
53  /// the client by supplying the correct 'wait' flags in SubmitCmds.
54  HGI_API
55  virtual void CopyTextureGpuToCpu(HgiTextureGpuToCpuOp const& copyOp) = 0;
56 
57  /// Copy new data from the CPU into a GPU texture.
58  HGI_API
59  virtual void CopyTextureCpuToGpu(HgiTextureCpuToGpuOp const& copyOp) = 0;
60 
61  /// Copy a buffer resource from GPU to GPU.
62  HGI_API
63  virtual void CopyBufferGpuToGpu(HgiBufferGpuToGpuOp const& copyOp) = 0;
64 
65  /// Copy new data from CPU into GPU buffer.
66  /// For example copy new data into a uniform block or storage buffer.
67  HGI_API
68  virtual void CopyBufferCpuToGpu(HgiBufferCpuToGpuOp const& copyOp) = 0;
69 
70  /// Copy new data from GPU into CPU buffer.
71  /// Synchronization between GPU writes and CPU reads must be managed by
72  /// the client by supplying the correct 'wait' flags in SubmitCmds.
73  HGI_API
74  virtual void CopyBufferGpuToCpu(HgiBufferGpuToCpuOp const& copyOp) = 0;
75 
76  /// Copy a texture resource into a buffer resource from GPU to GPU.
77  HGI_API
78  virtual void CopyTextureToBuffer(HgiTextureToBufferOp const& copyOp) = 0;
79 
80  /// Copy a buffer resource into a texture resource from GPU to GPU.
81  HGI_API
82  virtual void CopyBufferToTexture(HgiBufferToTextureOp const& copyOp) = 0;
83 
84  /// Generate mip maps for a texture
85  HGI_API
86  virtual void GenerateMipMaps(HgiTextureHandle const& texture) = 0;
87 
88  /// Fill a buffer with a constant value.
89  HGI_API
90  virtual void FillBuffer(HgiBufferHandle const& buffer, uint8_t value) = 0;
91 
92  /// Inserts a barrier so that data written to memory by commands before
93  /// the barrier is available to commands after the barrier.
94  HGI_API
95  virtual void InsertMemoryBarrier(HgiMemoryBarrier barrier) = 0;
96 
97 protected:
98  HGI_API
99  HgiBlitCmds();
100 
101 private:
102  HgiBlitCmds & operator=(const HgiBlitCmds&) = delete;
103  HgiBlitCmds(const HgiBlitCmds&) = delete;
104 };
105 
106 
107 
109 
110 #endif
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
virtual HGI_API void CopyBufferToTexture(HgiBufferToTextureOp const &copyOp)=0
Copy a buffer resource into a texture resource from GPU to GPU.
virtual HGI_API void CopyTextureToBuffer(HgiTextureToBufferOp const &copyOp)=0
Copy a texture resource into a buffer resource from GPU to GPU.
GLsizei const GLfloat * value
Definition: glcorearb.h:824
virtual HGI_API void CopyBufferGpuToCpu(HgiBufferGpuToCpuOp const &copyOp)=0
int HgiHandle< class HgiTexture > HgiTextureHandle
virtual HGI_API void CopyTextureGpuToCpu(HgiTextureGpuToCpuOp const &copyOp)=0
GLuint buffer
Definition: glcorearb.h:660
virtual HGI_API void CopyTextureCpuToGpu(HgiTextureCpuToGpuOp const &copyOp)=0
Copy new data from the CPU into a GPU texture.
virtual HGI_API void InsertMemoryBarrier(HgiMemoryBarrier barrier)=0
virtual HGI_API void GenerateMipMaps(HgiTextureHandle const &texture)=0
Generate mip maps for a texture.
HgiBits HgiMemoryBarrier
Definition: enums.h:672
HGI_API ~HgiBlitCmds() override
virtual HGI_API void CopyBufferGpuToGpu(HgiBufferGpuToGpuOp const &copyOp)=0
Copy a buffer resource from GPU to GPU.
HGI_API HgiBlitCmds()
virtual HGI_API void FillBuffer(HgiBufferHandle const &buffer, uint8_t value)=0
Fill a buffer with a constant value.
std::unique_ptr< class HgiBlitCmds > HgiBlitCmdsUniquePtr
Definition: blitCmds.h:28
#define HGI_API
Definition: api.h:23
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
GLuint texture
Definition: glcorearb.h:415
virtual HGI_API void PushDebugGroup(const char *label)=0
Push a debug marker.
virtual HGI_API void CopyBufferCpuToGpu(HgiBufferCpuToGpuOp const &copyOp)=0
Definition: cmds.h:27
virtual HGI_API void PopDebugGroup()=0
Pop the lastest debug.