swr: [rasterizer] Small cleanups
authorTim Rowley <timothy.o.rowley@intel.com>
Wed, 6 Apr 2016 21:23:14 +0000 (15:23 -0600)
committerTim Rowley <timothy.o.rowley@intel.com>
Fri, 22 Apr 2016 23:48:56 +0000 (18:48 -0500)
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/core/frontend.cpp
src/gallium/drivers/swr/rasterizer/core/frontend.h
src/gallium/drivers/swr/rasterizer/core/utils.cpp
src/gallium/drivers/swr/rasterizer/core/utils.h
src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
src/gallium/drivers/swr/rasterizer/jitter/jit_api.h
src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp

index 5dcd05b78d0d4f9fe4bccd6f82f2e19763555d2c..e6c77d8f068ba00b9f0085a89c6a520ec04726ac 100644 (file)
@@ -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);
     }
 
index b637785dcc5a18bcbe99af3a102d4f24e937b64c..e1b040015a931d89e7a95f3518eedb78817c9e61 100644 (file)
@@ -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);
index a1d665e77cc61d3d26b5c431d8e67165957f9fe8..97b631ba6f83c260fffb2ebb924b696ab6060024 100644 (file)
@@ -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;
index 63ecd5cfe1b824ad805b4ee2c343d43833aae830..e3c534dd8515d590339b0fd82d801df250f0302f 100644 (file)
@@ -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,
index de856c4a09504cc82d7bcd72b5321ae38b3c9b21..271c1969be6d6bc4f627edad6ad7ea560f82f1a3 100644 (file)
@@ -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
 }
 
index 39d63836673895bb6298739c4b8559099fb76e1c..b668eb479273f55a0e577572d403088e5294edd8 100644 (file)
@@ -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);
index 9ed1d0bd0ec93572d9970da38668ca03e6ede363..419f28b6fcc69fc18356ce12c7e6bc16aa3e6644 100644 (file)
@@ -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;
 }