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

Codegen Blocklists Separation #1319

Open
andrew-lunarg opened this issue Oct 23, 2023 · 0 comments
Open

Codegen Blocklists Separation #1319

andrew-lunarg opened this issue Oct 23, 2023 · 0 comments
Labels
P2 A high-priority code maintenance issue or a functional problem that is recoverable or not a crash.

Comments

@andrew-lunarg
Copy link
Contributor

andrew-lunarg commented Oct 23, 2023

Each code generator is passed a blocklist like framework\generated\vulkan_generators\blacklists.json of functions and structures not to generate code for. They look like this:

{
  "functions-all": [
    "vkGetInstanceProcAddr",
    "vkGetDeviceProcAddr",
    "vkEnumerateInstanceLayerProperties",
    ...
  ],
  "functions-encoder": [
    "vkCreateComputePipelines",
    "vkCreateGraphicsPipelines",
    "vkCreateRayTracingPipelinesNV",
    "vkCreateRayTracingPipelinesKHR"
  ],
  "functions-decoder": [
    "vkCreateRayTracingPipelinesKHR",
    "vkDeferredOperationJoinKHR"
  ],
  "structures": [
    "VkBaseOutStructure",
    "VkBaseInStructure",
    "VkDescriptorImageInfo",
    ...
  ]
}

That file is plumbed into DX12 and Vulkan generator options by a file like framework\generated\dx12_generators\gencode.py:

default_blacklists = 'blacklists.json'
default_platform_types = 'platform_types.json'
...
    # JSON configuration files
    blacklists = os.path.join(args.configs, default_blacklists)
    platform_types = os.path.join(args.configs, default_platform_types)
    ...
    gen_opts['generated_dx12_api_call_encoders.h'] = [
        Dx12ApiCallEncodersHeaderGenerator,
        Dx12GeneratorOptions(
            filename='generated_dx12_api_call_encoders.h',
            directory=directory,
            blacklists=blacklists,  # <---------------------------------------------------------
            platform_types=platform_types,
            prefix_text=prefix_strings + py_prefix_strings,
            protect_file=True,
            protect_feature=False
        )
    ]

Generators like the Vulkan to JSON consumer ones have a wider set of functions which can be automatically generated (and thus a smaller set to block) than replay for example, where the difficulties are not in the function signatures but the internal mechanisms which need implementing beyond merely copying parameters out of a capture and stuffing them into API calls.

Suggested PRs to Address This

  1. Separate JSON Blocklists from main Vulkan one.
  2. Check whether other generated code in Vulkan or D3D12 land could benefit from its own blocklist that lets it require less custom code than the replay consumers do. Split them off if so and delete the unnecessary custom code.

See Also

#1192 (comment)

@bradgrantham-lunarg bradgrantham-lunarg added the P2 A high-priority code maintenance issue or a functional problem that is recoverable or not a crash. label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A high-priority code maintenance issue or a functional problem that is recoverable or not a crash.
Projects
None yet
Development

No branches or pull requests

2 participants