Put all glslang internals (but not the external interface) into the glslang namespace.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22882 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-08-29 00:39:25 +00:00
parent 23bdb29eac
commit b603f918a4
55 changed files with 511 additions and 463 deletions

View file

@ -46,6 +46,7 @@
#define _vsnprintf vsnprintf
namespace glslang {
void DetachThreadLinux(void *);
@ -60,7 +61,7 @@ bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
inline void * OS_GetTLSValue(OS_TLSIndex nIndex)
inline void* OS_GetTLSValue(OS_TLSIndex nIndex)
{
//
// This function should return 0 if nIndex is invalid.
@ -69,18 +70,18 @@ inline void * OS_GetTLSValue(OS_TLSIndex nIndex)
return pthread_getspecific(nIndex);
}
namespace glslang {
void InitGlobalLock();
void GetGlobalLock();
void ReleaseGlobalLock();
void InitGlobalLock();
void GetGlobalLock();
void ReleaseGlobalLock();
typedef unsigned int (*TThreadEntrypoint)(void*);
void* OS_CreateThread(TThreadEntrypoint);
void OS_WaitForAllThreads(void* threads, int numThreads);
typedef unsigned int (*TThreadEntrypoint)(void*);
void* OS_CreateThread(TThreadEntrypoint);
void OS_WaitForAllThreads(void* threads, int numThreads);
void OS_Sleep(int milliseconds);
void OS_Sleep(int milliseconds);
void OS_DumpMemoryCounters();
};
void OS_DumpMemoryCounters();
} // end namespace glslang
#endif // __OSINCLUDE_H

View file

@ -38,6 +38,8 @@
#include "osinclude.h"
#include "InitializeDll.h"
namespace glslang {
//
// Thread cleanup
//
@ -135,25 +137,25 @@ bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
return false;
}
namespace glslang {
// TODO: if we need these on linux, flesh them out
void InitGlobalLock() { }
void GetGlobalLock() { }
void ReleaseGlobalLock() { }
// TODO: if we need these on linux, flesh them out
void InitGlobalLock() { }
void GetGlobalLock() { }
void ReleaseGlobalLock() { }
void* OS_CreateThread(TThreadEntrypoint entry)
{
}
void* OS_CreateThread(TThreadEntrypoint entry)
{
}
void OS_WaitForAllThreads(void* threads, int numThreads)
{
}
void OS_WaitForAllThreads(void* threads, int numThreads)
{
}
void OS_Sleep(int milliseconds)
{
}
void OS_Sleep(int milliseconds)
{
}
void OS_DumpMemoryCounters()
{
}
};
void OS_DumpMemoryCounters()
{
}
} // end namespace glslang

View file

@ -45,24 +45,24 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
case DLL_PROCESS_ATTACH:
if (!InitProcess())
if (! glslang::InitProcess())
return FALSE;
break;
case DLL_THREAD_ATTACH:
if (!InitThread())
if (! glslang::InitThread())
return FALSE;
break;
case DLL_THREAD_DETACH:
if (!DetachThread())
if (! glslang::DetachThread())
return FALSE;
break;
case DLL_PROCESS_DETACH:
DetachProcess();
glslang::DetachProcess();
break;
default:

View file

@ -44,6 +44,8 @@
#error Trying to include a windows specific file in a non windows build.
#endif
namespace glslang {
//
// Thread Local Storage Operations
//
@ -56,18 +58,18 @@ bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
void* OS_GetTLSValue(OS_TLSIndex nIndex);
namespace glslang {
void InitGlobalLock();
void GetGlobalLock();
void ReleaseGlobalLock();
void InitGlobalLock();
void GetGlobalLock();
void ReleaseGlobalLock();
typedef unsigned int (__stdcall *TThreadEntrypoint)(void*);
void* OS_CreateThread(TThreadEntrypoint);
void OS_WaitForAllThreads(void* threads, int numThreads);
typedef unsigned int (__stdcall *TThreadEntrypoint)(void*);
void* OS_CreateThread(TThreadEntrypoint);
void OS_WaitForAllThreads(void* threads, int numThreads);
void OS_Sleep(int milliseconds);
void OS_Sleep(int milliseconds);
void OS_DumpMemoryCounters();
};
void OS_DumpMemoryCounters();
} // end namespace glslang
#endif // __OSINCLUDE_H

View file

@ -50,6 +50,8 @@
#error Trying to build a windows specific file in a non windows build.
#endif
namespace glslang {
//
// Thread Local Storage Operations
//
@ -97,44 +99,44 @@ bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
return false;
}
namespace glslang {
HANDLE GlobalLock;
HANDLE GlobalLock;
void InitGlobalLock()
{
GlobalLock = CreateMutex(0, false, 0);
}
void InitGlobalLock()
{
GlobalLock = CreateMutex(0, false, 0);
}
void GetGlobalLock()
{
WaitForSingleObject(GlobalLock, INFINITE);
}
void GetGlobalLock()
{
WaitForSingleObject(GlobalLock, INFINITE);
}
void ReleaseGlobalLock()
{
ReleaseMutex(GlobalLock);
}
void ReleaseGlobalLock()
{
ReleaseMutex(GlobalLock);
}
void* OS_CreateThread(TThreadEntrypoint entry)
{
return (void*)_beginthreadex(0, 0, entry, 0, 0, 0);
//return CreateThread(0, 0, entry, 0, 0, 0);
}
void* OS_CreateThread(TThreadEntrypoint entry)
{
return (void*)_beginthreadex(0, 0, entry, 0, 0, 0);
//return CreateThread(0, 0, entry, 0, 0, 0);
}
void OS_WaitForAllThreads(void* threads, int numThreads)
{
WaitForMultipleObjects(numThreads, (HANDLE*)threads, true, INFINITE);
}
void OS_WaitForAllThreads(void* threads, int numThreads)
{
WaitForMultipleObjects(numThreads, (HANDLE*)threads, true, INFINITE);
}
void OS_Sleep(int milliseconds)
{
Sleep(milliseconds);
}
void OS_Sleep(int milliseconds)
{
Sleep(milliseconds);
}
void OS_DumpMemoryCounters()
{
PROCESS_MEMORY_COUNTERS counters;
GetProcessMemoryInfo(GetCurrentProcess(), &counters, sizeof(counters));
printf("Working set size: %d\n", counters.WorkingSetSize);
}
};
void OS_DumpMemoryCounters()
{
PROCESS_MEMORY_COUNTERS counters;
GetProcessMemoryInfo(GetCurrentProcess(), &counters, sizeof(counters));
printf("Working set size: %d\n", counters.WorkingSetSize);
}
} // namespace glslang