Adrian Sanchez
204 posts

Adrian Sanchez
@pervasivesense
Creative programming, games and stuff. Senior Technical Engineer @SquanchGames. Sole proprietor of @SunsetLearn.
California, USA Katılım Aralık 2020
143 Takip Edilen32 Takipçiler

@twodelab What in the eff?? So is this only the auto LOD graph work that we're seeing here? Does this also implement the optimized mesh disk streaming/compression that Nanite does?
English

This is as concerning as it is exciting 😬
Smoke-away@SmokeAwayyy
Sam Altman: "We hope that you'll come back next year. What we launch today is going to look very quaint relative to what we're busy creating for you now."
English

Starting up a sort of side hussle soon. Sign up and get it in the cheap!
sunsetlearn.com/soon
@SunsetLearn
English

@falco_girgis I often see large parts of C++ renderers use runtime polymorphic types for rendering abstractions, seems odd to me. Most times you'll know the rendering API to use upfront and can use a policy-based templates to represent the abstractions well enough without virtual dispatch.
English

Notice I have never once weighed in on this argument and still did not draw a conclusion for anyone from this data... My actual argument for or against the usage of virtual functions and their overhead is extremely context-dependent. When used properly, I argue that they are not only performant, but they are OPTIMAL. When used improperly... yeah, any per-function cost is too much overhead to incur (although god damn, they're faster than I thought on DC. lol)
First of all, they are a form of RUNTIME polymorphism, and as such, they should only be used to solve problems that are actually runtime polymorphic, meaning that you cannot know the actual method to invoke on the object until runtime. Good examples of such scenarios are a plugin system or scripted behaviors for a game engine... I would argue that for this type of problem, not only are virtual functions fast as hell for the flexibility you're gaining, but they're also optimal.
In such a scenario, what is even the alternative? You can do what C programmers have been doing for decades... which is create a structure of function pointers, store a pointer to the struct within the object, and call a "method" on it by dereferencing the pointer to the function pointer struct then the proper method... What have we achieved here? The same goddamn thing the C++ compiler does for you with a vptr and vtable... It's not going to be any more performant but will be less flexible...
Now the alternative: what if you *do* know the type of the underlying object at compile-time? Then you are reaching for the wrong tool to solve the problem. You're using runtime polymorphism for a fundamentally compile-time polymorphic problem, and any overhead here is not justifiable for any high-performance application... A big example of this is device drivers for fixed platforms. Are you going to instantiate multiple types of CPUs or swap out peripherals at runtime? No? Consider reaching for an alternative tool.
Unfortunately the C++ language doesn't allow you to express compile-time polymorphism as gracefully it does dynamic polymorphism with OOP... This is typically when I favor the "Curiously Recurring Template Pattern" in C++ or CRTP, which uses templates to resolve the proper method to invoke on the object statically at *compile-time*. Fortunately C++23 has recently added "deducing this" which makes expressing the CRTP more elegant.
English

Are C++ virtual functions slow? It's time to settle the debate once and for all... By seeing how they perform on the Sega #Dreamcast! #cpp #retrocomputing

English

I have a fresh existential crisis every time I hop on shadertoy.com. There's like full-on animated SDF + ray-marched scenes and all my brain can muster is slowing things down with exponential decay. Some crazy talented people in the world.
English

@karpathy Nanotech startup that seeks to feed millions with novel molecular processes but incites public fears of turning everyone into random Scandinavian dishes is still on my bingo card 😅
English

@pervasivesense Yeah a few newsgroups I browsed earlier seemed to go 🍌 worrying about it around the 90s
English


65% sure this is just an ancient bidet
NO CONTEXT HUMANS@HumansNoContext
Who is this? Wrong answer only.
English



