tp::GraphicsPipelineSetup class

Used as configuration for creating a new graphics tp::Pipeline object for use inside render passes.

Constructors, destructors, conversion operators

GraphicsPipelineSetup(const PipelineLayout* pipelineLayout, ShaderStageSetup vertexStageSetup, ShaderStageSetup fragmentStageSetup = {}, const char* debugName = nullptr)

Public functions

auto addDynamicState(DynamicState dynamicState) -> GraphicsPipelineSetup&
Adds a dynamic state flag, ignoring the associated fields in tp::GraphicsPipelineSetup in favor of setting them dynamically through the methods in tp::RenderList.
auto addFlags(PipelineFlagMask flags) -> GraphicsPipelineSetup&
Adds the pipeline flags.
auto clearDynamicState() -> GraphicsPipelineSetup&
Clears all dynamic state flags.
auto clearFlags() -> GraphicsPipelineSetup&
Clears all pipeline flags.
auto setAlphaToCoverage(bool enable, bool alphaToOneEnable = false) -> GraphicsPipelineSetup&
Sets the alpha to coverage functionality.
auto setBlendConstants(float blendConstants[4]) -> GraphicsPipelineSetup&
Sets the constants used for certain blend factors during blending operations.
auto setBlending(bool enable, AttachmentBlendState blendState = {}) -> GraphicsPipelineSetup&
Sets the attachment blending functionality.
auto setColorAttachments(ArrayParameter<const Format> colorAttachmentFormats) -> GraphicsPipelineSetup&
Sets the number and format of color attachments that will be bound along with this pipeline.
auto setCullMode(CullModeFlagMask cullMode) -> GraphicsPipelineSetup&
Sets whether front and/or back faces should be culled.
auto setDebugName(const char* debugName) -> GraphicsPipelineSetup&
Sets a debug name identifier for the object.
auto setDepthBias(bool enable, float constantFactor = 0.0f, float slopeFactor = 0.0f, float biasClamp = 0.0f) -> GraphicsPipelineSetup&
Sets the depth bias functionality.
auto setDepthBoundsTest(bool enable, float minDepthBounds = 0.0f, float maxDepthBounds = 1.0f) -> GraphicsPipelineSetup&
Sets the depth bounds testing functionality.
auto setDepthClamp(bool enable) -> GraphicsPipelineSetup&
Sets the depth clamp funcionality.
auto setDepthStencilAttachment(Format depthStencilAttachmentFormat, ImageAspectMask depthStencilAspects = ImageAspect::Depth|ImageAspect::Stencil) -> GraphicsPipelineSetup&
Sets the format of the depth stencil attachment that will be bound along with this pipeline.
auto setDepthTest(bool enable, CompareOp compareOp = CompareOp::Always, bool enableWrite = false) -> GraphicsPipelineSetup&
Sets the depth testing functionality.
auto setFragmentStage(ShaderStageSetup fragmentStageSetup) -> GraphicsPipelineSetup&
Sets the fragment shader stage.
auto setFrontFace(bool frontFaceIsClockwise) -> GraphicsPipelineSetup&
Sets whether or not the clockwise winding order of primitives should be considered as front facing.
auto setGeometryStage(ShaderStageSetup geometryStageSetup) -> GraphicsPipelineSetup&
Sets the geometry shader stage.
auto setIndependentBlending(bool enable, ArrayParameter<const AttachmentBlendState> blendStates = {}) -> GraphicsPipelineSetup&
Sets the attachment blending functionality with an independent blend state for each attachment.
auto setLineWidth(float width) -> GraphicsPipelineSetup&
Sets the width of rasterized line segments.
auto setLogicBlendOp(bool enable, LogicOp logicOp = LogicOp::And) -> GraphicsPipelineSetup&
Sets the logic blend operation functinality.
auto setMultisampling(MultisampleLevel level, uint64_t sampleMask = ~0, bool sampleShadingEnable = false, float minSampleShading = 1.0f) -> GraphicsPipelineSetup&
Sets the multisampling functionality.
auto setMultiViewMask(uint32_t viewMask) -> GraphicsPipelineSetup&
Sets the view mask indicating the indices of attachment layers that will be rendered into when it is not 0.
auto setRasterizationMode(RasterizationMode mode) -> GraphicsPipelineSetup&
Sets the rasterization mode.
auto setStencilTest(bool enable, StencilState frontFaceStencilState = {}, StencilState backFaceStencilState = {}) -> GraphicsPipelineSetup&
Sets the stencil testing functionality.
auto setStencilTest(bool enable, StencilState stencilState = {}) -> GraphicsPipelineSetup&
Sets the stencil testing functionality.
auto setTessellationStages(ShaderStageSetup tessellationControlStageSetup, ShaderStageSetup tessellationEvaluationStageSetup, uint32_t patchControlPoints = 0) -> GraphicsPipelineSetup&
Sets the tessellation control stages.
auto setTopology(PrimitiveTopology topology, bool primitiveRestartEnable = false) -> GraphicsPipelineSetup&
Sets the input primitive topology.
auto setVertexInputBindings(ArrayParameter<const VertexInputBinding> vertexInputBindings) -> GraphicsPipelineSetup&
Sets the bindings for the vertex input buffers to the given array.
auto setVertexStage(ShaderStageSetup vertexStageSetup) -> GraphicsPipelineSetup&
Sets the vertex shader stage.
auto setViewportCount(uint32_t viewportCount) -> GraphicsPipelineSetup&
Sets the number of viewports.
auto vkSetCreateInfoExtPtr(void* pNext) -> GraphicsPipelineSetup&
Sets the pointer to additional Vulkan structures to be passed in pNext of VkGraphicsPipelineCreateInfo.

Function documentation

tp::GraphicsPipelineSetup::GraphicsPipelineSetup(const PipelineLayout* pipelineLayout, ShaderStageSetup vertexStageSetup, ShaderStageSetup fragmentStageSetup = {}, const char* debugName = nullptr)

Parameters
pipelineLayout The pipeline layout to use.
vertexStageSetup The setup of the vertex shader stage.
fragmentStageSetup The setup of the optional fragment shader stage.
debugName The debug name identifier for the object.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setAlphaToCoverage(bool enable, bool alphaToOneEnable = false)

Sets the alpha to coverage functionality.

Parameters
enable Enables alpha to coverage if true, generating coverage based on the alpha component of the fragment's first color output.
alphaToOneEnable If true, replaces the alpha component with 1 afterwards.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setBlending(bool enable, AttachmentBlendState blendState = {})

Sets the attachment blending functionality.

Parameters
enable Enables blending operations on color attachments if true.
blendState The blend state used for all color attachments.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setColorAttachments(ArrayParameter<const Format> colorAttachmentFormats)

Sets the number and format of color attachments that will be bound along with this pipeline.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setDepthBias(bool enable, float constantFactor = 0.0f, float slopeFactor = 0.0f, float biasClamp = 0.0f)

Sets the depth bias functionality.

Parameters
enable Enables depth bias if true.
constantFactor Controls the constant depth value added to each fragment.
slopeFactor Controls the slope dependent depth value added to each fragment.
biasClamp Sets the maximum depth bias of a fragment.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setDepthBoundsTest(bool enable, float minDepthBounds = 0.0f, float maxDepthBounds = 1.0f)

Sets the depth bounds testing functionality.

Parameters
enable Enables depth bounds testing if true, discarding samples if the existing depth value in the depth attachment falls outside the given range.
minDepthBounds The minimum depth value.
maxDepthBounds The maximum depth value.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setDepthClamp(bool enable)

Sets the depth clamp funcionality.

Parameters
enable Enables depth clamp if true, clamping the output sample depth to the minimum and maximum depth values as set by tp::RenderList::cmdSetViewport.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setDepthStencilAttachment(Format depthStencilAttachmentFormat, ImageAspectMask depthStencilAspects = ImageAspect::Depth|ImageAspect::Stencil)

Sets the format of the depth stencil attachment that will be bound along with this pipeline.

Parameters
depthStencilAttachmentFormat The format of the depth stencil attachment.
depthStencilAspects The used aspects of the depth stencil attachment.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setDepthTest(bool enable, CompareOp compareOp = CompareOp::Always, bool enableWrite = false)

Sets the depth testing functionality.

Parameters
enable Enables depth operations if true.
compareOp The comparison operator to use for depth testing.
enableWrite If true and depth testing is enabled, also enables depth writes.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setGeometryStage(ShaderStageSetup geometryStageSetup)

Sets the geometry shader stage.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setIndependentBlending(bool enable, ArrayParameter<const AttachmentBlendState> blendStates = {})

Sets the attachment blending functionality with an independent blend state for each attachment.

Parameters
enable Enables blending operations on color attachments if true.
blendStates The blend states used for each color attachment.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setLineWidth(float width)

Sets the width of rasterized line segments.

Parameters
width The width of the rasterized line segments in pixels.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setLogicBlendOp(bool enable, LogicOp logicOp = LogicOp::And)

Sets the logic blend operation functinality.

Parameters
enable Enables logic blending on integer color attachment formats if true.
logicOp The logical operator to use.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setMultisampling(MultisampleLevel level, uint64_t sampleMask = ~0, bool sampleShadingEnable = false, float minSampleShading = 1.0f)

Sets the multisampling functionality.

Parameters
level The multisampling level to use, specifying the number of samples used in rasterization.
sampleMask The mask of samples to be applied to coverage.
sampleShadingEnable Enables shading of individual samples separately.
minSampleShading If sampleShadingEnable is true, specifies the minimum of samples to be shaded separately as a fraction.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setMultiViewMask(uint32_t viewMask)

Sets the view mask indicating the indices of attachment layers that will be rendered into when it is not 0.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setRasterizationMode(RasterizationMode mode)

Sets the rasterization mode.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setStencilTest(bool enable, StencilState frontFaceStencilState = {}, StencilState backFaceStencilState = {})

Sets the stencil testing functionality.

Parameters
enable Enables stencil testing if true.
frontFaceStencilState The stencil state to use for front faces.
backFaceStencilState The stencil state to use for back faces.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setStencilTest(bool enable, StencilState stencilState = {})

Sets the stencil testing functionality.

Parameters
enable Enables stencil testing if true.
stencilState The stencil state to use for both front faces and back faces.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setTessellationStages(ShaderStageSetup tessellationControlStageSetup, ShaderStageSetup tessellationEvaluationStageSetup, uint32_t patchControlPoints = 0)

Sets the tessellation control stages.

Parameters
tessellationControlStageSetup The setup of the tessellation control shader stage.
tessellationEvaluationStageSetup The setup of the tessellation evaluation shader stage.
patchControlPoints Specifies the number of control points per patch.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setTopology(PrimitiveTopology topology, bool primitiveRestartEnable = false)

Sets the input primitive topology.

Parameters
topology The primitive topology.
primitiveRestartEnable When enabled, a special vertex index value (~0) in the index buffer restarts the primitive assembly.

GraphicsPipelineSetup& tp::GraphicsPipelineSetup::setViewportCount(uint32_t viewportCount)

Sets the number of viewports.