Skip to content

Instantly share code, notes, and snippets.

@bussiere
bussiere / citations
Created December 24, 2010 10:16
citations quote informatic informatique quotes computer science
“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill
“In order to understand recursion, one must first understand recursion.” – Author Unknown
“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone.” – Bjarne Stroustrup
“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila.” – Mitch Ratcliffe
“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -C.A.R. Hoare
“The gap between theory and practice is not as wide in theory as it is in practice.” – Author Unknown
“If builders built buildings the way progra
@paniq
paniq / mt.glsl
Last active June 23, 2019 04:58
World's Tiniest* Marching Tetrahedron
// World's Tiniest* Marching Tetrahedron
// by Leonard Ritter (leonard.ritter@duangle.com)
// this code is public domain
// 0
// +
// / | \
// 3 +-----+ 1
// \ | /
@graphitemaster
graphitemaster / gist:f8e6666c48fbedf6e554
Last active January 21, 2023 21:22
Engine achievements
Achievement Engine/Game Why it's bad
storing world space positions in gbuffer STALKER, F.E.A.R. Depth buffer can be used to derive position saving a lot of memory bandwidth
uploaded texture upside down Various engines, mostly Quake derived. Difficult to debug with tools like apitrace, nsight, pix, renderdoc, etc
@shehzan10
shehzan10 / Remote OpenGL Setup.md
Last active February 1, 2024 13:39
Remote OpenGL Without Display

Remote OpenGL Setup without X

A full OpenGL profile requires X to be running. For X to run, it requires a display to be connected to the machine. Given that most server machines do not have this, it becomes difficult to run OpenGL.

This document details how to get OpenGL and X up and running without having a display connected to the sevrer.

Requirements

You will need access to the remote system over SSH. To run the tool, you will need libGL.so and libX11.so. These are installed when X and the NVIDIA Drivers are installed. So there is nothing special required to install these.

Another tool I would recommend strongly is glewinfo. Most linux distributions ship this with the glew-utils package. An alternate to glewinfo is glxinfo which is present on all systems with X. You can substitute glewinfo with glxinfo in all the commands below if needed.

@statico
statico / gpu.cpp
Last active January 25, 2024 01:06
Trick to tell AMD and Nvidia drivers to use the most powerful GPU instead of a lower-performance (such as integrated) GPU
#ifdef _WIN32
// Use discrete GPU by default.
extern "C" {
// http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
// http://developer.amd.com/community/blog/2015/10/02/amd-enduro-system-for-developers/
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#endif
- loadkeys de-latin1
- setfont Lat2-Terminus16
- cgdisk /dev/sda
- new -> default -> 32M -> ef02 -> bios -> new -> default -> default -> 8300 -> linux -> write -> yes -> quit
- mkfs.ext4 /dev/sda2
- mount /dev/sda2 /mnt
- export LANG="en_US.UTF-8"
- export LC_COLLATE="C"
- pacman -Syy
- pacstrap /mnt base base-devel git zsh vim
@TheRealMJP
TheRealMJP / Tex2DCatmullRom.hlsl
Last active May 26, 2024 22:43
An HLSL function for sampling a 2D texture with Catmull-Rom filtering, using 9 texture samples instead of 16
// The following code is licensed under the MIT license: https://gist.github.com/TheRealMJP/bc503b0b87b643d3505d41eab8b332ae
// Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16.
// See http://vec3.ca/bicubic-filtering-in-fewer-taps/ for more details
float4 SampleTextureCatmullRom(in Texture2D<float4> tex, in SamplerState linearSampler, in float2 uv, in float2 texSize)
{
// We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding
// down the sample location to get the exact center of our "starting" texel. The starting texel will be at
// location [1, 1] in the grid, where [0, 0] is the top left corner.
float2 samplePos = uv * texSize;
@reinsteam
reinsteam / atmosphere_clouds_rendering.md
Last active March 1, 2024 14:43
A collection of links to various materials on atmosphere / clouds rendering

Atmosphere / Clouds Rendering

Research papers

Atmosphere

  • A fast, simple method to render sky color using gradients maps [[Abad06]]
  • A Framework for the Experimental Comparison of Solar and Skydome Illumination [[Kider14]]
  • A Method for Modeling Clouds based on Atmospheric Fluid Dynamics [[Miyazaki01]]
  • A Physically-Based Night Sky Model [[Jensen01]]
@understeer
understeer / latency.txt
Created January 12, 2017 14:04 — forked from eshelman/latency.txt
HPC-oriented Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference/hit 1.5 ns 4 cycles
Floating-point add/mult/FMA operation 1.5 ns 4 cycles
L2 cache reference/hit 5 ns 12 ~ 17 cycles
Branch mispredict 6 ns 15 ~ 20 cycles
L3 cache hit (unshared cache line) 16 ns 42 cycles
L3 cache hit (shared line in another core) 25 ns 65 cycles
Mutex lock/unlock 25 ns
L3 cache hit (modified in another core) 29 ns 75 cycles