Private
Public Access
80 lines
4.2 KiB
Markdown
80 lines
4.2 KiB
Markdown
← [Back to Twitter thread index](../README.md)
|
||
|
||
---
|
||
title: "@Karyuutensei I don't use standard C libs or anything like that. I just write my"
|
||
author: "NOTimothyLottes"
|
||
handle: "@NOTimothyLottes"
|
||
post_url: "https://x.com/NOTimothyLottes/status/1948009807161721332"
|
||
post_id: "1948009807161721332"
|
||
timestamp: "2025-07-23 13:18:24"
|
||
post_count: 13
|
||
reply_count: 2
|
||
repost_count: 0
|
||
like_count: 4
|
||
view_count: 322
|
||
---
|
||
|
||
# @NOTimothyLottes — @Karyuutensei I don't use standard C libs or anything like that. I just write my
|
||
|
||
## Post 1 (2025-07-23 02:36:34)
|
||
|
||
"nobody self includes with defines to reorder C code" ... Haha, apparently I'm not the only one, the File Pilot guy does it too :)
|
||
|
||

|
||
|
||
## Post 2 (2025-07-23 07:14:41) — reply to Post 1
|
||
|
||
@NOTimothyLottes Do you also automatically generate the include files or do you just write them yourself?
|
||
|
||
## Post 3 (2025-07-23 12:48:28) — reply to Post 2
|
||
|
||
@Karyuutensei I only include __FILE__ (self). For WIN32 and VK even, I recreate the parts of external headers I need (use) inside the 'one source file', typically with structural type changes to switch back to simple types like 64 bit intergers instead of pointers. Trying to get to C--
|
||
|
||
## Post 4 (2025-07-23 12:54:01) — reply to Post 3
|
||
|
||
@Karyuutensei One side effect, even with C code the compilation is perceptually instant for the whole program. The other thing I do is mix the GLSL and C all in the same file, so I share defines. I do have one external include for the compiled SPIR-V ...
|
||
|
||
## Post 5 (2025-07-23 12:57:52) — reply to Post 4
|
||
|
||
@Karyuutensei For the SPIR-V, I also have one program, but I use specialization constants set at PSO generation to select the code path for a specific 'shader'. This requires spriv opt as a pre-processor else the IHV compilers tend to be 10x or more slower.
|
||
|
||
## Post 6 (2025-07-23 13:06:29) — reply to Post 5
|
||
|
||
@Karyuutensei During dev time I use 2 terminals each with their own shell scripts. The first is to just loop and keep regenerating the SPIR-V if anything in the 'one file' changes. This is unfortunately a mess to do in a batch file (below)
|
||
|
||

|
||
|
||
## Post 7 (2025-07-23 13:11:04) — reply to Post 6
|
||
|
||
@Karyuutensei The second does the same for the C program, loops recompiling and running the program. So when I'm editing source I can just fast exit the program and it restarts [with instant restart/reload it is quite fast to restart]
|
||
|
||

|
||
|
||
## Post 8 (2025-07-23 13:12:55) — reply to Post 7
|
||
|
||
@Karyuutensei I'm using GCC on Windows, because why bother with having to install Visual Studio or it's compiler tool chain mess. I just do MINGW64 and be done with it. My debugger is the instant restart for C code, and shader reload for GLSL
|
||
|
||
## Post 9 (2025-07-23 13:18:24) — reply to Post 8
|
||
|
||
@Karyuutensei I don't use standard C libs or anything like that. I just write my own stuff. For 'printf' style debugging I have macros that write to a memory mapped log file. They give {[restartNumber]|[msSinceLaunch]|[sourceLine]|[hex]|[dec]|[comment]}. Keeping multiple restarts in same log
|
||
|
||

|
||
|
||
## Post 10 (2025-07-23 13:22:24) — reply to Post 9
|
||
|
||
@Karyuutensei That log example is a simple test program, it starts in 0.3 ms for that run. The log tells all about how it pipelines start up {doing memory page warming, kart load, window setup, VK setup in parallel, getting to PSO gen as fast as possible [get layout done first]}
|
||
|
||

|
||
|
||
## Post 11 (2025-07-23 16:09:16) — reply to Post 9
|
||
|
||
@NOTimothyLottes Where does the restart number come from? I assume this is how many times you exited the code and started again automatically using your batch script?
|
||
|
||
## Post 12 (2025-07-23 16:14:55) — reply to Post 11
|
||
|
||
@Karyuutensei Yeah exactly that. The log file is a fixed size, and memory mapped (+page warming), and lines are a fixed size, so writing a message is lock free (fast just one atomic add, no file or system calls). When it fills it wraps around, and to clear just delete the file (it recreates it
|
||
|
||
## Post 13 (2025-07-23 20:14:13) — reply to Post 12
|
||
|
||
@NOTimothyLottes Thanks for sharing. I’ve never thought of doing logging like this.
|