| 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 |
|
| 15 |
;; Upon loading a file with the .spv extension into emacs, the file |
| 16 |
;; will be disassembled using spirv-dis, and the result colorized with |
| 17 |
;; asm-mode in emacs. The file may be edited within the constraints |
| 18 |
;; of validity, and when re-saved will be re-assembled using spirv-as. |
| 19 |
|
| 20 |
;; Note that symbol IDs are not preserved through a load/edit/save operation. |
| 21 |
;; This may change if the ability is added to spirv-as. |
| 22 |
|
| 23 |
;; It is required that those tools be in your PATH. If that is not the case |
| 24 |
;; when starting emacs, the path can be modified as in this example: |
| 25 |
;; (setenv "PATH" (concat (getenv "PATH") ":/path/to/spirv/tools")) |
| 26 |
;; |
| 27 |
;; See https://github.com/KhronosGroup/SPIRV-Tools/issues/359 |
| 28 |
|
| 29 |
(require 'jka-compr) |
| 30 |
(require 'asm-mode) |
| 31 |
|
| 32 |
(add-to-list 'jka-compr-compression-info-list |
| 33 |
'["\\.spv\\'" |
| 34 |
"Assembling SPIRV" "spirv-as" ("-o" "-") |
| 35 |
"Disassembling SPIRV" "spirv-dis" ("--no-color" "--raw-id") |
| 36 |
t nil "\003\002\043\007"]) |
| 37 |
|
| 38 |
(add-to-list 'auto-mode-alist '("\\.spv\\'" . asm-mode)) |
| 39 |
|
| 40 |
(jka-compr-update) |