Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Multiple devices for each control

$
0
0
Hey, I have a rather general question. I have several controls that I need to draw scenes to. So far I set up my object structure so that each control has it's own renderer and objects, like own device, swapchain, thus context, shader etc... Now I wonder if I could optimize my setup and objects to reuse, for example, the shaders to only be compiled once (which for example takes a lot of time), because all the instances of the windows need the same shaders. So I faced the issue that I cannot have the shader objects static and reuse with another instance since that instance has it's own Device and there is a policy that says that the objects needs to be created from the same Device or whatever, which makes sense to me. I ask though, If my approach is wrong in the first place and I should rebuild my structure a bit to have only one device, and so I can reuse the objects and don't have to do work twice or can save memory. Or is it valid? I am new to Windows programming and GPU programming, so I apologize. If I use a single static device I run into strang behavior in my code, because the context state maybe gets corrupted. I am not sure though, because I thought only the GUI Thread will work them, but maybe I can't say that it always works on the same control and finishes before it handles the next. So it would corrupted and mix states, which would maybe explain the issues I face now. Would the solution be some kind of referred contexts? And schedule them to draw when the state is finished? I don't want to optimize my runtime performance, this seems to be very well, even with the multi device approach, but maybe I can optimize the memory and setup time. I have a hard time finding any good advice online, so thanks for any suggestions or hints :-)

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>