
.. _program_listing_file_Src_GraphicsEngineVulkan_common_ComputePipelineHelper.hpp:

Program Listing for File ComputePipelineHelper.hpp
==================================================

|exhale_lsh| :ref:`Return to documentation for file <file_Src_GraphicsEngineVulkan_common_ComputePipelineHelper.hpp>` (``Src/GraphicsEngineVulkan/common/ComputePipelineHelper.hpp``)

.. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS

.. code-block:: cpp

   #pragma once
   
   #include <vulkan/vulkan.hpp>
   
   #include "common/ShaderStageHelper.hpp"
   
   namespace Kataglyphis {
   
   // Thin delegation to the shared builder in ShaderStageHelper.hpp - kept as
   // its own function (rather than inlining the eCompute call everywhere) so
   // call sites and computePipelineHelperSuite.cpp don't need to know the
   // compute stage bit.
   constexpr vk::PipelineShaderStageCreateInfo buildComputeShaderStageCreateInfo(vk::ShaderModule module)
   {
       return buildShaderStageCreateInfo(vk::ShaderStageFlagBits::eCompute, module);
   }
   
   // flags is deliberately left at its default so a pass that needs one
   // assigns it on the returned value rather than this helper growing a
   // parameter, the same rule ViewportHelper.hpp and PipelineLayoutHelper.hpp
   // both state.
   //
   // basePipelineHandle is passed explicitly as vk::Pipeline(nullptr) rather
   // than left on vk::ComputePipelineCreateInfo's own default: that default
   // argument invokes vk::Pipeline's non-constexpr default constructor, which
   // would make every call site - including the static_assert this file's test
   // suite builds against - not a constant expression.
   constexpr vk::ComputePipelineCreateInfo buildComputePipelineCreateInfo(
     const vk::PipelineShaderStageCreateInfo &stage, vk::PipelineLayout layout)
   {
       return vk::ComputePipelineCreateInfo{ vk::PipelineCreateFlags{}, stage, layout, vk::Pipeline(nullptr) };
   }
   
   }// namespace Kataglyphis
