如何减少DirectX的加载时间?
我正在制作一个需要这些函数的 C++/Windows/DirectX 程序
d3d = Direct3DCreate9(D3D_SDK_VERSION);
,
d3d->CreateDevice(...);
当我运行该程序时,这些初始化函数需要特别长的时间才能工作(不长,但很明显)。有什么办法可以缩短这些加载时间吗?
该程序的基本结构是
INIT
WHILE TRUE
CHECK WIN. MESSG.
ONE FRAME OF GAME
END WHILE
RELEASE RESC.
I am making a C++/Windows/DirectX program that requires the functions
d3d = Direct3DCreate9(D3D_SDK_VERSION);
and
d3d->CreateDevice(...);
when I run the program, these to init functions take particularily long to work (not long, but noticible). Is there any way to shorten the loading time of these?
The basic structure of the program is
INIT
WHILE TRUE
CHECK WIN. MESSG.
ONE FRAME OF GAME
END WHILE
RELEASE RESC.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不可以。不幸的是,初始化 D3D 系统和创建设备是一项耗时的操作。它需要使用显卡驱动程序、初始化 D3D 等。您对此唯一的控制权可能是获得一个能够更快地进行内部初始化的驱动程序,或者改进您的硬件。
No. Unfortunately, initializing the D3D system and creating a device is a time consuming operation. It requires working with your drivers for your graphics card, initializing D3D, etc. About the only control you have over this is to possibly get a driver that does its internal initialization more quickly, or improving your hardware.
当 DirectX 初始化时,您总是可以启动一个线程来做一些工作...
You could always fire off a thread to do some work while DirectX is initialising ...
我认为与您随后可以依赖的性能相比,初始化 DirectX 所花费的时间可以忽略不计。除非您在应用程序运行时经常初始化,否则这实际上应该不是什么大问题。
I think the time spent initializing DirectX is neglectable compared to the performance you can depend on afterwards. It shouldn't really be much of a problem unless you initialize often during your application's running time.