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

Simplify repetitive copy-paste declarations of single-value Vulkan commands. #2144

Merged

Conversation

billhollings
Copy link
Contributor

There are many MVKCommand subclasses that simply encode a single value, resulting in loads of repetitive copy-pasted code.

  • Add abstract template superclass MVKSingleValueCommand for these concrete command classes.
  • Modify MVKCmdSetBlendConstants to hold an MVKColor32 so it can subclass from MVKSingleValueCommand, and modify MVKGraphicsPipeline and MVKRenderingCommandEncoderState to use MVKColor32.
  • Remove trivial comments for simple concrete Vulkan command classes.

@cdavis5e This has interactions with your PR #2142, particularly your new MVKCmdSetDepthBounds and MVKCmdSetDepthBoundsTestEnable classes, which should both become subclasses of MVKSingleValueCommand (for MVKCmdSetDepthBounds, by passing & tracking an MVKDepthBounds, similar to how MVKCmdSetBlendConstants passes and tracks a MVKColor32).

So we'll need to merge these two PRs in order. We can either merge this PR first, and you modify PR #2142, or merge #2142 first, once we've resolved the discussion there, and then I'll add MVKCmdSetDepthBounds and MVKCmdSetDepthBoundsTestEnable to this PR.

…mmands.

There are many MVKCommand subclasses that simply encode a single value,
resulting in loads of repetitive copy-pasted code.
- Add abstract template superclass MVKSingleValueCommand
  for these concrete command classes.
- Modify MVKCmdSetBlendConstants to hold an MVKColor32 so it can
  subclass from MVKSingleValueCommand, and modify MVKGraphicsPipeline
  and MVKRenderingCommandEncoderState to use MVKColor32.
- Remove trivial comments for simple concrete Vulkan command classes.
@billhollings billhollings requested a review from cdavis5e January 27, 2024 23:33
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.

I think this should go in first, and then I'll update my PR.

@billhollings billhollings merged commit 622ab5a into KhronosGroup:main Jan 29, 2024
6 checks passed
@billhollings billhollings deleted the refactor-single-value-commands branch January 29, 2024 14:45
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.

2 participants