Possible inlining bug
まだ誰も着手していません。
- 主要言語
- Rust
- スター
- 3.4k
- フォーク
- 126
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
It seems that this function has different results depending on whether or not #[inline(always)] is used:
/// Return `1.0` when `value` is less than or equal to `edge`
/// and `0.0` when `value` is greater than `edge`.
#[inline(always)]
pub fn step_le(value: f32, edge: f32) -> f32 {
((value <= edge) as u32) as f32
}
I have a shader you can see here that uses this function.
Expected Behaviour
Using ((sphere_aabb.max.z <= 1.0) as u32) as f32, which is a manual inlining of the body of the function, produces the expected results.
Using crate::math::step_le(sphere_aabb.max.z, 1.0) while having an #[inline(always)] annotation on step_le produces the expected results.
Using crate::math::step_le(sphere_aabb.max.z, 1.0) without having an #[inline(always)] annotation on step_le produces the opposite of the expected result.
Example & Steps To Reproduce
I can work on a minimal reproducible shader.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンク先の行にある crates/renderling/src/debug.rs の shader から始め、crate::math::step_le の使用箇所を追跡してください。issue で言及されている最小再現可能な shader を作成し、手動でのインライン化、#[inline(always)]、inline アノテーションなしを比較してください。異なる結果が再現され、動作が修正されるか明確に切り分けられれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust
- 領域
- compilers, computer-graphics
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 42/100