Graphics state

The Mesa Vulkan runtime provides helpers for managing the numerous pieces of graphics state associated with a VkPipeline or set dynamically on a command buffer. No such helpers are provided for compute or ray-tracing because they have little or no state besides the shaders themselves.

Pipeline state

All (possibly dynamic) Vulkan graphics pipeline state is encapsulated into a single vk_graphics_pipeline_state structure which contains pointers to sub-structures for each of the different state categories. Unlike VkGraphicsPipelineCreateInfo, the pointers in vk_graphics_pipeline_state are guaranteed to be either be NULL or point to valid and properly populated memory.

When creating a pipeline, the vk_graphics_pipeline_state_fill() function can be used to gather all of the state from the core structures as well as various pNext chains into a single state structure. Whenever an extension struct is missing, a reasonable default value is provided whenever possible.

vk_graphics_pipeline_state_fill() automatically handles both the render pass and dynamic rendering. For drivers which use vk_render_pass, the vk_render_pass_state structure will be populated as if for dynamic rendering, regardless of which path is used. Drivers which use their own render pass structure should parse the render pass, if available, and pass a vk_render_pass_state to the driver_rp argument of vk_graphics_pipeline_state_fill() with the relevant information from the specified subpass. If a render pass is available, vk_render_pass_state will be populated with the the information from the driver_rp. If dynamic rendering is used or the driver provides a NULL driver_rp, the vk_render_pass_state structure will be populated for dynamic rendering, including color, depth, and stencil attachment formats.

The usual flow for creating a full graphics pipeline (not library) looks like this:

struct vk_graphics_pipeline_state state = { };
struct vk_graphics_pipeline_all_state all;
vk_graphics_pipeline_state_fill(&device->vk, &state, pCreateInfo,
                                NULL, &all, NULL, 0, NULL);

/* Emit stuff using the state in `state` */

The vk_graphics_pipeline_all_state structure exists to allow the state to sit on the stack instead of requiring a heap allocation. This is useful if you intend to use the state right away and don’t need to store it. For pipeline libraries, it’s likely more useful to use the dynamically allocated version and store the dynamically allocated memory in the library pipeline.

/* Assuming we have a vk_graphics_pipeline_state in pipeline */
memset(&pipeline->state, 0, sizeof(pipeline->state));

for (uint32_t i = 0; i < lib_info->libraryCount; i++) {
   VK_FROM_HANDLE(drv_graphics_pipeline_library, lib, lib_info->pLibraries[i]);
   vk_graphics_pipeline_state_merge(&pipeline->state, &lib->state);
}

/* This assumes you have a void **state_mem in pipeline */
result = vk_graphics_pipeline_state_fill(&device->vk, &pipeline->state,
                                         pCreateInfo, NULL, NULL, pAllocator,
                                         VK_SYSTEM_ALLOCATION_SCOPE_OBJECT,
                                         &pipeline->state_mem);
if (result != VK_SUCCESS)
   return result;

State from dependent libraries can be merged together using vk_graphics_pipeline_state_merge(). vk_graphics_pipeline_state_fill() will then only attempt to populate missing fields. You can also merge dependent pipeline libraries together but store the final state on the stack for immediate consumption:

struct vk_graphics_pipeline_state state = { };

for (uint32_t i = 0; i < lib_info->libraryCount; i++) {
   VK_FROM_HANDLE(drv_graphics_pipeline_library, lib, lib_info->pLibraries[i]);
   vk_graphics_pipeline_state_merge(&state, &lib->state);
}

struct vk_graphics_pipeline_all_state all;
vk_graphics_pipeline_state_fill(&device->vk, &state, pCreateInfo,
                                NULL, &all, NULL, 0, NULL);
VkResult vk_graphics_pipeline_state_fill(const struct vk_device *device, struct vk_graphics_pipeline_state *state, const VkGraphicsPipelineCreateInfo *info, const struct vk_render_pass_state *driver_rp, VkPipelineCreateFlags2KHR driver_rp_flags, struct vk_graphics_pipeline_all_state *all, const VkAllocationCallbacks *alloc, VkSystemAllocationScope scope, void **alloc_ptr_out)

Populate a vk_graphics_pipeline_state from VkGraphicsPipelineCreateInfo

This function crawls the provided VkGraphicsPipelineCreateInfo and uses it to populate the vk_graphics_pipeline_state. Upon returning from this function, all pointers in state will either be NULL or point to a valid sub-state structure. Whenever an extension struct is missing, a reasonable default value is provided whenever possible. Some states may be left NULL if the state does not exist (such as when rasterizer discard is enabled) or if all of the corresponding states are dynamic.

This function assumes that the vk_graphics_pipeline_state is already valid (i.e., all pointers are NULL or point to valid states). Any states already present are assumed to be identical to how we would populate them from VkGraphicsPipelineCreateInfo.

This function can operate in one of two modes with respect to how the memory for states is allocated. If a vk_graphics_pipeline_all_state struct is provided, any newly populated states will point to the relevant field in all. If all == NULL, it attempts to dynamically allocate any newly required states using the provided allocator and scope. The pointer to this new blob of memory is returned via alloc_ptr_out and must eventually be freed by the driver.

Parameters:
  • device[in] The Vulkan device

  • state[out] The graphics pipeline state to populate

  • info[in] The pCreateInfo from vkCreateGraphicsPipelines

  • driver_rp[in] Renderpass state if the driver implements render passes itself. This should be NULL for drivers that use the common render pass infrastructure built on top of dynamic rendering.

  • driver_rp_flags[in] Pipeline create flags implied by the renderpass or subpass if the driver implements render passes itself. This is only used if driver_rp is non-NULL.

  • all[in] The vk_graphics_pipeline_all_state to use to back any newly needed states. If NULL, newly needed states will be dynamically allocated instead.

  • alloc[in] Allocation callbacks for dynamically allocating new state memory.

  • scope[in] Allocation scope for dynamically allocating new state memory.

  • alloc_ptr_out[out] Will be populated with a pointer to any newly allocated state. The driver is responsible for freeing this pointer.

void vk_graphics_pipeline_state_merge(struct vk_graphics_pipeline_state *dst, const struct vk_graphics_pipeline_state *src)

Merge one vk_graphics_pipeline_state into another

Both the destination and source states are assumed to be valid (i.e., all pointers are NULL or point to valid states). Any states which exist in both are expected to be identical and the state already in dst is used. The only exception here is render pass state which may be only partially defined in which case the fully defined one (if any) is used.

Parameters:
  • dst[out] The destination state. When the function returns, this will be the union of the original dst and src.

  • src[in] The source state

Dynamic state

All dynamic states in Vulkan, regardless of which API version or extension introduced them, are represented by the mesa_vk_dynamic_graphics_state enum. This corresponds to the VkDynamicState enum in the Vulkan API only it’s compact (has no holes due to extension namespacing) and a bit better organized. Each enumerant is named with the name of the state group to which the dynamic state belongs as well as the name of the dynamic state itself. The fact that it’s compact allows us to use to index bitsets.

void vk_get_dynamic_graphics_states(unsigned int *dynamic, const VkPipelineDynamicStateCreateInfo *info)

Populate a bitset with dynamic states

This function maps a VkPipelineDynamicStateCreateInfo to a bitset indexed by mesa_vk_dynamic_graphics_state enumerants.

Parameters:
  • dynamic[out] Bitset to populate

  • info[in] VkPipelineDynamicStateCreateInfo or NULL

We also provide a vk_dynamic_graphics_state structure which contains all the dynamic graphics states, regardless of which API version or extension introduced them. This structure can be populated from a vk_graphics_pipeline_state via vk_dynamic_graphics_state_init().

void vk_dynamic_graphics_state_init(struct vk_dynamic_graphics_state *dyn)

Initialize a vk_dynamic_graphics_state with defaults

Parameters:
  • dyn[out] Dynamic graphics state to initialize

void vk_dynamic_graphics_state_copy(struct vk_dynamic_graphics_state *dst, const struct vk_dynamic_graphics_state *src)

Copies all set state from src to dst

Both src and dst are assumed to be properly initialized dynamic state structs. Anything not set in src, as indicated by src->set, is ignored and those bits of dst are left untouched.

Parameters:
  • dst[out] Copy destination

  • src[in] Copy source

There is also a vk_dynamic_graphics_state embedded in vk_command_buffer. Should you choose to use them, we provide common implementations for all vkCmdSet*() functions. Two additional functions are provided for the driver to call in CmdBindPipeline() and CmdBindVertexBuffers2():

void vk_cmd_set_dynamic_graphics_state(struct vk_command_buffer *cmd, const struct vk_dynamic_graphics_state *src)

Set all of the state in src on a command buffer

Anything not set, as indicated by src->set, is ignored and those states in the command buffer are left untouched.

Parameters:
  • cmd[inout] Command buffer to update

  • src[in] State to set

void vk_cmd_set_vertex_binding_strides(struct vk_command_buffer *cmd, uint32_t first_binding, uint32_t binding_count, const VkDeviceSize *strides)

Set vertex binding strides on a command buffer

This is the dynamic state part of vkCmdBindVertexBuffers2().

Parameters:
  • cmd[inout] Command buffer to update

  • first_binding[in] First binding to update

  • binding_count[in] Number of bindings to update

  • strides[in] binding_count many stride values to set

To use the dynamic state framework, you will need the following in your pipeline structure:

struct drv_graphics_pipeline {
   ....
   struct vk_vertex_input_state vi_state;
   struct vk_sample_locations_state sl_state;
   struct vk_dynamic_graphics_state dynamic;
   ...
};

Then, in your pipeline create function,

memset(&pipeline->dynamic, 0, sizeof(pipeline->dynamic));
pipeline->dynamic->vi = &pipeline->vi_state;
pipeline->dynamic->ms.sample_locations = &pipeline->sl_state;
vk_dynamic_graphics_state_init(&pipeline->dynamic, &state);

In your implementation of vkCmdBindPipeline(),

vk_cmd_set_dynamic_graphics_state(&cmd->vk, &pipeline->dynamic_state);

And, finally, at vkCmdDraw*() time, the code to emit dynamic state into your hardware command buffer will look something like this:

static void
emit_dynamic_state(struct drv_cmd_buffer *cmd)
{
   struct vk_dynamic_graphics_state *dyn = &cmd->vk.dynamic_graphics_state;

   if (!vk_dynamic_graphics_state_any_dirty(dyn))
      return;

   if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_VIEWPORTS) |
       BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_VIEWPORT_COUNT)) {
      /* Re-emit viewports */
   }

   if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_SCISSORS) |
       BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_SCISSOR_COUNT)) {
      /* Re-emit scissors */
   }

   /* etc... */

   vk_dynamic_graphics_state_clear_dirty(dyn);
}

Any states used by the currently bound pipeline and attachments are always valid in vk_command_buffer::dynamic_graphics_state so you can always use a state even if it isn’t dirty on this particular draw.

static inline void vk_dynamic_graphics_state_dirty_all(struct vk_dynamic_graphics_state *d)

Mark all states in the given vk_dynamic_graphics_state dirty

Parameters:
  • d[out] Dynamic graphics state struct

static inline void vk_dynamic_graphics_state_clear_dirty(struct vk_dynamic_graphics_state *d)

Mark all states in the given vk_dynamic_graphics_state not dirty

Parameters:
  • d[out] Dynamic graphics state struct

static inline bool vk_dynamic_graphics_state_any_dirty(const struct vk_dynamic_graphics_state *d)

Test if any states in the given vk_dynamic_graphics_state are dirty

Parameters:
  • d[in] Dynamic graphics state struct to test

Returns:

true if any state is dirty

Depth stencil state optimization

void vk_optimize_depth_stencil_state(struct vk_depth_stencil_state *ds, VkImageAspectFlags ds_aspects, bool consider_write_mask)

Optimize a depth/stencil state

The way depth and stencil testing is specified, there are many case where, regardless of depth/stencil writes being enabled, nothing actually gets written due to some other bit of state being set. In the presence of discards, it’s fairly easy to get into cases where early depth/stencil testing is disabled on some hardware, leading to a fairly big performance hit. This function attempts to optimize the depth stencil state and disable writes and sometimes even testing whenever possible.

Parameters:
  • ds[inout] The depth stencil state to optimize

  • ds_aspects[in] Which image aspects are present in the render pass.

  • consider_write_mask[in] If true, the write mask will be taken into account when optimizing. If false, it will be ignored.

Reference

struct vk_graphics_pipeline_state
unsigned int dynamic[2]

Bitset of which states are dynamic

VkPipelineCreateFlags2KHR pipeline_flags

Flags from VkGraphicsPipelineCreateInfo::flags that are considered part of a stage and need to be merged when linking libraries.

For drivers which use vk_render_pass, this will also include flags generated based on subpass self-dependencies and fragment density map.

const struct vk_vertex_input_state *vi

Vertex input state

const struct vk_input_assembly_state *ia

Input assembly state

const struct vk_tessellation_state *ts

Tessellation state

const struct vk_viewport_state *vp

Viewport state

const struct vk_discard_rectangles_state *dr

Discard Rectangles state

const struct vk_rasterization_state *rs

Rasterization state

const struct vk_fragment_shading_rate_state *fsr

Fragment shading rate state

const struct vk_multisample_state *ms

Multisample state

const struct vk_depth_stencil_state *ds

Depth stencil state

const struct vk_color_blend_state *cb

Color blend state

const struct vk_input_attachment_location_state *ial

Input attachment mapping state

const struct vk_color_attachment_location_state *cal

Color attachment mapping state

const struct vk_render_pass_state *rp

Render pass state

struct vk_vertex_binding_state
uint16_t stride

VkVertexInputBindingDescription::stride

uint16_t input_rate

VkVertexInputBindingDescription::inputRate

uint32_t divisor

VkVertexInputBindingDivisorDescriptionKHR::divisor or 1

struct vk_vertex_attribute_state
uint32_t binding

VkVertexInputAttributeDescription::binding

VkFormat format

VkVertexInputAttributeDescription::format

uint32_t offset

VkVertexInputAttributeDescription::offset

struct vk_vertex_input_state
uint32_t bindings_valid

Bitset of which bindings are valid, indexed by binding

uint32_t attributes_valid

Bitset of which attributes are valid, indexed by location

struct vk_input_assembly_state
uint8_t primitive_topology

VkPipelineInputAssemblyStateCreateInfo::topology

MESA_VK_DYNAMIC_GRAPHICS_STATE_IA_PRIMITIVE_TOPOLOGY

bool primitive_restart_enable

VkPipelineInputAssemblyStateCreateInfo::primitiveRestartEnable

MESA_VK_DYNAMIC_GRAPHICS_STATE_IA_PRIMITIVE_RESTART_ENABLE

struct vk_tessellation_state
uint8_t patch_control_points

VkPipelineTessellationStateCreateInfo::patchControlPoints

MESA_VK_DYNAMIC_TS_PATCH_CONTROL_POINTS

uint8_t domain_origin

VkPipelineTessellationDomainOriginStateCreateInfo::domainOrigin

MESA_VK_DYNAMIC_TS_DOMAIN_ORIGIN

struct vk_viewport_state
bool depth_clip_negative_one_to_one

VkPipelineViewportDepthClipControlCreateInfoEXT::negativeOneToOne

uint8_t viewport_count

VkPipelineViewportStateCreateInfo::viewportCount

MESA_VK_DYNAMIC_GRAPHICS_STATE_VP_VIEWPORT_COUNT

uint8_t scissor_count

VkPipelineViewportStateCreateInfo::scissorCount

MESA_VK_DYNAMIC_GRAPHICS_STATE_VP_SCISSOR_COUNT

VkViewport viewports[MESA_VK_MAX_VIEWPORTS]

VkPipelineViewportStateCreateInfo::pViewports

MESA_VK_DYNAMIC_GRAPHICS_STATE_VP_VIEWPORTS

VkRect2D scissors[MESA_VK_MAX_SCISSORS]

VkPipelineViewportStateCreateInfo::pScissors

MESA_VK_DYNAMIC_GRAPHICS_STATE_VP_SCISSORS

struct vk_discard_rectangles_state
VkDiscardRectangleModeEXT mode

VkPipelineDiscardRectangleStateCreateInfoEXT::discardRectangleMode

uint32_t rectangle_count

VkPipelineDiscardRectangleStateCreateInfoEXT::discardRectangleCount

VkRect2D rectangles[MESA_VK_MAX_DISCARD_RECTANGLES]

VkPipelineDiscardRectangleStateCreateInfoEXT::pDiscardRectangles

struct vk_rasterization_state
bool rasterizer_discard_enable

VkPipelineRasterizationStateCreateInfo::rasterizerDiscardEnable

This will be false if rasterizer discard is dynamic

MESA_VK_DYNAMIC_RS_RASTERIZER_DISCARD_ENABLE

bool depth_clamp_enable

VkPipelineRasterizationStateCreateInfo::depthClampEnable

MESA_VK_DYNAMIC_RS_DEPTH_CLAMP_ENABLE

enum vk_mesa_depth_clip_enable depth_clip_enable

VkPipelineRasterizationDepthClipStateCreateInfoEXT::depthClipEnable

MESA_VK_DYNAMIC_RS_DEPTH_CLIP_ENABLE

VkPolygonMode polygon_mode

VkPipelineRasterizationStateCreateInfo::polygonMode

MESA_VK_DYNAMIC_RS_POLYGON_MODE_ENABLEDEPTH_CLIP_ENABLE

VkCullModeFlags cull_mode

VkPipelineRasterizationStateCreateInfo::cullMode

MESA_VK_DYNAMIC_RS_CULL_MODE

VkFrontFace front_face

VkPipelineRasterizationStateCreateInfo::frontFace

MESA_VK_DYNAMIC_RS_FRONT_FACE

VkConservativeRasterizationModeEXT conservative_mode

VkPipelineRasterizationConservativeStateCreateInfoEXT::conservativeRasterizationMode

MESA_VK_DYNAMIC_RS_CONSERVATIVE_MODE

float extra_primitive_overestimation_size

VkPipelineRasterizationConservativeStateCreateInfoEXT::extraPrimitiveOverestimationSize

MESA_VK_DYNAMIC_RS_EXTRA_PRIMITIVE_OVERESTIMATION_SIZE

VkRasterizationOrderAMD rasterization_order_amd

VkPipelineRasterizationStateRasterizationOrderAMD::rasterizationOrder

VkProvokingVertexModeEXT provoking_vertex

VkPipelineRasterizationProvokingVertexStateCreateInfoEXT::provokingVertexMode

MESA_VK_DYNAMIC_RS_PROVOKING_VERTEX

uint32_t rasterization_stream

VkPipelineRasterizationStateStreamCreateInfoEXT::rasterizationStream

MESA_VK_DYNAMIC_RS_RASTERIZATION_STREAM

struct vk_fragment_shading_rate_state
VkExtent2D fragment_size

VkPipelineFragmentShadingRateStateCreateInfoKHR::fragmentSize

MESA_VK_DYNAMIC_GRAPHICS_STATE_FSR

VkFragmentShadingRateCombinerOpKHR combiner_ops[2]

VkPipelineFragmentShadingRateStateCreateInfoKHR::combinerOps

MESA_VK_DYNAMIC_GRAPHICS_STATE_FSR

struct vk_sample_locations_state
VkSampleCountFlagBits per_pixel

VkSampleLocationsInfoEXT::sampleLocationsPerPixel

VkExtent2D grid_size

VkSampleLocationsInfoEXT::sampleLocationGridSize

VkSampleLocationEXT locations[MESA_VK_MAX_SAMPLE_LOCATIONS]

VkSampleLocationsInfoEXT::sampleLocations

struct vk_multisample_state
VkSampleCountFlagBits rasterization_samples

VkPipelineMultisampleStateCreateInfo::rasterizationSamples

bool sample_shading_enable

VkPipelineMultisampleStateCreateInfo::sampleShadingEnable

float min_sample_shading

VkPipelineMultisampleStateCreateInfo::minSampleShading

uint16_t sample_mask

VkPipelineMultisampleStateCreateInfo::pSampleMask

bool alpha_to_coverage_enable

VkPipelineMultisampleStateCreateInfo::alphaToCoverageEnable

bool alpha_to_one_enable

VkPipelineMultisampleStateCreateInfo::alphaToOneEnable

bool sample_locations_enable

VkPipelineSampleLocationsStateCreateInfoEXT::sampleLocationsEnable

This will be true if sample locations enable dynamic.

const struct vk_sample_locations_state *sample_locations

VkPipelineSampleLocationsStateCreateInfoEXT::sampleLocationsInfo

May be NULL for dynamic sample locations.

struct vk_stencil_test_face_state

Represents the stencil test state for a face

uint8_t compare_mask

VkStencilOpState::compareMask

MESA_VK_DYNAMIC_GRAPHICS_STATE_DS_STENCIL_COMPARE_MASK

uint8_t write_mask

VkStencilOpState::writeMask

MESA_VK_DYNAMIC_GRAPHICS_STATE_DS_STENCIL_WRITE_MASK

uint8_t reference

VkStencilOpState::reference

MESA_VK_DYNAMIC_GRAPHICS_STATE_DS_STENCIL_REFERENCE

struct vk_depth_stencil_state
struct vk_color_blend_state
bool logic_op_enable

VkPipelineColorBlendStateCreateInfo::logicOpEnable

MESA_VK_DYNAMIC_CB_LOGIC_OP_ENABLE,

uint8_t logic_op

VkPipelineColorBlendStateCreateInfo::logicOp

MESA_VK_DYNAMIC_GRAPHICS_STATE_CB_LOGIC_OP,

uint8_t attachment_count

VkPipelineColorBlendStateCreateInfo::attachmentCount

MESA_VK_DYNAMIC_GRAPHICS_STATE_CB_ATTACHMENT_COUNT,

uint8_t color_write_enables

VkPipelineColorWriteCreateInfoEXT::pColorWriteEnables

Bitmask of color write enables, indexed by color attachment index.

MESA_VK_DYNAMIC_GRAPHICS_STATE_CB_COLOR_WRITE_ENABLES,

struct vk_color_blend_attachment_state attachments[MESA_VK_MAX_COLOR_ATTACHMENTS]

VkPipelineColorBlendStateCreateInfo::pAttachments

float blend_constants[4]

VkPipelineColorBlendStateCreateInfo::blendConstants

MESA_VK_DYNAMIC_GRAPHICS_STATE_CB_BLEND_CONSTANTS,

struct vk_render_pass_state
enum vk_rp_attachment_flags attachments

Set of image aspects bound as color/depth/stencil attachments

Set to MESA_VK_RP_ATTACHMENT_INFO_INVALID to indicate that attachment info is invalid.

uint32_t view_mask

VkPipelineRenderingCreateInfo::viewMask

uint8_t color_attachment_count

VkPipelineRenderingCreateInfo::colorAttachmentCount

VkFormat color_attachment_formats[MESA_VK_MAX_COLOR_ATTACHMENTS]

VkPipelineRenderingCreateInfo::pColorAttachmentFormats

VkFormat depth_attachment_format

VkPipelineRenderingCreateInfo::depthAttachmentFormat

VkFormat stencil_attachment_format

VkPipelineRenderingCreateInfo::stencilAttachmentFormat

uint8_t color_attachment_samples[MESA_VK_MAX_COLOR_ATTACHMENTS]

VkAttachmentSampleCountInfoAMD::pColorAttachmentSamples

uint8_t depth_stencil_attachment_samples

VkAttachmentSampleCountInfoAMD::depthStencilAttachmentSamples

enum mesa_vk_dynamic_graphics_state

Enumeration of all Vulkan dynamic graphics states

Enumerants are named with both the abbreviation of the state group to which the state belongs as well as the name of the state itself. These are intended to pretty closely match the VkDynamicState enum but may not match perfectly all the time.

struct vk_dynamic_graphics_state

Struct representing all dynamic graphics state

Before invoking any core functions, the driver must properly populate initialize this struct:

  • Initialize using vk_default_dynamic_graphics_state, if desired

  • Set vi to a driver-allocated vk_vertex_input_state struct

  • Set ms.sample_locations to a driver-allocated vk_sample_locations_state struct

struct vk_vertex_input_state *vi

Vertex input state

Must be provided by the driver if VK_EXT_vertex_input_dynamic_state is supported.

MESA_VK_DYNAMIC_GRAPHICS_STATE_VI

uint16_t vi_binding_strides[MESA_VK_MAX_VERTEX_BINDINGS]

Vertex binding strides

MESA_VK_DYNAMIC_GRAPHICS_STATE_VI_BINDING_STRIDES

struct vk_input_assembly_state ia

Input assembly state

struct vk_tessellation_state ts

Tessellation state

struct vk_viewport_state vp

Viewport state

struct [anonymous]

Discard rectangles state

bool enable

Custom enable

MESA_VK_DYNAMIC_DR_ENABLE

VkDiscardRectangleModeEXT mode

Mode

MESA_VK_DYNAMIC_DR_MODE

VkRect2D rectangles[MESA_VK_MAX_DISCARD_RECTANGLES]

Rectangles

MESA_VK_DYNAMIC_DR_RECTANGLES

uint32_t rectangle_count

Number of rectangles

MESA_VK_DYNAMIC_GRAPHICS_STATE_DR_RECTANGLES

struct vk_rasterization_state rs

Rasterization state

struct [anonymous]

Multisample state

VkSampleCountFlagBits rasterization_samples

Rasterization samples

MESA_VK_DYNAMIC_MS_RASTERIZATION_SAMPLES

uint16_t sample_mask

Sample mask

MESA_VK_DYNAMIC_MS_SAMPLE_MASK

bool alpha_to_coverage_enable

Alpha to coverage enable

MESA_VK_DYNAMIC_MS_ALPHA_TO_CONVERAGE_ENABLE

bool alpha_to_one_enable

Alpha to one enable

MESA_VK_DYNAMIC_MS_ALPHA_TO_ONE_ENABLE

bool sample_locations_enable

Custom sample locations enable

MESA_VK_DYNAMIC_MS_SAMPLE_LOCATIONS_ENABLE

struct vk_sample_locations_state *sample_locations

Sample locations

Must be provided by the driver if VK_EXT_sample_locations is supported.

MESA_VK_DYNAMIC_MS_SAMPLE_LOCATIONS

struct vk_depth_stencil_state ds

Depth stencil state

struct vk_color_blend_state cb

Color blend state

VkImageAspectFlags feedback_loops

MESA_VK_DYNAMIC_ATTACHMENT_FEEDBACK_LOOP_ENABLE

struct vk_input_attachment_location_state ial

MESA_VK_DYNAMIC_INPUT_ATTACHMENT_MAP

struct vk_color_attachment_location_state cal

MESA_VK_DYNAMIC_COLOR_ATTACHMENT_MAP

unsigned int set[2]

For pipelines, which bits of dynamic state are set

unsigned int dirty[2]

For command buffers, which bits of dynamic state have changed