@pervognsen@mastodon.social avatar

pervognsen

@pervognsen@mastodon.social

Performance, compilers, hardware, mathematics, computer science.

I've worked in or adjacent to the video game industry for most of my career.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

regehr, to random
@regehr@mastodon.social avatar

it's been years since I used Windows for anything, but one of my kids has a Windows laptop but wants to work with a group of people that uses Macs and Linuxes. so I showed him WSL (which I've never used myself) and wow this seems to be magically good unix interoperation. so nice to see Microsoft produce something like this!

I used to use cygwin :(

pervognsen,
@pervognsen@mastodon.social avatar

@regehr VS Code + WSL is doubleplusgood. Seriously, get him to check it out. VS Code Remote works really well in general but it's extra smooth with WSL.

llvm, to random
@llvm@fosstodon.org avatar
pervognsen,
@pervognsen@mastodon.social avatar

@llvm KOTOR 2 is one of my favorites (at least after fan patches made it playable).

pervognsen, to random
@pervognsen@mastodon.social avatar

The sched_ext work is exciting and it looks like it's getting a lot of traction: https://lwn.net/ml/linux-kernel/20240501151312.635565-1-tj@kernel.org/

msinilo, to random
@msinilo@mastodon.gamedev.place avatar

Oh no, it seems like VS 2022 no longer opens FBX files (VS2019 did)... Never thought I'd be sad about that, but it was handy

pervognsen,
@pervognsen@mastodon.social avatar

@msinilo That was such a random feature!

pervognsen,
@pervognsen@mastodon.social avatar

@aras @msinilo Gotta admit I never saw that one.

pervognsen, (edited ) to random
@pervognsen@mastodon.social avatar

For people who've been around much longer, has there been any retrospectives on Rust's decision to allow panics to unwind rather than abort? I've mostly come to terms with it in a practical sense but it's something that really "infects" the language and library ecosystem at a deep level, e.g. fn(&mut T) isn't "the same" as fn(T) -> T and it's especially troublesome if you're writing unsafe library code and dynamically calling code through closures or traits that could potentially panic.

pervognsen, (edited )
@pervognsen@mastodon.social avatar

You can easily write a helper function that allows you to use fn(T) -> T in place of fn(&mut T) by turning unwinding panics in a delimited region into aborting panics via drop guards [1], but it's kind of "anti-social" at an ecosystem level to do that for library code outside of really tough cases where you don't have a reasonable alternative (e.g. I think there's a few cases like this in Rayon's scheduler).

[1] E.g. fn replace_or_abort<T, R>(m: &mut T, f: impl FnOnce(T) -> (T, R)) -> R.

pervognsen, (edited )
@pervognsen@mastodon.social avatar

@pkhuong I wonder if there's a reasonable crate-level specification to deal with the legacy interop issues at least. With unwinding, it's also one of those things where once you accept it's there you can definitely get some value out of it, e.g. certain thread cancellation patterns. And even though I'd hoped never to deal with unwinding again after C++ I have to admit the "isolation level" with unwinding is infinitely better in Rust (outside of unsafe code).

pervognsen,
@pervognsen@mastodon.social avatar

@foonathan @pkhuong Thanks. I've started using my "turn delimited panics into aborts" helper in my own code more and more but I always had a twinge of guilt like I was taking a shortcut. I should probably just embrace it more if deprecation is even being considered.

pervognsen, (edited )
@pervognsen@mastodon.social avatar

@foonathan @pkhuong Incidentally, I have an interesting example of where it doesn't help. If you look at Vec::drain, in a world where Rust iterators were internal rather than external and unwinding wasn't a thing, it would be simple to implement. But with external iterators and no unwind, the relationship between the consumer and the iterator means that you still have to deal with the "hard" problem around what happens when you have a partially drained Vec and the Drain iterator gets dropped.

pervognsen, (edited )
@pervognsen@mastodon.social avatar

@foonathan @pkhuong I guess that isn't really a surprise to anyone (borrowing works best with "delimited callbacks" like you have with internal iterators) but Vec::drain is sort of a notorious problem case for a number of reasons and I always mentally bucketed it together with the "unwinding sucks" cases. But unwinding panics actually aren't the culprit there even if part of the problem is morally similar (dropping Drain vs unwinding the caller).

benjins, to random
@benjins@mastodon.gamedev.place avatar

The lesser known Siege of Eratosthenes involves lobbing integers at your enemy's fortifications, whereby only the prime numbers will break through

pervognsen,
@pervognsen@mastodon.social avatar

@benjins Not to be confused with the Sietch of Eratosthenes, his home on Arrakis.

justinesherry, to random
@justinesherry@masto.pt avatar

Lots of discussion about how Google has become garbage at pulling up helpful information... how are the alternatives doing? Does anyone actually use another search engine and like it? What do you like about it?

pervognsen, (edited )
@pervognsen@mastodon.social avatar

@j2kun @adrian @justinesherry After they changed the pricing on their "unlimited searches per month" package, I started using it. It's okay and feels easily worth the small amount of money (and I like paying for products). The quality of search results isn't anything special in absolute terms, but given how bad search quality has become on the major search engines it's very noticeably better.

pervognsen, (edited ) to random
@pervognsen@mastodon.social avatar

Do Apple-exclusive (or Apple-mostly) developers like their tech docs, etc? I always feel like I have a hard time finding anything I want. So much info is buried in WWDC presentations, their own docs are hard to navigate and often don't have what I want, and to top it off they also seem to have poor SEO juice so it's hard to use third-party search engines to find stuff (most of the time I find random blog posts instead).

pervognsen,
@pervognsen@mastodon.social avatar

I'm sure my negative experience is made much worse by the fact that I don't really live in that ecosystem daily but I'm legitimately curious what it feels like from the inside looking out.

pervognsen,
@pervognsen@mastodon.social avatar

Also, this is more surface-level, but their web tech docs seem to have a lot of totally custom JS UI that is super janky and outright glitchy at least any time I've accessed them with Firefox or Chrome. The custom "smooth scrolling" stands out as super hitchy and in general all the animated transitions are hitchy. If you show/hide toggle a tree view item in the table of contents side bar on the left, the vertical scroll position is unstable and will crawl up/down a bit every time. Etc.

pervognsen,
@pervognsen@mastodon.social avatar

But to give them props they will also randomly have these ultra polished bespoke tutorials, e.g. I really like how this shows the screenshots corresponding to single-stepped execution states. https://developer.apple.com/tutorials/swiftui-concepts/specifying-the-view-hierarchy-of-an-app-using-a-scene

dotstdy, to random
@dotstdy@mastodon.social avatar

To be honest I'm surprised the "one small rock a day" diet hasn't caught on outside of Sweden. Arguably it's one of the biggest reasons swedes are all so healthy and attractive. The rest of the world could learn a lot from Europe.

pervognsen,
@pervognsen@mastodon.social avatar

@dotstdy Signed, the Rocksmith

Doomed_Daniel, to random
@Doomed_Daniel@mastodon.gamedev.place avatar

I'm not sure if everyone shares my fondness for X macros, but I sure like them:
https://github.com/DanielGibson/dhewm3/blob/a0bd8161445462daf6253da3ce9b7eeee5a64c89/neo/sys/sys_imgui.cpp#L516-L886

(that code writes and reads Dear ImGui styles to/from an ini-like text file)

pervognsen,
@pervognsen@mastodon.social avatar

@Doomed_Daniel Aside from using multiple definitions "from the environment" it's also useful for each macro to take multiple arguments and then each instantiation can project down to what they want, e.g. X(TextDisabled, "This is a flag that when set disables the text") and then the enum type and name tables only use the first argument whereas a game editor's property inspector needs the pairing of both to display the help text.

pervognsen,
@pervognsen@mastodon.social avatar

@Doomed_Daniel BTW, you can also use this for essentially implementing templates in C: https://gist.github.com/pervognsen/c56d4ddce94fbef3c80e228b39efc028

pervognsen,
@pervognsen@mastodon.social avatar

@Doomed_Daniel No, it's just for isolation from the environment. IMHO you should always be using push/pop macros for cases like that in real code where you want to define/undef macros in a bracketed region. It's too bad they're not supported with MSVC.

pervognsen,
@pervognsen@mastodon.social avatar

@Doomed_Daniel Yeah, nevermind, I think I even wrote and tested that code with MSVC.

chandlerc, to random
@chandlerc@hachyderm.io avatar

C++ data structure API design question...

What are folks favorite ways to design a data structure that supports users providing two closely coupled custom functions? Why that pattern?

Specifically, imagine a hash table data structure that wants to allow users to deeply customize both the hash function and the equality comparison.

Current ideas, w/o ranking or even saying I like them, and interested in others:

  • A type parameter with static functions
  • two lambda template parameters
  • CRTP
pervognsen,
@pervognsen@mastodon.social avatar

@zwarich @chandlerc I like it. In Rust you can transparently use K or Box<K> as a key since Box has forwarding impls for all the usual traits and I guess also through auto-deref via the Deref trait. But that doesn't handle the case where you don't have a free-standing pointer but need to pair a handle with a context to get a reference.

pervognsen,
@pervognsen@mastodon.social avatar

@zwarich @chandlerc Incidentally, this is a neat alternative approach to the "pluggable allocator" problem which also tries to separate the concerns in a similar way by separating the handle and the context rather than having the allocator return free-standing pointers: https://github.com/matthieu-m/storage-poc. (I don't think this would solve the exact same problem, I'm just mentioning it as another example separating concerns in the same way.)

pervognsen,
@pervognsen@mastodon.social avatar

@zwarich @chandlerc (BTW, I think that storage proposal would work at least as well in C++ as in Rust and I believe Matthieu said he had first used the idea in the C++ code base at his day job.)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • kavyap
  • DreamBathrooms
  • cisconetworking
  • magazineikmin
  • InstantRegret
  • Durango
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • mdbf
  • khanakhh
  • tacticalgear
  • JUstTest
  • everett
  • modclub
  • Leos
  • cubers
  • ngwrru68w68
  • ethstaker
  • osvaldo12
  • GTA5RPClips
  • anitta
  • megavids
  • normalnudes
  • tester
  • lostlight
  • All magazines