This file contains 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
struct Output | |
{ | |
float4 position_cs : SV_POSITION; | |
float2 texcoord : TEXCOORD; | |
}; | |
Output main(uint id: SV_VertexID) | |
{ | |
Output output; |
This file contains 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
/* | |
* C11 <threads.h> emulation library | |
* | |
* (C) Copyright yohhoy 2012. | |
* Distributed under the Boost Software License, Version 1.0. | |
* (See copy at http://www.boost.org/LICENSE_1_0.txt) | |
*/ | |
#ifndef EMULATED_THREADS_H_INCLUDED_ | |
#define EMULATED_THREADS_H_INCLUDED_ |
This file contains 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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains 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
CGDirectDisplayID displays[MAX_DISPLAYS]; | |
uint32_t numDisplays; | |
uint32_t i; | |
CGGetActiveDisplayList(MAX_DISPLAYS, displays, &numDisplays); | |
for(i=0; i<numDisplays; i++) | |
{ | |
CGDisplayModeRef mode; | |
CFIndex index, count; |
This file contains 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
// FNV-1a (64-bit) non-cryptographic hash function. | |
// Adapted from: http://github.com/jakedouglas/fnv-java | |
public ulong HashFNV1a(byte[] bytes) | |
{ | |
const ulong fnv64Offset = 14695981039346656037; | |
const ulong fnv64Prime = 0x100000001b3; | |
ulong hash = fnv64Offset; | |
for (var i = 0; i < bytes.Length; i++) | |
{ |
This file contains 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
#!/bin/sh | |
# ***** BEGIN LICENSE BLOCK ***** | |
# Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |
# | |
# The contents of this file are subject to the Mozilla Public License Version | |
# 1.1 (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# http://www.mozilla.org/MPL/ | |
# |
This file contains 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
#ifdef _MSC_VER | |
struct Frame | |
{ | |
struct Frame *caller; | |
void *ret; | |
}; | |
int backtrace(void **array,int size) | |
{ | |
struct Frame *frame; |
This file contains 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 "gl_texture_surface.h" | |
#include <iostream> | |
#include <cstring> | |
#include <cstdlib> | |
GLRAMTextureSurface::GLRAMTextureSurface(int width, int height) : texture_id_(0), | |
buffer_(0), bpp_(4), rowspan_(0), width_(width), height_(height) { | |
rowspan_ = width_ * bpp_; | |
buffer_ = new unsigned char[rowspan_ * height_]; | |
needs_update_ = false; |
This file contains 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
// This file: https://gist.github.com/macton/4dd5fec2113be284796e | |
// See: Intel Intrinsics Guide https://software.intel.com/sites/landingpage/IntrinsicsGuide/ | |
// See: CPUID Explorer http://www.flounder.com/cpuid_explorer1.htm | |
// See: Playing with cpuid http://newbiz.github.io/cpp/2010/12/20/Playing-with-cpuid.html | |
// See: MSDN __cpuid, __cpuidex http://msdn.microsoft.com/en-us/library/hskdteyh.aspx | |
// See: Notes on MMX/SSE and a searchable table of intrinsics. http://www.taffysoft.com/pages/20120418-01.html | |
// See: AMD CPUID Specification http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/25481.pdf | |
#if defined(__GNUC__) | |
#include <stdint.h> |
This file contains 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 Creates an input layout from the vertex shader, after compilation. | |
//Input layout can be reused with any vertex shaders that use the same input layout. | |
HRESULT CreateInputLayoutDescFromVertexShaderSignature( ID3DBlob* pShaderBlob, ID3D11Device* pD3DDevice, ID3D11InputLayout** pInputLayout, int* inputLayoutByteLength ) | |
{ | |
// Reflect shader info | |
ID3D11ShaderReflection* pVertexShaderReflection = nullptr; | |
HRESULT hr = S_OK; | |
if ( FAILED( D3DReflect( pShaderBlob->GetBufferPointer(), pShaderBlob->GetBufferSize(), IID_ID3D11ShaderReflection, (void**) &pVertexShaderReflection ) ) ) | |
{ |
OlderNewer