!XFRnMvAfptAHthwBCx:matrix.org

Wgpu Users

118 Members
GPU architecture: https://docs.google.com/presentation/d/1qi2j-SZuzew7Rrf5VKEPDZAQQEitV40k9fKvwJNyicM/edit?usp=drivesdk9 Servers

Load older messages


SenderMessageTime
30 Sep 2020
@m4b:matrix.orgm4boh but that won't work either hah; because then the client can't add data, since it only has the type erased object, heh00:08:31
@cwfitzgerald:matrix.orgcwfitzgeraldWhy both the Arc and the box00:09:02
@m4b:matrix.orgm4barc makes it cloneable and Send00:09:31
@cwfitzgerald:matrix.orgcwfitzgeraldHuh? 00:09:45
@cwfitzgerald:matrix.orgcwfitzgeraldI'm saying Vec Arc Mutex dyn Plugin00:10:01
@m4b:matrix.orgm4boh yea, sorry, that would work; same issue i noted above though, so won't work00:10:31
@cwfitzgerald:matrix.orgcwfitzgeraldWhere's the add data coming from00:12:01
@m4b:matrix.orgm4bi already told you, the client needs to add whatever it needs to the plugin in order it to render stuff every frame00:12:35
@m4b:matrix.orgm4b in particular case, this is the prepare method, which passes a boxed imgui callback, for example, which is then consumed internally by imgui to make it ready to render 00:13:06
@m4b:matrix.orgm4b you can't add e.g., a method like fn add_data<T>(d: T) to the trait Plugin right, because it's no longer object safe then 00:13:41
@m4b:matrix.orgm4byou can get around this issue by using something like downcast-rs but that's a heavy hammer00:14:16
@m4b:matrix.orgm4bit's also too java-android-ui-y for me :P00:14:35
@cwfitzgerald:matrix.orgcwfitzgeraldso I think you're arriving at the main problem with trying to abstract like this00:15:58
@m4b:matrix.orgm4bwell i think it's perfect storm of trait objects, &mut renderpass<'a>, and mutexes00:16:31
@cwfitzgerald:matrix.orgcwfitzgeraldAs I'm not sure how useful of an abstraction this is, unless you somehow need to accept an arbitrary Plugin from your user00:16:50
@m4b:matrix.orgm4bwell it's extremely useful to me? my 3 applications no longer recompile a 40 second crate using this method, so it's pretty great00:17:41
@m4b:matrix.orgm4bbut yes the idea would be i could add other plugins later on, without hardcoding the plugin or ifdef-ing it in the renderer itself00:18:26
@m4b:matrix.orgm4b i'm just sad i can't get &mut Renderpass working :/ 00:18:36
@m4b:matrix.orgm4b i think the only way to do it is have Vec<Arc<Mutex<dyn Plugin>>>, lock in loop, render, etc.; then have the user downcast-rs to add whatever data they need (if i want the &mut Renderpass); otherwise i've become convinced the current version internalizing the arc + mutex is actually a better user api 00:19:46
@cwfitzgerald:matrix.orgcwfitzgeraldwhat is downcast-rs00:20:14
@m4b:matrix.orgm4bhttps://crates.io/crates/downcast-rs00:20:31
@cwfitzgerald:matrix.orgcwfitzgeraldseems a bit heavy handed to me, vs just dyn Any00:21:28
@m4b:matrix.orgm4b dyn Any is an upcast? downcasting turns an erased/abstract object into it's concrete type 00:22:09
@cwfitzgerald:matrix.orgcwfitzgerald yeah, Any has downcast_ref and whatev 00:22:37
@m4b:matrix.orgm4b it's like the entire android ui api, (MyActualButton) new Button(foo) haha 00:22:41
@m4b:matrix.orgm4bok well anyway, it doesn't seem like there's a nice solution to this problem00:23:42
@m4b:matrix.orgm4bi wonder what bevy does for a wgpu renderer plugin, does anyone know?00:23:54
@m4b:matrix.orgm4b * i wonder what bevy does for a wgpu renderer plugin, does anyone know?00:24:17
@cwfitzgerald:matrix.orgcwfitzgeraldI feel like it might just have a proper rendergraph00:25:35
@m4b:matrix.orgm4bi don't know what that means? if i want to use imgui in bevy, unless it supports it inside it's own renderer, how wouldn't they have the exact problem i just described?00:26:46

There are no newer messages yet.


Back to Room List