detached 352d9b8

build(vulkan): check committed SPIR-V matches the shaders in CI, rename shadowing test var

commit
352d9b858abfe70e099ccd0b983e87a6bdd03919
author
brice · · 2026-09-26 09:33 UTC
parent
942d2a2
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +10 -4
M .github/workflows/ci.yml +2 -0
@@ -13,3 +13,5 @@ jobs:
1313 - run: make check
1414 - run: make race
1515 - run: make mocks-check
16+ - run: sudo apt-get install -y glslc
17+ - run: make spv-check
@@ -13,3 +13,5 @@ jobs:
13 - run: make check13 - run: make check
14 - run: make race14 - run: make race
15 - run: make mocks-check15 - run: make mocks-check
16+ - run: sudo apt-get install -y glslc
17+ - run: make spv-check
M Makefile +5 -1
@@ -1,4 +1,4 @@
1-.PHONY: build test vet race mocks mocks-check fakes-check arch check bin tty logs pkg
1+.PHONY: build test vet race mocks mocks-check spv-check fakes-check arch check bin tty logs pkg
22
33 # 0 runs until quit; set e.g. TTY_TIMEOUT=60s for a safety net.
44 TTY_TIMEOUT ?= 0
@@ -35,6 +35,10 @@ mocks:
3535 mocks-check: mocks
3636 git diff --exit-code -- $(MOCKS)
3737 @test -z "$$(git ls-files --others --exclude-standard -- $(MOCKS))"
38+# Committed SPIR-V must match the GLSL shaders (needs glslc).
39+spv-check:
40+ go generate ./internal/adapters/vulkan
41+ git diff --exit-code -- 'internal/adapters/vulkan/shaders/*.spv'
3842 # Test doubles come from Mockery only: no handwritten fake/stub/spy types.
3943 # Matches `type fakeX`, `\ttype RendererStub[T any]` and `spyX struct` in `type (` blocks.
4044 # grep exit 1 (no match) passes; 0 (match) and 2 (error) fail.
@@ -1,4 +1,4 @@
1-.PHONY: build test vet race mocks mocks-check fakes-check arch check bin tty logs pkg1+.PHONY: build test vet race mocks mocks-check spv-check fakes-check arch check bin tty logs pkg
2 2
3 # 0 runs until quit; set e.g. TTY_TIMEOUT=60s for a safety net.3 # 0 runs until quit; set e.g. TTY_TIMEOUT=60s for a safety net.
4 TTY_TIMEOUT ?= 04 TTY_TIMEOUT ?= 0
@@ -35,6 +35,10 @@ mocks:
35 mocks-check: mocks35 mocks-check: mocks
36 git diff --exit-code -- $(MOCKS)36 git diff --exit-code -- $(MOCKS)
37 @test -z "$$(git ls-files --others --exclude-standard -- $(MOCKS))"37 @test -z "$$(git ls-files --others --exclude-standard -- $(MOCKS))"
38+# Committed SPIR-V must match the GLSL shaders (needs glslc).
39+spv-check:
40+ go generate ./internal/adapters/vulkan
41+ git diff --exit-code -- 'internal/adapters/vulkan/shaders/*.spv'
38 # Test doubles come from Mockery only: no handwritten fake/stub/spy types.42 # Test doubles come from Mockery only: no handwritten fake/stub/spy types.
39 # Matches `type fakeX`, `\ttype RendererStub[T any]` and `spyX struct` in `type (` blocks.43 # Matches `type fakeX`, `\ttype RendererStub[T any]` and `spyX struct` in `type (` blocks.
40 # grep exit 1 (no match) passes; 0 (match) and 2 (error) fail.44 # grep exit 1 (no match) passes; 0 (match) and 2 (error) fail.
M internal/adapters/vulkan/renderer_test.go +3 -3
@@ -384,16 +384,16 @@ func TestRendererAlphaBlend(t *testing.T) {
384384 }
385385 defer r.Close()
386386 halfRed, halfBlue := [4]byte{0, 0, 128, 128}, [4]byte{128, 0, 0, 128}
387- clear := fill(16, 8, halfRed)
387+ partly := fill(16, 8, halfRed)
388388 for y := range 8 {
389- copy(clear[y*64+48:y*64+64], make([]byte, 16)) // last 4 pixels: transparent
389+ copy(partly[y*64+48:y*64+64], make([]byte, 16)) // last 4 pixels: transparent
390390 }
391391 white := shmContent(t, 32, 48, 32*4, solid(32, 48, [3]uint8{255, 255, 255}))
392392 white.Opaque = true
393393 contents := map[ports.WindowID]ports.SurfaceContent{
394394 1: *white,
395395 2: *shmContent(t, 64, 48, 64*4, fill(64, 48, halfRed)),
396- 3: *shmContent(t, 16, 8, 16*4, clear),
396+ 3: *shmContent(t, 16, 8, 16*4, partly),
397397 4: *shmContent(t, 16, 8, 16*4, fill(16, 8, halfBlue)),
398398 }
399399 scene := ports.Scene{Background: "#000000",
@@ -384,16 +384,16 @@ func TestRendererAlphaBlend(t *testing.T) {
384 }384 }
385 defer r.Close()385 defer r.Close()
386 halfRed, halfBlue := [4]byte{0, 0, 128, 128}, [4]byte{128, 0, 0, 128}386 halfRed, halfBlue := [4]byte{0, 0, 128, 128}, [4]byte{128, 0, 0, 128}
387- clear := fill(16, 8, halfRed)387+ partly := fill(16, 8, halfRed)
388 for y := range 8 {388 for y := range 8 {
389- copy(clear[y*64+48:y*64+64], make([]byte, 16)) // last 4 pixels: transparent389+ copy(partly[y*64+48:y*64+64], make([]byte, 16)) // last 4 pixels: transparent
390 }390 }
391 white := shmContent(t, 32, 48, 32*4, solid(32, 48, [3]uint8{255, 255, 255}))391 white := shmContent(t, 32, 48, 32*4, solid(32, 48, [3]uint8{255, 255, 255}))
392 white.Opaque = true392 white.Opaque = true
393 contents := map[ports.WindowID]ports.SurfaceContent{393 contents := map[ports.WindowID]ports.SurfaceContent{
394 1: *white,394 1: *white,
395 2: *shmContent(t, 64, 48, 64*4, fill(64, 48, halfRed)),395 2: *shmContent(t, 64, 48, 64*4, fill(64, 48, halfRed)),
396- 3: *shmContent(t, 16, 8, 16*4, clear),396+ 3: *shmContent(t, 16, 8, 16*4, partly),
397 4: *shmContent(t, 16, 8, 16*4, fill(16, 8, halfBlue)),397 4: *shmContent(t, 16, 8, 16*4, fill(16, 8, halfBlue)),
398 }398 }
399 scene := ports.Scene{Background: "#000000",399 scene := ports.Scene{Background: "#000000",

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 23

Tags 10

↑↓ moveenter openesc close