Skip to content

Instantly share code, notes, and snippets.

View bitshifter's full-sized avatar

Cameron Hart bitshifter

View GitHub Profile
@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 <[email protected]>. 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.
#
#!/usr/bin/env python3
#
# Copyright 2014-2020 Cameron Hart <[email protected]>.
# 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.
#!/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
#
@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
@bitshifter
bitshifter / PurgeStandbyList.cpp
Last active June 19, 2024 19:42
Command line utility for purging Window's standby list. Requires /MANIFESTUAC:"level='highestAvailable'.
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
#define STATUS_PRIVILEGE_NOT_HELD ((NTSTATUS)0xC0000061L)
typedef enum _SYSTEM_INFORMATION_CLASS {
SystemMemoryListInformation = 80, // 80, q: SYSTEM_MEMORY_LIST_INFORMATION; s: SYSTEM_MEMORY_LIST_COMMAND (requires SeProfileSingleProcessPrivilege)
} SYSTEM_INFORMATION_CLASS;
@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
#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:
#ifndef TASK_FENCE_HPP
#define TASK_FENCE_HPP
#include <condition_variable>
#include <mutex>
class TaskFence
{
int taskCount_;
std::condition_variable taskCV_;
@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;