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

Move vulkan codegen generators #1851

Open
wants to merge 24 commits into
base: dev
Choose a base branch
from

Conversation

MarkY-LunarG
Copy link
Contributor

@MarkY-LunarG MarkY-LunarG commented Oct 30, 2024

These changes moves the current Vulkan and base generators into a better layout that can share code in a more understandable way.

Instead of:

   base_generators/
     base* files
   dx12_generators/
     dx12*  files
   vulkan_generators/
     vulkan* files

After this change:

   dx12_generators/
     dx12*  files
   khronos_generators/
      khronos_base_* files     <-  base* files
      vulkan_generators/
           vulkan* files

Also removed some duplication in the files and created utility functions to remove some additional Vulkan-specific items in the lower levels.

This is a big step towards building the appropriate structure for sharing files with OpenXR.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 291417.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5243 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5243 passed.

Copy link
Contributor

@jzulauf-lunarg jzulauf-lunarg left a comment

Choose a reason for hiding this comment

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

These look good. Probably can squash the "Rename Base..."

@@ -858,6 +859,11 @@ def genType(self, typeinfo, name, alias):
self.genUnion(typeinfo, name, alias)
elif (category == 'handle'):
self.handle_names.add(name)
if (
type_elem is not None and type_elem.find('type') is not None
and '_DEFINE_HANDLE' == type_elem.find('type').text[2:]
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does this logic come from... not seeing it within this commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It didn't come anywhere. We used to hard-code the dispatchable handles in Vulkan. This code automatically determines what handles are dispatchable based on how they are defined in the registry file. That's why it's a separate commit. The title of the commit states this as:

codgen: Automatically determine dispatchable handles

and only adds this detection logic.

@@ -120,7 +120,6 @@ def make_cmd_body(self, return_type, name, values):
else:
arg_names.append(value.name)

# Vulkan return is very simple.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there some comment that is need to replace this? It's not particularly a good comment originally, just wondering why it was here originally...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was here originally because of the shared DX12 code. That's why it was removed.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 300213.

@MarkY-LunarG
Copy link
Contributor Author

@locke-lunarg or @davidd-lunarg , can one of you review this because it's codegen?

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5335 running.

Move the Vulkan generator scripts under a khronos_generators folder
to prepare it for for sharing with other khronos APIs.
DX12 was still relying on one file in the base_generators folder.
Make a copy in the DX12 folder, and remove all references to the Vulkan
and base_generators folders in the generate_dx12.py script.
Move the reformat_code.py into the base of khronos_generators.
Move common items from the vulkan_generators/base_generator.py
to the khronos_generators/khronos_base_generator.py
Move more common type parsing into the khronos_base_generator
from the vulkan/base_generator.
base_generator code still has vulkan-specific items in it.
This starts the process of pulling those out.
Remove more vulkan-specific items in the base_generator code
path.
Modify the handling of 'pNext' extended struct variables in the base_generators
to be more Khronos-generic instead of Vulkan-specific.
First phase moving of base_generator files to have a khronos
identifier
Since the khronos_base files were referring back to the parent
"base_generator" (which in this case was Vulkan) it still resulted
in a tight coupling.  Move the "write" method into the
khronos_base_generator script to solve this.
Consolidate the structure type name generation into one location
shared with all future Khronos APIs.
Put variable naming in a common location
Removed local variables for use in decoder body scripts and
created a "all_cmd_params" that isn't cleared after every feature
update.
Added raising an exception on Python methods that should be implemented
by the Khronos API for the functionality to properly work.
@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5335 passed.

@MarkY-LunarG MarkY-LunarG force-pushed the marky-move-vulkan-codegen-generators branch from 1c1c5cd to 9809efb Compare November 11, 2024 19:02
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 300271.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5336 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 5336 passed.

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