Skip to content

Instantly share code, notes, and snippets.

// I tried not doing anything too non-portable so it should be possible to run
// this on Mac or Linux... probably... even then, you can't use the obj files there
//
// once you have the obj file you should be able to do:
// link YOUROBJ.obj /defaultlib:libcmt
// ^^^^^^^^^^^^^^^^^^
// linking against crt
#define _CRT_SECURE_NO_WARNINGS
#include <stdint.h>
#include <stdlib.h>
@ibireme
ibireme / kpc_demo.c
Last active October 21, 2024 18:07
A demo shows how to read Intel or Apple M1 CPU performance counter in macOS.
// =============================================================================
// XNU kperf/kpc demo
// Available for 64-bit Intel/Apple Silicon, macOS/iOS, with root privileges
//
//
// Demo 1 (profile a function in current thread):
// 1. Open directory '/usr/share/kpep/', find your CPU PMC database.
// M1 (Pro/Max/Ultra): /usr/share/kpep/a14.plist
// M2 (Pro/Max): /usr/share/kpep/a15.plist
// M3: /usr/share/kpep/as1.plist
@mmozeiko
mmozeiko / d3d11_pixels.c
Last active October 13, 2024 00:46
drawing pixels in software & showing them to window by uploading via D3D11
#define COBJMACROS
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <d3d11.h>
#include <stdint.h>
#include <string.h>
#include <intrin.h>
@d7samurai
d7samurai / .readme.md
Last active November 17, 2024 13:00
Minimal D3D11

Minimal D3D11

Minimal D3D11 reference implementation: An uncluttered Direct3D 11 setup + basic rendering primer and API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion that should be easy to follow from the code alone. ~200 LOC. No modern C++, OOP or (other) obscuring cruft. View on YouTube

hollowcube

Also check out Minimal D3D11 part 2, reconfigured for instanced rendering and with a smaller, tighter, simplified overall code structure, or Minimal D3D11 part 3, with shadowmapping + showcasing a range of alternative setup and rendering techniques.

@uucidl
uucidl / 00_the-problem-with-UI.org
Last active May 3, 2024 22:38
The Problem Of UI (User Interfaces)

Links

Note: a lot of programmers talk about UI without mentionning the user even once, as if it was entirely a programming problem. I wonder what we’re leaving off the table when we do that.