50spirv-tools.el 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ;; Copyright (c) 2016 LunarG Inc.
  2. ;;
  3. ;; Licensed under the Apache License, Version 2.0 (the "License");
  4. ;; you may not use this file except in compliance with the License.
  5. ;; You may obtain a copy of the License at
  6. ;;
  7. ;; http://www.apache.org/licenses/LICENSE-2.0
  8. ;;
  9. ;; Unless required by applicable law or agreed to in writing, software
  10. ;; distributed under the License is distributed on an "AS IS" BASIS,
  11. ;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. ;; See the License for the specific language governing permissions and
  13. ;; limitations under the License.
  14. ;; Upon loading a file with the .spv extension into emacs, the file
  15. ;; will be disassembled using spirv-dis, and the result colorized with
  16. ;; asm-mode in emacs. The file may be edited within the constraints
  17. ;; of validity, and when re-saved will be re-assembled using spirv-as.
  18. ;; Note that symbol IDs are not preserved through a load/edit/save operation.
  19. ;; This may change if the ability is added to spirv-as.
  20. ;; It is required that those tools be in your PATH. If that is not the case
  21. ;; when starting emacs, the path can be modified as in this example:
  22. ;; (setenv "PATH" (concat (getenv "PATH") ":/path/to/spirv/tools"))
  23. ;;
  24. ;; See https://github.com/KhronosGroup/SPIRV-Tools/issues/359
  25. (require 'jka-compr)
  26. (require 'asm-mode)
  27. (add-to-list 'jka-compr-compression-info-list
  28. '["\\.spv\\'"
  29. "Assembling SPIRV" "spirv-as" ("-o" "-")
  30. "Disassembling SPIRV" "spirv-dis" ("--no-color" "--raw-id")
  31. t nil "\003\002\043\007"])
  32. (add-to-list 'auto-mode-alist '("\\.spv\\'" . asm-mode))
  33. (jka-compr-update)