[Mesa-dev] [PATCH mesa 07/16] amd/addrlib: use NDEBUG to guard asserts

Eric Engestrom eric.engestrom at imgtec.com
Fri Nov 24 18:07:47 UTC 2017


Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
---
 src/amd/addrlib/core/addrelemlib.cpp | 2 +-
 src/amd/addrlib/core/addrlib1.cpp    | 8 ++++----
 src/amd/addrlib/core/addrlib2.h      | 2 +-
 src/amd/addrlib/gfx9/gfx9addrlib.cpp | 4 ++--
 src/amd/addrlib/r800/egbaddrlib.cpp  | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/amd/addrlib/core/addrelemlib.cpp b/src/amd/addrlib/core/addrelemlib.cpp
index c9e6da4729a5e2ef2aef..910c6ffda27000a4349b 100644
--- a/src/amd/addrlib/core/addrelemlib.cpp
+++ b/src/amd/addrlib/core/addrelemlib.cpp
@@ -1219,7 +1219,7 @@ VOID ElemLib::AdjustSurfaceInfo(
                     basePitch = basePitch / expandX;
                     width     = width  / expandX;
                     height    = height / expandY;
-#if DEBUG
+#ifndef NDEBUG
                     width     = (width == 0) ? 1 : width;
                     height    = (height == 0) ? 1 : height;
 
diff --git a/src/amd/addrlib/core/addrlib1.cpp b/src/amd/addrlib/core/addrlib1.cpp
index 86cd66aee43c4487ffe5..4f9ecae10002a7b51c84 100644
--- a/src/amd/addrlib/core/addrlib1.cpp
+++ b/src/amd/addrlib/core/addrlib1.cpp
@@ -367,12 +367,12 @@ ADDR_E_RETURNCODE Lib::ComputeSurfaceInfo(
             pOut->pixelPitch    = pOut->pitch;
             pOut->pixelHeight   = pOut->height;
 
-#if DEBUG
+#ifndef NDEBUG
             if (localIn.flags.display)
             {
                 ADDR_ASSERT((pOut->pitchAlign % 32) == 0);
             }
-#endif //DEBUG
+#endif //NDEBUG
 
             if (localIn.format != ADDR_FMT_INVALID)
             {
@@ -2036,12 +2036,12 @@ ADDR_E_RETURNCODE Lib::ComputeCmaskInfo(
     UINT_32 slice = (*pPitchOut) * (*pHeightOut);
     UINT_32 blockMax = slice / 128 / 128 - 1;
 
-#if DEBUG
+#ifndef NDEBUG
     if (slice % (64*256) != 0)
     {
         ADDR_ASSERT_ALWAYS();
     }
-#endif //DEBUG
+#endif //NDEBUG
 
     UINT_32 maxBlockMax = HwlGetMaxCmaskBlockMax();
 
diff --git a/src/amd/addrlib/core/addrlib2.h b/src/amd/addrlib/core/addrlib2.h
index bea2a485a61aa10990a1..e9cbea8f62ef6ac2b3aa 100644
--- a/src/amd/addrlib/core/addrlib2.h
+++ b/src/amd/addrlib/core/addrlib2.h
@@ -707,7 +707,7 @@ class Lib : public Addr::Lib
 
     VOID VerifyMipLevelInfo(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
     {
-#if DEBUG
+#ifndef NDEBUG
         if (pIn->numMipLevels > 1)
         {
             UINT_32 actualMipLevels = 1;
diff --git a/src/amd/addrlib/gfx9/gfx9addrlib.cpp b/src/amd/addrlib/gfx9/gfx9addrlib.cpp
index e06f13c0afe01d026a0b..1d42cbfc8a3a50c84343 100644
--- a/src/amd/addrlib/gfx9/gfx9addrlib.cpp
+++ b/src/amd/addrlib/gfx9/gfx9addrlib.cpp
@@ -196,7 +196,7 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlComputeHtileInfo(
     metaBlkDim.w <<= widthAmp;
     metaBlkDim.h <<= heightAmp;
 
-#if DEBUG
+#ifndef NDEBUG
     Dim3d metaBlkDimDbg = {8, 8, 1};
     for (UINT_32 index = 0; index < numCompressBlkPerMetaBlkLog2; index++)
     {
@@ -311,7 +311,7 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlComputeCmaskInfo(
     metaBlkDim.w <<= widthAmp;
     metaBlkDim.h <<= heightAmp;
 
-#if DEBUG
+#ifndef NDEBUG
     Dim2d metaBlkDimDbg = {8, 8};
     for (UINT_32 index = 0; index < numCompressBlkPerMetaBlkLog2; index++)
     {
diff --git a/src/amd/addrlib/r800/egbaddrlib.cpp b/src/amd/addrlib/r800/egbaddrlib.cpp
index 854d4cbe8ad87f70db14..ab5e554da7b190562558 100644
--- a/src/amd/addrlib/r800/egbaddrlib.cpp
+++ b/src/amd/addrlib/r800/egbaddrlib.cpp
@@ -3861,7 +3861,7 @@ ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceInfo(
         // Resets pTileInfo to NULL if the internal tile info is used
         if (pOut->pTileInfo == &tileInfo)
         {
-#if DEBUG
+#ifndef NDEBUG
             // Client does not pass in a valid pTileInfo
             if (IsMacroTiled(pOut->tileMode))
             {
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list