Skip to content

Conversation

XAMPPRocky
Copy link
Member

This PR overrides the default panic hook, with our own that will catch when SPIR-V tools are not available and give you a specific error message about that, and in all other cases we use the normal ICE message with the URL redirected to this repo, and we print out rust-gpu's version.

fixes #51

SPIR-V Error Message

error: failed to run custom build command for `example-runner v0.1.0 (/Users/src/rust-gpu/examples/example-runner)`

Caused by:
  process didn't exit successfully: `/Users/src/rust-gpu/target/debug/build/example-runner-062276209715c6a1/build-script-build` (exit code: 1)
  --- stderr
     Compiling spirv-std v0.1.0 (/Users/src/rust-gpu/spirv-std)
     Compiling example-shader v0.1.0 (/Users/src/rust-gpu/examples/example-shader)

  error: Couldn't find `spriv-val` tool in PATH.

  error: Please ensure that you have `spirv-tools` installed on your system and available in your PATH.

  note: `rust-gpu` version 0.1.0

  error: could not compile `example-shader`

  To learn more, run the command again with --verbose.
  Error: BuildFailed

Normal ICE

error: failed to run custom build command for `example-runner v0.1.0 (/Users/src/rust-gpu/examples/example-runner)`

Caused by:
  process didn't exit successfully: `/Users/src/rust-gpu/target/debug/build/example-runner-062276209715c6a1/build-script-build` (exit code: 1)
  --- stderr
     Compiling spirv-std v0.1.0 (/Users/src/rust-gpu/spirv-std)
  thread 'rustc' panicked at 'explicit panic', rustc_codegen_spirv/src/lib.rs:563:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  error: internal compiler error: unexpected panic

  note: the compiler unexpectedly panicked. this is a bug.

  note: we would appreciate a bug report: https://github.com/EmbarkStudios/rust-gpu/issues/new

  note: rustc 1.49.0-nightly (8dae8cdcc 2020-10-12) running on x86_64-apple-darwin

  note: compiler flags: -Z unstable-options -Z codegen-backend=librustc_codegen_spirv.dylib -C opt-level=3 -C embed-bitcode=no --crate-type lib

  note: some of the compiler flags provided by cargo are hidden

  note: `rust-gpu` version 0.1.0
  error: could not compile `spirv-std`

  To learn more, run the command again with --verbose.
  Error: BuildFailed

@XAMPPRocky XAMPPRocky requested a review from khyperia October 14, 2020 10:45
Copy link
Contributor

@khyperia khyperia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The custom handling with rustc_driver::report_ice is really good, though, thanks for finding that!

@XAMPPRocky
Copy link
Member Author

XAMPPRocky commented Oct 14, 2020

@khyperia Okay, I've refactored the PR into a single function output_spirv_tool that handles outputting tool errors as rustc compile errors and reworked the two functions to use that.

Error Message

     Compiling spirv-std v0.1.0 (/Users/erin.power/src/rust-gpu/spirv-std)
     Compiling example-shader v0.1.0 (/Users/erin.power/src/rust-gpu/examples/example-shader)
  error: Couldn't find `spirv-val` SPRI-V tool in PATH.
    |
    = note: Please ensure that you have `spirv-tools` installed on your system and available in your PATH.

  error: aborting due to previous error

  error: could not compile `example-shader`

  To learn more, run the command again with --verbose.

Copy link
Contributor

@khyperia khyperia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually rebased and tested locally and tests pass - so merging this! 🎉

@khyperia khyperia merged commit 16c35c6 into main Oct 14, 2020
@khyperia khyperia deleted the ice-message branch October 14, 2020 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Error Message When Missing SPIR-V tools
2 participants