InitializeGlobalPools();
- if (!InitializeGlobalParseContext())
+ if (!InitializeThreadParseContext())
return false;
if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) {
--- /dev/null
+#version 300 es
+
+in vec4 pos;
+
+uniform sampler2D s2D;
+uniform samplerCube sCube;
+uniform isampler2DArray is2DAbad; // ERROR, no default precision
+uniform sampler2DArrayShadow s2dASbad; // ERROR, no default precision
+
+precision highp sampler2D;
+precision mediump sampler2DArrayShadow;
+
+uniform sampler2DArrayShadow s2dAS;
+uniform isampler2DArray is2DAbad2; // ERROR, still no default precision
+
+uniform sampler2D s2Dhigh;
+
+void main()
+{
+ vec4 t = texture(s2D, vec2(0.1, 0.2));
+ t += texture(s2Dhigh, vec2(0.1, 0.2));
+ t += texture(s2dAS, vec4(0.5));
+
+ gl_Position = pos;
+}
#include "osinclude.h"
bool InitializeParseContextIndex();
-bool InitializeGlobalParseContext();
+bool InitializeThreadParseContext();
bool FreeParseContext();
bool FreeParseContextIndex();
return true;
}
-bool InitializeGlobalParseContext()
+bool InitializeThreadParseContext()
{
if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "InitializeGlobalParseContext(): Parse Context index not initialized");
+ assert(0 && "InitializeThreadParseContext(): Parse Context index not initialized");
return false;
}
TThreadParseContext *lpThreadData = new TThreadParseContext();
if (lpThreadData == 0) {
- assert(0 && "InitializeGlobalParseContext(): Unable to create thread parse context");
+ assert(0 && "InitializeThreadParseContext(): Unable to create thread parse context");
return false;
}
return true;
}
-TParseContextPointer& GetGlobalParseContext()
+TParseContextPointer& ThreadLocalParseContext()
{
//
// Minimal error checking for speed
void ResetFlex();
typedef TParseContext* TParseContextPointer;
-extern TParseContextPointer& GetGlobalParseContext();
-#define GlobalParseContext GetGlobalParseContext()
+TParseContextPointer& ThreadLocalParseContext();
typedef struct TThreadParseContextRec
{
TParseContext parseContext(*symbolTable, intermediate, true, version, profile, language, infoSink);
- GlobalParseContext = &parseContext;
+ ThreadLocalParseContext() = &parseContext;
assert(symbolTable->isEmpty() || symbolTable->atSharedBuiltInLevel());
}; // end anonymous namespace for local functions
+//
+// ShInitialize() should be called exactly once per process, not per thread.
+//
int ShInitialize()
{
if (! InitProcess())
return 0;
- // TODO: Quality: Thread safety:
- // This method should be called once per process. If it's called by multiple threads, then
- // we need to have thread synchronization code around the initialization of per process
- // global pool allocator
if (! PerProcessGPA) {
PerProcessGPA = new TPoolAllocator(true);
}
else if (profile == EEsProfile && version >= 300 && versionNotFirst)
parseContext.error(1, "statement must appear first in ESSL shader; before comments or newlines", "#version", "");
- GlobalParseContext = &parseContext;
+ ThreadLocalParseContext() = &parseContext;
ResetFlex();
InitPreprocessor();
\r
if (pc.AfterEOF) {\r
if (cpp->tokensBeforeEOF == 1)\r
- GlobalParseContext->error(yylineno, "", "pre-mature EOF", s, "");\r
+ ThreadLocalParseContext()->error(yylineno, "", "pre-mature EOF", s, "");\r
} else\r
- GlobalParseContext->error(yylineno, "", yytext, s, "");\r
+ ThreadLocalParseContext()->error(yylineno, "", yytext, s, "");\r
}\r
\r
void PaReservedWord()\r
{\r
- GlobalParseContext->error(yylineno, "Reserved word.", yytext, "", "");\r
+ ThreadLocalParseContext()->error(yylineno, "Reserved word.", yytext, "", "");\r
}\r
\r
int PaIdentOrType(const char* yytext, TParseContext& parseContextLocal, YYSTYPE* pyylval)\r
//
//
-// This file contains the Linux specific functions
+// This file contains the Linux-specific functions
//
#include "osinclude.h"
#include "InitializeDll.h"
#include "osinclude.h"
//
-// This file contains contains the window's specific functions
+// This file contains contains the Window-OS-specific functions
//
#if !(defined(_WIN32) || defined(_WIN64))
#ifdef __cplusplus
extern "C" {
#endif
+
//
// Driver must call this first, once, before doing any other
// compiler/linker operations.
//
+// (Call once per process, not once per thread.)
+//
SH_IMPORT_EXPORT int ShInitialize();
+
//
-// Driver should call this at shutdown.
+// Driver should call this at process shutdown.
//
SH_IMPORT_EXPORT int __fastcall ShFinalize();