summaryrefslogtreecommitdiffstats
path: root/docs/update_spirv.md
blob: 8463da3436bfc227793377f0d8c9e5126eede4fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Updating external spirv

There are three directories under `external` that are related to SPIR-V:
- external/spirv-headers
- external/spirv-tools
- external/spirv-tools-generated

In order to use the latest or custom SPIR-V, they need to be updated.

## Update URLs to the repo

Open `.gitmodules` and update the following sections to have a desired `url` set.
```
[submodule "external/spirv-tools"]
	path = external/spirv-tools
	url = https://github.com/shader-slang/SPIRV-Tools.git
[submodule "external/spirv-headers"]
	path = external/spirv-headers
	url = https://github.com/KhronosGroup/SPIRV-Headers.git
```

Run the following command to apply the change.
```
git submodule sync
git submodule update --init --recursive
```

If you need to use a specific branch from the repos, you need to manually checkout the branch.
```
cd external/spirv-tools
git checkout branch_name_to_use
cd ..
git add spirv-tools

cd external/spirv-headers
git checkout branch_name_to_use
cd ..
git add spirv-headers
```

## Build spirv-tools

A directory, `external/spirv-tools/generated`, holds a set of files generated from spirv-tools directory.
You need to build spirv-tools in order to generate them.

```
cd external/spirv-tools
python3.exe utils/git-sync-deps # this step may require you to register your ssh public key to gitlab.khronos.org
mkdir build
cd build
cmake.exe ..
cmake.exe --build . --config Release
```

## Copy the generated files from spirv-tools

Copy some of generated files from `external/spirv-tools/build/` to `external/spirv-tools-generated`.
The following files are ones you need to copy at the momment, but the list will change in the future.
```
DebugInfo.h
NonSemanticShaderDebugInfo100.h
OpenCLDebugInfo100.h
build-version.inc
core.insts-unified1.inc
debuginfo.insts.inc
enum_string_mapping.inc
extension_enum.inc
generators.inc
glsl.std.450.insts.inc
nonsemantic.clspvreflection.insts.inc
nonsemantic.shader.debuginfo.100.insts.inc
nonsemantic.vkspreflection.insts.inc
opencl.debuginfo.100.insts.inc
opencl.std.insts.inc
operand.kinds-unified1.inc
options-pinned.h
spv-amd-gcn-shader.insts.inc
spv-amd-shader-ballot.insts.inc
spv-amd-shader-explicit-vertex-parameter.insts.inc
spv-amd-shader-trinary-minmax.insts.inc
```