Skip to content

Commit a1aafcd

Browse files
committed
ci: 图形示例在 macOS 与 Windows 上也构建一次
此前 `examples/` 只在 Linux 上被构建过(`build_examples.sh` 只在那里跑)。这正是 这一轮要消除的形状:一条 lane 里为某个宿主写的那半段,恰好是那个宿主从不走的那半段。 两个 runner 都没有 Vulkan 设备,所以断言的是这个平台决定的那部分:**这个平台用的那个 着色器编译器**(规则在这里声明 `xim:shaderc`,Linux 上是 `xim:glslang`)产出两个 SPIR-V 头,而 Vulkan 那一半编译并链接得上 loader 包。跑起来是 Linux job 的判据 —— 那里有已发布的软件设备,而且两条腿的像素被逐字节比较。 工具链显式命名而不是继承:让它取决于隔壁某一步恰好选了什么,会让这一步的被测对象 取决于步骤顺序,而那不是任何人会去读的性质。
1 parent 8635f53 commit a1aafcd

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/ci-macos.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,38 @@ jobs:
310310
"$MCPP" build
311311
"$MCPP" --version
312312
313+
314+
# GRAPHICS ON THIS HOST, BUILD ONLY, AND THAT IS THE WHOLE CLAIM.
315+
#
316+
# This runner has no Vulkan device, so what is asserted is what this
317+
# platform decides: that the shader compiler THIS platform uses -- the
318+
# rule declares `xim:shaderc` here and `xim:glslang` on Linux -- produces
319+
# both SPIR-V headers, and that the Vulkan half compiles and links
320+
# against the loader package. Running it is the Linux job's criterion,
321+
# where a software device (`xim:mesa-lavapipe`) is published and the two
322+
# legs' pixels are compared.
323+
#
324+
# The example is otherwise built only on Linux (`build_examples.sh` runs
325+
# there), which is exactly the shape this change exists to remove: the
326+
# half of a lane written for a host is the half that host never
327+
# exercises.
328+
- name: "Graphics: the offscreen example builds on this host"
329+
shell: bash
330+
run: |
331+
set -e
332+
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
333+
cd "$GITHUB_WORKSPACE/examples/10-graphics/offscreen"
334+
# The toolchain is NAMED rather than inherited: leaving it to whatever
335+
# a neighbouring step happened to select makes this step's subject
336+
# depend on step order, which is not a property anybody reads.
337+
"/tmp/mcpp-fresh" build --toolchain "llvm@${MCPP_LLVM_VER}"
338+
for f in triangle_vert triangle_frag; do
339+
h="target/.build-mcpp/out/spirv/$f.h"
340+
test -f "$h" || { echo "missing $h"; exit 1; }
341+
grep -q '0x07230203' "$h" || { echo "$h carries no SPIR-V magic"; exit 1; }
342+
done
343+
echo "ok: both shader stages compiled and the Vulkan half linked"
344+
313345
# Integration: the mcpp built from THIS PR's source (the self-host binary,
314346
# $MCPP = /tmp/mcpp-fresh) builds & runs a real external C++ project —
315347
# xlings (openxlings/xlings ships its own mcpp.toml).

.github/workflows/ci-windows.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,38 @@ jobs:
405405
# restore the LLVM default for the remaining steps
406406
"$MCPP_SELF" toolchain default llvm@20.1.7
407407
408+
409+
# GRAPHICS ON THIS HOST, BUILD ONLY, AND THAT IS THE WHOLE CLAIM.
410+
#
411+
# This runner has no Vulkan device, so what is asserted is what this
412+
# platform decides: that the shader compiler THIS platform uses -- the
413+
# rule declares `xim:shaderc` here and `xim:glslang` on Linux -- produces
414+
# both SPIR-V headers, and that the Vulkan half compiles and links
415+
# against the loader package. Running it is the Linux job's criterion,
416+
# where a software device (`xim:mesa-lavapipe`) is published and the two
417+
# legs' pixels are compared.
418+
#
419+
# The example is otherwise built only on Linux (`build_examples.sh` runs
420+
# there), which is exactly the shape this change exists to remove: the
421+
# half of a lane written for a host is the half that host never
422+
# exercises.
423+
- name: "Graphics: the offscreen example builds on this host"
424+
shell: bash
425+
run: |
426+
set -e
427+
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
428+
cd "$GITHUB_WORKSPACE/examples/10-graphics/offscreen"
429+
# The toolchain is NAMED rather than inherited: leaving it to whatever
430+
# a neighbouring step happened to select makes this step's subject
431+
# depend on step order, which is not a property anybody reads.
432+
"$MCPP_SELF" build --toolchain "llvm@20.1.7"
433+
for f in triangle_vert triangle_frag; do
434+
h="target/.build-mcpp/out/spirv/$f.h"
435+
test -f "$h" || { echo "missing $h"; exit 1; }
436+
grep -q '0x07230203' "$h" || { echo "$h carries no SPIR-V magic"; exit 1; }
437+
done
438+
echo "ok: both shader stages compiled and the Vulkan half linked"
439+
408440
- name: "Toolchain: LLVM — build mcpp (self-host)"
409441
shell: bash
410442
run: |

0 commit comments

Comments
 (0)