| 118 | } |
| 119 | |
| 120 | ErrorCode VulkanRasterAndInterpolate::_initTarget(int width, int height) { |
| 121 | if (mWidth == width || mHeight == height) { |
| 122 | return NO_ERROR; |
| 123 | } |
| 124 | mTarget = nullptr; |
| 125 | auto extra = static_cast<VulkanBackend*>(backend()); |
| 126 | SharedPtr<VulkanImage> depth = new VulkanImage(extra->getMemoryPool(), false, std::vector<int>{width, height}, VK_FORMAT_D32_SFLOAT, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT); |
| 127 | std::vector<SharedPtr<VulkanImage>> colors(4); |
| 128 | for (int i=0; i<colors.size(); ++i) { |
| 129 | colors[i] = new VulkanImage(extra->getMemoryPool(), false, std::vector<int>{width, height}, VK_FORMAT_R32G32B32A32_SFLOAT, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_STORAGE_BIT); |
| 130 | } |
| 131 | mTarget = VulkanTarget::create(colors, depth); |
| 132 | #ifdef TEST |
| 133 | auto& cmdPool = extra->getPool(); |
| 134 | auto buffer = cmdPool.allocBuffer(); |
| 135 | buffer->begin(0); |
| 136 | mTarget->onEnter(buffer->get()); |
| 137 | mTarget->onExit(buffer->get()); |
| 138 | buffer->end(); |
| 139 | cmdPool.submitAndWait(buffer->get()); |
| 140 | delete buffer; |
| 141 | #endif |
| 142 | auto& info = mGraphicCache->info(); |
| 143 | mTarget->writePipelineInfo(info); |
| 144 | mGraphicPipeline = extra->getPipelineFactory()->createGraphicPipeline(mEmptyLayout, mGraphicCache.get()); |
| 145 | mWidth = width; |
| 146 | mHeight = height; |
| 147 | return NO_ERROR; |
| 148 | } |
| 149 | |
| 150 | ErrorCode VulkanRasterAndInterpolate::onEncode(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs, |
| 151 | const VulkanCommandPool::Buffer *cmdBuffer) { |
nothing calls this directly
no test coverage detected