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;
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;

View File

@ -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;

View File

@ -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.

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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;