带有调试器的C ++/opengl应用程序运行更流畅 [英] C++/opengl application running smoother with debugger attached

查看:58
本文介绍了带有调试器的C ++/opengl应用程序运行更流畅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您是否遇到过这样的情况,即从Visual Studio中执行时,C ++ opengl应用程序运行得更快,更流畅?如果在没有调试器的情况下正常执行,我会得到较低的帧率,而不是80,而是50,还有一个奇怪的滞后,即fps每20-30帧跳至约25帧/秒.有办法解决这个问题吗?

Have you experienced a situation, where C++ opengl application is running faster and smoother when executed from visual studio? When executed normally, without debugger, I get lower framerate, 50 instead of 80, and a strange lagging, where fps is diving to about 25 frames/sec every 20-30th frame. Is there a way to fix this?

修改: 另外,我们使用了很多显示列表(使用glNewList创建).并且增加显示列表的数量似乎会增加滞后.

Edit: Also we are using quite many display lists (created with glNewList). And increasing the number of display lists seem to increase lagging.

修改: 该问题似乎是由页面错误引起的.使用SetProcessWorkingSetSizeEx()调整流程工作集无济于事.

Edit: The problem seems to be caused by page faults. Adjusting process working set with SetProcessWorkingSetSizeEx() doesn't help.

修改: 对于某些大型模型,使用procexp-utility的GPU内存使用很容易发现问题.每帧有很多glCallList调用时,内存使用情况非常不稳定.没有添加新的几何体,没有加载纹理,但是gpu内存分配的波动范围为+ -20 MB.过了一会儿,情况变得更糟,可能一口气分配大约150Mb.

Edit: With some large models the problem is easy to spot with procexp-utility's GPU-memory usage. Memory usage is very unstable when there are many glCallList-calls per frame. No new geometry is added, no textures loaded, but gpu-memory-allocation fluctuates +-20 Mbytes. After a while it becomes even worse, and may allocate something like 150Mb in one go.

推荐答案

我相信您所看到的是调试器锁定了某些页面,因此无法交换它们以便调试器可以立即访问.这给进程切换时的OS带来了一些警告,通常不建议这样做.

I believe that what you are seeing is the debugger locking some pages so they couldn't be swapped to be immediately accessible to the debugger. This brings some caveats for OS at the time of process switching and is, in general, not reccommended.

您可能不希望听到我这样说,但是即使您这样做,也没有解决此问题的好方法.

You will probably not like to hear me saying this, but there is no good way to fix this, even if you do.

使用VBO,或至少使用顶点数组,可以期望在驱动程序中对VBO进行更好的优化(让我们面对现实-显示列表已过时).显示列表可以轻松包装以生成顶点缓冲区,因此只需要修改少量旧代码.另外,您可以使用旨在避免驱动程序中的页面错误(GL_EXT_direct_state_access)的无边框图形".

Use VBOs, or at least vertex arrays, those can be expected to be optimized much better in the driver (let's face it - display lists are getting obsolete). Display lists can be easily wrapped to generate vertex buffers so only a little of the old code needs to be modified. Also, you can use "bindless graphics" which was designed to avoid page faults in the driver (GL_EXT_direct_state_access).

这篇关于带有调试器的C ++/opengl应用程序运行更流畅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆