Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

entry points with an enum of exactly two variants fails

未关闭
#358 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust
领域
compilers

调研方向

从错误中显示的 build-pass 用例 entry_point_enum_two_variants.rs 开始,复现将一个双变体 enum 传递给入口点时被拒绝的情况。跟踪入口点参数验证过程,该过程将 bools 报告为不受支持。确定预期的处理方式,并由一个通过的回归测试覆盖后,即视为完成。

由索引模型根据 Issue 内容生成。

描述

bug

Rust-gpu rejects entry points with an enum of exactly two variants and no values. rustc seems to convert those to bools, and we have explicit checks to fail emitting bools. Maybe we should even reconsider whether we actually want to block bools this way, and handle them as two variant enums?

// build-pass
use spirv_std::spirv;
use spirv_std::glam::Vec4;

pub enum MyEnum {
    Variant1,
    Variant2,
}

#[spirv(fragment)]
pub fn main(
    #[spirv(storage_buffer, descriptor_set = 0, binding = 0)] value: &MyEnum,
    out: &mut Vec4,
) {
    *out = match value {
        MyEnum::Variant1 => Vec4::new(1., 0., 0., 1.),
        MyEnum::Variant2 => Vec4::new(0., 1., 1., 1.),
    }
}

fails with:

error: entry-point parameter cannot contain `bool`s
  --> $DIR/entry_point_enum_two_variants.rs:12:70
   |
12 |     #[spirv(storage_buffer, descriptor_set = 0, binding = 0)] value: &MyEnum,
   |                                                                      ^^^^^^^

error: aborting due to 1 previous error
主要语言
Rust
星标
3.4k
派生
126
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Rust-GPU/rust-gpu 的其他 Issue

查看 Rust-GPU/rust-gpu 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。