Rust-GPU / Rust-GPU/rust-gpu

[Migrated] Using `arch::ignore_intersection` causes shader compilation to fail

Đang mở
#67 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Rust
Star
3.4k
Fork
126
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/1099
Old labels: t: bug
Originally creatd by Steelbirdy on 2023-11-13T21:07:54Z


Expected Behaviour

Shader crate successfully compiles

Example & Steps To Reproduce
#[spirv(any_hit)]
pub fn my_any_hit() {
    let p = Vec3A::ZERO;
    if p.length_squared() < 1e-3 {
        unsafe { spirv_std::arch::ignore_intersection(); }
    }
}
  1. Use the above snippet in a shader crate
  2. Compilation fails

Replacing this with the below snippet causes it to compile.

#[spirv(any_hit)]
pub fn my_any_hit() {
    let p = Vec3A::ZERO;
    if p.length_squared() < 1e-3 {
        my_ignore_intersection();
    }
}

#[inline(never)]
fn my_ignore_intersection() {
    unsafe { spirv_std::arch::ignore_intersection(); }
}

System Info

  • Rust: 1.71.0-nightly (1a5f8bce7 2023-05-26)
  • OS: Windows 11
  • GPU: NVIDIA RTX 3060 Ti

Backtrace

Backtrace

  error: Selection must be structured
           OpBranchConditional %1274 %1275 %1276
    |
    = note: module `C:\Users\Pat\CLionProjects\rayven_gpu2\target\spirv-builder\spirv-unknown-vulkan1.2\release\deps\shader.spv`

  warning: an unknown error occurred
    |
    = note: spirv-opt failed, leaving as unoptimized
    = note: module `C:\Users\Pat\CLionProjects\rayven_gpu2\target\spirv-builder\spirv-unknown-vulkan1.2\release\deps\shader.spv`

  error: error:0:0 - Selection must be structured
           OpBranchConditional %1274 %1275 %1276
    |
    = note: spirv-val failed
    = note: module `C:\Users\Pat\CLionProjects\rayven_gpu2\target\spirv-builder\spirv-unknown-vulkan1.2\release\deps\shader.spv`

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện lỗi với any-hit shader snippet được cung cấp và so sánh với biến thể dùng hàm trợ giúp. Kiểm tra SPIR-V được tạo ra xung quanh OpBranchConditional được báo cáo và sử dụng spirv-opt cùng spirv-val để xác định tại sao lệnh gọi trực tiếp ignore_intersection tạo ra một lựa chọn không có cấu trúc. Được xem là hoàn tất khi snippet ban đầu biên dịch và vượt qua quá trình xác thực SPIR-V.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
rust
Lĩnh vực
compilers, computer-graphics
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.