Skip to content

Instantly share code, notes, and snippets.

View timdecode's full-sized avatar
👁️‍🗨️

Timothy Davison timdecode

👁️‍🗨️
View GitHub Profile
@kieber-emmons
kieber-emmons / ParallelRadixSort.metal
Last active February 6, 2024 10:24
This gist is for an article I wrote on Medium (https://medium.com/p/4f4590cfd5d3).
//
// ParallelRadixSort.metal
//
// Created by Matthew Kieber-Emmons on 08/29/22.
// Copyright © 2022 Matthew Kieber-Emmons. All rights reserved.
// This work is for educational purposes only and cannot be used without consent.
//
#include <metal_stdlib>
using namespace metal;
@Thomvis
Thomvis / Migrated.swift
Last active January 30, 2024 16:11
An approach towards migrating properties in a Codable struct without having to write a custom Codable implementation
import Cocoa
// Say we have a Person model
enum V1 {
struct Person: Codable {
let name: String
var age: Int
}
}
@alexsr
alexsr / svd_glsl.glsl
Last active April 3, 2023 18:47
SVD and other matrix decompositions on 3x3 matrices written in GLSL
// This is a GLSL implementation of
// "Computing the Singular Value Decomposition of 3 x 3 matrices with
// minimal branching and elementary floating point operations"
// by Aleka McAdams et.al.
// http://pages.cs.wisc.edu/~sifakis/papers/SVD_TR1690.pdf
// This should also work on the CPU using glm
// Then you probably should use glm::quat instead of vec4
// and mat3_cast to convert to mat3.
@mattatz
mattatz / Quaternion.hlsl
Last active May 14, 2024 21:22
Quaternion structure for HLSL
#ifndef __QUATERNION_INCLUDED__
#define __QUATERNION_INCLUDED__
#define QUATERNION_IDENTITY float4(0, 0, 0, 1)
#ifndef PI
#define PI 3.14159265359f
#endif
// Quaternion multiplication