Skip to content

[bug report] vkCmdSetCullModeEXT(...VK_CULL_MODE_NONE) not worked as expected caused by dirty flag #2569

@awkr

Description

@awkr

Hi everyone. I have two pipelines, which are created from the same VkPipelineLayout:

  • pipeline T:
    • primitive topology is VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST
    • has two dynamic states: VK_DYNAMIC_STATE_POLYGON_MODE_EXT, VK_DYNAMIC_STATE_CULL_MODE_EXT
  • pipeline G:
    • primitive topology is VK_PRIMITIVE_TOPOLOGY_LINE_LIST
    • has no dynamic state

Then I rendered two entities, just TWO:

  • entity Triangle:
    • a triangle with indices
  • entity Grid:
    • a line grid with no indices, just vertices

For simplicity, my code is like:

begin render pass
  // draw entity Grid
  bind pipeline G
  draw
  // draw entity Triangle
  bind pipeline T
  cmd set polygon mode to LINE <-- it works
  cmd set cull mode to NONE <-- it does not work, triangle is invisible
  draw indexed
end render pass

But if I change the code execution order to:

begin render pass
  // draw entity Triangle
  bind pipeline T
  cmd set polygon mode to LINE <-- it works
  cmd set cull mode to NONE <-- it also works
  draw indexed
  // draw entity Grid
  bind pipeline G
  draw
end render pass

I also tried:

  • Making pipeline G have dynamic state VK_DYNAMIC_STATE_CULL_MODE_EXT, and set it when drawing, it also works in the first code snippet, but it is not what I want.
  • Rendering more than two entities, it works too.

I don't know why, can you guys figure me out? Many thanks~

Context:

  • macOS 15.5 (24F74)
  • MoltenVK version 1.2.11, supporting Vulkan version 1.2.296.
  • app using Vulkan API: VK_API_VERSION_1_2
  • volk version 1.4.318
  • swapchain image count: 3
  • in flight frame count: 2
  • In device creation:
    • enabled extensions: VK_EXT_extended_dynamic_state and VK_EXT_extended_dynamic_state3
    • pNext chain(part) of VkDeviceCreateInfo is :
    VkPhysicalDeviceExtendedDynamicStateFeaturesEXT dynamic_state_features{};
    dynamic_state_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT;
    dynamic_state_features.extendedDynamicState = VK_TRUE; // Enable extended dynamic state for cull mode
    
    VkPhysicalDeviceExtendedDynamicState3FeaturesEXT extended_dynamic_state3_features_ext{};
    extended_dynamic_state3_features_ext.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT;
    extended_dynamic_state3_features_ext.extendedDynamicState3PolygonMode = VK_TRUE;
    extended_dynamic_state3_features_ext.pNext = &dynamic_state_features;
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions