1 // 2 // Copyright 2020 Pixar 3 // 4 // Licensed under the Apache License, Version 2.0 (the "Apache License") 5 // with the following modification; you may not use this file except in 6 // compliance with the Apache License and the following modification to it: 7 // Section 6. Trademarks. is deleted and replaced with: 8 // 9 // 6. Trademarks. This License does not grant permission to use the trade 10 // names, trademarks, service marks, or product names of the Licensor 11 // and its affiliates, except as required to comply with Section 4(c) of 12 // the License and to reproduce the content of the NOTICE file. 13 // 14 // You may obtain a copy of the Apache License at 15 // 16 // http://www.apache.org/licenses/LICENSE-2.0 17 // 18 // Unless required by applicable law or agreed to in writing, software 19 // distributed under the Apache License with the above modification is 20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21 // KIND, either express or implied. See the Apache License for the specific 22 // language governing permissions and limitations under the Apache License. 23 // 24 #ifndef PXR_IMAGING_HGIVULKAN_BLIT_CMDS_H 25 #define PXR_IMAGING_HGIVULKAN_BLIT_CMDS_H 26 27 #include "pxr/pxr.h" 28 #include "pxr/imaging/hgiVulkan/api.h" 29 #include "pxr/imaging/hgi/blitCmds.h" 30 31 PXR_NAMESPACE_OPEN_SCOPE 32 33 class HgiVulkan; 34 class HgiVulkanCommandBuffer; 35 36 37 /// \class HgiVulkanBlitCmds 38 /// 39 /// Vulkan implementation of HgiBlitCmds. 40 /// 41 class HgiVulkanBlitCmds final : public HgiBlitCmds 42 { 43 public: 44 HGIVULKAN_API 45 ~HgiVulkanBlitCmds() override; 46 47 HGIVULKAN_API 48 void PushDebugGroup(const char* label) override; 49 50 HGIVULKAN_API 51 void PopDebugGroup() override; 52 53 HGIVULKAN_API 54 void CopyTextureGpuToCpu(HgiTextureGpuToCpuOp const& copyOp) override; 55 56 HGIVULKAN_API 57 void CopyTextureCpuToGpu(HgiTextureCpuToGpuOp const& copyOp) override; 58 59 HGIVULKAN_API 60 void CopyBufferGpuToGpu(HgiBufferGpuToGpuOp const& copyOp) override; 61 62 HGIVULKAN_API 63 void CopyBufferCpuToGpu(HgiBufferCpuToGpuOp const& copyOp) override; 64 65 HGIVULKAN_API 66 void CopyBufferGpuToCpu(HgiBufferGpuToCpuOp const& copyOp) override; 67 68 HGIVULKAN_API 69 void CopyTextureToBuffer(HgiTextureToBufferOp const& copyOp) override; 70 71 HGIVULKAN_API 72 void CopyBufferToTexture(HgiBufferToTextureOp const& copyOp) override; 73 74 HGIVULKAN_API 75 void GenerateMipMaps(HgiTextureHandle const& texture) override; 76 77 HGIVULKAN_API 78 void MemoryBarrier(HgiMemoryBarrier barrier) override; 79 80 /// Returns the command buffer used inside this cmds. 81 HGIVULKAN_API 82 HgiVulkanCommandBuffer* GetCommandBuffer(); 83 84 protected: 85 friend class HgiVulkan; 86 87 HGIVULKAN_API 88 HgiVulkanBlitCmds(HgiVulkan* hgi); 89 90 HGIVULKAN_API 91 bool _Submit(Hgi* hgi, HgiSubmitWaitType wait) override; 92 93 private: 94 HgiVulkanBlitCmds & operator=(const HgiVulkanBlitCmds&) = delete; 95 HgiVulkanBlitCmds(const HgiVulkanBlitCmds&) = delete; 96 97 void _CreateCommandBuffer(); 98 99 HgiVulkan* _hgi; 100 HgiVulkanCommandBuffer* _commandBuffer; 101 102 // BlitCmds is used only one frame so storing multi-frame state on BlitCmds 103 // will not survive. 104 }; 105 106 PXR_NAMESPACE_CLOSE_SCOPE 107 108 #endif 109