This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGET=$(shell basename $(CURDIR)) | |
CC=gcc | |
CFLAGS= -O2 -Wall -std=gnu99 | |
SRCS=$(wildcard *.c) | |
OBJS=$(SRCS:%.c=%.o) | |
HEADERS=$(wildcard *.h) | |
LDFLAGS= -lm | |
all: $(TARGET) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
/* 要らない処理 | |
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
// Override point for customization after application launch. | |
self.window.backgroundColor = [UIColor whiteColor]; | |
[self.window makeKeyAndVisible]; | |
*/ | |
return YES; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline bool ____benchmark_check_time(char const * const comment, uint64_t const start, uint64_t const tick) | |
{ | |
if (!tick) return true; | |
uint64_t const elapsed = mach_absolute_time() - start; | |
mach_timebase_info_data_t base; | |
mach_timebase_info(&base); | |
uint64_t const nsec = elapsed * base.numer / base.denom; | |
printf("%s: %.3fms\n", comment, nsec / 1000000.0); | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void fenceSync() | |
{ | |
// コマンドストリームにfenceを挿入する | |
GLsync sync = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 0); | |
// fenceに到達するまで待つ | |
glClientWaitSyncAPPLE(sync, GL_SYNC_FLUSH_COMMANDS_BIT_APPLE, GL_TIMEOUT_IGNORED_APPLE); | |
// syncオブジェクトを解放する | |
glDeleteSyncAPPLE(sync); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd "$INPUT_FILE_DIR" # move into file dir, otherwise xxd takes the full path for the symbol | |
/usr/bin/xxd -i "$INPUT_FILE_NAME" | sed s/}\;/,0x00}\;/ > "$DERIVED_SOURCES_DIR/$INPUT_FILE_BASE.glsl.c" # builds a c file with a hex array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGET=glsl_optimizer | |
CC=g++ | |
CFLAGS= -O2 -Wall | |
SRCS=$(wildcard *.cpp) | |
OBJS=$(SRCS:%.cpp=%.o) | |
STATICLIBS=libglsl_optimizer.a | |
HEADERS=$(wildcard *.h) | |
LDFLAGS= | |
all: $(TARGET) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadImage(array_buffer, onload) { | |
var img = new Image(); | |
img.src = URL.createObjectURL(new Blob([array_buffer], {type:'image/jpeg'})); | |
img.onload = function() { | |
onload(img); // imgを即座に使い終わる関数 | |
URL.revokeObjectURL(img.src); | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ghc --make gen.hs | |
./gen sample.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using(something, 100) { | |
something_show(this); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <libkern/OSAtomic.h> | |
static volatile OSSpinLock lock = OS_SPINLOCK_INIT; | |
void spinlock_lock() | |
{ | |
OSSpinLockLock(&lock); | |
} | |
void spinlock_unlock() |