Skip to content

Instantly share code, notes, and snippets.

@nickav
nickav / d3d12_textured_quad.c
Created July 27, 2025 14:28
DirectX12 Textured Quad, Vertex, Index and Constants Buffer
//
// Compile with:
// > cl /I . /D"BUILD_DEBUG=1" /D"BUILD_ARCH64=1" /D"BUILD_WIN=1" /Z7 /W4 /sdl /MT /GR- /EHa /WX /nologo /Oi /Gm- /MP d3d12_textured_quad.c /link /opt:ref /DEBUG "kernel32.lib" "user32.lib" "gdi32.lib" "d3d12.lib" "dxguid.lib" "dxgi.lib" "d3dcompiler.lib" /OUT:d3d12_textured_quad.exe
//
#pragma warning(disable:4221)
#pragma warning(disable:4204)
#pragma warning(disable:4201)
#define NOMINMAX
@nickav
nickav / coreaudio_backend.m
Last active July 28, 2025 20:17
Audio Playback on MacOS with AudioUnit Backend
//
// Build with:
// > clang coreaudio_backend.m -o main -framework AudioUnit
//
//
// Base Types
//
#include <stdint.h>
@nickav
nickav / triangle.m
Created August 11, 2025 22:23
Minimal Example of a Metal Triangle using Metal and QuartzCore (no MetalKit)
//
// Build with:
// > clang -fobjc-arc triangle.m -o triangle -framework Metal -framework AppKit -framework QuartzCore
//
#import <Cocoa/Cocoa.h>
#import <Metal/Metal.h>
#import <QuartzCore/QuartzCore.h>
typedef struct {
float position[2];
@nickav
nickav / directx12_hello_triangle.cpp
Created May 8, 2026 15:16
Minimal DirectX12 Hello Triangle With Textures, MSAA
#pragma comment(lib, "d3d12")
#pragma comment(lib, "dxgi")
#pragma comment(lib, "d3dcompiler")
#pragma comment(lib, "user32")
#include <windows.h>
#include <d3d12.h>
#include <dxgi1_4.h>
#include <d3dcompiler.h>
#pragma warning(disable:4221)
#pragma warning(disable:4204)
#pragma warning(disable:4201)
#pragma comment(lib, "d3d12")
#pragma comment(lib, "dxgi")
#pragma comment(lib, "d3dcompiler")
#pragma comment(lib, "user32")
#pragma comment(lib, "dxguid")
#pragma comment(lib, "gdi32")