[Migrated] Image macro doesn't fully enforce valid use of non-sampled storage images
还没有人认领这个 Issue。
- 主要语言
- Rust
- 星标
- 3.4k
- 派生
- 126
- PR 合并指标
- 30 天内没有已合并 PR
描述
Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/812
Old labels: t: bug,s: blocked
Originally creatd by fu5ha on 2021-11-29T20:17:40Z
Currently, if we create an image type with the image macro as such:
Image!(2D, type=f32, sampled=false),
the image will still be able to be .read/.fetched, and the spirv Image object won't be decorated as NonReadable. However, according to vulkan spec, "If shaderStorageImageReadWithoutFormat is not enabled, any variable created with a "Type" of OpTypeImage that has a "Sampled" operand of 2 and an "Image Format" operand of Unknown must be decorated with NonReadable."
This can be solved for now by just using an explicit format=blah in the Image macro instead of type, but I think we could also handle this/validate it in the macro automatically. I think the best way forward would be:
- Make a
readableflag in the macro which gets auto-disabled under the above conditions, and when disabled, decorates theOpTypeImagewithNonReadableand doesn't allow to do.read/.fetchon the Image. - However, if it is manually enabled, then we do the current behavior, allowing
readetc. (assumingshaderStorageImageReadWithoutFormatis enabled).
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Image 宏开始,跟踪 type、sampled=false 和 .read/.fetch 如何影响生成的 OpTypeImage。检查如何发出 NonReadable,以及如何允许读取操作。完成标准是:无效的非采样存储图像被标记为 NonReadable,除非显式启用,否则无法读取,并根据 issue 中描述的 Vulkan 规则检查其行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100