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
// example how to set up WebGPU rendering on Windows in C | |
// uses Dawn implementation of WebGPU: https://dawn.googlesource.com/dawn/ | |
// download pre-built Dawn webgpu.h/dll/lib files from https://github.com/mmozeiko/build-dawn/releases/latest | |
#include "webgpu.h" | |
#define WIN32_LEAN_AND_MEAN | |
#include <windows.h> | |
#define _USE_MATH_DEFINES |
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
extern "C" | |
{ | |
int _fltused; | |
#ifdef _M_IX86 // following functions are needed only for 32-bit architecture | |
__declspec(naked) void _ftol2() | |
{ | |
__asm | |
{ |
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
#pragma once | |
#include <stdint.h> | |
#define PCG_DEFAULT_MULTIPLIER_64 6364136223846793005ULL | |
#define PCG_DEFAULT_INCREMENT_64 1442695040888963407ULL | |
typedef struct { | |
uint64_t state; | |
} pcg32; |
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 TerminalCell | |
{ | |
// cell index into GlyphTexture, should be two 16-bit (x,y) values packed: "x | (y << 16)" | |
uint GlyphIndex; | |
// 0xAABBGGRR encoded colors, nonzero alpha for Foreground indicates to render colored-glyph | |
// which means use RGB values from GlyphTexture directly as output, not as ClearType blending weights | |
uint Foreground; |
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
// example of using Windows Preview Handler | |
// https://learn.microsoft.com/en-us/windows/win32/shell/preview-handlers | |
#define COBJMACROS | |
#define WIN32_LEAN_AND_MEAN | |
#include <windows.h> | |
#include <shlwapi.h> | |
#include <shellapi.h> | |
#include <shobjidl.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
// generic A* pathfinding | |
// | |
// INTERFACE | |
// | |
// mandatory macros | |
#ifndef ASTAR_POS_TYPE | |
#error ASTAR_POS_TYPE should specify position type |
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
#pragma once | |
#define MEOW_HASH_VERSION 5 | |
#define MEOW_HASH_VERSION_NAME "0.5/calico" | |
// Meow hash v0.5 with ARMv8 Crypto Extension instructions | |
// Ported from https://github.com/cmuratori/meow_hash | |
// Performance on Pine A64 (Cortex-A53, 1.2GHz) | |
// (compiled with clang v10.0 with -O3 -mcpu=cortex-a53) |
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
#pragma once | |
#define MEOW_HASH_VERSION 5 | |
#define MEOW_HASH_VERSION_NAME "0.5/calico" | |
// Meow hash v0.5 in C without dependency on special CPU instructions | |
// Ported from https://github.com/cmuratori/meow_hash | |
// Performance on Ryzen 9 3950X | |
// AESNI code = ~16 bytes/cycle |
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 <stdio.h> | |
#define STR2(x) #x | |
#define STR(x) STR2(x) | |
#ifdef _WIN32 | |
#define INCBIN_SECTION ".rdata, \"dr\"" | |
#else | |
#define INCBIN_SECTION ".rodata" | |
#endif |
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
// download glfw3 from https://www.glfw.org/download and then compile: | |
// cl.exe -O2 q1.c -Iinclude -link opengl32.lib glu32.lib lib-vc2019\glfw3dll.lib | |
#define _CRT_SECURE_NO_DEPRECATE | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include <assert.h> |