
Hacker & Tinker. DMs open. Beginner in C++. He/Him
The Internet
Joined August 2019
- Tweets3.8K
- Following3.4K
- Followers165
- Likes13K
HackingPheasant retweeted
Replying to @JaceCear
Oh, trust me, the time is coming soon to be bustin' out the 'semblies. Even here, a bunch of the crap I'm calling is literally just a tiny macro wrapper around inline ASM.
But modern C++ is not all cruft. The truth is that it can do shit at compile-time that C itself cannot dream of... and I need everything I can possibly leverage, ASM to C++. Shit, I'd be in Objective-C++ too right now if I could fit the ObjC runtime. lmfao.
HackingPheasant retweeted
Writing the most absurdly, meticulously hand-optimized sprite and billboard rendering routine of my life for our #GTA 3 port to the Sega #Dreamcast. This baby gets used by all of GTA3's UIs, fog effects, screen-space effects, and ESPECIALLY the fake bloom-lighting effects you see blurring light sources in the scene...
First of all, I bumped the project up from C++17 to GNU++23, because I ain't fucking around here, and I need every dirty tool at my disposal from C and C++. Good, evil, or questionable language features? Don't care. Enabled!
Then what you're looking at here is the core routine for blasting sprites through the Dreamcast's fast path. The pvrVertexSubmit() lambda is responsible for translating one of the GTA3 engine's vertex types over to the Dreamcast's vertex type, and it do so by mapping a DC vertex directly into a "store queue" on our SH4 CPU, where we fill the thing in directly.
A store queue is a pretty damn interesting feature of the SuperHitachi architecture which allows us to copy data around extremely quickly by writing cache-line sized chunks of data (32-bytes) into it then issuing a cache flush on it to write its contexts extremely quickly through the cache and into some other region of memory... It's the fastest mechanism we have for memory transfers, faster than DMA, and we have two of them.
What happens here is that we've preconfigured the store queues' destination addresses to point to the PowerVR GPU's TA (Tile Accelerator), which is the unit that processes incoming vertices, storing them within vertex buffers in VRAM until it is time to draw the scene. pvr_dr_target() here is simply returning a pointer to ONE of the two store queues, then we translate gtaVert to pvrVert within the SQ, and finally do a call to pvr_dr_commit() to blast that fucker directly to the TA...
Something to keep in mind is that although we have two SQs, they cannot both be flushed and accessing the memory bus simultaneously, or the SH4 CPU's pipeline will stall while he first store queue finishing flushing.
What we do instead is alternate between writing to one while we flush another store queue. This essentially creates an efficient transfer pipeline where we are never stalled waiting for one store queue to finish! This is honestly the Dreamcast's equivalent of the Genesis's fabled "Blast Processing."
Now, the rest of the sprite routine is pretty standard crap, just looping over vertices, blasting them through the store queues. I have gone ahead and added C++20's [[likely]] and [[unlikely]] optimization hints on branches and loops, and yes, we have confirmed that they do actually impact performance on the SH4 architecture with GCC14!
The loops have also been unrolled to process up to three vertices at a time, prefetching each one into the cache while we're writing the previous one to the store queue... allowing us to easily push a shitton of these sprites.
#cplusplus #cpp #gamedev #retrocomputing
HackingPheasant retweeted
I can't believe I'm the one who's scared of taking jobs working in the kernel/ring0 and writing drivers but these 80billion USD-valuation companies can just no-protection rawdog the kernel with the sloppiest practices I've ever seen and it's totally okay.
Sweet mercy.
Lmao
This morning, we published the Root Cause Analysis (RCA) detailing the findings, mitigations and technical details of the July 19, 2024, Channel File 291 incident. We apologize unreservedly and will use the lessons learned from this incident to become more resilient and better serve our customers. To any customer still affected, please know we will not rest until all systems are restored.
For the executive summary and full RCA, please visit crowdstrike.com/falcon-conte…
43
HackingPheasant retweeted
I need the people to know that olympic silver medalist giorgia villa is sponsored by parmesan cheese and regularly posts pics of herself with giant wheels of cheese
HackingPheasant retweeted
Time for me to put my performance where my mouth is and show everybody how it's done.
Can a generic text encoding library be both versatile and fast? At #P99CONF on Oct. 23-24, @ShepherdsOasis' @__phantomderp will share how to achieve top speed without sacrificing user-friendly APIs. Don't miss this interactive session! ow.ly/RV1J50SHa8h
#ScyllaDB #DevTalk
HackingPheasant retweeted
| ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|
| Don't Push To Production On Friday |
|_________________|
\ (•◡•) /
\ /
——
| |
|_ |_
HackingPheasant retweeted
This global outage sounds like I’m finally getting the y2k bug I was promised as a child
HackingPheasant retweeted
Replying to @fasterthanlime
IN FAIRNESS it was a pretty novel idea AND they had to preserve backwards compatibility. Obviously in a world with Rust it all feels insane and backwards but at the time they were inventing it from whole cloth.
Anyway the answer is C++ is pass-by-clone, use `std::move` to move
HackingPheasant retweeted
For all the people currently freaking out about the Once Human Privacy Policy.
The policy states under "Personal Information we receive from you:" that they receive "Name & Contact Details" "Such as first and last name, title, prefix, email address, telephone number, (instant) messaging account, postal address, date of birth, age, gender, country/region, and government-issued ID, such as passport information, as required by applicable laws for age verification and correction of personal information."
The general internet has warped this into a demanded requirement and a privacy issue. It's not. These are only sent to the company when required by applicable local laws. This is why it says "Receive from you" and "as required by applicable laws".
In some countries government issued ID's are required for live service game access. If you are not in one of these countries you obviously are not asked or required to present those documents.
Fearmongering on social media is boring as shit.
HackingPheasant retweeted
We DO NOT throw perfectly good food away in this house.
We put leftovers in a Tupperware & let it go bad, THEN throw it out!
HackingPheasant retweeted
crazy that the only one of these companies founded in the City of San Francisco is Saudi Aramco























