Path: blob/master/modules/dnn/src/vkcom/include/op_base.hpp
16344 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html.3//4// Copyright (C) 2018, Intel Corporation, all rights reserved.5// Third party copyrights are property of their respective owners.67#ifndef OPENCV_DNN_VKCOM_OP_BASE_HPP8#define OPENCV_DNN_VKCOM_OP_BASE_HPP910#include "../../precomp.hpp"11#include "vkcom.hpp"1213namespace cv { namespace dnn { namespace vkcom {1415#ifdef HAVE_VULKAN1617// Forward declare18class Context;1920class OpBase21{22public:23OpBase();24virtual ~OpBase();25virtual bool forward(std::vector<Tensor>& ins,26std::vector<Tensor>& blobs,27std::vector<Tensor>& outs) = 0;28protected:29void initVulkanThing(int buffer_num);30void createDescriptorSetLayout(int buffer_num);31void createDescriptorSet(int buffer_num);32void createShaderModule(const uint32_t* spv, size_t sz, const std::string& source = std::string());33void createPipeline(size_t push_constants_size = 0);34void createCommandBuffer();35void recordCommandBuffer(void* push_constants = NULL, size_t push_constants_size = 0);36void runCommandBuffer();3738const Context* ctx_;39VkPipeline pipeline_;40VkCommandBuffer cmd_buffer_;41VkDescriptorPool descriptor_pool_;42VkDescriptorSet descriptor_set_;43VkDevice device_;44VkDescriptorSetLayout descriptor_set_layout_;45VkPipelineLayout pipeline_layout_;46VkShaderModule module_;47int group_x_;48int group_y_;49int group_z_;50std::string type_;51};5253#endif // HAVE_VULKAN5455}}} // namespace cv::dnn::vkcom5657#endif // OPENCV_DNN_VKCOM_OP_BASE_HPP585960