The generated offsets/sizes were wrong on the 64-bit ABI because of three registry-parsing bugs, which silently broke any struct carrying a handle (swapchain, render pass, framebuffers, ...): - handles: their name lives in a child <name> element, not a `name` attribute (e.g. <type category="handle"><type>VK_DEFINE_HANDLE</type> (<name>VkInstance</name>)</type>), so every handle fell through to the 4-byte default. Read the child element; handles are 8-byte pointers again (VkSwapchainCreateInfoKHR.surface @24, not @20). - duplicated members: vk.xml lists some members once per API variant (api="vulkan" and api="vulkansc"); keep only the default Vulkan ones, else the field is emitted twice and inflates the struct size. - constants: emit bitflags from `bitpos`, extension enums from `offset`+extension `number` (sTypes like ..._SWAPCHAIN_CREATE_INFO_KHR = 1000001000), SPEC_VERSION numerics and EXTENSION_NAME strings from inside <require>, and resolve aliases. Verified against the system Vulkan header: 37 struct sizes/offsets checked, 0 mismatches; suite still 130 green.
27 lines
774 B
Bash
27 lines
774 B
Bash
#!/bin/sh
|
|
# tools/build_shaders.sh -- compile the GLSL shaders to SPIR-V.
|
|
#
|
|
# Uses the vendored glslangValidator (no network, no system install).
|
|
# Run from the repository root: sh tools/build_shaders.sh
|
|
|
|
set -e
|
|
|
|
DIR=$(dirname "$0")/..
|
|
GLSLANG="$DIR/tools/bin/glslangValidator"
|
|
|
|
if [ ! -x "$GLSLANG" ]; then
|
|
chmod +x "$GLSLANG" 2>/dev/null || true
|
|
fi
|
|
if [ ! -x "$GLSLANG" ]; then
|
|
echo "build_shaders: glslangValidator not found at $GLSLANG" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "compiling shaders/triangle.vert -> shaders/triangle.vert.spv"
|
|
"$GLSLANG" -V "$DIR/shaders/triangle.vert" -o "$DIR/shaders/triangle.vert.spv"
|
|
|
|
echo "compiling shaders/triangle.frag -> shaders/triangle.frag.spv"
|
|
"$GLSLANG" -V "$DIR/shaders/triangle.frag" -o "$DIR/shaders/triangle.frag.spv"
|
|
|
|
echo "shaders ok"
|