开发者

OpenGL 3.2 in Delphi 2009 using FastMM 4.97 problem with UBOs in FullDebugMode

开发者 https://www.devze.com 2023-02-24 05:29 出处:网络
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 l

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 overwri开发者_开发问答tten with $80 sequence when freed.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消