Something went wrong. Try again.
A puzzle game of bent arrows sent off a board of dots, written in Zig.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>// SPDX-License-Identifier: MIT
//! The compiled shaders as they are embedded, with the source language//! their `OpSource` names made Unknown.//!//! Zig's SPIR-V backend says, truthfully, that the source was Zig, which is//! language 12 in the SPIR-V registry. Older SPIR-V parsers do not know//! it: the Android emulator's SwiftShader rejects the module and takes the//! emulator down with it. Nothing reads the language but tools, so nothing//! is lost by not saying.
const std = @import("std");
const op_source = 3;const header_words = 5;
pub fn unsourced(comptime spv: []const u8) [spv.len]u8 { @setEvalBranchQuota(spv.len * 4); var out = spv[0..spv.len].*; var at: usize = header_words * 4; while (at + 8 <= out.len) { const word = std.mem.readInt(u32, out[at..][0..4], .little); const count = word >> 16; if (count == 0) break; if (word & 0xffff == op_source) std.mem.writeInt(u32, out[at + 4 ..][0..4], 0, .little); at += count * 4; } return out;}
test unsourced { const words = [_]u32{ // The header: magic, version, generator, bound, schema. 0x07230203, 0x00010500, 0, 1, 0, // OpSource Zig, version 0. (3 << 16) | op_source, 12, 0, // OpCapability Shader. (2 << 16) | 17, 1, }; const out = unsourced(std.mem.sliceAsBytes(&words)); const got: [words.len]u32 = @bitCast(out); try std.testing.expectEqual(0, got[6]); try std.testing.expectEqualSlices(u32, words[0..6], got[0..6]); try std.testing.expectEqualSlices(u32, words[7..], got[7..]);}