merge: blend-followup (spv-check)
3 files · +10 -4
M .github/workflows/ci.yml +2 -0
| @@ -13,3 +13,5 @@ jobs: | |||
| 13 | 13 | - run: make check | |
| 14 | 14 | - run: make race | |
| 15 | 15 | - 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 check | 13 | - run: make check | ||
| 14 | - run: make race | 14 | - run: make race | ||
| 15 | - run: make mocks-check | 15 | - 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 | |
| 2 | 2 | ||
| 3 | 3 | # 0 runs until quit; set e.g. TTY_TIMEOUT=60s for a safety net. | |
| 4 | 4 | TTY_TIMEOUT ?= 0 | |
| @@ -35,6 +35,10 @@ mocks: | |||
| 35 | 35 | mocks-check: mocks | |
| 36 | 36 | git diff --exit-code -- $(MOCKS) | |
| 37 | 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 | 42 | # Test doubles come from Mockery only: no handwritten fake/stub/spy types. | |
| 39 | 43 | # Matches `type fakeX`, `\ttype RendererStub[T any]` and `spyX struct` in `type (` blocks. | |
| 40 | 44 | # 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 pkg | 1 | + | .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 ?= 0 | 4 | TTY_TIMEOUT ?= 0 | ||
| @@ -35,6 +35,10 @@ mocks: | |||||
| 35 | mocks-check: mocks | 35 | 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) { | |||
| 384 | 384 | } | |
| 385 | 385 | defer r.Close() | |
| 386 | 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 | 388 | 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 | |
| 390 | 390 | } | |
| 391 | 391 | white := shmContent(t, 32, 48, 32*4, solid(32, 48, [3]uint8{255, 255, 255})) | |
| 392 | 392 | white.Opaque = true | |
| 393 | 393 | contents := map[ports.WindowID]ports.SurfaceContent{ | |
| 394 | 394 | 1: *white, | |
| 395 | 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 | 397 | 4: *shmContent(t, 16, 8, 16*4, fill(16, 8, halfBlue)), | |
| 398 | 398 | } | |
| 399 | 399 | 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: transparent | 389 | + | 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 = true | 392 | 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", | ||