Skip to content

Instantly share code, notes, and snippets.

View bitshifter's full-sized avatar

Cameron Hart bitshifter

View GitHub Profile
@echo off
@rem Set up environment for compiling with XP support
@rem Gist: 8b357a25f08329636081
if not "%3" == "" goto usage
if /i %1 == vc10 goto vc10
if /i %1 == vc11 goto vc11
if /i %1 == vc12 goto vc12
extern crate sdl2;
use sdl2::pixels::Color;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::rect::Rect;
const BORDER: i32 = 32;
const WIDTH: i32 = 1024;
const HEIGHT: i32 = 768;
@bitshifter
bitshifter / gist:71f0c5f3146db43a223ce08cdd0247c2
Created December 5, 2017 00:35
benchmarking f32 vs f32x4
# bench_f32 loop:
.LBB23_30:
vmovss (%rdi), %xmm1
vmovsd 4(%rdi), %xmm2
vmulss 12(%rdi), %xmm1, %xmm1
vmovsd 16(%rdi), %xmm3
vmulps %xmm3, %xmm2, %xmm2
vaddss %xmm2, %xmm1, %xmm1
vmovshdup %xmm2, %xmm2
vaddss %xmm2, %xmm1, %xmm1
@bitshifter
bitshifter / issue96.patch
Created January 1, 2018 00:47
Test case for issue 96, replicating cgmath AsMut ambiguity.
diff --git a/imgui-examples/examples/test_window_impl.rs b/imgui-examples/examples/test_window_impl.rs
index c9cc5c8..e5ec03a 100644
--- a/imgui-examples/examples/test_window_impl.rs
+++ b/imgui-examples/examples/test_window_impl.rs
@@ -4,9 +4,34 @@ extern crate imgui;
extern crate imgui_glium_renderer;
use imgui::*;
+use std::mem;
@bitshifter
bitshifter / gdc2015.md
Last active February 17, 2018 20:17
GDC2015 Talks

Programming track

  • Advanced DirectX12 graphics and performance | Max McMullen, Microsoft video
  • Code clinic - How to Write Code the Compiler Can Actually Optimize | Mike Acton, Engine Director, Insomniac Games slideshare
  • Destiny - Six years in the making | Chris Butcher, Bungie video
  • Fast Iteration for Far Cry 4 - Optimizing Key Parts of the Dunia Pipeline | Remi Quenin, Engine Architect, Ubisoft pptx
  • More on Vulkan and SPIR-V - The future of high-performance graphics | Khronos Group pdf video
  • Parallelizing the Naughty Dog engine using fibers | Ch
#ifndef TASK_FENCE_HPP
#define TASK_FENCE_HPP
#include <condition_variable>
#include <mutex>
class TaskFence
{
int taskCount_;
std::condition_variable taskCV_;
#include "tbb/tbb.h"
#include "tbb/concurrent_queue.h"
#include "tbb/task_arena.h"
// Based on LocalSerializer pattern which enforces execution order based on submission order
// https://www.threadingbuildingblocks.org/docs/help/tbb_userguide/Design_Patterns/Local_Serializer.html
class SerializedTaskArena
{
public:
@bitshifter
bitshifter / ack.cmd
Created January 7, 2016 08:18
Git bash commands
@rem Do not use "echo off" to not affect any child calls.
@setlocal
@rem Get the abolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=%git_install_root%\bin;%git_install_root%\usr\bin;%PATH%
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%
#!/usr/bin/env python
#
# Lists best candidates for adding to pre-compiled headers from an
# output list showing all the includes during a build.
#
# By Noel Llopis - April 2005
# http://www.gamesfromwithin.com
#
# Modified by Cameron Hart 2014
#
@bitshifter
bitshifter / ctags-from-clangdb.py
Created February 7, 2014 13:01
Python script that generates ctags for files and dependencies of a clang compilation json database
#!/usr/bin/env python
#
# Copyright 2014 Cameron Hart <cam@bitshifter.net.nz>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#