diff --git a/Test/300operations.frag b/Test/300operations.frag index 9657c5926c6ed10ca1fe37821b15cc0fdb57f3a2..3e7782c0e084004610be4ae6a6857b6e21c22fac 100644 --- a/Test/300operations.frag +++ b/Test/300operations.frag @@ -79,6 +79,7 @@ void main() f >> i; m4 >> i; a >> u; + iv3 >> iv4; i & u; u ^ uv3; @@ -86,6 +87,7 @@ void main() u & f; m2 | m2; s ^ s; + (f = f) = f; // These are all okay: f * v4; @@ -118,6 +120,7 @@ void main() uv3 <<= i; i >> i; u << u; + iv3 >> iv3; i & i; u | u; diff --git a/Test/cppSimple.vert b/Test/cppSimple.vert index 4cfa4f4ebd2e1db191fc6a59776f38035d35627d..2b48c01905669c3ffee4decb43a1a4d60be7ed7b 100644 --- a/Test/cppSimple.vert +++ b/Test/cppSimple.vert @@ -121,5 +121,9 @@ sum += 0.05; #error bad6 #endif +int linenumber = __LINE__; +int filenumber = __FILE__; +int version = __VERSION__; + #define PASTE(a,b) a ## b float PASTE(tod, ay) = 17; diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 77f3ff17c1e9f759d483305c00e4fa673875b125..8b7e3fc00ad5916a840ab018c1ecfd06656d978a 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -630,7 +630,8 @@ void TBuiltIns::initialize(int version, EProfile profile) // // Geometric Functions. // - s.append(TString("vec4 ftransform();")); + if (profile != EEsProfile) + s.append(TString("vec4 ftransform();")); // // Original-style texture Functions with lod. diff --git a/glslang/MachineIndependent/glslang.l b/glslang/MachineIndependent/glslang.l index 60a2dbad57b822cb6e2655e621bc8e6149264383..8160ae8de447fdcc65b9e68b6451eea054b63048 100644 --- a/glslang/MachineIndependent/glslang.l +++ b/glslang/MachineIndependent/glslang.l @@ -1128,6 +1128,13 @@ void SetVersion(int version) // CPP should still report errors in semantics } +int GetVersion(void* cppPc) +{ + TParseContext& pc = *((TParseContext *)cppPc); + + return pc.version; +} + void SetProfile(EProfile profile) { // called by the CPP, but this functionality is currently diff --git a/glslang/MachineIndependent/preprocessor/cpp.c b/glslang/MachineIndependent/preprocessor/cpp.c index efa77bc3a1b4c6eb62dd5d3f6336a20471155198..77416511b73cab3808910fc11546ff5a22dc2b12 100644 --- a/glslang/MachineIndependent/preprocessor/cpp.c +++ b/glslang/MachineIndependent/preprocessor/cpp.c @@ -1027,8 +1027,8 @@ int MacroExpand(int atom, yystypepp* yylvalpp, int expandUndef) } if (atom == __VERSION__Atom) { - strcpy(yylvalpp->symbol_name, "100"); - yylvalpp->sc_int = atoi(yylvalpp->symbol_name); + yylvalpp->sc_int = GetVersion(cpp->pC); + sprintf(yylvalpp->symbol_name, "%d", yylvalpp->sc_int); UngetToken(CPP_INTCONSTANT, yylvalpp); return 1; diff --git a/glslang/MachineIndependent/preprocessor/cpp.h b/glslang/MachineIndependent/preprocessor/cpp.h index aa8b685822e737b3c18a6dba184ff816fa42d640..cdedb62c1a1a00111f05ed8203a187b1b69ccd78 100644 --- a/glslang/MachineIndependent/preprocessor/cpp.h +++ b/glslang/MachineIndependent/preprocessor/cpp.h @@ -117,6 +117,7 @@ int GetStringNumber(void); // Get the current String Number. const char* GetStrfromTStr(void); // Convert TString to String. void SetVersion(int); void SetProfile(EProfile); +int GetVersion(void*); void updateExtensionBehavior(const char* extName, const char* behavior); int FreeCPP(void); diff --git a/glslang/MachineIndependent/preprocessor/slglobals.h b/glslang/MachineIndependent/preprocessor/slglobals.h index 88c63773a35eaf4f85c29a2bb9676303542ca02e..3af23862b18ad83b89f85258f380c6d6cdf135d8 100644 --- a/glslang/MachineIndependent/preprocessor/slglobals.h +++ b/glslang/MachineIndependent/preprocessor/slglobals.h @@ -83,7 +83,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. typedef struct CPPStruct_Rec CPPStruct; -// Multi-threading note: The existence of this global makes +// TODO: threading: Multi-threading note: The existence of this global makes // this preprocessing single-threaded only. extern CPPStruct *cpp;