Skip to content

Instantly share code, notes, and snippets.

View rotoglup's full-sized avatar

Nicolas Lelong rotoglup

View GitHub Profile
@aras-p
aras-p / GraphicsCapsGLES.h
Created April 26, 2015 07:56
Part of runtime flags that kick in different things on our GL implementaton
int maxAASamplesConst; // gles2 img/apple/ext extensions all use different constants (facepalm)
int halfConst; // gles2 and gles3 have different constants for half float type
int texSRGBAConst; // gles2 (without 'internal format' ext) and gles3 have different constants for SRGB RGBA texture type
int texSRGBConst; // gles2 (without 'internal format' ext) and gles3 have different constants for SRGB RGB texture type
int etcFormatConst; // gles2/gles3 have different standard etc formats
bool isPvrGpu;
bool isMaliGpu;
bool isAdrenoGpu;
bool isTegraGpu;
#ifndef _SDL_opengl_load_h
#define _SDL_opengl_load_h
extern PFNGLBLENDCOLORPROC SDL_glBlendColor;
#define glBlendColor SDL_glBlendColor
extern PFNGLBLENDEQUATIONPROC SDL_glBlendEquation;
#define glBlendEquation SDL_glBlendEquation
extern PFNGLDRAWRANGEELEMENTSPROC SDL_glDrawRangeElements;
@castano
castano / half_to_float_test.cpp
Created March 21, 2012 18:27
ISPC half to float conversion
#include <intrin.h> // __rdtsc
#include <stdio.h>
typedef unsigned int uint;
typedef unsigned short uint16;
typedef unsigned long long uint64;
// ISPC functions:
extern "C" void half_to_float_test(const uint16 * vin, float * vout, int count);
extern "C" void half_to_float_test_fast(const uint16 * vin, float * vout, int count);
@dwilliamson
dwilliamson / SH.h
Last active July 12, 2021 13:32
Shared SH Library for C++/HLSL/OpenCL/CUDA using pycgen to generate/document optimal transforms
//
// References
//
// [1] Sloan, P.-P., Luna, B., and Snyder, J. 2005.
// Local, deformable precomputedradiance transfer.
// ACM Trans. Graph. 24, 3, 1216–1223
//
// [2] Stupid Spherical Harmonics (SH) Tricks
// Peter-Pike Sloan, Microsoft Corporation
@attilaz
attilaz / gist:d75fc7d4ab75388a42720f97a7075c81
Created November 26, 2016 18:45
metal transient object lifetime
From metal documentation:
"Command buffer and command encoder objects are transient and designed for a single use.
They are very inexpensive to allocate and deallocate, so their creation methods return autoreleased objects."
https://developer.apple.com/library/content/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Cmd-Submiss/Cmd-Submiss.html
Autorelease example:
NSAutoreleasePool* autoreleasePool = [[NSAutoreleasePool alloc] init];
//c is an autoreleased object
@mbostock
mbostock / .block
Last active May 10, 2022 12:50 — forked from jasondavies/README.md
Raster Reprojection
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/raster-reprojection-ii
import { FileLoader } from './FileLoader';
import { DataTexture } from '../textures/DataTexture';
import { DefaultLoadingManager } from './LoadingManager';
import { _Math } from '../math/Math';
function IESLoader(manager) {
this.manager = (manager !== undefined) ? manager : DefaultLoadingManager;
}
@pervognsen
pervognsen / expr.c
Last active February 5, 2023 17:27
void parse_expr(Value *dest);
Sym *parse_ident(void) {
if (tok != TOK_IDENT) {
error("Expected identifier");
}
Sym *ident = tok_sym;
next();
return ident;
}
@vurtun
vurtun / fibers.c
Last active February 27, 2023 05:37
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <string.h>
#define streq(a, b) (!strcmp((a), (b)))
#ifndef __USE_GNU
#define __USE_GNU
@danpaluska
danpaluska / capture.sh
Created February 22, 2010 15:53
shell script for making timelapse screencast movies
#! /bin/sh
# THIS VERSION TAKES A WEBCAM PIC AND BLENDS IT WITH SCREENSHOT
###
### THIS IS MACOS VERSION, linux commands commented out below.
###
# ***************************************
# ******OMPD - One Minute Per Day - Voluntary Anthropology
# ******public timelapse wall
# need to install ffmpeg and imagemagick for this to work