Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support VK_EXT_extended_dynamic_state, VK_EXT_extended_dynamic_state2 & VK_EXT_extended_dynamic_state3 #1739

Closed
billhollings opened this issue Oct 10, 2022 · 9 comments
Assignees
Labels
Completed Issue has been fixed, or enhancement implemented. Enhancement

Comments

@billhollings
Copy link
Contributor

Not all of the functionality of VK_EXT_extended_dynamic_state, VK_EXT_extended_dynamic_state2 & VK_EXT_extended_dynamic_state3 can be supported in Metal but the following dynamic state functionality can be supported:

VK_EXT_extended_dynamic_state:

  • VK_DYNAMIC_STATE_CULL_MODE
  • VK_DYNAMIC_STATE_FRONT_FACE
  • VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY
  • VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT
  • VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT
  • VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE (unsupported)
  • VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE
  • VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE
  • VK_DYNAMIC_STATE_DEPTH_COMPARE_OP
  • VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE (unsupported but VkPhysicalDeviceFeatures::depthBounds disabled already)
  • VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE
  • VK_DYNAMIC_STATE_STENCIL_OP

VK_EXT_extended_dynamic_state2:

  • VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE
  • VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE (unsupported)
  • VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE (unsupported)
  • VK_DYNAMIC_STATE_LOGIC_OP_EXT (unsupported but can be disabled and VkPhysicalDeviceFeatures::logicOp disabled already)
  • VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT

VK_EXT_extended_dynamic_state3 (each unsupported dynamic state can be individually disabled):

  • VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT
  • VK_DYNAMIC_STATE_ALPHA_TO_ONE_ENABLE_EXT
  • VK_DYNAMIC_STATE_COLOR_BLEND_ADVANCED_EXT
  • VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT
  • VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT
  • VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT
  • VK_DYNAMIC_STATE_CONSERVATIVE_RASTERIZATION_MODE_EXT
  • VK_DYNAMIC_STATE_COVERAGE_MODULATION_MODE_NV
  • VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_ENABLE_NV
  • VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_NV
  • VK_DYNAMIC_STATE_COVERAGE_REDUCTION_MODE_NV
  • VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_ENABLE_NV
  • VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_LOCATION_NV
  • VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT
  • VK_DYNAMIC_STATE_DEPTH_CLIP_ENABLE_EXT
  • VK_DYNAMIC_STATE_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE_EXT
  • VK_DYNAMIC_STATE_EXTRA_PRIMITIVE_OVERESTIMATION_SIZE_EXT
  • VK_DYNAMIC_STATE_LINE_RASTERIZATION_MODE_EXT
  • VK_DYNAMIC_STATE_LINE_STIPPLE_ENABLE_EXT
  • VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT
  • VK_DYNAMIC_STATE_POLYGON_MODE_EXT
  • VK_DYNAMIC_STATE_PROVOKING_VERTEX_MODE_EXT
  • VK_DYNAMIC_STATE_RASTERIZATION_SAMPLES_EXT
  • VK_DYNAMIC_STATE_RASTERIZATION_STREAM_EXT
  • VK_DYNAMIC_STATE_REPRESENTATIVE_FRAGMENT_TEST_ENABLE_NV
  • VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE_EXT
  • VK_DYNAMIC_STATE_SAMPLE_MASK_EXT
  • VK_DYNAMIC_STATE_SHADING_RATE_IMAGE_ENABLE_NV
  • VK_DYNAMIC_STATE_TESSELLATION_DOMAIN_ORIGIN_EXT
  • VK_DYNAMIC_STATE_VIEWPORT_SWIZZLE_NV
  • VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_ENABLE_NV
@spnda
Copy link
Collaborator

spnda commented Oct 12, 2022

I created a branch to support EXT_dynamic_state a long time ago (https://github.com/spnda/MoltenVK/tree/KHR_extended_dynamic_state). However, there's a couple of things we simply can't support with Metal, specifically the depth stuff I think.

@oscarbg
Copy link

oscarbg commented Oct 13, 2022

@spnda the depth stuff is optional? if yes, would be nice if a PR is done and eventually merged?

@spnda
Copy link
Collaborator

spnda commented Oct 14, 2022

@oscarbg As I understand it none of it is optional. Unless you can quote the spec where it says what is optional and what isn't.

@spnda
Copy link
Collaborator

spnda commented Jun 6, 2023

VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE can now be partially implemented with Metal 3.1:
https://developer.apple.com/documentation/metal/mtlrendercommandencoder/4126949-setvertexbuffer?changes=latest_minor&language=objc

However, the Vulkan functions still allow to change the vertex input rate (per vertex, per instance, ...) which Metal still doesn't allow.

@corporateshark
Copy link

Is there a way to partially enable some dynamic states from VK_EXT_extended_dynamic_state now? Maybe using VK_KHR_portability_subset etc...

@billhollings billhollings self-assigned this Sep 19, 2023
@billhollings
Copy link
Contributor Author

billhollings commented Sep 19, 2023

I've starting working on this.

I created a branch to support EXT_dynamic_state a long time ago (https://github.com/spnda/MoltenVK/tree/KHR_extended_dynamic_state). However, there's a couple of things we simply can't support with Metal, specifically the depth stuff I think.

@spnda Thanks. I've pulled your start in to save me some typing (and give you credit).

VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE can now be partially implemented with Metal 3.1

I noticed that in the Metal docs, too. Fortunate timing!

@reduz
Copy link

reduz commented Sep 27, 2023

This feature would be super useful for Godot on MacOS / iOS, even without the depth buffer / input stride support.

@billhollings
Copy link
Contributor Author

PR #2036 implements VK_EXT_extended_dynamic_state & VK_EXT_extended_dynamic_state2.

@billhollings
Copy link
Contributor Author

billhollings commented Nov 15, 2023

PR #2066 implements VK_EXT_extended_dynamic_state3.

@billhollings billhollings added the Completed Issue has been fixed, or enhancement implemented. label Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Completed Issue has been fixed, or enhancement implemented. Enhancement
Projects
None yet
Development

No branches or pull requests

5 participants