Rasterization


typedef struct VkPipelineRasterizationStateCreateInfo{ VkStructureType const void* VkPipelineRasterizationStateCreateFlags VkBool32 VkBool32 VkPolygonMode VkCullModeFlags VkFrontFace VkBool32 float float float float } VkPipelineRasterizationStateCreateInfo; sType; pNext; flags; depthClampEnable; rasterizerDiscardEnable; polygonMode; cullMode; frontFace; depthBiasEnable; depthBiasConstantFactor; depthBiasClamp; depthBiasSlopeFactor; lineWidth;

typedef struct VkPipelineMultisampleStateCreateInfo { VkStructureType const void* VkPipelineMultisampleStateCreateFlags VkSampleCountFlagBits VkBool32 float const VkSampleMask* VkBool32 VkBool32 } VkPipelineMultisampleStateCreateInfo; sType; pNext; flags; rasterizationSamples; sampleShadingEnable; minSampleShading; pSampleMask; alphaToCoverageEnable; alphaToOneEnable;

void vkCmdSetRasterizerDiscardEnable( VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable);

This command sets the discard enable for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineRasterizationStateCreateInfo::rasterizerDiscardEnable value used to create the currently active pipeline.

Rasterization Order

Multisampling

Each set of samples has a number of samples determined by VkPipelineMultisampleStateCreateInfo::rasterizationSamples. Each sample in a set is assigned a unique sample index i in the range [0, rasterizationSamples).

If the standardSampleLocations member of VkPhysicalDeviceLimits is VK_TRUE, then the sample counts VK_SAMPLE_COUNT_1_BIT, VK_SAMPLE_COUNT_2_BIT, VK_SAMPLE_COUNT_4_BIT, VK_SAMPLE_COUNT_8_BIT, and VK_SAMPLE_COUNT_16_BIT have sample locations as listed in the following table, with the ith entry in the table corresponding to sample index i. VK_SAMPLE_COUNT_32_BIT and VK_SAMPLE_COUNT_64_BIT do not have standard sample locations. Locations are defined relative to an origin in the upper left corner of the fragment.

Sample Shading

Points

Basic Point Rasterization

void vkCmdSetLineWidth( VkCommandBuffer float commandBuffer, lineWidth);

This command sets the line width for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_LINE_WIDTH set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineRasterizationStateCreateInfo::lineWidth value used to create the currently active pipeline.

Basic Line Segment Rasterization

Bresenham Line Segment Rasterization

Polygons

Basic Polygon Rasterization

void vkCmdSetFrontFace( VkCommandBuffer commandBuffer, VkFrontFace frontFace);

This command sets the front face orientation for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_FRONT_FACE set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineRasterizationStateCreateInfo::frontFace value used to create the currently active pipeline.

typedef enum VkFrontFace { VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, VK_FRONT_FACE_CLOCKWISE = 1, } VkFrontFace;

void vkCmdSetCullMode( VkCommandBuffer commandBuffer, VkCullModeFlags cullMode);

typedef enum VkCullModeFlagBits { VK_CULL_MODE_NONE = 0, VK_CULL_MODE_FRONT_BIT = 0x00000001, VK_CULL_MODE_BACK_BIT = 0x00000002, VK_CULL_MODE_FRONT_AND_BACK = 0x00000003, } VkCullModeFlagBits;

This command sets the cull mode for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_CULL_MODE set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineRasterizationStateCreateInfo::cullMode value used to create the currently active pipeline.

typedef enum VkPolygonMode { VK_POLYGON_MODE_FILL = 0, VK_POLYGON_MODE_LINE = 1, VK_POLYGON_MODE_POINT = 2, } VkPolygonMode;

void vkCmdSetDepthBiasEnable( VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable);

This command sets the depth bias enable for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineRasterizationStateCreateInfo::depthBiasEnable value used to create the currently active pipeline.

void vkCmdSetDepthBias( VkCommandBuffer float float float commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);

This command sets the depth bias parameters for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_DEPTH_BIAS set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the corresponding VkPipelineRasterizationStateCreateInfo::depthBiasConstantFactor, depthBiasClamp, and depthBiasSlopeFactor values used to create the currently active pipeline.

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

谢谢大家,再见!


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