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=..\..\..\..\..\..\spinel\bin\x64\Debug\hs_gen
23
24:: --- 32-bit keys ---
25
26:: %HS_GEN% -v -a "glsl" -D HS_NVIDIA_SM35 -t 1 -w 32 -r 32 -s 49152 -S 65536 -b 32 -m 1 -M 1 -f 1 -F 1 -c 1 -C 1 -z
27%HS_GEN% -v -a "glsl" -D HS_NVIDIA_SM35 -t 1 -w 32 -r 16 -s 32768 -S 32768 -b 16 -m 1 -M 1 -p 1 -P 1 -f 0 -F 0 -c 0 -C 0 -z
28
29::
30:: remove trailing whitespace from generated files
31::
32
33sed -i 's/[[:space:]]*$//' hs_config.h
34sed -i 's/[[:space:]]*$//' hs_modules.h
35
36::
37::
38::
39
40where glslangValidator
41
42::
43:: FIXME -- convert this to a bash script
44::
45:: Note that we can use xargs instead of the cmd for/do
46::
47
48for %%f in (*.comp) do (
49    dos2unix %%f
50    clang-format -style=Mozilla -i %%f                                   || goto :error
51    cl -I ../.. -I ../../.. -EP %%f -P -Fi%%~nf.pre.comp                 || goto :error
52    clang-format -style=Mozilla -i %%~nf.pre.comp                        || goto :error
53    glslangValidator --target-env vulkan1.1 -o %%~nf.spv %%~nf.pre.comp  || goto :error
54    spirv-opt -O %%~nf.spv -o %%~nf.spv                                  || goto :error
55REM spirv-remap ...                                                      || goto :error
56    xxd -i < %%~nf.spv > %%~nf.spv.xxd                                   || goto :error
57    for /f %%A in ('wc -c %%~nf.spv') do (
58        echo %%~nf.spv %%A
59        printf "%%.8x" %%A | xxd -r -p | xxd -i > %%~nf.len.xxd          || goto :error
60    )
61)
62
63::
64:: dump a binary
65::
66
67cl -I ../../.. -I ../../../../.. /DHS_DUMP /Fe:hs_dump.exe *.c
68hs_dump
69
70::
71:: delete temporary files
72::
73
74del *.pre.comp
75del *.comp
76del *.spv
77REM del *.obj
78REM del *.exe
79
80exit /b 0
81
82:error
83
84exit /b %errorlevel%
85