Skip to content

Instantly share code, notes, and snippets.

View theoparis's full-sized avatar

Theo Paris theoparis

View GitHub Profile
@theoparis
theoparis / llvm.nix
Last active October 15, 2024 07:27
llvm-project git build with nix (without runtimes, clangir enabled, using mold as the linker)
{
src,
targets ? "host",
projects ? "clang;lld;mlir;libc",
stdenv,
cmakeMinimal,
ninja,
python313,
mold,
}:
@theoparis
theoparis / line.glsl
Created July 11, 2024 05:14
wavy aah line shader with glslViewer
// vim:ft=glsl
uniform float u_time;
uniform vec2 u_resolution;
float line(vec2 p, vec2 a, vec2 b) {
vec2 a2b = b - a;
vec2 a2p = p - a;
float h = clamp(dot(a2p,a2b) / dot(a2b,a2b), 0.0, 1.0);
vec2 p1 = mix(a, b, h);
@theoparis
theoparis / renderer.rs
Created July 10, 2024 03:16
Rusty renderer
use std::collections::HashSet;
use anyhow::{Context as _, Result};
use raw_window_handle::{HasDisplayHandle as _, HasWindowHandle as _};
use vulkanalia::{
loader::{LibloadingLoader, LIBRARY},
vk::{
self, DeviceV1_0 as _, Handle as _, HasBuilder, InstanceV1_0 as _,
KhrSurfaceExtension, KhrSwapchainExtension, PolygonMode,
},
@theoparis
theoparis / make.conf
Created June 17, 2024 21:32
/etc/portage/make.conf musl llvm
COMMON_FLAGS="-Os -pipe"
LDFLAGS="-Os -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -stdlib=libc++ -Wl,--undefined-version"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS} -stdlib=libc++"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
USE="-* udev bash pbzip2 gawk curl libarchive pigz gh zstd ipv6 vulkan wayland wayland-only static-libs"
EMERGE_DEFAULT_OPTS="--jobs=12 --load-average=12 --ask --tree"
PORTAGE_NICENESS="19"
MAKEOPTS="-j12"
@theoparis
theoparis / qemu_softmmu.patch
Created March 26, 2024 00:27
Build qemu softmmu targets as static libraries
diff --git a/meson.build b/meson.build
index c9c3217ba4..d935e8f0bd 100644
--- a/meson.build
+++ b/meson.build
@@ -3905,8 +3905,9 @@ foreach target : target_dirs
objects: objects,
include_directories: target_inc,
c_args: c_args,
- build_by_default: false,
- name_suffix: 'fa')
@theoparis
theoparis / fetch.py
Created February 19, 2024 02:00
Git clone multithreaded progress bar with python and rich
import os
from concurrent.futures import ThreadPoolExecutor
import pygit2
from rich.console import Group
from rich.live import Live
from rich.progress import (BarColumn, DownloadColumn, Progress, TextColumn,
TimeRemainingColumn, TransferSpeedColumn)
@theoparis
theoparis / README.md
Created January 31, 2024 23:04
How to speed up pacman on Arch Linux

Install Dependencies

These steps require a non-root user and doas!

doas pacman -S powerpill

cd /tmp
git clone https://aur.archlinux.org/paru-bin.git
cd paru-bin
@theoparis
theoparis / Makefile
Created January 14, 2024 02:52
Build llvm with C++20 modules + mlir with the vulkan runner
ROOT_DIR = $(PWD)
THIRD_PARTY_DIR = $(ROOT_DIR)/third_party
INSTALL_DIR = $(ROOT_DIR)/install
# TODO: this be in its own git repository
llvm-configure:
cmake -S $(ROOT_DIR)/../llvm-project/llvm \
-B $(ROOT_DIR)/build/llvm \
-G Ninja \
@theoparis
theoparis / standards.cmake
Created December 12, 2023 04:24
standards.cmake
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(
-Weverything
)
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.c *.hpp *.h)
add_custom_target(
clang_tidy
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
index 39f4f6cf5..b9cb91a27 100644
--- a/loader/CMakeLists.txt
+++ b/loader/CMakeLists.txt
@@ -326,7 +326,6 @@ if(WIN32)
set(LOADER_UNKNOWN_CHAIN_LIBRARY $<$<TARGET_EXISTS:loader-unknown-chain>:$<TARGET_OBJECTS:loader-unknown-chain>>)
add_library(vulkan
- SHARED
${NORMAL_LOADER_SRCS}