diff options
author | Tim Rowley <[email protected]> | 2017-02-27 10:11:47 -0800 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2017-03-20 18:04:53 -0500 |
commit | 0b066b2bf3845f47b6294633266ee2aa64403f13 (patch) | |
tree | 87cfbee336f1129d42143b7326f240240f8e2380 /src/gallium/drivers | |
parent | f445b6de9cc416ba3f3a900e98baa57e090c39ed (diff) |
swr: [rasterizer] Slight assert refactoring
Make asserts more robust.
Add SWR_INVALID(...) as a replacement for SWR_ASSERT(0, ...)
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
17 files changed, 296 insertions, 256 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index acd0a0f50f3..20b14a3a28c 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -285,7 +285,7 @@ namespace ArchRast return pManager; } - SWR_ASSERT(0, "Failed to register thread."); + SWR_INVALID("Failed to register thread."); return nullptr; } diff --git a/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h b/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h index 88edc03f4f4..b361188c3dd 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h +++ b/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h @@ -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; }; diff --git a/src/gallium/drivers/swr/rasterizer/common/swr_assert.cpp b/src/gallium/drivers/swr/rasterizer/common/swr_assert.cpp index 98a5a52957f..43b74a68fde 100644 --- a/src/gallium/drivers/swr/rasterizer/common/swr_assert.cpp +++ b/src/gallium/drivers/swr/rasterizer/common/swr_assert.cpp @@ -34,103 +34,111 @@ #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); @@ -145,76 +153,6 @@ void SwrTrace( 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]; - sprintf_s(msgBuf, "%s(%d): ASSERT: %s\n", pFileName, lineNum, pExpression); msgBuf[MAX_MESSAGE_LEN - 2] = '\n'; msgBuf[MAX_MESSAGE_LEN - 1] = 0; @@ -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 diff --git a/src/gallium/drivers/swr/rasterizer/common/swr_assert.h b/src/gallium/drivers/swr/rasterizer/common/swr_assert.h index bd6833615a1..89ae10efb23 100644 --- a/src/gallium/drivers/swr/rasterizer/common/swr_assert.h +++ b/src/gallium/drivers/swr/rasterizer/common/swr_assert.h @@ -53,14 +53,30 @@ // //============================================================================= +// 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__ diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index f622e94d91f..e169094787e 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -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; diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp b/src/gallium/drivers/swr/rasterizer/core/binner.cpp index d5f2e97027d..88bfede58fb 100644 --- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp @@ -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"); } }; diff --git a/src/gallium/drivers/swr/rasterizer/core/format_types.h b/src/gallium/drivers/swr/rasterizer/core/format_types.h index 58c60e275b4..faa2e76ded8 100644 --- a/src/gallium/drivers/swr/rasterizer/core/format_types.h +++ b/src/gallium/drivers/swr/rasterizer/core/format_types.h @@ -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 diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp index b2f46432fd7..2109864b5d8 100644 --- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp @@ -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 diff --git a/src/gallium/drivers/swr/rasterizer/core/pa.h b/src/gallium/drivers/swr/rasterizer/core/pa.h index 6b7efb8daf4..1053e0ab7a5 100644 --- a/src/gallium/drivers/swr/rasterizer/core/pa.h +++ b/src/gallium/drivers/swr/rasterizer/core/pa.h @@ -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) { diff --git a/src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp b/src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp index 9c2b8e081ea..511b3d0aeda 100644 --- a/src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp @@ -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; }; diff --git a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp index 6d4e50408fc..a8a052a73c3 100644 --- a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp @@ -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; }; diff --git a/src/gallium/drivers/swr/rasterizer/core/tessellator.h b/src/gallium/drivers/swr/rasterizer/core/tessellator.h index 915ac77897b..316f66f94ae 100644 --- a/src/gallium/drivers/swr/rasterizer/core/tessellator.h +++ b/src/gallium/drivers/swr/rasterizer/core/tessellator.h @@ -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; } diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp index 64147960a89..ead52fe55f3 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp @@ -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" diff --git a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp index b4a33b85cc7..da1dfbb32fd 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp @@ -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: diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp index d65267ecd2b..c28d2ede161 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp @@ -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; } } diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp index ffa7605a919..df3ac5e7b36 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp @@ -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(); } } diff --git a/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template b/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template index 693865eff7e..48ff0b0a958 100644 --- a/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template +++ b/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template @@ -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; } |