Implement __VERSION__ macro, make ftransform() non-ES only, add more tests.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22000 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-06-13 23:56:04 +00:00
parent fb7044a9a8
commit f78fff94e9
7 changed files with 20 additions and 4 deletions

View File

@ -79,6 +79,7 @@ void main()
f >> i; f >> i;
m4 >> i; m4 >> i;
a >> u; a >> u;
iv3 >> iv4;
i & u; i & u;
u ^ uv3; u ^ uv3;
@ -86,6 +87,7 @@ void main()
u & f; u & f;
m2 | m2; m2 | m2;
s ^ s; s ^ s;
(f = f) = f;
// These are all okay: // These are all okay:
f * v4; f * v4;
@ -118,6 +120,7 @@ void main()
uv3 <<= i; uv3 <<= i;
i >> i; i >> i;
u << u; u << u;
iv3 >> iv3;
i & i; i & i;
u | u; u | u;

View File

@ -121,5 +121,9 @@ sum += 0.05;
#error bad6 #error bad6
#endif #endif
int linenumber = __LINE__;
int filenumber = __FILE__;
int version = __VERSION__;
#define PASTE(a,b) a ## b #define PASTE(a,b) a ## b
float PASTE(tod, ay) = 17; float PASTE(tod, ay) = 17;

View File

@ -630,6 +630,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
// //
// Geometric Functions. // Geometric Functions.
// //
if (profile != EEsProfile)
s.append(TString("vec4 ftransform();")); s.append(TString("vec4 ftransform();"));
// //

View File

@ -1128,6 +1128,13 @@ void SetVersion(int version)
// CPP should still report errors in semantics // CPP should still report errors in semantics
} }
int GetVersion(void* cppPc)
{
TParseContext& pc = *((TParseContext *)cppPc);
return pc.version;
}
void SetProfile(EProfile profile) void SetProfile(EProfile profile)
{ {
// called by the CPP, but this functionality is currently // called by the CPP, but this functionality is currently

View File

@ -1027,8 +1027,8 @@ int MacroExpand(int atom, yystypepp* yylvalpp, int expandUndef)
} }
if (atom == __VERSION__Atom) { if (atom == __VERSION__Atom) {
strcpy(yylvalpp->symbol_name, "100"); yylvalpp->sc_int = GetVersion(cpp->pC);
yylvalpp->sc_int = atoi(yylvalpp->symbol_name); sprintf(yylvalpp->symbol_name, "%d", yylvalpp->sc_int);
UngetToken(CPP_INTCONSTANT, yylvalpp); UngetToken(CPP_INTCONSTANT, yylvalpp);
return 1; return 1;

View File

@ -117,6 +117,7 @@ int GetStringNumber(void); // Get the current String Number.
const char* GetStrfromTStr(void); // Convert TString to String. const char* GetStrfromTStr(void); // Convert TString to String.
void SetVersion(int); void SetVersion(int);
void SetProfile(EProfile); void SetProfile(EProfile);
int GetVersion(void*);
void updateExtensionBehavior(const char* extName, const char* behavior); void updateExtensionBehavior(const char* extName, const char* behavior);
int FreeCPP(void); int FreeCPP(void);

View File

@ -83,7 +83,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
typedef struct CPPStruct_Rec CPPStruct; 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. // this preprocessing single-threaded only.
extern CPPStruct *cpp; extern CPPStruct *cpp;