aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-05-19 16:23:07 -0600
committerTim Rowley <[email protected]>2016-05-24 13:29:29 -0500
commit1e3e22efb5221f9c480c02f9175a5d33ecf9775f (patch)
tree46bd77c1d8b99293ca1ec7a1b95cf9314567087b /src
parentdc34479b8c610314076b5c19cdeded8180c7beb4 (diff)
swr: [rasterizer core] remove utility dead code
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/swr/Makefile.sources1
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/utils.cpp164
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/utils.h92
3 files changed, 0 insertions, 257 deletions
diff --git a/src/gallium/drivers/swr/Makefile.sources b/src/gallium/drivers/swr/Makefile.sources
index d8be0f5cca4..7e28f50da67 100644
--- a/src/gallium/drivers/swr/Makefile.sources
+++ b/src/gallium/drivers/swr/Makefile.sources
@@ -90,7 +90,6 @@ CORE_CXX_SOURCES := \
rasterizer/core/threads.h \
rasterizer/core/tilemgr.cpp \
rasterizer/core/tilemgr.h \
- rasterizer/core/utils.cpp \
rasterizer/core/utils.h
JITTER_CXX_SOURCES := \
diff --git a/src/gallium/drivers/swr/rasterizer/core/utils.cpp b/src/gallium/drivers/swr/rasterizer/core/utils.cpp
deleted file mode 100644
index 97b631ba6f8..00000000000
--- a/src/gallium/drivers/swr/rasterizer/core/utils.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/****************************************************************************
-* Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-* IN THE SOFTWARE.
-*
-* @file utils.cpp
-*
-* @brief Utilities used by SWR core.
-*
-******************************************************************************/
-#if defined(_WIN32)
-
-#if defined(NOMINMAX)
-// GDI Plus requires non-std min / max macros be defined :(
-#undef NOMINMAX
-#endif
-
-#include<Windows.h>
-#include <Gdiplus.h>
-#include <Gdiplusheaders.h>
-#include <cstdint>
-
-using namespace Gdiplus;
-
-int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
-{
- uint32_t num = 0; // number of image encoders
- uint32_t size = 0; // size of the image encoder array in bytes
-
- ImageCodecInfo* pImageCodecInfo = nullptr;
-
- GetImageEncodersSize(&num, &size);
- if(size == 0)
- return -1; // Failure
-
- pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
- if(pImageCodecInfo == nullptr)
- return -1; // Failure
-
- GetImageEncoders(num, size, pImageCodecInfo);
-
- for(uint32_t j = 0; j < num; ++j)
- {
- if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
- {
- *pClsid = pImageCodecInfo[j].Clsid;
- free(pImageCodecInfo);
- return j; // Success
- }
- }
-
- free(pImageCodecInfo);
- return -1; // Failure
-}
-
-void SaveImageToPNGFile(
- const WCHAR *pFilename,
- void *pBuffer,
- uint32_t width,
- uint32_t height,
- bool broadcastRed = false)
-{
- // dump pixels to a png
- // Initialize GDI+.
- GdiplusStartupInput gdiplusStartupInput;
- ULONG_PTR gdiplusToken;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr);
-
- Bitmap *bitmap = new Bitmap(width, height);
- BYTE *pBytes = (BYTE*)pBuffer;
- 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 = 0;
- if (broadcastRed)
- {
- pixel = *(uint8_t*)pBytes;
- pixel = pixel | (pixel << 8) | (pixel << 16) | 0xFF000000;
- }
- else
- {
- 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;
- }
-
- // Save image.
- CLSID pngClsid;
- GetEncoderClsid(L"image/png", &pngClsid);
- bitmap->Save(pFilename, &pngClsid, nullptr);
-
- delete bitmap;
-
- GdiplusShutdown(gdiplusToken);
-}
-
-void OpenBitmapFromFile(
- const WCHAR *pFilename,
- void **pBuffer,
- uint32_t *width,
- uint32_t *height)
-{
- GdiplusStartupInput gdiplusStartupInput;
- ULONG_PTR gdiplusToken;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr);
-
- Bitmap *bitmap = new Bitmap(pFilename);
-
- *width = bitmap->GetWidth();
- *height = bitmap->GetHeight();
- *pBuffer = new BYTE[*width * *height * 4]; // width * height * |RGBA|
-
- // The folder 'stb_image' contains a PNG open/close module which
- // is far less painful than this is, yo.
- Gdiplus::Color clr;
- for (uint32_t y = 0, idx = 0; y < *height; ++y)
- {
- for (uint32_t x = 0; x < *width; ++x, idx += 4)
- {
- bitmap->GetPixel(x, *height - y - 1, &clr);
- ((BYTE*)*pBuffer)[idx + 0] = clr.GetBlue();
- ((BYTE*)*pBuffer)[idx + 1] = clr.GetGreen();
- ((BYTE*)*pBuffer)[idx + 2] = clr.GetRed();
- ((BYTE*)*pBuffer)[idx + 3] = clr.GetAlpha();
- }
- }
-
- delete bitmap;
- bitmap = 0;
-}
-#endif
diff --git a/src/gallium/drivers/swr/rasterizer/core/utils.h b/src/gallium/drivers/swr/rasterizer/core/utils.h
index a5b004c6fb3..2853f98fd78 100644
--- a/src/gallium/drivers/swr/rasterizer/core/utils.h
+++ b/src/gallium/drivers/swr/rasterizer/core/utils.h
@@ -33,21 +33,6 @@
#include "common/simdintrin.h"
#include "common/swr_assert.h"
-#if defined(_WIN32)
-void SaveImageToPNGFile(
- const WCHAR *pFilename,
- void *pBuffer,
- uint32_t width,
- uint32_t height,
- bool broadcastRed);
-
-void OpenBitmapFromFile(
- const WCHAR *pFilename,
- void **pBuffer,
- uint32_t *width,
- uint32_t *height);
-#endif
-
#if defined(_WIN64) || defined(__x86_64__)
#define _MM_INSERT_EPI64 _mm_insert_epi64
#define _MM_EXTRACT_EPI64 _mm_extract_epi64
@@ -866,81 +851,4 @@ struct TemplateArgUnroller
}
};
-//////////////////////////////////////////////////////////////////////////
-/// Helpers used to get / set environment variable
-//////////////////////////////////////////////////////////////////////////
-static INLINE std::string GetEnv(const std::string& variableName)
-{
- std::string output;
-#if defined(_WIN32)
- DWORD valueSize = GetEnvironmentVariableA(variableName.c_str(), nullptr, 0);
- if (!valueSize) return output;
- output.resize(valueSize - 1); // valueSize includes null, output.resize() does not
- GetEnvironmentVariableA(variableName.c_str(), &output[0], valueSize);
-#else
- output = getenv(variableName.c_str());
-#endif
-
- return output;
-}
-
-static INLINE void SetEnv(const std::string& variableName, const std::string& value)
-{
-#if defined(_WIN32)
- SetEnvironmentVariableA(variableName.c_str(), value.c_str());
-#else
- setenv(variableName.c_str(), value.c_str(), true);
-#endif
-}
-
-//////////////////////////////////////////////////////////////////////////
-/// Abstraction for dynamically loading modules and getting functions
-//////////////////////////////////////////////////////////////////////////
-#if defined(_WIN32)
-typedef HMODULE SWR_MODULE_HANDLE;
-#else
-#include <dlfcn.h>
-typedef void* SWR_MODULE_HANDLE;
-#endif
-
-static inline SWR_MODULE_HANDLE SWR_API LoadModule(const char* szModuleName)
-{
-#if defined(_WIN32)
- return LoadLibraryA(szModuleName);
-#else
- return dlopen(szModuleName, RTLD_LAZY | RTLD_LOCAL);
-#endif
-}
-
-static inline void SWR_API FreeModuleHandle(SWR_MODULE_HANDLE hModule)
-{
- if (hModule)
- {
-#if defined(_WIN32)
- FreeLibrary((HMODULE)hModule);
-#else
- dlclose(hModule);
-#endif
- }
-}
-
-static inline void* SWR_API GetProcFromModule(SWR_MODULE_HANDLE hModule, const char* szProcName)
-{
- if (hModule && szProcName)
- {
-#if defined(_WIN32)
- return GetProcAddress((HMODULE)hModule, szProcName);
-#else
- return dlsym(hModule, szProcName);
-#endif
- }
-
- return nullptr;
-}
-
-template<typename T>
-static inline void GetProcFromModule(SWR_MODULE_HANDLE hModule, const char* szProcName, T& outFunc)
-{
- outFunc = (T)GetProcFromModule(hModule, szProcName);
-}