Fixed-Function Vertex Post- Processing


After pre-rasterization shader stages, the following fixed-function operations are applied to vertices of the resulting primitives:

  • Flat shading (see Flat Shading).
  • Primitive clipping, including client-defined half-spaces (see Primitive Clipping).
  • Shader output attribute clipping (see Clipping Shader Outputs).
  • Perspective division on clip coordinates (see Coordinate Transformations).
  • Viewport mapping, including depth range scaling (see Controlling the Viewport).
  • Front face determination for polygon primitives (see Basic Polygon Rasterization).
  • Next, rasterization is performed on primitives as described in chapter Rasterization.

Flat Shading

Flat shading a vertex output attribute means to assign all vertices of the primitive the same value for that output. The output values assigned are those of the provoking vertex of the primitive. Flat shading is applied to those vertex attributes that match fragment input attributes which are decorated as Flat.

Primitive Clipping

Primitives are culled against the cull volume and then clipped to the clip volume. This view volume can be further restricted by as many as VkPhysicalDeviceLimits::maxClipDistances client-defined half-spaces. The cull volume is the intersection of up to VkPhysicalDeviceLimits::maxCullDistances client-defined half-spaces (if no client-defined cull half-spaces are enabled, culling against the cull volume is skipped).

Clipping Shader Outputs

Coordinate Transformations

Controlling the Viewport

typedef struct VkPipelineViewportStateCreateInfo { VkStructureType const void* VkPipelineViewportStateCreateFlags uint32_t const VkViewport* uint32_t const VkRect2D* } VkPipelineViewportStateCreateInfo; sType; pNext; flags; viewportCount; pViewports; scissorCount; pScissors;

bool FVulkanPipelineStateCacheManager::CreateGfxPipelineFromEntry(FVulkanRHIGraphicsPipelineState* PSO, FVulkanShader* Shaders[ShaderStage::NumStages], VkPipeline* Pipeline)

void vkCmdSetViewportWithCount( VkCommandBuffer uint32_t const VkViewport* commandBuffer, viewportCount, pViewports);

This command sets the viewport count and viewports state for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the corresponding VkPipelineViewportStateCreateInfo::viewportCount and pViewports values used to create the currently active pipeline.

void vkCmdSetScissorWithCount( VkCommandBuffer uint32_t const VkRect2D* commandBuffer, scissorCount, pScissors);

This command sets the scissor count and scissor rectangular bounds state for subsequence drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the corresponding VkPipelineViewportStateCreateInfo::scissorCount and pScissors values used to create the currently active pipeline.

void vkCmdSetViewport( VkCommandBuffer uint32_t uint32_t const VkViewport* commandBuffer, firstViewport, viewportCount, pViewports);

void FVulkanPendingGfxState::InternalUpdateDynamicStates(FVulkanCmdBuffer* Cmd)

This command sets the viewport transformation parameters state for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_VIEWPORT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineViewportStateCreateInfo::pViewports values used to create the currently active pipeline.The viewport parameters taken from element i of pViewports replace the current state for the viewport index firstViewport + i, for i in [0, viewportCount).

本节教程就到此结束,希望大家继续阅读我之后的教程。

谢谢大家,再见!


原创技术文章,撰写不易,转载请注明出处:电子设备中的画家|王烁 于 2021 年 5 月 10 日发表,原文链接(http://geekfaner.com/shineengine/blog20_Vulkanv1.2_6.html)