#How do you use context now vs the old way in the wgpu sdl example?

10 messages · Page 1 of 1 (latest)

median blade
median blade
#

naturally 0 answers lol

latent solstice
#

Your question isn't actually clear--what do you mean "the old way"? The callbacks are proc "c", so they don't have a context unless you assign one. This is still the case, and can't really change--the context is an implicit parameter that can't just be invisibly tacked on to a proc "c".

The example uses the state global to pass the context through to the callbacks. You can use runtime.default_context() if you want a default-initialized context (i.e. without any custom allocators, loggers, etc.), or any other method of doing so, but there's nothing really outdated here that I'm seeing.

median blade
latent solstice
#

No, it's just what you get upon entry into main, with no customizations applied. The default context

median blade
#

That sounds stripped to me, but idk

latent solstice
#

Stripped of any customizations you've made to it, I guess. It's not really going to affect performance, though--it's just a struct with a bunch of pointers

#

It's the same thing you have when you first enter main. Default allocator, default temp allocator, no logger, etc.

median blade
#

So every variable in the scope that the context is allocated to is available?

latent solstice
#

That depends on how you've set things up. Context is just a struct containing mostly pointers, so that's on you. It's typically set up in main, and when main exits so does the entire program