Skip to content

Instantly share code, notes, and snippets.

Avatar
🎩
Building my dream game

Dale Weiler graphitemaster

🎩
Building my dream game
  • Buckeye Software, Inc.
View GitHub Profile
View gist:45561d0387911c1995c07653fde79b72
Here's an example. I have this data structure which represents a rectangle
struct Rectangle {
uint32_t x, y, w, h;
};
I have myself an unspecified size of these in a vector.
Vector<Rectangle> rectangles;
There is this other data structure which represents a rounded rectangle, looks something like this.
struct RoundedRectangle {
View gist:ef04a8f7632651a616c561250d16afca
This file has been truncated, but you can view the full file.
Loaded 39742 vertices and 76148 triangles
Baked 146 occluders
(0.000000 7.780000 0.000000) <=> (-16.210800 0.000000 -7.220000) x (16.210800 15.560000 7.220000)
[[ 720162987 721419435 1270874619 ] [ 720162987 721329323 2145387002 ] [ 720048299 721326251 2145387001 ] [ 720048299 721419435 1270874615 ]]
[[ 720926891 721318059 2099249653 ] [ 721299627 720926891 2136998396 ] [ 721299627 721419435 -2147483148 ] [ 720926891 721322155 -2147483345 ]]
[[ 721312939 720837440 2109735215 ] [ 721311915 720927552 2118123823 ] [ 721308843 720927552 2124415487 ] [ 721305771 720837440 2126512639 ]]
[[-802486014 -147485309 1893728559 ] [-802369159 -147485189 1453326639 ] [-802369159 -146871813 2145386799 ] [-802474696 -146871878 1975517487 ]]
[[ 720927032 720048442 1270874415 ] [ 1041701306 -2146758340 1270874415 ] [ 1041791488 -2146643653 1270874415 ] [ 721419435 720163131 1270874415 ]]
View foo1.txt
1rrs
1
28
length = 2096 , offset = 0 , unknown1 = 0x1ad1c0ed, unknown2 = 0xac30eadc, name_length = 20 , flags = 0x01, name = text\en-us\bot.table
length = 80272 , offset = 2096 , unknown1 = 0x286765c4, unknown2 = 0x4c756a54, name_length = 25 , flags = 0x01, name = text\en-us\gametype.table
length = 31962 , offset = 82368 , unknown1 = 0x9db6f6ad, unknown2 = 0xf2e23039, name_length = 24 , flags = 0x01, name = text\en-us\default.table
length = 1064 , offset = 114336 , unknown1 = 0x1dc6ec77, unknown2 = 0xc15e9e30, name_length = 23 , flags = 0x01, name = text\en-us\minion.table
length = 38 , offset = 115408 , unknown1 = 0x7638e6c9, unknown2 = 0x24f3773e, name_length = 31 , flags = 0x08, name = fonts\univers67_14\font.texture
length = 12656 , offset = 115456 , unknown1 = 0x5ccc2324, unknown2 = 0x23b65834, name_length = 28 , flags = 0x09, name = fonts\univers67_17\font.font
length = 65
View foo.txt
1rrs
1
7216
length = 29977 , offset = 200160 , unknown1 = 0xff6fcf4f, unknown2 = 0xd1a06422, name_length = 16 , flags = 0x01, name = shadowrun.config
length = 686 , offset = 6495216 , unknown1 = 0x208164bf, unknown2 = 0x75491f13, name_length = 22 , flags = 0x01, name = xuiscenes\biped.xuihud
length = 38 , offset = 33626912 , unknown1 = 0xa44f9342, unknown2 = 0x00243f34, name_length = 75 , flags = 0x08, name = effects\textures\weapons\muzzle_flash\muzzle_flash_shotgun_sequence.texture
length = 49 , offset = 33626960 , unknown1 = 0x6e9672e2, unknown2 = 0x00359b2d, name_length = 264 , flags = 0x08, name = effects\video\weapons\pistol\fx_pistol_muzzle_third.video{[PixelStorm::EffectElementProxy]layers}{[]flare_subeffect}{[PixelStorm::ParticleSystemProxy]renderer}{[PixelStorm::RendererProxy]subeffects}{[]flame_rotate}{[PixelStorm::SubEffectProxy]renderer}{shaderball}
length = 173 , offset = 33627024 , unknown1 = 0x95b1c6
View main.c
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
struct header
{
char magic[4];
uint32_t version;
uint32_t entries;
View gist:8af3cc92dc7903143541696d0b213409
;; Function void* memchr(void*, int, size_t) (*memchr)
;; enabled by -tree-original
<<< Unknown tree: eh_spec_block
return <retval> = __builtin_memchr ((const void *) __s, __c, __n)
>>>;
@graphitemaster
graphitemaster / ryzen.c
Last active Nov 15, 2017
Measure cross CPU memory performance
View ryzen.c
/*
* RATIONALE:
*
* This was written to show a pathological case with Ryzen where this
* test escapes Ryzens typical dual page walker hardware and cache utag
* mechanism.
*
* Software Optimization Guide for AMD Family 17h Processors section 2.7.3
* states "Linear aliasing occurs when two different linear addresses are
* mapped to the same physical address. This can cause performance penalties
View openglbb.md

OpenGL Black Bible

Author: Dale Weiler

Preface

The following is a writeup of the following things I've independently discovered or been told over the years on how to utilize OpenGL effectively. Not everything in here I gurantee to be factually correct - though several others share similar ideas as present here. Take these are your own peril, like everything else - nothing is absolute; so profile to be sure and check the standards if something here is incorrect. These things presented here I've come to accept as being a safe

View gist:7a1b970798cf2b1f65c38fbf97f8edf1
This file has been truncated, but you can view the full file.
t.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000007 <foo>:
7: 55 push %rbp
8: 48 89 e5 mov %rsp,%rbp
b: b8 00 00 00 00 mov $0x0,%eax
View a.c
int trace(lua_State* L) {
if (!lua_isstring( L, 1 )) return 1;
lua_getglobal(L, "debug");
if (!lua_istable(L, -1)) {
lua_pop(L, 1);
return 1;
}
lua_getfield(L, -1, "traceback");
if (!lua_isfunction(L, -1)) {
lua_pop(L, 2);
You can’t perform that action at this time.