Skip to content

Instantly share code, notes, and snippets.

View tiye's full-sized avatar
💭
Make Cirru great again!

题叶 tiye

💭
Make Cirru great again!
View GitHub Profile
@tiye
tiye / compact.cirru
Created February 3, 2024 18:45
run with `cr -1 compact.cirru`
{} (:package |app)
:configs $ {} (:init-fn |app.main/main!) (:package |app) (:reload-fn |app.main/main!)
:modules $ []
:files $ {}
|app.lib $ %{} :FileEntry
:ns $ %{} :CodeEntry (:doc |)
:code $ quote (ns app.lib)
:defs $ {}
|call-lib $ %{} :CodeEntry (:doc |)
:code $ quote
@tiye
tiye / size.log
Created January 31, 2024 06:57
Calcit struct size
type: `calcit::Calcit`: 80 bytes, alignment: 8 bytes
discriminant: 1 bytes
variant `Fn`: 79 bytes
padding: 7 bytes
field `.name`: 16 bytes, alignment: 8 bytes
field `.def_ns`: 16 bytes
field `.id`: 16 bytes
field `.scope`: 8 bytes
field `.args`: 8 bytes
field `.body`: 8 bytes
struct Camera {
origin: vec3f,
forward: vec3f,
upward: vec3f,
}
struct Line {
start: vec3f,
direction: vec3f,
@tiye
tiye / crash log
Last active December 17, 2023 06:08
webgpu crashes Chrome
panic(cpu 1 caller 0xfffffe002bb6d218): userspace watchdog timeout: no successful checkins from WindowServer in 120 seconds
WindowServer has not exited since first loaded
service: logd, total successful checkins in 19605 seconds: 1853, last successful checkin: 0 seconds ago
service: WindowServer, total successful checkins in 19559 seconds: 1837, last successful checkin: 120 seconds ago
service: opendirectoryd, total successful checkins in 19605 seconds: 1853, last successful checkin: 0 seconds ago
service: configd, total successful checkins in 19605 seconds: 1852, last successful checkin: 0 seconds ago
Debugger message: panic
Memory ID: 0x1
OS release type: User
@tiye
tiye / demo.caddyfile
Created December 9, 2023 15:17
Caddy that serves /ws as WebSockets and others from static files
pumila.my.domain {
# Websockets, if headers match
handle /ws {
reverse_proxy localhost:11011
}
handle /* {
root * /web-assets/pumila/
file_server

@compute.toys is a playground for WebGPU compute shaders. Everything here is written in WGSL, which is WebGPU's native shader language. For up-to-date information on WGSL, please see the WGSL draft specification. You can also take a tour of WGSL.

Inputs

@compute.toys supplies keyboard input, mouse input, selectable input textures, custom values controlled by sliders, and the current frame and elapsed time.

Mouse input can be accessed from the mouse struct:

const inner_width: f32 = {%inner_width%};
const inner_height: f32 = {%inner_height%};
fn julia(z0: vec2<f32>, c: vec2<f32>) -> bool {
var i = 0;
var z = z0;
while i < 100 {
z = vec2<f32>(z.x * z.x - z.y * z.y, 2.0 * z.x * z.y) + c;
if length(z) > 400.0 {
return false;
@tiye
tiye / ga3.wgsl
Created October 19, 2023 19:39
Trying 3D geometric algebra in WebGPU(not confirmed in real use yet)
//! converted from https://github.com/calcit-lang/geometric/blob/main/compact.cirru
//! TODO not confirmed the correctness
/// struct holding 3D geometric algebra
struct GometricAlgebra3D {
s: f32;
x: f32;
y: f32;
z: f32;
@tiye
tiye / version.md
Last active August 29, 2023 01:59
08-21 版本更新中
PkG version
bisection-key 0.0.15
calcit-test 0.0.4
calcit-theme 0.3.0
cumulo-reel 0.0.10
cumulo-util 0.0.6
http 0.2.0
lilac 0.4.0-a2