Skip to content

Instantly share code, notes, and snippets.

@kayru
kayru / gaussian_filter_generator.py
Created January 24, 2011 19:48
Python script for generation of Gaussian blur weights
import sys
def GenerateGaussianFilter(taps) :
weights = []
sum = 0.0
w = 1.0
width = (taps-1)*2
for i in range((width)/2+1) :
@kayru
kayru / halftofloat.cpp
Created October 18, 2011 23:51
SSE2 Half to Float
// Yuriy O'Donnell <yuriyo@gmail.com>
// Released under MIT License (do whatever you want with it)
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <windows.h>
#include <xnamath.h>
#include <malloc.h>
Raw Symbols
Total Count : 1548
Total Size : 388632
--------------------------------------
Sorted by Size
Size Section/Type Name Source
19720 .text _vfprintf_r
19397 .text _svfprintf_r
16384 .bss emergency_buffer
11997 .text _vfiprintf_r
@kayru
kayru / bin2cpp.py
Created December 8, 2011 22:11
Create array from binary file
import sys
import textwrap
s=open(sys.argv[1], 'rb').read().encode("hex").upper()
t=",".join(["0x"+x+y for (x,y) in zip(s[0::2], s[1::2])])
print "const unsigned char data[] = {\n\t%s\n};"%" \n\t".join(textwrap.wrap(t,80))
@kayru
kayru / BoilerplateD3D11.cpp
Last active November 29, 2020 11:21
D3D11 Boilerplate code
// clang main.cpp
#include <tchar.h>
#include <stdint.h>
#include <stdio.h>
#include <windows.h>
#include <D3D11.h>
#include <D3Dcompiler.h>
@kayru
kayru / opencl_device_info.cpp
Created December 31, 2011 04:35
Dump basic information about OpenCL devices in the system
// On MacOS X compile with g++ -framework OpenCL <filename>
#include <stdio.h>
#include <OpenCL/opencl.h>
#define P(x) x,#x
void printClDeviceInfoString(cl_device_id device_id, cl_device_info param_name, const char* printable_name)
{
char val[1024];
@kayru
kayru / gist:1654356
Created January 21, 2012 22:54
librush sample: embedded font
#include <Rush/Rush.h>
#include <Rush/Platform.h>
#include <Rush/RenderPrimitiveBatch.h>
#include <Rush/GraphicsBitmapFont.h>
#include <stdio.h>
using namespace Rush;
RushAppConfig g_appConfig;
@kayru
kayru / gist:1654357
Created January 21, 2012 22:54
librush sample: hello world
#include <Rush/Rush.h>
#include <Rush/Platform.h>
#include <stdio.h>
using namespace Rush;
RushAppConfig g_appConfig;
static void startup(RushPlatformContext* context)
@kayru
kayru / Jamrules.jam
Created April 21, 2012 12:58
Data build jamrules
# JamPlus script
MODEL_TOOL = "..\\bin\\datatool.exe" ;
TEXTURE_TOOL = "..\\scripts\\win32\\texconv.exe" ;
SHADER_TOOL = "..\\scripts\\win32\\fxc.exe" ;
# --------------------------------------------------------------------------
actions ModelAction
{
@kayru
kayru / Jamfile.jam
Created April 21, 2012 12:58
Data build jamfile
# JamPlus script
SubDir TOP ;
DEPCACHE.standard = ../bin/data/depcache ;
# Global paths
PATH_DATA = "../bin/data" ;
PATH_CONTENT = "../content" ;