Skip to content

Instantly share code, notes, and snippets.

View graphitemaster's full-sized avatar
🎩
Building my dream game

Dale Weiler graphitemaster

🎩
Building my dream game
View GitHub Profile
// Estimating CPU frequency...
// CPU frequency: 4.52 GHz
// sum1: value = 15182118497126522709, 0.31 secs, 5.14 cycles/elem
// sum2: value = 15182118497126522709, 0.17 secs, 2.93 cycles/elem
#define RW(x) asm("" : "+r"(x))
typedef struct Node {
u64 value;
struct Node *next;
@graphitemaster
graphitemaster / T0.md
Last active July 2, 2023 12:26
Vulkan Tutorial

Tutorial 0

What is Vulkan

Vulkan is a low-overhead, cross-platform 3D graphics and compute API.

Vulkan targets

Vulkan targets high-performance realtime 3D graphics applications such as games and interactive media across multiple platforms providing higher performance and lower CPU usage.

@graphitemaster
graphitemaster / WORKING_AROUND_OFFSETOF_LIMITATIONS.MD
Last active February 29, 2024 08:49
Working around offsetof limitations in C++

Working around offsetof limitations in C++:

There is sometimes a situation in which one needs to get the relative offset of a structure field, common examples of this include serialization frameworks which aid to serialize objects, vertex attributes for rendering (D3D, GL.), etc.

The most common technique for getting this information is through the offsetof macro defined in stddef.h. Unfortunately using the macro in C++ comes with a new set of restrictions that prevent some (subjectively valid) uses of it.

@graphitemaster
graphitemaster / gist:f8e6666c48fbedf6e554
Last active January 21, 2023 21:22
Engine achievements
Achievement Engine/Game Why it's bad
storing world space positions in gbuffer STALKER, F.E.A.R. Depth buffer can be used to derive position saving a lot of memory bandwidth
uploaded texture upside down Various engines, mostly Quake derived. Difficult to debug with tools like apitrace, nsight, pix, renderdoc, etc