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