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

Add support for VK_EXT_extended_dynamic_state & VK_EXT_extended_dynamic_state2 extensions. #2036

Merged

Conversation

billhollings
Copy link
Contributor

  • Add MVKRenderingCommandEncoderState to consolidate handling
    of static and dynamic rasterizing states in a consistent manner.

  • Rework MVKDepthStencilCommandEncoderState to consolidate handling
    of static and dynamic depth states in a consistent manner.

  • MVKMTLDepthStencilDescriptorData clean up content setting, and struct layout.

  • Add MVKRenderStateType to enumerate render state types.

  • Add MVKRenderStateFlags to track binary info about states (enabled, dirty, etc).

  • Add MVKMTLBufferBinding::stride.

  • Add `MVKPhysicalDeviceMetalFeatures::dynamicVertexStride.

  • Set MVKPhysicalDeviceMetalFeatures::vertexStrideAlignment
    to 1 for Apple5+ GPUs (unrelated).

  • Set VkPhysicalDeviceLimits::maxVertexInputBindingStride
    to unlimited for Apple2+ GPUs (unrelated).

  • Add mvkVkRect2DFromMTLScissorRect() and simplify
    mvkMTLViewportFromVkViewport() and mvkMTLScissorRectFromVkRect2D().

  • MVKFoundation:

    • Add mvkEnableAllFlags( and mvkDisableAllFlags().
    • Improve performance of mvkClear(), mvkCopy() & mvkAreEqual()
      when content is a single simple primitive type (unrelated).
    • Declare more functions as static constexpr (unrelated).
  • Add MVKPipelineCommandEncoderState subclasses
    MVKGraphicsPipelineCommandEncoderState & MVKComputePipelineCommandEncoderState,
    track patch control points in MVKGraphicsPipelineCommandEncoderState,
    and add getGraphicsPipeline() & getComputePipeline() to simplify casting.

  • Rename `MVKCmdRenderPass.h/mm to MVKCmdRendering.h/mm.

  • Move MVKCmdExecuteCommands from MVKCmdRenderPass.h/mm to MVKCmdPipeline.h/mm.

  • While working on vkCmdSetLogicOpEXT(), add support for
    vkCmdSetLogicOpEnableEXT() from VK_EXT_extended_dynamic_state3.

Implements primary chunks of #1739 and impacts #1930.

spnda and others added 5 commits May 24, 2022 15:36
- Add MVKRasterizingCommandEncoderState to consolidate handling
  of static and dynamic rasterizing states in a consistent manner.
- Rework MVKDepthStencilCommandEncoderState to consolidate handling
  of static and dynamic depth states in a consistent manner.
- MVKMTLDepthStencilDescriptorData clean up content setting, and struct layout.
- Add MVKRenderStateType to enumerate render state types.
- Add MVKRenderStateFlags to track binary info about states (enabled, dirty, etc).
- Add MVKMTLBufferBinding::stride.
- Add MVKPhysicalDeviceMetalFeatures::dynamicVertexStride.
- Set MVKPhysicalDeviceMetalFeatures::vertexStrideAlignment
  to 1 for Apple5+ GPUs (unrelated).
- Set VkPhysicalDeviceLimits::maxVertexInputBindingStride
  to unlimited for Apple2+ GPUs (unrelated).
- Add mvkVkRect2DFromMTLScissorRect() and simplify
  mvkMTLViewportFromVkViewport() and mvkMTLScissorRectFromVkRect2D().
- MVKFoundation:
  - Add mvkEnableAllFlags() and mvkDisableAllFlags().
  - Improve performance of mvkClear(), mvkCopy() & mvkAreEqual()
    when content is a single simple primitive type (unrelated).
  - Declare more functions as static constexpr (unrelated).
- Add MVKPipelineCommandEncoderState subclasses
  MVKGraphicsPipelineCommandEncoderState & MVKComputePipelineCommandEncoderState,
  track patch control points in MVKGraphicsPipelineCommandEncoderState,
  and add getGraphicsPipeline() & getComputePipeline() to simplify casting.
- Rename MVKRasterizingCommandEncoderState to MVKRenderingCommandEncoderState,
  and MVKCommandEncoder::_rasterizingState to _renderingState.
- Rename MVKCmdRenderPass.h/mm to MVKCmdRendering.h/mm.
- Move MVKCmdExecuteCommands from MVKCmdRenderPass.h/mm to MVKCmdPipeline.h/mm.
- While working on vkCmdSetLogicOpEXT(), add support for
  vkCmdSetLogicOpEnableEXT() from VK_EXT_extended_dynamic_state3.
@billhollings billhollings force-pushed the VK_EXT_extended_dynamic_state branch from f003228 to 659b1ce Compare October 10, 2023 19:15
Copy link
Collaborator

@cdavis5e cdavis5e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whew! What a large change!

MoltenVK/MoltenVK/API/mvk_datatypes.h Outdated Show resolved Hide resolved
MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm Outdated Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm Outdated Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm Outdated Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm Show resolved Hide resolved
MoltenVK/MoltenVK/Utility/MVKFoundation.h Outdated Show resolved Hide resolved
MoltenVK/MoltenVK/Utility/MVKFoundation.h Show resolved Hide resolved
@spnda
Copy link
Collaborator

spnda commented Oct 10, 2023

Will there be an exhaustive list of all the dynamic statea that are "invalidly" unsupported in the MVK documentation? I see some are noted in the original issue on these extension but it doesnt seem up to date anymore.

Otherwise I think everything is covered; though I havent looked thoroughly through the code nor have I tested any of it. Feature compatibility itself is looking good except for the obvious issues with missing required dynamic states.

- Fix runtime failure on Metal versions that don't support dynamic attribute stride.
- Add MVKCommandEncoder::encodeVertexAttributeBuffer() consolidation function.
- Remove unnecessary validations that will be caught by Vulkan validation layers.
- To reduce memory, remove command class and pools for rendering commands that
  are not supported, and perform no validation.
- Document extension conformance limitations in MoltenVK_Runtime_UserGuide.md.
@billhollings
Copy link
Contributor Author

Whew! What a large change!

Thanks for all the feedback. I appreciate it.

Will there be an exhaustive list of all the dynamic statea that are "invalidly" unsupported in the MVK documentation?

The list is actually not so exhaustive. There are only two real deviations from conformance (others are actually permitted in the spec via feature flags). I've updated MoltenVK_Runtime_UserGuide.md to document them. In the process, I've structured the extensions section of that document to make it easier to be consistent in specifying limitations for each extension in a readable way, and to encourage us devs to keep that up.

@billhollings billhollings requested a review from cdavis5e October 11, 2023 15:46
@cdavis5e
Copy link
Collaborator

You didn't push anything new for me to review.

@billhollings
Copy link
Contributor Author

You didn't push anything new for me to review.

Oops! Pushed now.

@billhollings billhollings merged commit 61b8712 into KhronosGroup:main Oct 11, 2023
@billhollings billhollings deleted the VK_EXT_extended_dynamic_state branch October 11, 2023 21:37
m154k1 added a commit to m154k1/mpv-build-macOS that referenced this pull request Oct 12, 2023
m154k1 added a commit to m154k1/mpv-build-macOS that referenced this pull request Oct 12, 2023
m154k1 added a commit to m154k1/mpv-build-macOS that referenced this pull request Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants