Skip to content

Add spirv-tools and spirv-tools-sys crates to wrap usage of spirv-tools #179

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

Merged
merged 44 commits into from
Oct 29, 2020

Conversation

Jake-Shadle
Copy link
Member

Replaces the use of spirv-tools' binaries (as, opt, and val) with the ability use the compiled C++ code instead, or in addition to the spirv binaries.

Additions

  • Adds spirv-headers and spirv-tools as git submodules (will add docs about retrieiving/updating them for contributors)
  • Adds spirv-tools-sys which builds spirv-tools, including a small generator script that generates some includes based on spirv-headers
  • Adds a spirv-tools-sys/src/c/opt.cpp which is just a thin (and incomplete) C wrapper around Optimizer because C++
  • Adds a spirv-tools crate which provides a slighly nicer API on top of spirv-tools-sys

Changes

  • Replaces the usage of the spirv-opt binary in link.rs with spirv_tools::opt::Optimizer
  • Replaces the usage of spirv-val for validating resulting binaries in link.rs with spirv_tools::val::Validator
  • Replaces the usage of spirv-as in the linker tests with spirv_tools::as::Assembler
  • All of the crates that use rustc_codegen_spirv now have a use-installed-tools and use-compiled-tools feature flags, where use-compiled-tools is the default feature for optimal user experience.

Missing

  • There is one change I had to do in our spirv-tools fork due some incredible strangeness with libstdc++ streams, so right now the Assembler will choke on hexadecimal floats, but we only use the Assembler in tests and none of them currently use hexadecimal floats, so figured this would be ok for now, the issue is fixable but doing C++ code was making me sad so I punted until it became an actual issue.

Resolves: #31

@Jake-Shadle
Copy link
Member Author

This fixes the docs deployment.

@Jake-Shadle Jake-Shadle merged commit 307d0da into main Oct 29, 2020
@Jake-Shadle Jake-Shadle deleted the spirv-opt branch October 29, 2020 22:03
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.

Add bindings for spirv-opt
1 participant