diff options
author | Tim Rowley <[email protected]> | 2016-04-06 15:23:14 -0600 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2016-04-22 18:48:56 -0500 |
commit | 0487377dcec9122173c963360f8d302d071d3434 (patch) | |
tree | bd93e4f6b1962f5a3f65c692dd1d990b1274b020 /src | |
parent | 2c4c3c9c71a7ec7cb4aac5c8ee8bf3a479a00153 (diff) |
swr: [rasterizer] Small cleanups
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
7 files changed, 29 insertions, 20 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp index 5dcd05b78d0..e6c77d8f068 100644 --- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp @@ -39,6 +39,7 @@ #include "clip.h" #include "tilemgr.h" #include "tessellator.h" +#include <limits> ////////////////////////////////////////////////////////////////////////// /// @brief Helper macro to generate a bitmask @@ -1847,7 +1848,7 @@ void BinTriangles( } } } - +nextPrimitive: triMask &= ~(1 << triIndex); } diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.h b/src/gallium/drivers/swr/rasterizer/core/frontend.h index b637785dcc5..e1b040015a9 100644 --- a/src/gallium/drivers/swr/rasterizer/core/frontend.h +++ b/src/gallium/drivers/swr/rasterizer/core/frontend.h @@ -308,7 +308,7 @@ bool CanUseSimplePoints(DRAW_CONTEXT *pDC) } INLINE -bool vIsNaN(const __m128& vec) +bool vHasNaN(const __m128& vec) { const __m128 result = _mm_cmpunord_ps(vec, vec); const int32_t mask = _mm_movemask_ps(result); diff --git a/src/gallium/drivers/swr/rasterizer/core/utils.cpp b/src/gallium/drivers/swr/rasterizer/core/utils.cpp index a1d665e77cc..97b631ba6f8 100644 --- a/src/gallium/drivers/swr/rasterizer/core/utils.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/utils.cpp @@ -74,7 +74,8 @@ void SaveImageToPNGFile( const WCHAR *pFilename, void *pBuffer, uint32_t width, - uint32_t height) + uint32_t height, + bool broadcastRed = false) { // dump pixels to a png // Initialize GDI+. @@ -84,23 +85,33 @@ void SaveImageToPNGFile( Bitmap *bitmap = new Bitmap(width, height); BYTE *pBytes = (BYTE*)pBuffer; - static const uint32_t bytesPerPixel = 4; + const uint32_t bytesPerPixel = (broadcastRed ? 1 : 4); for (uint32_t y = 0; y < height; ++y) for (uint32_t x = 0; x < width; ++x) { - uint32_t pixel = *(uint32_t*)pBytes; - if (pixel == 0xcdcdcdcd) + uint32_t pixel = 0; + if (broadcastRed) { - pixel = 0xFFFF00FF; - } - else if (pixel == 0xdddddddd) - { - pixel = 0x80FF0000; + pixel = *(uint8_t*)pBytes; + pixel = pixel | (pixel << 8) | (pixel << 16) | 0xFF000000; } else { - pixel |= 0xFF000000; + pixel = *(uint32_t*)pBytes; + if (pixel == 0xcdcdcdcd) + { + pixel = 0xFFFF00FF; + } + else if (pixel == 0xdddddddd) + { + pixel = 0x80FF0000; + } + else + { + pixel |= 0xFF000000; + } } + Color color(pixel); bitmap->SetPixel(x, y, color); pBytes += bytesPerPixel; diff --git a/src/gallium/drivers/swr/rasterizer/core/utils.h b/src/gallium/drivers/swr/rasterizer/core/utils.h index 63ecd5cfe1b..e3c534dd851 100644 --- a/src/gallium/drivers/swr/rasterizer/core/utils.h +++ b/src/gallium/drivers/swr/rasterizer/core/utils.h @@ -38,7 +38,8 @@ void SaveImageToPNGFile( const WCHAR *pFilename, void *pBuffer, uint32_t width, - uint32_t height); + uint32_t height, + bool broadcastRed); void OpenBitmapFromFile( const WCHAR *pFilename, diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp index de856c4a095..271c1969be6 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp @@ -197,12 +197,6 @@ JitManager::JitManager(uint32_t simdWidth, const char *arch) CreateDirectory(SWR_OUTPUT_DIR, NULL); CreateDirectory(JITTER_OUTPUT_DIR, NULL); } - - ///@todo Figure out a better solution for this. - // Redirect stdin, stdout, and stderr to attached console. - freopen("CONIN$", "r", stdin); - freopen("CONOUT$", "w", stdout); - freopen("CONOUT$", "w", stderr); #endif } diff --git a/src/gallium/drivers/swr/rasterizer/jitter/jit_api.h b/src/gallium/drivers/swr/rasterizer/jitter/jit_api.h index 39d63836673..b668eb47927 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/jit_api.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/jit_api.h @@ -34,6 +34,8 @@ #include "streamout_jit.h" #include "blend_jit.h" +#include <stdlib.h> + #if defined(_WIN32) #define EXCEPTION_PRINT_STACK(ret) ret #endif // _WIN32 @@ -61,6 +63,7 @@ struct JIT_COMPILE_INPUT bool enableJitSampler; }; + ////////////////////////////////////////////////////////////////////////// /// @brief Create JIT context. HANDLE JITCALL JitCreateContext(uint32_t targetSimdWidth, const char* arch); diff --git a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp index 9ed1d0bd0ec..419f28b6fcc 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp +++ b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp @@ -1694,7 +1694,6 @@ template <SWR_TILE_MODE TileModeT, size_t NumTileModes, size_t ArraySizeT> void InitStoreTilesTableStencil( PFN_STORE_TILES(&table)[NumTileModes][ArraySizeT]) { - table[TileModeT][R32_UINT] = StoreMacroTile<TilingTraits<TileModeT, 32>, R8_UINT, R32_UINT>::Store; table[TileModeT][R8_UINT] = StoreMacroTile<TilingTraits<TileModeT, 8>, R8_UINT, R8_UINT>::Store; } |