Rust-GPU / Rust-GPU/rust-gpu

[Migrated] Incorrect array stride for arrays of vector types

オープン
#128 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Rust
スター
3.4k
フォーク
126
PR マージ指標
30日以内にマージされた PR はありません

説明

Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/573
Old labels: t: bug,c: rustc_codegen_spirv,s: qptr may fix
Originally creatd by msiglreith on 2021-03-31T18:36:48Z


const QUAD_CLIP: [f32x2; 4] = [
    f32x2 { x: -1.0, y: -1.0 },
    f32x2 { x: 1.0, y: -1.0 },
    f32x2 { x: -1.0, y: 1.0 },
    f32x2 { x: 1.0, y: 1.0 },
];

#[spirv(vertex)]
pub fn quad_vs(#[spirv(vertex_id)] vert_id: i32, #[spirv(position)] a_position: &mut f32x4) {
    let idx = vert_id as usize;
    let pos_clip = QUAD_CLIP[idx];
    *a_position = vec4(pos_clip.x, pos_clip.y, idx as f32, 1.0);
}

QUAD_CLIP type will be generated with an ArrayStride of 8 which is incorrect as in this case all array elements should be treated as vec4 types, requiring a stride of 16.

Generated:

OpDecorate %_arr_v2float_uint_4 ArrayStride 8

Expected:

OpDecorate %_arr_v2float_uint_4 ArrayStride 16

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

QUAD_CLIP 用の Rust 再現コードから始め、配列型に対して生成された SPIR-V decoration を調査します。出力された ArrayStride を期待値 16 と比較し、ベクトル型の配列が正しい stride を受け取るようになった時点で issue は完了とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。