Hacker Newsnew | past | comments | ask | show | jobs | submit | corysama's commentslogin

If you want to play with software rendering, here's probably the shortest code that will get an ARGB8888 2D array from main memory to the screen efficiently for all platforms using SDL2 in C https://gist.github.com/CoryBloyd/6725bb78323bb1157ff8d4175d... you'll need to do the translation from a 320x200x8-bit palletized framebuffer to ARGB yourself ;)

If you want to get inspired by what can be done with palletized framebuffers check out http://www.effectgames.com/demos/canvascycle/ (click Show Options) and the GDC presentation by the artist https://youtu.be/aMcJ1Jvtef0

With that you can fire up https://github.com/mriale/PyDPainter for that classic Deluxe Paint IIe vibe. Or, https://www.aseprite.org/ for something more modern.


At least with SDL3, you don't even need the renderer or the texture anymore. SDL_GetWindowSurface to get the surface and SDL_UpdateWindowSurface to present. That's the more software-graphics you can get from my understanding of the library. SDL still does the double-buffering for you.

SDL has always made it easy to directly present a software buffer of pixels to the screen. I'm not sure why someone would want to use the renderer/texture thing for this use case.

Thank you for sharing this. There's a handful of very popular Quake forks already, but Planimeter publishes a Quake-VS2026 fork that doesn't introduce changes. The team is working on x64 builds, which requires replacing the old SciTech Mult-platform Graphics Library (x86 only) with SDL3 (or port scitech-mgl to x64, which I don't think will happen) and the last I understood, the software renderer may be dropped.

But maybe a software renderer and SDL_Texture could preserve it?


It's certainly the most rudimentary. Small optimisation on the inner-loop would be to pre-calculate the scanline offset before going into the pixel loop:

    int s = y*screenRect.w;
    
    for (int x = 0; x < screenRect.w; x++) {
       pixels[s + x] = argb(255, frame>>3, y+frame, x+frame);
    }

I'd be surprised if the compiler didn't make that optimisation on its own.

Possibly, but always check the assembly.

The even faster version, opts aside, would be to initialize the pointer at y*screenRect.w and ++ at every loop to avoid the addressing arithmetic.


Certainly check the assembly, but loop invariant code motion and strength reduction are basic optimizations. C compilers tend to be good at optimizing indexing patterns even at -O1.

Take a look, GCC and Clang go further than these suggestions by adding screenRect.w to the pointer each iteration to avoid the multiplication: https://godbolt.org/z/YfroqK7T6

Writing anything but pixels[y*screenRect.w + x] in an attempt to be faster, without checking the assembly first, is obfuscation.

(For what it's worth, you can beat the compiler by using *pixels++. I didn't profile the code to check it actually was faster in practice however.)


Then there’s the opposite situation. I knew the guys who ported NBA Jam: TE from arcade to PC (by hand-translating assembly!). Apparently the arcade CPU had bitwise addressing. And, because pretty much all of the data was aligned to bytes, the arcade programmers liked to stuff 3 bits of extra parameter data into the low bits of pointers.

it's not uncommon for runtimes to use always-zero bits from aligned pointers or bits above 48 (unused in most current 64bit CPUs) to store flags today. you don't need special 'bit-addressing' to do it. byte addressing works just fine.

We are currently at real-time video generation that can be converted to splats or meshes.

https://research.nvidia.com/labs/sil/projects/lyra2/




Or firefox flavoured https://www.brow.sh/


Heh that's ... truly the worst of both worlds.


The paradox is usually presented as:

The People: Hey local government! The roads are so packed with cars they are useless. Fix it!

The Government: We hear you and just finished a huge road expansion project. The roads now have 2x the capacity! Enjoy the new fast roads!

The People: The roads are just as slow as before because they are packed with 2X as many cars now!

So, the paradox is that greatly increasing the capacity of the roads led to the roads being just as slow as before. Maybe even slower. This is because there previously were lots of potential uses of the roads that people did not enact because it would not have been worth the hassle. But, now with 2X the capacity, those uses become viable. So, more people find more uses of the roads up until it gets right back to the limit of everyone patience.

Apply this to coding and you can predict: Coding is much faster and easier now. So, why are all my coders still so busy?


The road thing is usually tied to “induced demand” (which is a bad way of looking at it imo). Jevrons is more directly related to the cost of something dropping increasing the usage because new things that weren’t worthwhile are now doable - related, but more directly tied to things like “smartphones are cheaper now so more people have them”.

You do hit limits eventually (most people get to one smartphone and stop except for replacements) but the surprising paradox is when you don’t even see the possible demand (think: worldwide market for maybe six computers type things) - you have to think of something and then think of what would happen if it was (effectively) cheap as free.

Water in the USA might be an example, it went from something difficult and valuable and precious to we flush our toilets with drinking water - unthinkable wealth to parts of the world even today.

If a smartphone was fifty cents what new uses could be found? If the small shell script that replaces you is now $19 for anyone to develop, what happens?


Generating MIDI sequences

https://www.muse.art/home


"Approved for Exams" make more sense when you take into account the history of the Ti family of calculators.

Why are they still able to sell what is effectively a 30 year old computer for as much or more today than when it came out? Because they managed to get the family informally standardized as "The calculator every teacher in America understands well enough to manage students who use it. Therefore pretty much everything else that could be as or more advanced is effect banned."

It was an amazing piece of kit when it first came out. No doubt you could make something 100x better and 10x cheaper today if someone really tried. But, they would fail commercially because you can't design-in 30 years of legacy in the US school system.


> If you were to approximately age sync the red and yellow lines on that chart, by moving their start dates to the same point, the red line is higher.

Like this: https://imgur.com/a/d7stXVN


Thanks for sharing! Seems to show that both are doing poorly relative to earlier generations, and it doesn’t seem Gen Z is greatly (or much at all) outpacing millennials.


And as usual, no one cares about Gen X :)


Which is crazy cause GenX is management as everything falls apart. GenX is 50-65 year olds running everything and everything sucks now.

GenX is the big tech leaders, the insurance CEO that got got, the EpiPen CEO jacking up prices, senior teachers and admins as student grades slide into the toilet, the uncreative repetitive Hollywood decision makers. Hollywood actors slapping each other live on camera and hacking their faces up to pretend they are still 25. They manage the construction companies that refuse to build more homes.

As an older Millennial it's not a shock they ended up such poor leaders. Working with GenX has always sucked.


I think you need to be a little careful of taking the whole generational group thing too far. It's a very lazy way to think, and it can cause real hatred on overly simplified, group identified lines.

Like: if you were a few years older, now you're the focus of your own hatred? Doesn't make much sense, does it?


At least you aren’t hated like us boomers. Apparently everything wrong in the world is down to us.


As a millennial, I apologize for the blame and hate the boomer generation gets. But I think it's important to understand why the hate exists.

Many boomers grew up in an era where even if you dropped out of high school and waited tables full time for a few years, you'd be able to afford to buy a house and start a family by age 25. Sure, interest rates were 20%, but the price of a house was often just 2-3x someone's annual salary (single earner). Now the price of a house is often 4-5x a households annual salary.

Boomers also had access to stuff like pensions.

I think boomers wouldn't get hate if it weren't a trope for them to say that the millennial generation is lazy, entitled, etc. When milennials have to be extraordinary in order to live what used to be an ordinary life (3 bedroom house, 2 kids).


I am right on the cusp of my home cost being 3x my salary, I bought it when it was 4x, but the interest rate was 2.75%.

If I refinanced now, I probably couldn't afford my own home.


You would be the subject of much envy for those on the west coast of Canada!


"for them to say that the millennial generation is lazy, entitled, etc" - they said it about Gen X too, but there's too few of us, so they focused on the Millenials instead.

I too dislike the Millenial whoop, but I like smashed avocado toast, so it's a wash for me.


Hey, buddy! Can I bum a command line arg list off ya?


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: