1:26:40 I think it's probably because of cache locality actually. With the 'interesting' approach you keep iterating over the whole image, whereas in the 'naive' one you iterate over the seeds array instead. The seeds array fits into the cache no problem, so that's the better solution in terms of cache hits.
Very interesting way to generate Voronoi diagrams, looking forward to the shader implementation. To get the encoding and decoding of positions and colors essentially for free, you could maybe put them in a union, something like this: typedef union { struct { uint16_t x, y; }; uint32_t color; } Point32;
You can actually use for loops and ifs inside fragment shaders. And as long as all control flow only depends on constants and uniforms (so all pixels will go through the same control flow path), they won't even cause performance penalties. Branching in shaders is only a problem when nearby pixels that run on the same SIMD unit need to go through different paths of the branch. Then the GPU has to go through both paths in sequence and do complicated SIMD lane masking to perform the computations only on the pixels that need it.
Is there a specific reason you chose to store the the seeds' x and y position in the color as opposed to its index into the seeds array? Storing it's color would take less space which might leave space to store it's distance the current pixel so you wouldn't have to recalculate that as often
The P6 variant of PPM supports up to 16 bits per channel (although very few applications can read it). IIRC in the ASCII version the newlines aren't required - only a whitespace character is required, and by convention people use spaces between values and newlines (which are a valid whitespace character) at the end of each scanline. This simplifies reading the file one scanline at a time, and on occasion I've found it useful for debugging as it's quite human-readable. The binary format doesn't require any padding between values and is generally preferable as it produces significantly smaller files anyway
I'm enjoying the video so far. You can use `std::numeric_limits` for checking the ranges of numeric types. This way you don't need to remember those macros. Whatever you prefer.
@@wiktorwektor123 I watched the video in multiple parts and completely forgot about that 😅. I realized it while watching part 2 and came to remove the comment but you beat me to it.
This means there are no assembly jump instructions in code that can cause cache misses in CPU. CPU can safely assume which part of code will be executed next and have it preloaded to the lowest level of cache.
0:30 *nerd-mode-on* '.tv' does not actually stand for "television", if that is what you wanted to say. It is the country specific TLD (Top Level Domain) of Tuvalu. TV itself stands for television, of course, but the domain ending is only a*used for representing this. *nerd-mode-standby*
Maybe next time get a dedicated mic for the keyboard as it was still possible to hear some of what you said above the key bashing. Is it a normal keyboard or is each key 25cm2, and you type with fists not fingers like a sort of coding whack-a- mole?
@@atlantic_love then you're looking for "UI programming", not "graphics programming". The most common way people write GUI in C and C++ is to use an external windowing library like Qt. Qt is super powerful and there are tons of people using it online so you should be able to find information about it easily. If you want to make really beautiful UI then you're better off writing an Electron-based app in JavaScript.
1:26:40 I think it's probably because of cache locality actually. With the 'interesting' approach you keep iterating over the whole image, whereas in the 'naive' one you iterate over the seeds array instead. The seeds array fits into the cache no problem, so that's the better solution in terms of cache hits.
Very interesting way to generate Voronoi diagrams, looking forward to the shader implementation.
To get the encoding and decoding of positions and colors essentially for free, you could maybe put them in a union, something like this:
typedef union {
struct {
uint16_t x, y;
};
uint32_t color;
} Point32;
Zozing zession 😊
Haw abaut dat
Rather interesting
@@alpers.2123 I bet you didn't expect that sh*t to happen!
@@loryon Welcome to the epic coding club
Tsoding: Outside of Linus, you are my favorite hacker on the planet.
Когда-нибудь я смогу попасть на стрим вовремя...
Долго искал информацию по программированию графики на Си, наконец то нашёл!!! Подписался, будем посмотреть :)
The traditional method could be done in fragment shader with a shader storage buffer. Nonetheless, this is a very interesting method.
wonderful,can u pack the series of olive.c into playlist ? that is also popular and interesting
It would be interesting if you’ll try compute shaders that are available even in webgl as far as I know
Compute shaders aren't in webgl, they were going to add them but decided to move back on that idea when they realized it's better to define webgpu
You can actually use for loops and ifs inside fragment shaders. And as long as all control flow only depends on constants and uniforms (so all pixels will go through the same control flow path), they won't even cause performance penalties.
Branching in shaders is only a problem when nearby pixels that run on the same SIMD unit need to go through different paths of the branch. Then the GPU has to go through both paths in sequence and do complicated SIMD lane masking to perform the computations only on the pixels that need it.
Is there a specific reason you chose to store the the seeds' x and y position in the color as opposed to its index into the seeds array? Storing it's color would take less space which might leave space to store it's distance the current pixel so you wouldn't have to recalculate that as often
tscoding, have you heard about the farbfeld image format? It's similar to pbm, but with more colors and without EOLs.
The P6 variant of PPM supports up to 16 bits per channel (although very few applications can read it).
IIRC in the ASCII version the newlines aren't required - only a whitespace character is required, and by convention people use spaces between values and newlines (which are a valid whitespace character) at the end of each scanline. This simplifies reading the file one scanline at a time, and on occasion I've found it useful for debugging as it's quite human-readable.
The binary format doesn't require any padding between values and is generally preferable as it produces significantly smaller files anyway
You are an epic programmer
Love your videos I learn a lot 👏👏👏👏. Regards.
It is indeed interesting
0:30 tv actually stands for Tuvalu
moreover, Tuvalu lives on the money paid by companies that wants to use their domain space because it looks like an abbreviation for television
this man is speed incarnate
Tsoding are you still working on porth?
Last commit on 4th Feb 2022. I'm taking about the gitlab repo.
@@DuskyDaily he stopped updating the repo, but he did say he was going to work on it in private.
🙏 porth 😇
1:09 I am actually doing like that, bc I love your content :)
Привет
I'm enjoying the video so far. You can use `std::numeric_limits` for checking the ranges of numeric types. This way you don't need to remember those macros. Whatever you prefer.
Yeah, in C++, this is C
@@wiktorwektor123 I watched the video in multiple parts and completely forgot about that 😅. I realized it while watching part 2 and came to remove the comment but you beat me to it.
@@bunpasi No problem m8, everyone can make mistake. It was just friendly reminder :)
Is all this crazy editing/multiwindowing etc just Emacs functionalities?
You can do this many ways. Emacs is one. Neovim is another. A tiling window manager could give you the same thing.
1:21:30 what do you mean by branches? Thanks for the video. :)
It's 'branchless' (computing/programming).
This means there are no assembly jump instructions in code that can cause cache misses in CPU. CPU can safely assume which part of code will be executed next and have it preloaded to the lowest level of cache.
Btw try out Odin, if you like C, very interested if you like it or not.
he tried, says it's not his style
Impossible. Nobody writes c in 2022. You are a maniac.
23:35 won't uint8_t bytes auto shift
Which font are you using in your terminal?
It is Iosevka
0:30 *nerd-mode-on* '.tv' does not actually stand for "television", if that is what you wanted to say. It is the country specific TLD (Top Level Domain) of Tuvalu. TV itself stands for television, of course, but the domain ending is only a*used for representing this. *nerd-mode-standby*
when is using farbfeld instead of ppm?
Maybe next time get a dedicated mic for the keyboard as it was still possible to hear some of what you said above the key bashing. Is it a normal keyboard or is each key 25cm2, and you type with fists not fingers like a sort of coding whack-a- mole?
Any books that teach graphic programming in C or even C++?
"3D Game Engine Design" by David Eberly
@@tissuepaper9962 I'm talking about GUI programming, building GUI apps and games. Not interested in graphic engine building.
@@atlantic_love then you're looking for "UI programming", not "graphics programming". The most common way people write GUI in C and C++ is to use an external windowing library like Qt. Qt is super powerful and there are tons of people using it online so you should be able to find information about it easily. If you want to make really beautiful UI then you're better off writing an Electron-based app in JavaScript.
@@tissuepaper9962 Okay. I'll check them out.
your emacs config?
Remix on github
it dose not work ???
i don´t undertand .what is procedural graphics ? i program in c ,i am interested. please make a video basics of basics.
what editor is tsoding using?
based emacs
Firstn't
firstn't
7
ты русский
hey, do you hvaew discord, or are you part of poimandres?