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

Always emit json metadata, and emit entry point names #622

Merged
merged 3 commits into from
May 24, 2021
Merged

Conversation

khyperia
Copy link
Contributor

Fixes #620

Copy link
Member

@VZout VZout left a comment

Choose a reason for hiding this comment

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

Awesome! and looks quite easy to add interface variables as well to the metadata. But this does not work with multimodule?

@khyperia
Copy link
Contributor Author

But this does not work with multimodule?

yeah, it does work? cargo run -p multibuilder outputs this:

CompileResult {
    module: MultiModule(
        {
            "main_fs": "/home/khyperia/me/rust-gpu/target/spirv-unknown-spv1.3/release/deps/sky_shader.spv.dir/main_fs",
            "main_vs": "/home/khyperia/me/rust-gpu/target/spirv-unknown-spv1.3/release/deps/sky_shader.spv.dir/main_vs",
        },
    ),
    entry_points: [
        "main_fs",
        "main_vs",
    ],
}

the code does take a little shortcut and yoinks the entrypoint out of the precomputed dictionary (which itself yoinks the entrypoint out of the module) instead of digging around in the module itself, because it's a bit simpler code, but it could easily be expanded to dig through the modules themselves if we wanted to extract more metadata (or carry information through the compiler and emit it, instead of reflecting the output)

@VZout
Copy link
Member

VZout commented May 18, 2021

Ah I saw this and thought metadata was disabled in its entirety for multimodule.

if self.print_metadata && self.multimodule {
    return Err(SpirvBuilderError::MultiModuleWithPrintMetadata);
}

@khyperia
Copy link
Contributor Author

Ah, that's printing cargo metadata, and is no change in behavior from the current system - it already produces the same error before this PR. "Metadata" in the context of that code means things like printing cargo:rerun-if-changed=blah to stdout.

@khyperia khyperia merged commit 47d1e75 into main May 24, 2021
@khyperia khyperia deleted the always-json branch May 24, 2021 07: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.

Always emit json, even for non-multimodule, and embed metadata in the json
2 participants