VPP  0.8
A high-level modern C++ API for Vulkan
vppPipelineConfig.hpp
1 /*
2  Copyright 2016-2018 SOFT-ERG, Przemek Kuczmierczyk (www.softerg.com)
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 // -----------------------------------------------------------------------------
28 namespace vpp {
29 // -----------------------------------------------------------------------------
30 
86 {
87 protected:
188  PipelineConfig ( const Process& boundProcess );
189 
201  void setBlendingMode (
202  const BaseAttachment& dataNode,
203  const VkPipelineColorBlendAttachmentState& blendConfig );
204 
236  void enableLogicOperation ( bool bEnable, VkLogicOp logicOp );
237 
259  void setPrimitiveTopology ( VkPrimitiveTopology v );
260 
271  void setEnablePrimitiveRestart ( bool v );
272 
273  void setTessPatchControlPoints ( std::uint32_t v );
274 
275 public:
276  enum
277  {
278  POINT_LIST = VK_PRIMITIVE_TOPOLOGY_POINT_LIST,
279  LINE_LIST = VK_PRIMITIVE_TOPOLOGY_LINE_LIST,
280  LINE_STRIP = VK_PRIMITIVE_TOPOLOGY_LINE_STRIP,
281  TRIANGLE_LIST = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
282  TRIANGLE_STRIP = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
283  TRIANGLE_FAN = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN,
284  LINE_LIST_ADJ = VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY,
285  LINE_STRIP_ADJ = VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY,
286  TRIANGLE_LIST_ADJ = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY,
287  TRIANGLE_STRIP_ADJ = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY,
288  PATCH_LIST = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST
289  };
290 
294  VkPrimitiveTopology getPrimitiveTopology() const;
295 
299  bool getEnablePrimitiveRestart() const;
300 
301  std::uint32_t getTessPatchControlPoints() const;
302 
307  RenderGraph& getRenderGraph() const;
308 
312  std::uint32_t getProcessIndex() const;
313 
448  template< class AssignmentListT >
449  void cmdBindVertexInput (
450  const AssignmentListT& list,
451  CommandBuffer hCmdBuffer = CommandBuffer() );
452 
468  void cmdBindIndexInput (
469  const VertexIndexBufferView& hVertexIndexBufferView,
470  CommandBuffer hCmdBuffer = CommandBuffer() );
471 };
472 
473 // -----------------------------------------------------------------------------
474 
540 {
541 public:
543 };
544 
545 // -----------------------------------------------------------------------------
546 // -----------------------------------------------------------------------------
547 
552 template< class ValueT >
553 inline TUpdateMultipleDescriptors< ValueT > multi (
554  const ValueT& value, std::uint32_t startIdx = 0 );
555 
556 //template< class ValueT >
557 //inline TUpdateMultipleDescriptors< ValueT > multi (
558 // const std::vector< ValueT >& values, std::uint32_t startIdx = 0 );
559 //
560 //template< class ValueT >
561 //inline TUpdateMultipleDescriptors< ValueT > multi (
562 // const std::initializer_list< ValueT >& values, std::uint32_t startIdx = 0 );
563 
564 // -----------------------------------------------------------------------------
565 } // namespace vpp
566 // -----------------------------------------------------------------------------
void setPrimitiveTopology(VkPrimitiveTopology v)
Specifies what kind of geometric primitives are supplied to the pipeline as input.
Base class for custom compute pipelines.
Definition: vppPipelineConfig.hpp:539
Definition: vppBufferView.hpp:120
void enableLogicOperation(bool bEnable, VkLogicOp logicOp)
Sets logical operation mode for the rasterizer.
The VPP namespace.
Definition: main.hpp:1
void cmdBindIndexInput(const VertexIndexBufferView &hVertexIndexBufferView, CommandBuffer hCmdBuffer=CommandBuffer())
Issues a command which binds some data buffer containing indices for indexed draw to the pipeline...
Represents process graph node.
Definition: vppRenderGraphNodes.hpp:231
void setEnablePrimitiveRestart(bool v)
Enables primitive restart feature for indexed draws.
Represents a sequence of Vulkan commands.
Definition: vppCommandBuffer.hpp:68
void cmdBindVertexInput(const AssignmentListT &list, CommandBuffer hCmdBuffer=CommandBuffer())
Issues a command which binds some data buffer containing vertex information to a binding point declar...
VkPrimitiveTopology getPrimitiveTopology() const
Retrieves selected primitive topology.
Base class for custom rendering pipelines.
Definition: vppPipelineConfig.hpp:85
std::uint32_t getProcessIndex() const
Retrieves an index of associated Process node in the render graph.
void setBlendingMode(const BaseAttachment &dataNode, const VkPipelineColorBlendAttachmentState &blendConfig)
Sets blending mode for specified color attachment.
Base class for render graphs.
Definition: vppRenderGraph.hpp:190
RenderGraph & getRenderGraph() const
Retrieves a reference to the parent render graph of this pipeline.
bool getEnablePrimitiveRestart() const
Checks if the primitive restart feature is enabled.
PipelineConfig(const Process &boundProcess)
Constructor, called only from subclass constructor.
TUpdateMultipleDescriptors< ValueT > multi(const ValueT &value, std::uint32_t startIdx=0)
Resource binding helper for binding items or ranges of resource arrays.