From a3f22be86dc94e95ccc3306a85468728caa83391 Mon Sep 17 00:00:00 2001
From: Mark Oliver Mints <mmints@uni-koblenz.de>
Date: Sat, 4 Sep 2021 09:58:05 +0200
Subject: [PATCH] [#71] remove compute pipeline stuff from pipeline manager

---
 src/vkcv/PipelineManager.cpp | 62 ------------------------------------
 src/vkcv/PipelineManager.hpp |  8 -----
 2 files changed, 70 deletions(-)

diff --git a/src/vkcv/PipelineManager.cpp b/src/vkcv/PipelineManager.cpp
index 3037f263..7705c7c4 100644
--- a/src/vkcv/PipelineManager.cpp
+++ b/src/vkcv/PipelineManager.cpp
@@ -678,66 +678,4 @@ namespace vkcv
 
         return m_Pipelines[id].m_config;
     }
-
-    PipelineHandle PipelineManager::createComputePipeline(
-            const ShaderProgram &shaderProgram,
-            const std::vector<vk::DescriptorSetLayout> &descriptorSetLayouts) {
-
-        // Temporally handing over the Shader Program instead of a pipeline config
-        vk::ShaderModule computeModule{};
-        if (createShaderModule(computeModule, shaderProgram, ShaderStage::COMPUTE) != vk::Result::eSuccess)
-            return PipelineHandle();
-
-        vk::PipelineShaderStageCreateInfo pipelineComputeShaderStageInfo(
-                {},
-                vk::ShaderStageFlagBits::eCompute,
-                computeModule,
-                "main",
-                nullptr
-        );
-
-        vk::PipelineLayoutCreateInfo pipelineLayoutCreateInfo({}, descriptorSetLayouts);
-
-        const size_t pushConstantSize = shaderProgram.getPushConstantSize();
-        vk::PushConstantRange pushConstantRange(vk::ShaderStageFlagBits::eCompute, 0, pushConstantSize);
-        if (pushConstantSize > 0) {
-            pipelineLayoutCreateInfo.setPushConstantRangeCount(1);
-            pipelineLayoutCreateInfo.setPPushConstantRanges(&pushConstantRange);
-        }
-
-        vk::PipelineLayout vkPipelineLayout{};
-        if (m_Device.createPipelineLayout(&pipelineLayoutCreateInfo, nullptr, &vkPipelineLayout) != vk::Result::eSuccess)
-        {
-            m_Device.destroy(computeModule);
-            return PipelineHandle();
-        }
-
-        vk::ComputePipelineCreateInfo computePipelineCreateInfo{};
-        computePipelineCreateInfo.stage = pipelineComputeShaderStageInfo;
-        computePipelineCreateInfo.layout = vkPipelineLayout;
-
-        vk::Pipeline vkPipeline;
-        if (m_Device.createComputePipelines(nullptr, 1, &computePipelineCreateInfo, nullptr, &vkPipeline)!= vk::Result::eSuccess)
-        {
-            m_Device.destroy(computeModule);
-            return PipelineHandle();
-        }
-
-        m_Device.destroy(computeModule);
-
-        const uint64_t id = m_Pipelines.size();
-        m_Pipelines.push_back({ vkPipeline, vkPipelineLayout, PipelineConfig() });
-
-        return PipelineHandle(id, [&](uint64_t id) { destroyPipelineById(id); });
-    }
-
-    // There is an issue for refactoring the Pipeline Manager.
-    // While including Compute Pipeline Creation, some private helper functions where introduced:
-    vk::Result PipelineManager::createShaderModule(vk::ShaderModule &module, const ShaderProgram &shaderProgram, const ShaderStage stage)
-    {
-        std::vector<char> code = shaderProgram.getShader(stage).shaderCode;
-        vk::ShaderModuleCreateInfo moduleInfo({}, code.size(), reinterpret_cast<uint32_t*>(code.data()));
-        return m_Device.createShaderModule(&moduleInfo, nullptr, &module);
-    }
-
 }
diff --git a/src/vkcv/PipelineManager.hpp b/src/vkcv/PipelineManager.hpp
index ae25e768..4e6caddd 100644
--- a/src/vkcv/PipelineManager.hpp
+++ b/src/vkcv/PipelineManager.hpp
@@ -40,11 +40,6 @@ namespace vkcv
          */
         PipelineHandle createPipeline(const PipelineConfig &config, PassManager& passManager);
 
-        // TODO: Move to ComputePipelineManager
-        PipelineHandle createComputePipeline(
-                const ShaderProgram& shaderProgram,
-                const std::vector<vk::DescriptorSetLayout>& descriptorSetLayouts);
-
         /**
          * Returns a vk::Pipeline object by handle.
          * @param handle Directing to the requested pipeline.
@@ -81,8 +76,5 @@ namespace vkcv
 
         void destroyPipelineById(uint64_t id);
 
-        // TODO: Move to ComputePipelineManager
-        vk::Result createShaderModule(vk::ShaderModule &module, const ShaderProgram &shaderProgram, ShaderStage stage);
-
     };
 }
-- 
GitLab