Build: replace Blender specific DEBUG by standard NDEBUG #115774

Merged
Brecht Van Lommel merged 2 commits from brecht/blender:ndebug into main 2023-12-06 16:05:26 +01:00

Build: replace Blender specific DEBUG by standard NDEBUG

NDEBUG is part of the C standard and disables asserts. Only this will
now be used to decide if asserts are enabled.

DEBUG was a Blender specific define, that has now been removed.

_DEBUG is a Visual Studio define for builds in Debug configuration.
Blender defines this for all platforms. This is still used in a few
places in the draw code, and in external libraries Bullet and Mantaflow.

Build: replace Blender specific DEBUG by standard NDEBUG NDEBUG is part of the C standard and disables asserts. Only this will now be used to decide if asserts are enabled. DEBUG was a Blender specific define, that has now been removed. _DEBUG is a Visual Studio define for builds in Debug configuration. Blender defines this for all platforms. This is still used in a few places in the draw code, and in external libraries Bullet and Mantaflow.
Author
Owner

@blender-bot build

@blender-bot build
Brecht Van Lommel force-pushed ndebug from fcc77f4ff8 to d1f1f1387e 2023-12-05 02:35:41 +01:00 Compare
Author
Owner

Guessing some developers that might have opinions on this: @ideasman42 @mont29 @JacquesLucke @HooglyBoogly

I'm trying to move forward #115071, so that we can enable asserts on the buildbot. To me it seems that we should either define both DEBUG and NDEBUG as exact opposites of each other, or only define NDEBUG as this PR does.

I don't feel very strongly about it either way, just slightly prefer using only the standard C NDEBUG.

Guessing some developers that might have opinions on this: @ideasman42 @mont29 @JacquesLucke @HooglyBoogly I'm trying to move forward #115071, so that we can enable asserts on the buildbot. To me it seems that we should either define both DEBUG and NDEBUG as exact opposites of each other, or only define NDEBUG as this PR does. I don't feel very strongly about it either way, just slightly prefer using only the standard C NDEBUG.
Author
Owner

@fclem @pragma37 I'm not confident at all about the changes in 15e079fd4f421edd529edadc546153294c95a9f7. But if we are going to allow asserts outside the Debug configuration, we need to clarify somehow what happens with these somewhat unusual uses of the DEBUG flag. Which CMake option(s) do you want to control this?

@ideasman42 the BMesh threading changes in 5fb1285ca9fa8629059b735ad60775da3c017407 are undoing a change made by you. Not sure if you feel strongly about keeping threading always enabled in Debug configuration for this handful of BMesh functions, and if so which CMake option it should be tied to. Nowadays we have threading in many more places and doing it just here seems a bit strange.

@fclem @pragma37 I'm not confident at all about the changes in 15e079fd4f421edd529edadc546153294c95a9f7. But if we are going to allow asserts outside the Debug configuration, we need to clarify somehow what happens with these somewhat unusual uses of the DEBUG flag. Which CMake option(s) do you want to control this? @ideasman42 the BMesh threading changes in 5fb1285ca9fa8629059b735ad60775da3c017407 are undoing a change made by you. Not sure if you feel strongly about keeping threading always enabled in Debug configuration for this handful of BMesh functions, and if so which CMake option it should be tied to. Nowadays we have threading in many more places and doing it just here seems a bit strange.

Am totally up to keep only one debug flag, and indeed keeping the C standard NDEBUG one makes the most sense imo.

So big +1 for this cleanup from me.

Am totally up to keep only one debug flag, and indeed keeping the C standard `NDEBUG` one makes the most sense imo. So big +1 for this cleanup from me.
Member

I think WITH_DRAW_DEBUG is supposed to be specifically about Draw Manager features.
So I guess it's ok to use it directly in the DrawManager (@fclem ?), but I don't think it makes too much sense to use it for the Workbench case.
That one is there only to be able to debug f12 renders in NSight, so a simple #define USE_GPU_FINISH_DELIMITER 0 and then #if USE_GPU_FINISH_DELIMITER would be ok if you don't want to use #ifndef NDEBUG.

I think `WITH_DRAW_DEBUG` is supposed to be specifically about Draw Manager features. So I guess it's ok to use it directly in the `DrawManager` (@fclem ?), but I don't think it makes too much sense to use it for the Workbench case. That one is there only to be able to debug f12 renders in NSight, so a simple `#define USE_GPU_FINISH_DELIMITER 0` and then `#if USE_GPU_FINISH_DELIMITER` would be ok if you don't want to use `#ifndef NDEBUG`.
Brecht Van Lommel force-pushed ndebug from d1f1f1387e to 6ba31a0863 2023-12-06 15:36:31 +01:00 Compare
Brecht Van Lommel changed title from WIP: Build: replace Blender specific DEBUG by standard NDEBUG to Build: replace Blender specific DEBUG by standard NDEBUG 2023-12-06 15:37:06 +01:00
Author
Owner

I've left the draw manager behavior unchanged now so I can merge this and test buildbot side changes.

The draw manager is using _DEBUG instead of the removed DEBUG. Still probably a good idea to eliminate different behavior depending on the build configuration, but no longer a blocker for #115071.

I've left the draw manager behavior unchanged now so I can merge this and test buildbot side changes. The draw manager is using `_DEBUG` instead of the removed `DEBUG`. Still probably a good idea to eliminate different behavior depending on the build configuration, but no longer a blocker for #115071.
Brecht Van Lommel merged commit e06561a27a into main 2023-12-06 16:05:26 +01:00
Brecht Van Lommel deleted branch ndebug 2023-12-06 16:05:28 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#115774
No description provided.