Skip to content

Instantly share code, notes, and snippets.

View emoon's full-sized avatar
:octocat:
Hacking on stuff!

Daniel Collin emoon

:octocat:
Hacking on stuff!
View GitHub Profile
(def-vu0-fun vu0-fun (input1 :in vf01
input2 :in vf02
output :out vf03)
(add output input1 input2))
(defun my-ee-fun ()
; do something funky, set stuff etc and then call the code
(vu0-fun))
(def-spu-fun spu-fun (data :u32)
(spu-format "~d~%" data))
(defun my-ppu-fun ()
(spu-fun 0)) ; scheduling, etc is up to the implementation
(defmacro genfuncs (data)
`(progn
,@(loop for i in data collecting
`(defun test-,i () ,i))))
(genfuncs '(1 2 3))
(defun test-1 () 1)
(defun test-2 () 2)
(defun test-3 () 3)
@emoon
emoon / gist:1049782
Created June 27, 2011 20:42
Trying to get overlay icon to display
item = xbmcgui.ListItem('testing', iconImage = 'DefaultVideo.png')
item.setInfo(type='video', infoLabels={ 'title': 'testing', 'Playcount': 1, 'overlay': 7 })
xbmcplugin.addDirectoryItem(thisPlugin, 'temp.tmp', item, False)
xbmcplugin.endOfDirectory(thisPlugin)
@emoon
emoon / Makefile
Created April 20, 2012 19:34
Makefile for building data
OUTPUT_DIR := Data
INPUT_DIR := OriginalData
FOO_IN_FILES = $(wildcard $(INPUT_DIR)/Foo/*)
FOO_OUT_FILES = $(patsubst $(INPUT_DIR)/%, $(OUTPUT_DIR)/%, $(FOO_IN_FILES))
$(FOO_OUT_FILES) : $(FOO_IN_FILES)
mkdir -p "$(@D)"
cp $< $@
const char* s_mapPixelKernelSource = "\n" \
"__kernel void mapPixel( \n" \
" __global uchar* output, \n" \
" __global uchar4* input, \n" \
" __constant float4* pal, \n" \
" const unsigned int palCount, \n" \
" const unsigned int width) \n" \
"{ \n" \
" const int xOut = get_global_id(0); \n" \
" const int yOut = get_global_id(1); \n" \
@emoon
emoon / gist:2937100
Created June 15, 2012 15:40
selb in odd pipe
Challenge:
Implement selb with only using odd instructions on SPU.
----------------------------------------------------------------------------------
input : mask (comes from a floating point compare so result is always zero or ones for each 32-bit value (and 4 of them))
a, b to select between
----------------------------------------------------------------------------------
Suggestion 1 by @daniel_collin
typedef struct Poly
{
int x, y, z, .. // etc values
struct Poly* next;
} Poly;
Poly* g_sortArray[MaxBuckets];
static void addPoly(Poly* poly, int z)
{