Commit d5b18a78 by Nicolas Capens Committed by Nicolas Capens

Fix the Linux build.

Change-Id: I2c06dbe89f8e079f690242cd97af6638087af593 Reviewed-on: https://swiftshader-review.googlesource.com/1394Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 2bae3ed2
...@@ -20,6 +20,10 @@ using namespace std; ...@@ -20,6 +20,10 @@ using namespace std;
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h> #include <ctype.h>
#if defined(__unix__)
#include <unistd.h>
#endif
namespace sw namespace sw
{ {
Configurator::Configurator(string iniPath) Configurator::Configurator(string iniPath)
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
void *getLibraryHandle(const char *path);
void *loadLibrary(const char *path);
template<int n> template<int n>
void *loadLibrary(const char *(&names)[n]) void *loadLibrary(const char *(&names)[n])
{ {
...@@ -71,7 +74,7 @@ void *loadLibrary(const char *(&names)[n]) ...@@ -71,7 +74,7 @@ void *loadLibrary(const char *(&names)[n])
inline void *getLibraryHandle(const char *path) inline void *getLibraryHandle(const char *path)
{ {
bool resident = (dlopen(names[i], RTLD_NOLOAD) != 0); bool resident = (dlopen(path, RTLD_NOLOAD) != 0);
if(resident) if(resident)
{ {
......
...@@ -424,7 +424,7 @@ public: ...@@ -424,7 +424,7 @@ public:
/// @returns the all-ones value for an APInt of the specified bit-width. /// @returns the all-ones value for an APInt of the specified bit-width.
/// @brief Get the all-ones value. /// @brief Get the all-ones value.
static APInt getAllOnesValue(unsigned numBits) { static APInt getAllOnesValue(unsigned numBits) {
return APInt(numBits, _UI64_MAX, true); return APInt(numBits, ~0ULL, true);
} }
/// @returns the '0' value for an APInt of the specified bit-width. /// @returns the '0' value for an APInt of the specified bit-width.
...@@ -495,7 +495,7 @@ public: ...@@ -495,7 +495,7 @@ public:
if (loBitsSet == 0) if (loBitsSet == 0)
return APInt(numBits, 0); return APInt(numBits, 0);
if (loBitsSet == APINT_BITS_PER_WORD) if (loBitsSet == APINT_BITS_PER_WORD)
return APInt(numBits, _UI64_MAX); return APInt(numBits, ~0ULL);
// For small values, return quickly. // For small values, return quickly.
if (numBits < APINT_BITS_PER_WORD) if (numBits < APINT_BITS_PER_WORD)
return APInt(numBits, (1ULL << loBitsSet) - 1); return APInt(numBits, (1ULL << loBitsSet) - 1);
...@@ -1062,11 +1062,11 @@ public: ...@@ -1062,11 +1062,11 @@ public:
/// @brief Set every bit to 1. /// @brief Set every bit to 1.
void setAllBits() { void setAllBits() {
if (isSingleWord()) if (isSingleWord())
VAL = _UI64_MAX; VAL = ~0ULL;
else { else {
// Set all the bits in all the words. // Set all the bits in all the words.
for (unsigned i = 0; i < getNumWords(); ++i) for (unsigned i = 0; i < getNumWords(); ++i)
pVal[i] = _UI64_MAX; pVal[i] = ~0ULL;
} }
// Clear the unused ones // Clear the unused ones
clearUnusedBits(); clearUnusedBits();
...@@ -1091,10 +1091,10 @@ public: ...@@ -1091,10 +1091,10 @@ public:
/// @brief Toggle every bit to its opposite value. /// @brief Toggle every bit to its opposite value.
void flipAllBits() { void flipAllBits() {
if (isSingleWord()) if (isSingleWord())
VAL ^= _UI64_MAX; VAL ^= ~0ULL;
else { else {
for (unsigned i = 0; i < getNumWords(); ++i) for (unsigned i = 0; i < getNumWords(); ++i)
pVal[i] ^= _UI64_MAX; pVal[i] ^= ~0ULL;
} }
clearUnusedBits(); clearUnusedBits();
} }
......
...@@ -40,12 +40,12 @@ public: ...@@ -40,12 +40,12 @@ public:
return height; return height;
} }
GLenum Image::getFormat() GLenum getFormat()
{ {
return format; return format;
} }
GLenum Image::getType() GLenum getType()
{ {
return type; return type;
} }
...@@ -100,7 +100,7 @@ public: ...@@ -100,7 +100,7 @@ public:
virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0; virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;
protected: protected:
virtual ~Image() = 0 virtual ~Image()
{ {
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<Option compiler="gcc" /> <Option compiler="gcc" />
<Build> <Build>
<Target title="Debug x86"> <Target title="Debug x86">
<Option output="./../../bin/x86/Debug/libEGL.so.1" prefix_auto="0" extension_auto="0" /> <Option output="./../../../lib/Debug_x86/libEGL.so.1" prefix_auto="0" extension_auto="0" />
<Option object_output="obj/x86/Debug/" /> <Option object_output="obj/x86/Debug/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Release x86"> <Target title="Release x86">
<Option output="./../../bin/x86/Release/libEGL.so.1" prefix_auto="0" extension_auto="0" /> <Option output="./../../../lib/Release_x86/libEGL.so.1" prefix_auto="0" extension_auto="0" />
<Option object_output="obj/x86/Release/" /> <Option object_output="obj/x86/Release/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Debug x64"> <Target title="Debug x64">
<Option output="./../../bin/x64/Debug/libEGL.so.1" prefix_auto="0" extension_auto="0" /> <Option output="./../../../lib/Debug_x64/libEGL.so.1" prefix_auto="0" extension_auto="0" />
<Option object_output="obj/x64/Debug/" /> <Option object_output="obj/x64/Debug/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Release x64"> <Target title="Release x64">
<Option output="./../../bin/x64/Release/libEGL.so.1" prefix_auto="0" extension_auto="0" /> <Option output="./../../../lib/Release_x64/libEGL.so.1" prefix_auto="0" extension_auto="0" />
<Option object_output="obj/x64/Release/" /> <Option object_output="obj/x64/Release/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
...@@ -86,16 +86,18 @@ ...@@ -86,16 +86,18 @@
<Linker> <Linker>
<Add library="pthread" /> <Add library="pthread" />
</Linker> </Linker>
<Unit filename="../../Common/SharedLibrary.hpp" />
<Unit filename="../common/debug.cpp" /> <Unit filename="../common/debug.cpp" />
<Unit filename="./Config.cpp" /> <Unit filename="Config.cpp" />
<Unit filename="./Config.h" /> <Unit filename="Config.h" />
<Unit filename="./Display.cpp" /> <Unit filename="Display.cpp" />
<Unit filename="./Display.h" /> <Unit filename="Display.h" />
<Unit filename="./Surface.cpp" /> <Unit filename="Image.hpp" />
<Unit filename="./Surface.h" /> <Unit filename="Surface.cpp" />
<Unit filename="./libEGL.cpp" /> <Unit filename="Surface.h" />
<Unit filename="./main.cpp" /> <Unit filename="libEGL.cpp" />
<Unit filename="./main.h" /> <Unit filename="main.cpp" />
<Unit filename="main.h" />
<Extensions> <Extensions>
<code_completion /> <code_completion />
<debugger /> <debugger />
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "Common/Version.h" #include "Common/Version.h"
#include <exception> #include <exception>
#include <string.h>
static bool validateDisplay(egl::Display *display) static bool validateDisplay(egl::Display *display)
{ {
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file> <CodeBlocks_workspace_file>
<Workspace title="SwiftShader"> <Workspace title="SwiftShader">
<Project filename="./GLES2/libEGL/libEGL.cbp" /> <Project filename="./OpenGL/libEGL/libEGL.cbp" />
<Project filename="./GLES2/libGLESv2/libGLESv2.cbp"> <Project filename="./OpenGL/libGLESv2/libGLESv2.cbp">
<Depends filename="./LLVM/LLVM.cbp" /> <Depends filename="./LLVM/LLVM.cbp" />
</Project> </Project>
<Project filename="./LLVM/LLVM.cbp" /> <Project filename="./LLVM/LLVM.cbp" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment