1::
2:: Copyright 2018 Google Inc.
3::
4:: Use of this source code is governed by a BSD-style license that can
5:: be found in the LICENSE file.
6::
7
8@ECHO OFF
9
10::
11:: delete the previous images
12::
13
14del *.comp
15del *.spv
16del *.xxd
17
18::
19::
20::
21
22set HS_GEN=..\..\..\..\gen\hs_gen
23
24:: --- 32-bit keys ---
25
26%HS_GEN% -v -a "glsl" -D HS_AMD_GCN -t 1 -w 64 -r 16 -s 32768 -S 32768 -b 16 -m 1 -M 1 -f 1 -F 1 -c 1 -C 1 -z
27
28::
29:: remove trailing whitespace from generated files
30::
31
32sed -i 's/[[:space:]]*$//' hs_config.h
33sed -i 's/[[:space:]]*$//' hs_modules.h
34
35::
36::
37::
38
39where glslangValidator
40
41::
42:: FIXME -- convert this to a bash script
43::
44:: Note that we can use xargs instead of the cmd for/do
45::
46
47for %%f in (*.comp) do (
48    dos2unix %%f
49    clang-format -style=Mozilla -i %%f                                   || goto :error
50    cl -I ../.. -I ../../.. -EP %%f -P -Fi%%~nf.pre.comp                 || goto :error
51    clang-format -style=Mozilla -i %%~nf.pre.comp                        || goto :error
52    glslangValidator --target-env vulkan1.1 -o %%~nf.spv %%~nf.pre.comp  || goto :error
53    spirv-opt -O %%~nf.spv -o %%~nf.spv                                  || goto :error
54REM spirv-remap ...                                                      || goto :error
55    xxd -i < %%~nf.spv > %%~nf.spv.xxd                                   || goto :error
56    for /f %%A in ('wc -c %%~nf.spv') do (
57        echo %%~nf.spv %%A
58        printf "%%.8x" %%A | xxd -r -p | xxd -i > %%~nf.len.xxd          || goto :error
59    )
60)
61
62::
63:: dump a binary
64::
65
66cl -I ../../.. -I ../../../../.. /DHS_DUMP /Fe:hs_dump.exe *.c
67hs_dump
68
69::
70:: delete temporary files
71::
72
73del *.pre.comp
74del *.comp
75del *.spv
76
77del *.obj
78del *.exe
79
80exit /b 0
81
82:error
83
84exit /b %errorlevel%
85