You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hotcakes at the discord channel had some issues with MaskPixmap - as they did not check if the passed pixmap is a valid one.
As brl.pixmap (pixmap.bmx) defines MaskPixmap as noDebug a debug build does not catch it.
I am now looking for "proper" ways to have "valid object checks" (in debug builds only...) while keeping the performance benefit of "nodebug" in debug builds.
I came up with this:
FunctionMaskPixmap:TPixmap( pixmap:TPixmap,mask_red,mask_green,mask_blue )
assert pixmap Else"pixmap is null"Return __MaskPixmap( pixmap, mask_red, mask_green, mask_blue)
End Function
Function__MaskPixmap:TPixmap( pixmap:TPixmap,mask_red,mask_green,mask_blue ) Inline NoDebug
Local tmp:TPixmap=pixmap
If tmp.format<>PF_RGBA8888 tmp=tmp.Convert( PF_RGBA8888 )
Local out:TPixmap=CreatePixmap( tmp.width,tmp.height,PF_RGBA8888 )
...
'rest of the original MaskPixmap function
Inline will make the GCC marking the function able to get inlined (so we should get rid of the "function call" overhead) NoDebug will keep the for-loops in the original function logic "fast" in debug builds.
Another option might be to use the hackish
?debug
'!direct-c-code`
?
approach to build an assert-style thingy in C - which is only existing in "debug builds" then.
I know - only 6 functions in brl and pub.mod are "nodebug" (4 in pixmap and 2 in freeprocess) so maybe simply making them "debug" again is the way to go - but I am trying to find a way to improve the situation for "debug builds" (maybe some other code could benefit from a "nodebug" too.. )
The text was updated successfully, but these errors were encountered:
Hotcakes at the discord channel had some issues with
MaskPixmap
- as they did not check if the passed pixmap is a valid one.As brl.pixmap (pixmap.bmx) defines
MaskPixmap
asnoDebug
a debug build does not catch it.I am now looking for "proper" ways to have "valid object checks" (in debug builds only...) while keeping the performance benefit of "nodebug" in debug builds.
I came up with this:
Inline
will make the GCC marking the function able to get inlined (so we should get rid of the "function call" overhead)NoDebug
will keep the for-loops in the original function logic "fast" in debug builds.Another option might be to use the hackish
approach to build an assert-style thingy in C - which is only existing in "debug builds" then.
I know - only 6 functions in brl and pub.mod are "nodebug" (4 in pixmap and 2 in freeprocess) so maybe simply making them "debug" again is the way to go - but I am trying to find a way to improve the situation for "debug builds" (maybe some other code could benefit from a "nodebug" too.. )
The text was updated successfully, but these errors were encountered: