Skip to content

Commit

Permalink
Re-enable DebugRegistry::setProperty for release build (#8086)
Browse files Browse the repository at this point in the history
`DebugRegistry::setProperty` is no longer just applicable to debug
builds.

This change was previously added in 6c0bd36 but then reverted
in a7317e7. We re-enable it and separate it from the shadow
changes in this commit.
  • Loading branch information
poweifeng authored Aug 28, 2024
1 parent 0e0f3a5 commit 283d240
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions filament/src/details/DebugRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
#include <string_view>
#include <utility>

#ifndef NDEBUG
# define DEBUG_PROPERTIES_WRITABLE true
#else
# define DEBUG_PROPERTIES_WRITABLE false
#endif

using namespace filament::math;
using namespace utils;

Expand Down Expand Up @@ -79,17 +73,15 @@ bool FDebugRegistry::hasProperty(const char* name) const noexcept {

template<typename T>
bool FDebugRegistry::setProperty(const char* name, T v) noexcept {
if constexpr (DEBUG_PROPERTIES_WRITABLE) {
auto info = getPropertyInfo(name);
T* const addr = static_cast<T*>(info.first);
if (addr) {
auto old = *addr;
*addr = v;
if (info.second && old != v) {
info.second();
}
return true;
auto info = getPropertyInfo(name);
T* const addr = static_cast<T*>(info.first);
if (addr) {
auto old = *addr;
*addr = v;
if (info.second && old != v) {
info.second();
}
return true;
}
return false;
}
Expand Down

0 comments on commit 283d240

Please sign in to comment.