swr: [rasterizer] Slight assert refactoring
authorTim Rowley <timothy.o.rowley@intel.com>
Mon, 27 Feb 2017 18:11:47 +0000 (10:11 -0800)
committerTim Rowley <timothy.o.rowley@intel.com>
Mon, 20 Mar 2017 23:04:53 +0000 (18:04 -0500)
Make asserts more robust.

Add SWR_INVALID(...) as a replacement for SWR_ASSERT(0, ...)

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
17 files changed:
src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp
src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h
src/gallium/drivers/swr/rasterizer/common/swr_assert.cpp
src/gallium/drivers/swr/rasterizer/common/swr_assert.h
src/gallium/drivers/swr/rasterizer/core/api.cpp
src/gallium/drivers/swr/rasterizer/core/binner.cpp
src/gallium/drivers/swr/rasterizer/core/format_types.h
src/gallium/drivers/swr/rasterizer/core/frontend.cpp
src/gallium/drivers/swr/rasterizer/core/pa.h
src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp
src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp
src/gallium/drivers/swr/rasterizer/core/tessellator.h
src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template

index acd0a0f50f352611a3b90ae35e14f10e48c2790b..20b14a3a28c975358181eb493a5fbeeef9095de8 100644 (file)
@@ -285,7 +285,7 @@ namespace ArchRast
             return pManager;
         }
 
-        SWR_ASSERT(0, "Failed to register thread.");
+        SWR_INVALID("Failed to register thread.");
         return nullptr;
     }
 
index 88edc03f4f4bad026f7994404d8159d508e479f8..b361188c3ddfe011cf17c89a13b50b85d0b5ef26 100644 (file)
@@ -80,7 +80,7 @@ namespace ArchRast
     private:
 
         // Handlers stay registered for life
-        void Detach(EventHandler* pHandler) { SWR_ASSERT(0); }
+        void Detach(EventHandler* pHandler) { SWR_INVALID("Should not be called"); }
 
         std::vector<EventHandler*> mHandlers;
     };
index 98a5a52957fe2707b29abae31b54712fe5ab6e8d..43b74a68fdec4edd9ab17ec008a8a80614fed08e 100644 (file)
 #pragma comment(lib, "user32.lib")
 #endif // _WIN32
 
-enum TextColor
-{
-    TEXT_BLACK      = 0,
-    TEXT_RED        = 1,
-    TEXT_GREEN      = 2,
-    TEXT_BLUE       = 4,
-    TEXT_PURPLE     = TEXT_RED | TEXT_BLUE,
-    TEXT_CYAN       = TEXT_GREEN | TEXT_BLUE,
-    TEXT_YELLOW     = TEXT_RED | TEXT_GREEN,
-    TEXT_WHITE      = TEXT_RED | TEXT_GREEN | TEXT_BLUE,
-};
-
-enum TextStyle
-{
-    TEXT_NORMAL     = 0,
-    TEXT_INTENSITY  = 1,
-};
-
-void SetTextColor(FILE* stream, TextColor color = TEXT_WHITE, TextStyle style = TEXT_NORMAL)
+namespace ConsoleUtils
 {
+    enum class TextColor
+    {
+        BLACK      = 0,
 #if defined(_WIN32)
+        RED        = 4,
+        GREEN      = 2,
+        BLUE       = 1,
+#else
+        RED        = 1,
+        GREEN      = 2,
+        BLUE       = 4,
+#endif // _WIN32
+        PURPLE     = static_cast<uint32_t>(RED) | static_cast<uint32_t>(BLUE),
+        CYAN       = static_cast<uint32_t>(GREEN) | static_cast<uint32_t>(BLUE),
+        YELLOW     = static_cast<uint32_t>(RED) | static_cast<uint32_t>(GREEN),
+        WHITE      = static_cast<uint32_t>(RED) | static_cast<uint32_t>(GREEN) | static_cast<uint32_t>(BLUE),
+    };
 
-    HANDLE hConsoleHandle = nullptr;
-    if (stream == stderr)
-    {
-        hConsoleHandle = GetStdHandle(STD_ERROR_HANDLE);
-    }
-    else if (stream == stdout)
-    {
-        hConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
-    }
-    else
+    enum class TextStyle
     {
-        // Not a console stream, do nothing
-        return;
-    }
+        NORMAL     = 0,
+        INTENSITY  = 1,
+    };
 
-    WORD textAttributes = 0;
-    if (color & TEXT_RED)
-    {
-        textAttributes |= FOREGROUND_RED;
-    }
-    if (color & TEXT_GREEN)
-    {
-        textAttributes |= FOREGROUND_GREEN;
-    }
-    if (color & TEXT_BLUE)
-    {
-        textAttributes |= FOREGROUND_BLUE;
-    }
-    if (style & TEXT_INTENSITY)
+    void SetTextColor(FILE* stream, TextColor color = TextColor::WHITE, TextStyle style = TextStyle::NORMAL)
     {
-        textAttributes |= FOREGROUND_INTENSITY;
-    }
-    SetConsoleTextAttribute(hConsoleHandle, textAttributes);
+#if defined(_WIN32)
+
+        HANDLE hConsoleHandle = nullptr;
+        if (stream == stderr)
+        {
+            hConsoleHandle = GetStdHandle(STD_ERROR_HANDLE);
+        }
+        else if (stream == stdout)
+        {
+            hConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
+        }
+        else
+        {
+            // Not a console stream, do nothing
+            return;
+        }
+
+        WORD textAttributes = static_cast<WORD>(color);
+        if (style == TextStyle::INTENSITY)
+        {
+            textAttributes |= FOREGROUND_INTENSITY;
+        }
+        SetConsoleTextAttribute(hConsoleHandle, textAttributes);
 
 #else // !_WIN32
 
-    // Print ANSI codes
-    uint32_t cc = 30 + (style ? 60 : 0) + color;
-    fprintf(stream, "\033[0m\033[%d;%dm", style, cc);
+        // Print ANSI codes
+        uint32_t cc = 30 + ((style == TextStyle::INTENSITY) ? 60 : 0) + static_cast<uint32_t>(color);
+        fprintf(stream, "\033[0m\033[%d;%dm", static_cast<uint32_t>(style), cc);
 
 #endif
-}
+    }
 
-void ResetTextColor(FILE* stream)
-{
+    void ResetTextColor(FILE* stream)
+    {
 #if defined(_WIN32)
 
-    SetTextColor(stream);
+        SetTextColor(stream);
 
 #else // !_WIN32
 
-    // Print ANSI codes
-    fprintf(stream, "\033[0m");
+        // Print ANSI codes
+        fprintf(stream, "\033[0m");
 
 #endif
-}
+    }
 
-static std::mutex g_stderrMutex;
+    static std::mutex g_stderrMutex;
+} // ns ConsoleUtils
 
-void SwrTrace(
-    const char* pFileName,
-    uint32_t    lineNum,
-    const char* function,
-    const char* pFmtString,
-    ...)
+bool SwrAssert(
+        bool        chkDebugger,
+        bool&       enabled,
+        const char* pExpression,
+        const char* pFileName,
+        uint32_t    lineNum,
+        const char* pFunction,
+        const char* pFmtString,
+        ...)
 {
+    using namespace ConsoleUtils;
     std::lock_guard<std::mutex> l(g_stderrMutex);
 
-    SetTextColor(stderr, TEXT_CYAN, TEXT_NORMAL);
+    SetTextColor(stderr, TextColor::CYAN, TextStyle::NORMAL);
+
+    fprintf(stderr, "%s(%d): ", pFileName, lineNum);
+
+    SetTextColor(stderr, TextColor::RED, TextStyle::INTENSITY);
+
+    fprintf(stderr, "ASSERT: %s\n", pExpression);
 
-    fprintf(stderr, "%s(%d): TRACE in %s:\n", pFileName, lineNum, function);
+    SetTextColor(stderr, TextColor::CYAN, TextStyle::INTENSITY);
+    fprintf(stderr, "\t%s\n", pFunction);
 
     if (pFmtString)
     {
-        SetTextColor(stderr, TEXT_PURPLE, TEXT_INTENSITY);
+        SetTextColor(stderr, TextColor::YELLOW, TextStyle::INTENSITY);
         fprintf(stderr, "\t");
         va_list args;
         va_start(args, pFmtString);
@@ -141,76 +149,6 @@ void SwrTrace(
     ResetTextColor(stderr);
     fflush(stderr);
 
-#if defined(_WIN32)
-    static const int MAX_MESSAGE_LEN = 2048;
-    char msgBuf[MAX_MESSAGE_LEN];
-
-    sprintf_s(msgBuf, "%s(%d): TRACE in %s\n", pFileName, lineNum, function);
-    msgBuf[MAX_MESSAGE_LEN - 2] = '\n';
-    msgBuf[MAX_MESSAGE_LEN - 1] = 0;
-    OutputDebugStringA(msgBuf);
-
-    int offset = 0;
-
-    if (pFmtString)
-    {
-        va_list args;
-        va_start(args, pFmtString);
-        offset = _vsnprintf_s(
-            msgBuf,
-            sizeof(msgBuf),
-            sizeof(msgBuf),
-            pFmtString,
-            args);
-        va_end(args);
-
-        if (offset < 0) { return; }
-
-        OutputDebugStringA("\t");
-        OutputDebugStringA(msgBuf);
-        OutputDebugStringA("\n");
-    }
-#endif // _WIN32
-}
-
-bool SwrAssert(
-    bool        chkDebugger,
-    bool&       enabled,
-    const char* pExpression,
-    const char* pFileName,
-    uint32_t    lineNum,
-    const char* pFunction,
-    const char* pFmtString /* = nullptr */,
-    ...)
-{
-    {
-        std::lock_guard<std::mutex> l(g_stderrMutex);
-
-        SetTextColor(stderr, TEXT_CYAN, TEXT_NORMAL);
-
-        fprintf(stderr, "%s(%d): ", pFileName, lineNum);
-
-        SetTextColor(stderr, TEXT_RED, TEXT_INTENSITY);
-
-        fprintf(stderr, "ASSERT: %s\n", pExpression);
-
-        SetTextColor(stderr, TEXT_CYAN, TEXT_INTENSITY);
-        fprintf(stderr, "\t%s\n", pFunction);
-
-        if (pFmtString)
-        {
-            SetTextColor(stderr, TEXT_YELLOW, TEXT_INTENSITY);
-            fprintf(stderr, "\t");
-            va_list args;
-            va_start(args, pFmtString);
-            vfprintf(stderr, pFmtString, args);
-            va_end(args);
-            fprintf(stderr, "\n");
-        }
-        ResetTextColor(stderr);
-        fflush(stderr);
-    }
-
 #if defined(_WIN32)
     static const int MAX_MESSAGE_LEN = 2048;
     char msgBuf[MAX_MESSAGE_LEN];
@@ -232,11 +170,11 @@ bool SwrAssert(
         va_list args;
         va_start(args, pFmtString);
         offset = _vsnprintf_s(
-            msgBuf,
-            sizeof(msgBuf),
-            sizeof(msgBuf),
-            pFmtString,
-            args);
+                msgBuf,
+                sizeof(msgBuf),
+                sizeof(msgBuf),
+                pFmtString,
+                args);
         va_end(args);
 
         if (offset < 0) { return true; }
@@ -249,19 +187,19 @@ bool SwrAssert(
     if (enabled && KNOB_ENABLE_ASSERT_DIALOGS)
     {
         int retval = sprintf_s(
-            &msgBuf[offset],
-            MAX_MESSAGE_LEN - offset,
-            "\n\n"
-            "File: %s\n"
-            "Line: %d\n"
-            "\n"
-            "Expression: %s\n\n"
-            "Cancel: Disable this assert for the remainder of the process\n"
-            "Try Again: Break into the debugger\n"
-            "Continue: Continue execution (but leave assert enabled)",
-            pFileName,
-            lineNum,
-            pExpression);
+                &msgBuf[offset],
+                MAX_MESSAGE_LEN - offset,
+                "\n\n"
+                "File: %s\n"
+                "Line: %d\n"
+                "\n"
+                "Expression: %s\n\n"
+                "Cancel: Disable this assert for the remainder of the process\n"
+                "Try Again: Break into the debugger\n"
+                "Continue: Continue execution (but leave assert enabled)",
+                pFileName,
+                lineNum,
+                pExpression);
 
         if (retval < 0) { return true; }
 
@@ -270,24 +208,24 @@ bool SwrAssert(
         if (!IsDebuggerPresent())
         {
             sprintf_s(
-                &msgBuf[offset],
-                MAX_MESSAGE_LEN - offset,
-                "\n\n*** NO DEBUGGER DETECTED ***\n\nPressing \"Try Again\" will cause a program crash!");
+                    &msgBuf[offset],
+                    MAX_MESSAGE_LEN - offset,
+                    "\n\n*** NO DEBUGGER DETECTED ***\n\nPressing \"Try Again\" will cause a program crash!");
         }
 
         retval = MessageBoxA(nullptr, msgBuf, "Assert Failed", MB_CANCELTRYCONTINUE | MB_ICONEXCLAMATION | MB_SETFOREGROUND);
 
         switch (retval)
         {
-        case IDCANCEL:
-            enabled = false;
-            return false;
+            case IDCANCEL:
+                enabled = false;
+                return false;
 
-        case IDTRYAGAIN:
-            return true;
+            case IDTRYAGAIN:
+                return true;
 
-        case IDCONTINUE:
-            return false;
+            case IDCONTINUE:
+                return false;
         }
     }
     else
@@ -299,4 +237,63 @@ bool SwrAssert(
     return enabled;
 }
 
+void SwrTrace(
+        const char* pFileName,
+        uint32_t    lineNum,
+        const char* pFunction,
+        const char* pFmtString,
+        ...)
+{
+    using namespace ConsoleUtils;
+    std::lock_guard<std::mutex> l(g_stderrMutex);
+
+    SetTextColor(stderr, TextColor::CYAN, TextStyle::NORMAL);
+
+    fprintf(stderr, "%s(%d): TRACE in %s:\n", pFileName, lineNum, pFunction);
+
+    if (pFmtString)
+    {
+        SetTextColor(stderr, TextColor::PURPLE, TextStyle::INTENSITY);
+        fprintf(stderr, "\t");
+        va_list args;
+        va_start(args, pFmtString);
+        vfprintf(stderr, pFmtString, args);
+        va_end(args);
+        fprintf(stderr, "\n");
+    }
+    ResetTextColor(stderr);
+    fflush(stderr);
+
+#if defined(_WIN32)
+    static const int MAX_MESSAGE_LEN = 2048;
+    char msgBuf[MAX_MESSAGE_LEN];
+
+    sprintf_s(msgBuf, "%s(%d): TRACE in %s\n", pFileName, lineNum, pFunction);
+    msgBuf[MAX_MESSAGE_LEN - 2] = '\n';
+    msgBuf[MAX_MESSAGE_LEN - 1] = 0;
+    OutputDebugStringA(msgBuf);
+
+    int offset = 0;
+
+    if (pFmtString)
+    {
+        va_list args;
+        va_start(args, pFmtString);
+        offset = _vsnprintf_s(
+                msgBuf,
+                sizeof(msgBuf),
+                sizeof(msgBuf),
+                pFmtString,
+                args);
+        va_end(args);
+
+        if (offset < 0) { return; }
+
+        OutputDebugStringA("\t");
+        OutputDebugStringA(msgBuf);
+        OutputDebugStringA("\n");
+    }
+#endif // _WIN32
+}
+
 #endif // SWR_ENABLE_ASSERTS
index bd6833615a17029cd8a82376ec7875752adc8a55..89ae10efb23042f1bcb28868ee24ea1e9d72e6dc 100644 (file)
 //
 //=============================================================================
 
+// Stupid preprocessor tricks to avoid -Wall / -W4 warnings
+#if defined(_MSC_VER)
+#define _SWR_WARN_DISABLE __pragma(warning(push)) __pragma(warning(disable:4127))
+#define _SWR_WARN_RESTORE __pragma(warning(pop))
+#else // ! MSVC compiler
+#define _SWR_WARN_DISABLE
+#define _SWR_WARN_RESTORE
+#endif
+
+#define _SWR_MACRO_START do {
+#define _SWR_MACRO_END  \
+    _SWR_WARN_DISABLE   \
+    } while(0)          \
+    _SWR_WARN_RESTORE
+
+
 #if defined(_WIN32)
-#define SWR_ASSUME(e, ...) __assume(e)
+#define SWR_ASSUME(e, ...) _SWR_MACRO_START __assume(e); _SWR_MACRO_END
 #elif defined(__clang__)
-#define SWR_ASSUME(e, ...) __builtin_assume(e)
+#define SWR_ASSUME(e, ...) _SWR_MACRO_START __builtin_assume(e); _SWR_MACRO_END
 #elif defined(__GNUC__)
-#define SWR_ASSUME(e, ...) ((e) ? ((void)0) : __builtin_unreachable())
+#define SWR_ASSUME(e, ...) _SWR_MACRO_START ((e) ? ((void)0) : __builtin_unreachable()); _SWR_MACRO_END
 #else
-#define SWR_ASSUME(e, ...) ASSUME(e)
+#define SWR_ASSUME(e, ...) _SWR_MACRO_START ASSUME(e); _SWR_MACRO_END
 #endif
 
 #if !defined(SWR_ENABLE_ASSERTS)
@@ -111,14 +127,22 @@ void SwrTrace(
     const char* pFmtString,
     ...);
 
-#define _SWR_ASSERT(chkDebugger, e, ...) {\
+#define _SWR_ASSERT(chkDebugger, e, ...)    \
+    _SWR_MACRO_START \
     bool expFailed = !(e);\
     if (expFailed) {\
         static bool swrAssertEnabled = true;\
         expFailed = SwrAssert(chkDebugger, swrAssertEnabled, #e, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);\
         if (expFailed) { DEBUGBREAK; }\
     }\
-}
+    _SWR_MACRO_END
+
+#define _SWR_INVALID(chkDebugger, ...)    \
+    _SWR_MACRO_START \
+    static bool swrAssertEnabled = true;\
+    bool expFailed = SwrAssert(chkDebugger, swrAssertEnabled, "", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);\
+    if (expFailed) { DEBUGBREAK; }\
+    _SWR_MACRO_END
 
 #define _SWR_TRACE(_fmtstr, ...) \
     SwrTrace(__FILE__, __LINE__, __FUNCTION__, _fmtstr, ##__VA_ARGS__);
@@ -139,24 +163,40 @@ void SwrTrace(
 #define SWR_REL_ASSERT(e, ...)          _SWR_ASSERT(false, e, ##__VA_ARGS__)
 #define SWR_REL_ASSUME_ASSERT(e, ...)   SWR_REL_ASSERT(e, ##__VA_ARGS__)
 #define SWR_REL_TRACE(_fmtstr, ...)     _SWR_TRACE(_fmtstr, ##__VA_ARGS__)
+
+// SWR_INVALID is always enabled
+#define SWR_INVALID(fmtStr, ...)                _SWR_INVALID(false, fmtStr, ##__VA_ARGS__)
 #endif
 
 #endif // C++
 
 #endif // SWR_ENABLE_ASSERTS || SWR_ENABLE_REL_ASSERTS
 
+// Needed to allow passing bitfield members to sizeof() in disabled asserts
+template<typename T>
+static bool SwrSizeofWorkaround(T) {return false;}
+
 #if !SWR_ENABLE_ASSERTS
-#define SWR_ASSERT(e, ...)              (void)(0)
+#define SWR_ASSERT(e, ...)              _SWR_MACRO_START (void)sizeof(SwrSizeofWorkaround(e)); _SWR_MACRO_END
 #define SWR_ASSUME_ASSERT(e, ...)       SWR_ASSUME(e, ##__VA_ARGS__)
-#define SWR_TRACE(_fmtstr, ...)         (void)(0)
+#define SWR_TRACE(_fmtstr, ...)         _SWR_MACRO_START (void)(0); _SWR_MACRO_END
 #endif
 
 #if !SWR_ENABLE_REL_ASSERTS
-#define SWR_REL_ASSERT(e, ...)          (void)(0)
+#define SWR_REL_ASSERT(e, ...)          _SWR_MACRO_START (void)sizeof(SwrSizeofWorkaround(e)); _SWR_MACRO_END
+#define SWR_INVALID(...)                _SWR_MACRO_START (void)(0); _SWR_MACRO_END
 #define SWR_REL_ASSUME_ASSERT(e, ...)   SWR_ASSUME(e, ##__VA_ARGS__)
-#define SWR_REL_TRACE(_fmtstr, ...)     (void)(0)
+#define SWR_REL_TRACE(_fmtstr, ...)     _SWR_MACRO_START (void)(0); _SWR_MACRO_END
+#endif
+
+#if defined(_MSC_VER)
+#define SWR_FUNCTION_DECL __FUNCSIG__
+#elif (defined(__GNUC__) || defined(__clang__))
+#define SWR_FUNCTION_DECL __PRETTY_FUNCTION__
+#else
+#define SWR_FUNCTION_DECL __FUNCTION__
 #endif
 
-#define SWR_NOT_IMPL SWR_ASSERT(0, "%s not implemented", __FUNCTION__)
+#define SWR_NOT_IMPL SWR_INVALID("%s not implemented", SWR_FUNCTION_DECL)
 
 #endif//__SWR_ASSERT_H__
index f622e94d91f568926b92e75bb4672f94af05d911..e169094787e2796133865206ca1ef6cf0c76593b 100644 (file)
@@ -1231,7 +1231,7 @@ void DrawIndexedInstance(
     case R16_UINT: indexSize = sizeof(uint16_t); break;
     case R8_UINT: indexSize = sizeof(uint8_t); break;
     default:
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid index buffer format: %d", pState->indexBuffer.format);
     }
 
     int draw = 0;
index d5f2e97027ddeeb1d492023a0bf237fde54cb1e3..88bfede58fbd8b0202a5ff44a78d3a8678c3ed02 100644 (file)
@@ -310,7 +310,7 @@ struct GatherScissors
         simdscalari &scisXmin, simdscalari &scisYmin,
         simdscalari &scisXmax, simdscalari &scisYmax)
     {
-        SWR_ASSERT(0, "Unhandled Simd Width in Scissor Rect Gather");
+        SWR_INVALID("Unhandled Simd Width in Scissor Rect Gather");
     }
 };
 
index 58c60e275b49d245cac2ca7fc51dbb5e65bea4d9..faa2e76ded842f0fe8ebd21cd1716c2700fc77d9 100644 (file)
@@ -215,7 +215,7 @@ struct PackTraits<8, true>
     {
 #if KNOB_SIMD_WIDTH == 8
 #if KNOB_ARCH==KNOB_ARCH_AVX
-        SWR_ASSERT(0); // I think this may be incorrect.
+        SWR_INVALID("I think this may be incorrect.");
         __m128i src = _mm_castps_si128(_mm256_castps256_ps128(in));
         __m128i resLo = _mm_cvtepi8_epi32(src);
         __m128i resHi = _mm_shuffle_epi8(src,
@@ -428,7 +428,7 @@ struct PackTraits<16, true>
     {
 #if KNOB_SIMD_WIDTH == 8
 #if KNOB_ARCH==KNOB_ARCH_AVX
-        SWR_ASSERT(0); // I think this is incorrectly implemented
+        SWR_INVALID("I think this may be incorrect.");
         __m128i src = _mm_castps_si128(_mm256_castps256_ps128(in));
         __m128i resLo = _mm_cvtepi16_epi32(src);
         __m128i resHi = _mm_shuffle_epi8(src,
@@ -538,8 +538,8 @@ struct TypeTraits : PackTraits<NumBits>
 {
     static const SWR_TYPE MyType = type;
     static float toFloat() { return 0.0; }
-    static float fromFloat() { SWR_ASSERT(0); return 0.0; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static float fromFloat() { SWR_NOT_IMPL; return 0.0; }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -549,8 +549,8 @@ template<> struct TypeTraits<SWR_TYPE_UINT, 8> : PackTraits<8>
 {
     static const SWR_TYPE MyType = SWR_TYPE_UINT;
     static float toFloat() { return 0.0; }
-    static float fromFloat() { SWR_ASSERT(0); return 0.0; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static float fromFloat() { SWR_NOT_IMPL; return 0.0; }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -560,8 +560,8 @@ template<> struct TypeTraits<SWR_TYPE_SINT, 8> : PackTraits<8, true>
 {
     static const SWR_TYPE MyType = SWR_TYPE_SINT;
     static float toFloat() { return 0.0; }
-    static float fromFloat() { SWR_ASSERT(0); return 0.0; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static float fromFloat() { SWR_NOT_IMPL; return 0.0; }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -571,8 +571,8 @@ template<> struct TypeTraits<SWR_TYPE_UINT, 16> : PackTraits<16>
 {
     static const SWR_TYPE MyType = SWR_TYPE_UINT;
     static float toFloat() { return 0.0; }
-    static float fromFloat() { SWR_ASSERT(0); return 0.0; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static float fromFloat() { SWR_NOT_IMPL; return 0.0; }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -582,8 +582,8 @@ template<> struct TypeTraits<SWR_TYPE_SINT, 16> : PackTraits<16, true>
 {
     static const SWR_TYPE MyType = SWR_TYPE_SINT;
     static float toFloat() { return 0.0; }
-    static float fromFloat() { SWR_ASSERT(0); return 0.0; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static float fromFloat() { SWR_NOT_IMPL; return 0.0; }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -593,8 +593,8 @@ template<> struct TypeTraits<SWR_TYPE_UINT, 32> : PackTraits<32>
 {
     static const SWR_TYPE MyType = SWR_TYPE_UINT;
     static float toFloat() { return 0.0; }
-    static float fromFloat() { SWR_ASSERT(0); return 0.0; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static float fromFloat() { SWR_NOT_IMPL; return 0.0; }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -604,8 +604,8 @@ template<> struct TypeTraits<SWR_TYPE_SINT, 32> : PackTraits<32>
 {
     static const SWR_TYPE MyType = SWR_TYPE_SINT;
     static float toFloat() { return 0.0; }
-    static float fromFloat() { SWR_ASSERT(0); return 0.0; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static float fromFloat() { SWR_NOT_IMPL; return 0.0; }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -616,7 +616,7 @@ template<> struct TypeTraits<SWR_TYPE_UNORM, 5> : PackTraits<5>
     static const SWR_TYPE MyType = SWR_TYPE_UNORM;
     static float toFloat() { return 1.0f / 31.0f; }
     static float fromFloat() { return 31.0f; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -627,7 +627,7 @@ template<> struct TypeTraits<SWR_TYPE_UNORM, 6> : PackTraits<6>
     static const SWR_TYPE MyType = SWR_TYPE_UNORM;
     static float toFloat() { return 1.0f / 63.0f; }
     static float fromFloat() { return 63.0f; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -638,7 +638,7 @@ template<> struct TypeTraits<SWR_TYPE_UNORM, 8> : PackTraits<8>
     static const SWR_TYPE MyType = SWR_TYPE_UNORM;
     static float toFloat() { return 1.0f / 255.0f; }
     static float fromFloat() { return 255.0f; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -649,7 +649,7 @@ template<> struct TypeTraits<SWR_TYPE_SNORM, 8> : PackTraits<8, true>
     static const SWR_TYPE MyType = SWR_TYPE_SNORM;
     static float toFloat() { return 1.0f / 127.0f; }
     static float fromFloat() { return 127.0f; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -660,7 +660,7 @@ template<> struct TypeTraits<SWR_TYPE_UNORM, 16> : PackTraits<16>
     static const SWR_TYPE MyType = SWR_TYPE_UNORM;
     static float toFloat() { return 1.0f / 65535.0f; }
     static float fromFloat() { return 65535.0f; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -671,7 +671,7 @@ template<> struct TypeTraits<SWR_TYPE_SNORM, 16> : PackTraits<16, true>
     static const SWR_TYPE MyType = SWR_TYPE_UNORM;
     static float toFloat() { return 1.0f / 32767.0f; }
     static float fromFloat() { return 32767.0f; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -683,7 +683,7 @@ struct TypeTraits < SWR_TYPE_UNORM, 24 > : PackTraits<32>
     static const SWR_TYPE MyType = SWR_TYPE_UNORM;
     static float toFloat() { return 1.0f / 16777215.0f; }
     static float fromFloat() { return 16777215.0f; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -926,7 +926,7 @@ template<> struct TypeTraits<SWR_TYPE_FLOAT, 16> : PackTraits<16>
     static const SWR_TYPE MyType = SWR_TYPE_FLOAT;
     static float toFloat() { return 1.0f; }
     static float fromFloat() { return 1.0f; }
-    static simdscalar convertSrgb(simdscalar &in) { SWR_ASSERT(0); return _simd_setzero_ps(); }
+    static simdscalar convertSrgb(simdscalar &in) { SWR_NOT_IMPL; return _simd_setzero_ps(); }
 
     static simdscalar pack(const simdscalar &in)
     {
@@ -1037,7 +1037,7 @@ template<> struct TypeTraits<SWR_TYPE_FLOAT, 16> : PackTraits<16>
     static simdscalar unpack(const simdscalar &in)
     {
         // input is 8 packed float16, output is 8 packed float32
-        SWR_ASSERT(0); // @todo
+        SWR_NOT_IMPL; // @todo
         return _simd_setzero_ps();
     }
 #if ENABLE_AVX512_SIMD16
@@ -1070,7 +1070,7 @@ template<> struct TypeTraits<SWR_TYPE_FLOAT, 16> : PackTraits<16>
     static simd16scalar unpack(const simd16scalar &in)
     {
         // input is 16 packed float16, output is 16 packed float32
-        SWR_ASSERT(0); // @todo
+        SWR_NOT_IMPL; //  @todo
         return _simd16_setzero_ps();
     }
 #endif
@@ -1310,7 +1310,7 @@ struct ComponentTraits
         case 3:
             return (W == SWR_TYPE_UNORM || W == SWR_TYPE_SNORM) ? true : false;
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return false;
     }
 
@@ -1327,7 +1327,7 @@ struct ComponentTraits
         case 3:
             return TypeTraits<W, NumBitsW>::toFloat();
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return TypeTraits<X, NumBitsX>::toFloat();
 
     }
@@ -1345,7 +1345,7 @@ struct ComponentTraits
         case 3:
             return TypeTraits<W, NumBitsW>::fromFloat();
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return TypeTraits<X, NumBitsX>::fromFloat();
     }
 
@@ -1362,7 +1362,7 @@ struct ComponentTraits
         case 3:
             return TypeTraits<W, NumBitsW>::loadSOA(pSrc);
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return TypeTraits<X, NumBitsX>::loadSOA(pSrc);
     }
 
@@ -1383,7 +1383,7 @@ struct ComponentTraits
             TypeTraits<W, NumBitsW>::storeSOA(pDst, src);
             return;
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         TypeTraits<X, NumBitsX>::storeSOA(pDst, src);
     }
 
@@ -1400,7 +1400,7 @@ struct ComponentTraits
         case 3:
             return TypeTraits<W, NumBitsW>::unpack(in);
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return TypeTraits<X, NumBitsX>::unpack(in);
     }
 
@@ -1417,7 +1417,7 @@ struct ComponentTraits
         case 3:
             return TypeTraits<W, NumBitsW>::pack(in);
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return TypeTraits<X, NumBitsX>::pack(in);
     }
 
@@ -1434,7 +1434,7 @@ struct ComponentTraits
         case 3:
             return TypeTraits<W, NumBitsW>::convertSrgb(in);
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return TypeTraits<X, NumBitsX>::convertSrgb(in);
     }
 #if ENABLE_AVX512_SIMD16
@@ -1452,7 +1452,7 @@ struct ComponentTraits
         case 3:
             return TypeTraits<W, NumBitsW>::loadSOA_16(pSrc);
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return TypeTraits<X, NumBitsX>::loadSOA_16(pSrc);
     }
 
@@ -1473,7 +1473,7 @@ struct ComponentTraits
             TypeTraits<W, NumBitsW>::storeSOA(pDst, src);
             return;
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         TypeTraits<X, NumBitsX>::storeSOA(pDst, src);
     }
 
@@ -1490,7 +1490,7 @@ struct ComponentTraits
         case 3:
             return TypeTraits<W, NumBitsW>::unpack(in);
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return TypeTraits<X, NumBitsX>::unpack(in);
     }
 
@@ -1507,7 +1507,7 @@ struct ComponentTraits
         case 3:
             return TypeTraits<W, NumBitsW>::pack(in);
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return TypeTraits<X, NumBitsX>::pack(in);
     }
 
@@ -1524,7 +1524,7 @@ struct ComponentTraits
         case 3:
             return TypeTraits<W, NumBitsW>::convertSrgb(in);
         }
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid component: %d", comp);
         return TypeTraits<X, NumBitsX>::convertSrgb(in);
     }
 #endif
index b2f46432fd7e97a0d905826b45967903326e4a9a..2109864b5d8528ea9dc02fee511b0f1791364026 100644 (file)
@@ -1358,9 +1358,7 @@ static void TessellationStages(
                     simd16vector    prim_simd16[3];
 #endif
                     AR_BEGIN(FEPAAssemble, pDC->drawId);
-#if SWR_ENABLE_ASSERTS
                     bool assemble =
-#endif
 #if USE_SIMD16_FRONTEND
                         tessPa.Assemble_simd16(VERTEX_POSITION_SLOT, prim_simd16);
 #else
@@ -1470,7 +1468,7 @@ void ProcessDraw(
             pLastRequestedIndex = (int32_t*)(&(((uint8_t*)work.pIB)[endVertex]));
             break;
         default:
-            SWR_ASSERT(0);
+            SWR_INVALID("Invalid work.type: %d", work.type);
         }
     }
     else
index 6b7efb8daf41545ca3c4863c627383eaf1a91d5d..1053e0ab7a5f69d28c12ee8fbf1b7cf1edf5ceb8 100644 (file)
@@ -1145,7 +1145,7 @@ struct PA_TESS : PA_STATE
             break;
 
         default:
-            SWR_ASSERT(0, "Invalid binTopology (%d) for %s", binTopology, __FUNCTION__);
+            SWR_INVALID("Invalid binTopology (%d) for %s", binTopology, __FUNCTION__);
             break;
         }
     }
@@ -1157,7 +1157,7 @@ struct PA_TESS : PA_STATE
 
     simdvector& GetSimdVector(uint32_t index, uint32_t slot)
     {
-        SWR_ASSERT(0, "%s NOT IMPLEMENTED", __FUNCTION__);
+        SWR_INVALID("%s NOT IMPLEMENTED", __FUNCTION__);
         static simdvector junk;
         return junk;
     }
@@ -1165,7 +1165,7 @@ struct PA_TESS : PA_STATE
 #if ENABLE_AVX512_SIMD16
     simd16vector& GetSimdVector_simd16(uint32_t index, uint32_t slot)
     {
-        SWR_ASSERT(0, "%s NOT IMPLEMENTED", __FUNCTION__);
+        SWR_INVALID("%s NOT IMPLEMENTED", __FUNCTION__);
         static simd16vector junk;
         return junk;
     }
@@ -1327,20 +1327,20 @@ struct PA_TESS : PA_STATE
 
     SIMDVERTEX& GetNextVsOutput()
     {
-        SWR_ASSERT(0, "%s", __FUNCTION__);
+        SWR_NOT_IMPL;
         static SIMDVERTEX junk;
         return junk;
     }
 
     bool GetNextStreamOutput()
     {
-        SWR_ASSERT(0, "%s", __FUNCTION__);
+        SWR_NOT_IMPL;
         return false;
     }
 
     SIMDMASK& GetNextVsIndices()
     {
-        SWR_ASSERT(0, "%s", __FUNCTION__);
+        SWR_NOT_IMPL;
         static SIMDMASK junk;
         return junk;
     }
@@ -1350,7 +1350,10 @@ struct PA_TESS : PA_STATE
         return std::min<uint32_t>(m_numPrims, SIMD_WIDTH);
     }
 
-    void Reset() { SWR_ASSERT(0); };
+    void Reset()
+    {
+        SWR_NOT_IMPL;
+    }
 
     SIMDSCALARI GetPrimID(uint32_t startID)
     {
index 9c2b8e081ea76d4065e76543d95b0a45a904b69e..511b3d0aeda590bdf3c39f8c27387e9b10b08fd4 100644 (file)
@@ -2379,7 +2379,7 @@ bool PaRectList2(
     uint32_t slot,
     simdvector verts[])
 {
-    SWR_ASSERT(0); // Is rect list used for anything other then clears?
+    SWR_INVALID("Is rect list used for anything other then clears?");
     SetNextPaState(pa, PaRectList0, PaRectListSingle0, 0, KNOB_SIMD_WIDTH, true);
     return true;
 }
@@ -2509,7 +2509,7 @@ bool PaRectList2_simd16(
     uint32_t slot,
     simd16vector verts[])
 {
-    SWR_ASSERT(0); // Is rect list used for anything other then clears?
+    SWR_INVALID("Is rect list used for anything other then clears?")
     SetNextPaState_simd16(pa, PaRectList0_simd16, PaRectListSingle0, 0, KNOB_SIMD16_WIDTH, true);
     return true;
 }
@@ -2582,7 +2582,7 @@ void PaRectListSingle0(
     case 5:
     case 6:
     case 7:
-        SWR_ASSERT(0);
+        SWR_INVALID("Invalid primIndex: %d", primIndex);
         break;
     };
 }
@@ -2864,7 +2864,7 @@ PA_STATE_OPT::PA_STATE_OPT(DRAW_CONTEXT *in_pDC, uint32_t in_numPrims, uint8_t*
             break;
 
         default:
-            SWR_ASSERT(0);
+            SWR_INVALID("Invalid topology: %d", this->binTopology);
             break;
     };
 
@@ -2961,7 +2961,7 @@ PA_STATE_OPT::PA_STATE_OPT(DRAW_CONTEXT *in_pDC, uint32_t in_numPrims, uint8_t*
             break;
 
         default:
-            SWR_ASSERT(0);
+            SWR_INVALID("Invalid topology: %d", this->binTopology);
             break;
     };
 
index 6d4e50408fcde8deec9c6a2db0d41a3f81d47095..a8a052a73c3b9fb7247d08ce802ccb70fbde6f1b 100644 (file)
@@ -684,7 +684,7 @@ struct ComputeScissorEdges<std::true_type, std::false_type, RT>
 template <typename ValidEdgeMaskT>
 INLINE bool TrivialRejectTest(const int, const int, const int)
 {
-    SWR_ASSERT(0, "Primary templated function should never be called");
+    SWR_INVALID("Primary templated function should never be called");
     return false;
 };
 
index 915ac77897b6a85cd8ca2b4538ff455421fa4c81..316f66f94ae90becf98d20a3d444470b0d4aa143 100644 (file)
@@ -67,14 +67,14 @@ INLINE HANDLE SWR_API TSInitCtx(
     void* pContextMem,
     size_t& memSize)
 {
-    SWR_ASSERT(0, "%s: Not Implemented", __FUNCTION__);
+    SWR_NOT_IMPL;
     return NULL;
 }
 
 
 INLINE void SWR_API TSDestroyCtx(HANDLE tsCtx)
 {
-    SWR_ASSERT(0, "%s: Not Implemented", __FUNCTION__);
+    SWR_NOT_IMPL;
 }
 
 
@@ -83,6 +83,6 @@ INLINE void SWR_API TSTessellate(
     const SWR_TESSELLATION_FACTORS& tsTessFactors,
     SWR_TS_TESSELLATED_DATA& tsTessellatedData)
 {
-    SWR_ASSERT(0, "%s: Not Implemented", __FUNCTION__);
+    SWR_NOT_IMPL;
 }
 
index 64147960a89f64de6995e0adb24046922cf4f518..ead52fe55f348f1c2204288f8baf5e4c5181f5e4 100644 (file)
@@ -69,7 +69,8 @@
 #define INTEL_OUTPUT_DIR "c:\\Intel"
 #define SWR_OUTPUT_DIR INTEL_OUTPUT_DIR "\\SWR"
 #define JITTER_OUTPUT_DIR SWR_OUTPUT_DIR "\\Jitter"
-#endif
+#endif // _WIN32
+
 
 using namespace llvm;
 using namespace SwrJit;
@@ -197,6 +198,7 @@ bool JitManager::SetupModuleFromIR(const uint8_t *pIR, size_t length)
     SMDiagnostic Err;
     std::unique_ptr<Module> newModule = parseIR(pMem.get()->getMemBufferRef(), Err, mContext);
 
+
     SWR_REL_ASSERT(
         !(newModule == nullptr),
         "Parse failed!\n"
index b4a33b85cc7266fef34c2bdda81ee8a9cc424847..da1dfbb32fd7bb6780ff0bf3500a2198ceeeaaf5 100644 (file)
@@ -684,7 +684,7 @@ struct BlendJit : public Builder
 
                 switch (info.type[i]) {
                 default:
-                    SWR_ASSERT(0, "Unsupported type for logic op\n");
+                    SWR_INVALID("Unsupported type for logic op\n");
                     /* fallthrough */
                 case SWR_TYPE_UINT:
                 case SWR_TYPE_SINT:
@@ -725,7 +725,7 @@ struct BlendJit : public Builder
 
                 switch (info.type[i]) {
                 default:
-                    SWR_ASSERT(0, "Unsupported type for logic op\n");
+                    SWR_INVALID("Unsupported type for logic op\n");
                     /* fallthrough */
                 case SWR_TYPE_UINT:
                 case SWR_TYPE_SINT:
index d65267ecd2b6473222fde2dbebbbe4eed87c3d21..c28d2ede16127561b01c511132419a80b1e5f39f 100644 (file)
@@ -1097,7 +1097,7 @@ namespace SwrJit
             }
                 break;
             default:
-                SWR_ASSERT(0, "Invalid float format");
+                SWR_INVALID("Invalid float format");
                 break;
         }
     }
@@ -1184,7 +1184,7 @@ namespace SwrJit
             }
                 break;
             default:
-                SWR_ASSERT(0, "unsupported format");
+                SWR_INVALID("unsupported format");
             break;
         }
     }
index ffa7605a9193b3a9644447a3baaa3a935589feda..df3ac5e7b36b146c5a4b8b7314731c0b2c2f5dd5 100644 (file)
@@ -158,7 +158,7 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
             (fetchState.bDisableIndexOOBCheck) ? vIndices = LOAD(BITCAST(indices, PointerType::get(mSimdInt32Ty,0)),{(uint32_t)0})
                                                : vIndices = GetSimdValid32bitIndices(indices, pLastIndex);
             break; // incoming type is already 32bit int
-        default: SWR_ASSERT(0, "Unsupported index type"); vIndices = nullptr; break;
+        default: SWR_INVALID("Unsupported index type"); vIndices = nullptr; break;
     }
 
     Value* vVertexId = vIndices;
@@ -613,7 +613,7 @@ void FetchJit::CreateGatherOddFormats(SWR_FORMAT format, Value* pMask, Value* pB
     case 16: pLoadTy = Type::getInt16PtrTy(JM()->mContext); break;
     case 24:
     case 32: pLoadTy = Type::getInt32PtrTy(JM()->mContext); break;
-    default: SWR_ASSERT(0);
+    default: SWR_INVALID("Invalid bpp: %d", info.bpp);
     }
 
     // allocate temporary memory for masked off lanes
@@ -1015,7 +1015,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState,
                 }
                     break;
                 default:
-                    SWR_ASSERT(0, "Tried to fetch invalid FP format");
+                    SWR_INVALID("Tried to fetch invalid FP format");
                     break;
             }
         }
@@ -1371,7 +1371,7 @@ void FetchJit::Shuffle8bpcGatherd(Shuffle8bpcArgs &args)
             conversionFactor = VIMMED1((float)(1.0));
             break;
         case CONVERT_USCALED:
-            SWR_ASSERT(0, "Type should not be sign extended!");
+            SWR_INVALID("Type should not be sign extended!");
             conversionFactor = nullptr;
             break;
         default:
@@ -1434,7 +1434,7 @@ void FetchJit::Shuffle8bpcGatherd(Shuffle8bpcArgs &args)
             conversionFactor = VIMMED1((float)(1.0));
             break;
         case CONVERT_SSCALED:
-            SWR_ASSERT(0, "Type should not be zero extended!");
+            SWR_INVALID("Type should not be zero extended!");
             conversionFactor = nullptr;
             break;
         default:
@@ -1507,7 +1507,7 @@ void FetchJit::Shuffle8bpcGatherd(Shuffle8bpcArgs &args)
     }
     else
     {
-        SWR_ASSERT(0, "Unsupported conversion type");
+        SWR_INVALID("Unsupported conversion type");
     }
 }
 
@@ -1590,7 +1590,7 @@ void FetchJit::Shuffle16bpcGather(Shuffle16bpcArgs &args)
             conversionFactor = VIMMED1((float)(1.0));
             break;
         case CONVERT_USCALED:
-            SWR_ASSERT(0, "Type should not be sign extended!");
+            SWR_INVALID("Type should not be sign extended!");
             conversionFactor = nullptr;
             break;
         default:
@@ -1672,7 +1672,7 @@ void FetchJit::Shuffle16bpcGather(Shuffle16bpcArgs &args)
             conversionFactor = VIMMED1((float)(1.0f));
             break;
         case CONVERT_SSCALED:
-            SWR_ASSERT(0, "Type should not be zero extended!");
+            SWR_INVALID("Type should not be zero extended!");
             conversionFactor = nullptr;
             break;
         default:
@@ -1721,7 +1721,7 @@ void FetchJit::Shuffle16bpcGather(Shuffle16bpcArgs &args)
     }
     else
     {
-        SWR_ASSERT(0, "Unsupported conversion type");
+        SWR_INVALID("Unsupported conversion type");
     }
 }
 
@@ -1780,7 +1780,7 @@ Value* FetchJit::GenerateCompCtrlVector(const ComponentControl ctrl)
             return VBROADCAST(pId);
         }
         case StoreSrc:
-        default:        SWR_ASSERT(0, "Invalid component control"); return VUNDEF_I();
+        default:        SWR_INVALID("Invalid component control"); return VUNDEF_I();
     }
 }
 
index 693865eff7e889a3a86fc4886887309922078252..48ff0b0a958a75671ae53e06a73dd65b6fe59175 100644 (file)
@@ -92,7 +92,7 @@ namespace ArchRast
 
                 if (!file.is_open())
                 {
-                    SWR_ASSERT(0, "ArchRast: Could not open event file!");
+                    SWR_INVALID("ArchRast: Could not open event file!");
                     return false;
                 }