Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using arch::ignore_intersection causes shader compilation to fail #1099

Open
Steelbirdy opened this issue Nov 13, 2023 · 0 comments
Open

Using arch::ignore_intersection causes shader compilation to fail #1099

Steelbirdy opened this issue Nov 13, 2023 · 0 comments
Labels
t: bug Something isn't working

Comments

@Steelbirdy
Copy link

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`

@Steelbirdy Steelbirdy added the t: bug Something isn't working label Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant