Handmade Network»Mārtiņš Možeiko

Recent Activity

Forum reply: wcap
Mārtiņš Možeiko
Forum reply: wcap
Mārtiņš Možeiko
Forum reply: wcap
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: C runtime (CRT)
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: TwitchNotifiy
Mārtiņš Možeiko
Forum reply: TwitchNotifiy
Mārtiņš Možeiko
Forum reply: TwitchNotifiy
Mārtiņš Možeiko
Mārtiņš Možeiko

stb_image_resize2.h: https://github.com/nothings/stb/blob/master/stb_image_resize2.h
Much faster and better than stb_image_resize.h
Major performance increases (in degenerate cases can be >1000x faster). Now includes SIMD optimizations - for SSE2, AVX, NEON and WASM.
Bit-identical deterministic results between scalar and SIMD code, across architectures (x86, arm, wasm) and across all compilers - msvc, clang, gcc.

Forum reply: Locals
Mārtiņš Možeiko

WASAPI wrapper example that offers directsound-like lock/unlock buffer functionality (but simpler): https://gist.github.com/mmozeiko/5a5b168e61aff4c1eaec0381da62808f#file-win32_wasapi-h

Header has just 4 functions - start/stop, lock/unlock. And then you fill in the buffer between lock/unlock calls in every frame. No worrying about callbacks or multithreading for your audio code to mix the samples. The buffer to fill is a "magic ringbuffer" allocated with virtual memory mapping trick - it gives just one array to fill, no need to handle split in the middle for wrapping back to start like dsound requires. It wraps around automatically. Internally wrapper creates large ringbuffer that you fill on every frame as much as you want. This means no audio going out or glitching when frame time stutters and you get longer frame than expected. This is done by running a background thread where samples are submitted to wasapi from ringbuffer with smallest buffer size. And lock/unlock allows to overwrite portion of ringbuffer that has not been submitted yet, so you can get lower latency even if you have prepared more samples than necessary.

example.c file with example code at the top.

Toy project to mount tags from local git repository as "virtual" folder using Windows Projected File System: https://github.com/mmozeiko/gitprj

This allows you to browse tree of all commits referenced by tags without need to run git command to checkout between commits.

Forum reply: IRC bridge down
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: wcap
Mārtiņš Možeiko
Forum reply: wcap
Mārtiņš Možeiko
Forum reply: wcap
Mārtiņš Možeiko

"hello triangle" using WebGPU on Windows in C: https://gist.github.com/mmozeiko/4c68b91faff8b7026e8c5e44ff810b62
draws same triangle as my other d3d11/opengl gists. Just a single file to compile, no other dependencies (other than webgpu implementation itself), simple code without abstractions.

upng.h - uncompressed png writer & reader, with optimizations for x64 and arm64: https://gist.github.com/mmozeiko/e66f6d23e101b1b9c37cb3d9d10727f5?ts=4
Standalone header file with two functions to use, no memory allocations, no runtime dependencies.
In case you need to create valid png files really really fast. Supports all 8-bit and 16-bit png pixel formats & any image size (32-bit width/height) - as long as it fits in memory.
Can create 8k BGRA8 png file (256MB) in 23msec on Ryzen 5950x. Which means it's running at 11GB/s.
Compared to libpng 170msec (uncompressed png, 1.5GB/s) or 2150msec (compressed png, 120MB/s).

Forum reply: wcap
Mārtiņš Možeiko

Minor TwitchNotify improvement - code updated to refresh stream status for users when websocket is reconnected. This happens, for example, after computer was resumed for sleep/standby. Previously UI did not reflect changes in user stream status during this time. So you had old info available after resuming pc, potentially showing users streams being live when they are not, or opposite.
Plus removed nested user context menu - it's simpler to have everything in one list without sub-menus. &twitchnotify
https://github.com/mmozeiko/TwitchNotify

Forum reply: a few observations
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko

alternatively use fwidth for automatic "zoom" calculations, no need to manually scale anything - just pass correct vertex/texcoord coordinates: https://www.shadertoy.com/view/csX3RH

&wcap update - now it can encode video to 10-bit HEVC (main10 profile). Theoretically it increases quality of image as there is more resolution for color values in conversion to YUV. But it depends on how GPU implements encoder. In practice it will be very hard to see any differences. From my non-scientific tests with Nvidia, it seems it encodes better - on some content it gets ~10% smaller video files than 8-bit HEVC.

Not all GPU's support encoding to 10-bit HEVC. Check your GPU support here:
Nvidia: https://en.wikipedia.org/wiki/Nvidia_NVENC#Versions or https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new
Intel: https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding

Get it on GitHub: https://github.com/mmozeiko/wcap

Forum reply: Android debugging
Mārtiņš Možeiko
Forum reply: Issues with compiling
Mārtiņš Možeiko
Forum reply: Why use a unity build?
Mārtiņš Možeiko
Forum reply: Why use a unity build?
Mārtiņš Možeiko
Forum reply: Why use a unity build?
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Performance of IMGUI
Mārtiņš Možeiko
Forum reply: Performance of IMGUI
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Parallel Stacks
Mārtiņš Možeiko
Forum reply: Converting files fast?
Mārtiņš Možeiko
Forum reply: C++ without classes
Mārtiņš Možeiko
Forum reply: Converting files fast?
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: So Casey thinks C sux?
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: So Casey thinks C sux?
Mārtiņš Možeiko
Forum reply: So Casey thinks C sux?
Mārtiņš Možeiko
Forum reply: So Casey thinks C sux?
Mārtiņš Možeiko
Forum reply: So Casey thinks C sux?
Mārtiņš Možeiko
Forum reply: So Casey thinks C sux?
Mārtiņš Možeiko
Forum reply: So Casey thinks C sux?
Mārtiņš Možeiko
Forum reply: So Casey thinks C sux?
Mārtiņš Možeiko
Forum reply: So Casey thinks C sux?
Mārtiņš Možeiko
Forum reply: So Casey thinks C sux?
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Casey 4coder config
Mārtiņš Možeiko

&TwitchNotify now allows to download followed user list from your Twitch account - set username in .ini file and choose to download automatically on startup, or do it manually in popup menu. https://github.com/mmozeiko/TwitchNotify/

Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Blog comment: Surgical programming
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko

TwitchNotify update: https://github.com/mmozeiko/TwitchNotify/ Much better websocket connection code. Now it does not need to disconnect to reload users - websocket connection stays permanent. Also because Twitch likes you to notify that stream is live but then it takes sometimes up to 10 seconds to actually report game/stream name, so now TwitchNotify will show notification with just user name, and then try to get game/stream name later and update notification when it successfully gets one. And now it shows viewer count in user list. &twitchnotify

New TwitchNotify codebase: https://github.com/mmozeiko/TwitchNotify/ Now it monitors Twitch user live status via websocket instead of previous 1-min polls. Now you get notifications instantly without any delay. It also now uses Windows 10 toast notifications - it shows actions buttons in notification popup itself. Either to open mpv video player, or open browser page. All this with nice 34KB .exe and ~3MB runtime memory usage. CC @DreamerSleeper &twitchnotify

Forum reply: Attach assets to exe
Mārtiņš Možeiko
Forum reply: Attach assets to exe
Mārtiņš Možeiko

new &wcap feature - allow to choose discrete vs integrated GPU to use for encoding. By default it will select discrete one. Using integrated may be useful for laptop users with nvidia optimus when you're recording low framerate / low complexity screen capture, as that uses less power, which means less heat & better battery usage. I recommend using iGPU only if you're on Skylake or newer Intel CPU, as older CPUs than Skylake have pretty poor performance & quality. New version also includes minor fix for bad handling of minimized window capture. In such case no new frames are captured which means messed up timestamp or hanging of recording (if audio capture was also enabled). Now it will properly produce discontinuity in video stream. https://github.com/mmozeiko/wcap

new &wcap bugfixes: https://github.com/mmozeiko/wcap thanks @Crysist for debugging these

Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Attach assets to exe
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Linux Evdev Poll Lag
Mārtiņš Možeiko
Forum reply: Handling stereo audio
Mārtiņš Možeiko
Forum reply: Handling stereo audio
Mārtiņš Možeiko
Forum reply: Handling stereo audio
Mārtiņš Možeiko
Forum reply: Handling stereo audio
Mārtiņš Možeiko
Forum reply: Handling stereo audio
Mārtiņš Možeiko
Forum reply: Linux Evdev Poll Lag
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Debugging opengl
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Cmake?
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: How I program C
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Jon Blow using OpenGL
Mārtiņš Možeiko
Forum reply: Can't build the game
Mārtiņš Možeiko
Forum reply: Day 40: Loading Cursor
Mārtiņš Možeiko
Forum reply: Peer to Peer and NAT
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Set Thread Name
Mārtiņš Možeiko
Forum reply: Set Thread Name
Mārtiņš Možeiko
Blog comment: Be Aware of High DPI
Mārtiņš Možeiko
Blog comment: Be Aware of High DPI
Mārtiņš Možeiko
Forum reply: Help with XAudio2
Mārtiņš Možeiko
Forum reply: Help with XAudio2
Mārtiņš Možeiko
Forum reply: Xlib event loop
Mārtiņš Možeiko
Forum reply: Table-driven C++?
Mārtiņš Možeiko
Forum reply: Jonathan Blow array
Mārtiņš Možeiko
Forum reply: Jonathan Blow array
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Tim Sweeny vs Apple
Mārtiņš Možeiko
Forum reply: Tim Sweeny vs Apple
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Subscribe to updates
Mārtiņš Možeiko
Forum reply: inversion of control
Mārtiņš Možeiko
Forum reply: WaveOut Sound API
Mārtiņš Možeiko
Forum reply: Dynamic arrays
Mārtiņš Možeiko
Forum reply: WaveOut Sound API
Mārtiņš Možeiko
Forum reply: DWARF 5 support?
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: function pointer
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: algebra solvers
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Handmade Unity
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: GLAD without glfw
Mārtiņš Možeiko
Forum reply: Making a console app
Mārtiņš Možeiko
Forum reply: Making a console app
Mārtiņš Možeiko
Forum reply: Making a console app
Mārtiņš Možeiko
Forum reply: MSDN in November 2019
Mārtiņš Možeiko
Forum reply: STB and OGG video
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Discussion
Mārtiņš Možeiko
Forum reply: Discussion
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Handmade JS
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Back buffer allocation
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Programming mannerisms
Mārtiņš Možeiko
Forum reply: To SDL, ot not to SDL
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: On cross-compiling.
Mārtiņš Možeiko
Blog comment: Setting the Exe icon
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: PE header is invalid
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Blog comment: Instancing
Mārtiņš Možeiko
Blog comment: Instancing
Mārtiņš Možeiko
Blog comment: Instancing
Mārtiņš Možeiko
Blog comment: Instancing
Mārtiņš Možeiko
Mārtiņš Možeiko
Blog comment: Instancing
Mārtiņš Možeiko
Blog comment: Instancing
Mārtiņš Možeiko
Forum reply: float vs double?
Mārtiņš Možeiko
Forum reply: Minimal D3D11
Mārtiņš Možeiko
Mārtiņš Možeiko
Blog comment: CDbg Build 0.0.0.8
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Blog comment: Text
Mārtiņš Možeiko
Blog comment: Text
Mārtiņš Možeiko
Forum reply: Questions and Answers
Mārtiņš Možeiko
Blog comment: GBEmu 0.0.3 Released!
Mārtiņš Možeiko
Forum reply: Annotated guide down?
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Batch File Programming
Mārtiņš Možeiko
Forum reply: Batch File Programming
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Forum reply: Bitmap Functions
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Mārtiņš Možeiko
Blog comment: Unicode vs Ansi vs UTF8
Mārtiņš Možeiko
Blog comment: Unicode vs Ansi vs UTF8
Mārtiņš Možeiko
Forum reply: why are templates bad
Mārtiņš Možeiko
Mārtiņš Možeiko