Delphi 2009 中的 OpenGL 3.2 使用 FastMM 4.97 FullDebugMode 中的 UBO 问题

发布于 2024-10-31 21:45:41 字数 774 浏览 1 评论 0原文

我正在使用 Delphi 2009 中的 OpenGL 3.2 应用程序。当使用定义了 FullDebugMode 的 FastMM 4.97 时,UBO 无法正确获取数据。当 FullDebugMode 未定义时,一切都像魅力一样工作。

例子: 在渲染帧类中设置指向两个私有整数字段 FWidth 和 FHeight 的视口尺寸。

glBufferSubData(GL_UNIFORM_BUFFER, VUniform.Offset, VUniform.Size, @FWidth);

我已经为这个问题绞尽脑汁好几天了,我真的不知道如何继续。我并不期望这里有完整的 OpenGL 支持,但希望有人可以根据在 FullDebugMode 下运行和不运行之间的已知差异提出一些建议。

项目设置:

[Compiling]
Optimization    False
Stack frames    True
Use debug .dcus True
[Linking]
Debug info      True
Map file        Detailed

操作系统为Windows 7 64位。

编辑: 找到了! 它与 OpenGL 完全无关。在我们的代码库的其他地方,一个函数使用 Result := @AnsiString(Object.Name)[1]; 返回一个 PAnsiChar,这在大多数情况下都能正常运行,因为内存只是被释放但没有改变。在 FullDebugMode 中,数据在释放时被 $80 序列覆盖。

I'm sitting with an OpenGL 3.2 application in Delphi 2009. When using FastMM 4.97 with FullDebugMode defined the UBOs does not get their data properly. With FullDebugMode undefined everything works like a charm.

Example:
Setting the viewport dimensions pointing to two private integer fields, FWidth and FHeight, in our render frame class.

glBufferSubData(GL_UNIFORM_BUFFER, VUniform.Offset, VUniform.Size, @FWidth);

I've been pulling my hair over this issue for a few days now and I really don't know how to proceed. I'm not expecting full OpenGL support here but hopefully someone can come with some suggestion based on known differences between running in FullDebugMode and not.

Project settings:

[Compiling]
Optimization    False
Stack frames    True
Use debug .dcus True
[Linking]
Debug info      True
Map file        Detailed

OS is Windows 7 64 bit.

Edit:
Found it!
It had nothing at all to do with OpenGL. Elsewhere in our codebase a function returned a PAnsiChar using Result := @AnsiString(Object.Name)[1]; This worked most of the time running normally since the memory was only released but unchanged. In FullDebugMode the data was overwritten with $80 sequence when freed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

战皆罪 2024-11-07 21:45:41

您可能正在查看已过早释放的内存(由您自己的应用程序)。

通常,您仍然可以访问旧值,直到它们被新的分配+写入覆盖。即使您正在访问陈旧(已释放)的内存部分,这也很可能使您的应用程序正常运行。

但是,在 FullDebugMode 中,已释放的内存将填充字节 $80 序列。如果您知道中断的 glBufferSubData 的确切调用,您可以轻松检查这一点,只需查看此时的内存即可。

You are probably looking at memory that has been freed prematurely (by your own application).

Normally, you'd still be able to access the old values until they are overwritten by a new allocation + writes. This could very well allow your application to run properly, even though you are accessing stale (freed) parts of memory.

However, in FullDebugMode, deallocated memory is filled with a byte $80 sequence. You can easily check for this if you know the exact call to glBufferSubData that breaks, simply take a look at the memory at that point.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文