[Migrated] RuntimeArray as uniform creates invalid spv instead of erroring
まだ誰も着手していません。
- 主要言語
- Rust
- スター
- 3.4k
- フォーク
- 126
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/1098
Old labels: t: bug
Originally creatd by Firestar99 on 2023-11-13T10:30:24Z
Expected Behaviour
In the following example, you can't have a uniform with a variable amount of data, so it must be a storage_buffer instead. Currently, rust-gpu compiles it to an invalid spv, that is then caught by spirv-opt running afterwards, noticing the invalid spv and failing the build. Rust-gpu should probably catch this mistake earlier in the build pipeline and not even produce an invalid spv in the first place.
#[spirv(descriptor_set = 0, binding = 0, uniform)] vertex_input_buffer: &[f32],
Example & Steps To Reproduce
- have a shader entry point with the parameter declaration above
- compile the shader crate
- observe compile failing due to invalid spv being optimized
System Info
- Rust: nightly-2023-05-27
- OS: Ubuntu 23.04
- GPU: irrevelant
- SPIR-V: v2023.5 unknown hash, 2023-10-17T17:19:41
Backtrace
Backtrace
Compiling space-engine v0.1.0 (<project dir>/space-engine)
error: failed to run custom build command for `space-engine v0.1.0 (<project dir>/space-engine)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.
Caused by:
process didn't exit successfully: `<project dir>/target/debug/build/space-engine-ab7683b3782ee376/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=RUSTGPU_CODEGEN_ARGS
cargo:rerun-if-env-changed=RUSTGPU_RUSTFLAGS
--- stderr
Compiling space-engine-shader v0.1.0 (<project dir>/space-engine-shader)
warning: error:0:0 - [VUID-StandaloneSpirv-OpTypeRuntimeArray-04680] For Vulkan, an OpTypeStruct variable containing an OpTypeRuntimeArray must be decorated with BufferBlock if it has storage class Uniform.
|
= note: spirv-opt failed, leaving as unoptimized
= note: module `<project dir>/target/spirv-builder/spirv-unknown-vulkan1.2/release/deps/space_engine_shader.spvs/space-renderer-lod_obj-opaque_shader-opaque_vs.spv`
error: error:0:0 - [VUID-StandaloneSpirv-OpTypeRuntimeArray-04680] For Vulkan, an OpTypeStruct variable containing an OpTypeRuntimeArray must be decorated with BufferBlock if it has storage class Uniform.
|
= note: spirv-val failed
= note: module `<project dir>/target/spirv-builder/spirv-unknown-vulkan1.2/release/deps/space_engine_shader.spvs/space-renderer-lod_obj-opaque_shader-opaque_vs.spv`
warning: `space-engine-shader` (lib) generated 1 warning
error: could not compile `space-engine-shader` (lib) due to previous error; 1 warning emitted
Error: SpirvBuilderError(BuildFailed)
Process finished with exit code 101
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
#[spirv(..., uniform)] vertex_input_buffer: &[f32] を使用したシェーダーエントリーポイントのパラメータ宣言から始め、uniform ストレージ内のランタイム配列を処理するコンパイラパスを追跡します。spirv-opt と spirv-val を使ってビルドを再現し、無効な SPIR-V を出力する前に、コンパイラが uniform とランタイム配列の無効な組み合わせを報告することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100