summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/core/platform.cpp15
-rw-r--r--source/core/slang-string.cpp18
-rw-r--r--source/slang-glslang/slang-glslang.cpp9
-rw-r--r--source/slang-glslang/slang-glslang.h2
-rw-r--r--source/slang/slang.cpp2
5 files changed, 41 insertions, 5 deletions
diff --git a/source/core/platform.cpp b/source/core/platform.cpp
index dbb536b0f..374606e4a 100644
--- a/source/core/platform.cpp
+++ b/source/core/platform.cpp
@@ -8,6 +8,7 @@
#undef WIN32_LEAN_AND_MEAN
#undef NOMINMAX
#else
+ #include "slang-string.h"
#include <dlfcn.h>
#endif
@@ -27,7 +28,19 @@ namespace Slang
}
#else
{
- void* h = dlopen(name, RTLD_LOCAL);
+ String fullName;
+ fullName.append("lib");
+ fullName.append(name);
+ fullName.append(".so");
+
+ void* h = dlopen(fullName.Buffer(), RTLD_NOW|RTLD_LOCAL);
+ if(!h)
+ {
+ if(auto msg = dlerror())
+ {
+ fprintf(stderr, "error: %s\n", msg);
+ }
+ }
result.handle = (Handle) h;
}
diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp
index 5a3d8e4f9..460a077b5 100644
--- a/source/core/slang-string.cpp
+++ b/source/core/slang-string.cpp
@@ -172,14 +172,26 @@ namespace Slang
else
{
List<char> buf;
- Slang::Encoding::UTF16->GetBytes(buf, *this);
+ switch(sizeof(wchar_t))
+ {
+ case 2:
+ Slang::Encoding::UTF16->GetBytes(buf, *this);
+ break;
+
+ case 4:
+ Slang::Encoding::UTF32->GetBytes(buf, *this);
+ break;
+
+ default:
+ break;
+ }
auto length = buf.Count() / sizeof(wchar_t);
if (outLength)
*outLength = length;
- buf.Add(0);
- buf.Add(0);
+ for(int ii = 0; ii < sizeof(wchar_t); ++ii)
+ buf.Add(0);
wchar_t* beginData = (wchar_t*)buf.Buffer();
wchar_t* endData = beginData + length;
diff --git a/source/slang-glslang/slang-glslang.cpp b/source/slang-glslang/slang-glslang.cpp
index 21a95c3b9..ae61823d1 100644
--- a/source/slang-glslang/slang-glslang.cpp
+++ b/source/slang-glslang/slang-glslang.cpp
@@ -28,6 +28,7 @@
#include <Windows.h>
#endif
+#include <memory>
#include <sstream>
// This is a wrapper to allow us to run the `glslang` compiler
@@ -67,7 +68,11 @@ static void dump(
// also output it for debug purposes
std::string str((char const*)data, size);
+ #ifdef _WIN32
OutputDebugStringA(str.c_str());
+ #else
+ fprintf(stderr, "%s\n", str.c_str());;
+ #endif
}
}
@@ -177,7 +182,11 @@ static int glslang_dissassembleSPIRV(glslang_CompileRequest* request)
}
extern "C"
+#ifdef _MSC_VER
_declspec(dllexport)
+#else
+__attribute__((__visibility__("default")))
+#endif
int glslang_compile(glslang_CompileRequest* request)
{
glslang::InitializeProcess();
diff --git a/source/slang-glslang/slang-glslang.h b/source/slang-glslang/slang-glslang.h
index 748ad3dd1..22014de72 100644
--- a/source/slang-glslang/slang-glslang.h
+++ b/source/slang-glslang/slang-glslang.h
@@ -2,6 +2,8 @@
#ifndef SLANG_GLSLANG_H_INCLUDED
#define SLANG_GLSLANG_H_INCLUDED
+#include <stddef.h>
+
typedef void (*glslang_OutputFunc)(void const* data, size_t size, void* userData);
enum
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 65abbb3f2..e51d111de 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -859,7 +859,7 @@ SLANG_API int spCompile(
{
auto req = REQ(request);
-#if 1
+#if 0
// By default we'd like to catch as many internal errors as possible,
// and report them to the user nicely (rather than just crash their
// application). Internally Slang currently uses exceptions for this.