Skip to content

Instantly share code, notes, and snippets.

@fp64
fp64 / u32noise.h
Last active March 27, 2023 08:48
// Public Domain under http://unlicense.org, see link for details.
// Several stateless PRNGs.
// Emphatically NOT cryptographically secure.
#ifndef U32NOISE_H
#define U32NOISE_H
#include <stdint.h>
@fp64
fp64 / u16noise.h
Last active January 24, 2023 07:04
// Public Domain under http://unlicense.org, see link for details.
// Downsized version of u32noise.h ( https://gist.github.com/fp64/126289051f0c9e1b70bcba7c3e07a82f ).
// Probably useless as actual PRNGs, but may be helpful for testing.
#ifndef U16NOISE_H
#define U16NOISE_H
#include <stdint.h>
// Public Domain under http://unlicense.org, see link for details.
// Simple self-contained software triangle rasterizer, largerly based on
// https://fgiesen.wordpress.com/2013/02/10/optimizing-the-basic-rasterizer/
// See also https://gist.github.com/rygorous/9b793cd21d876da928bf4c7f3e625908
// Not optimized for speed, but should be practical for
// less speed-intensive purposes.
#if 0
@fp64
fp64 / results.md
Last active September 5, 2023 17:43
Comparison of several sRGB↔Linear approximations

Update: added a few more functions.

Results, on AMD EPYC 7571.

Note: time for _identity functions is essentially pure overhead of the test setup.

sRGB→Linear:

Function Abs. error (Linf) Time, ns