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

Fix "expected expression, found ," compile error for precompiled shaders with more than one entrypoint #2136

Merged
merged 1 commit into from Feb 15, 2023

Conversation

Arc-blroth
Copy link
Contributor

Commit c6959aa seems to have introduced a regression that causes the vulkano-shaders macro to emit two consecutive commas for any single shader module with more than one entry point. (Since vulkano-shaders doesn't generate shader modules with multiple entrypoints itself as far as I know, this regression only manifests on precompiled shaders in practice.)

Here's a minimal reproducible example with two entrypoints vert and frag: shaders.spv.zip

mod shaders {
    vulkano_shaders::shader!{
        ty: "vertex",
        bytes: "shaders.spv",
    }
}

oh noes

Dumping the generated macro output reveals the double comma of doom:

unsafe {
    ::vulkano::shader::ShaderModule::from_words_with_data(
        // -- snip --
        [
            (
                "vert".to_owned(),
                ::vulkano::shader::spirv::ExecutionModel::Vertex,
                ::vulkano::shader::EntryPointInfo {
                    // -- snip --
                },
            ),, // <-- ERROR
            (
                "frag".to_owned(),
                ::vulkano::shader::spirv::ExecutionModel::Fragment,
                ::vulkano::shader::EntryPointInfo {
                    // -- snip --
                },
            ),
        ],
    )
}

Luckily, the fix for this is to simply remove the offending comma from the write_entry_point method - a one character change that makes this PR quite possibly the shortest PR I've ever authored :D

Changelog:

### Bugs fixed
- Vulkano-shaders: Fixed an "expected expression, found `,`" compile error for precompiled shaders with more than one entrypoint.

@Rua Rua merged commit 58fe067 into vulkano-rs:master Feb 15, 2023
Rua added a commit that referenced this pull request Feb 15, 2023
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
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.

None yet

2 participants