Add gl_PointCoord.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20510 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
38c507e75a
commit
6968b823ef
15
Test/pointCoord.frag
Normal file
15
Test/pointCoord.frag
Normal file
@ -0,0 +1,15 @@
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D sampler;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color;
|
||||
|
||||
if (length(gl_PointCoord) < 0.3)
|
||||
color = texture2D(sampler, gl_PointCoord);
|
||||
else
|
||||
color = vec4(0.0);
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
@ -16,3 +16,4 @@ cppSimple.vert
|
||||
cppIndent.vert
|
||||
cppNest.vert
|
||||
cppComplexExpr.vert
|
||||
pointCoord.frag
|
||||
|
@ -94,6 +94,7 @@ enum TStorageQualifier {
|
||||
// built-ins read by fragment shader
|
||||
EvqFace,
|
||||
EvqFragCoord,
|
||||
EvqPointCoord,
|
||||
|
||||
// built-ins written by fragment shader
|
||||
EvqFragColor,
|
||||
@ -123,8 +124,9 @@ __inline const char* getStorageQualifierString(TStorageQualifier q)
|
||||
case EvqPosition: return "Position"; break;
|
||||
case EvqPointSize: return "PointSize"; break;
|
||||
case EvqClipVertex: return "ClipVertex"; break;
|
||||
case EvqFace: return "Face"; break;
|
||||
case EvqFace: return "FrontFacing"; break;
|
||||
case EvqFragCoord: return "FragCoord"; break;
|
||||
case EvqPointCoord: return "PointCoord"; break;
|
||||
case EvqFragColor: return "FragColor"; break;
|
||||
case EvqFragDepth: return "FragDepth"; break;
|
||||
default: return "unknown qualifier";
|
||||
|
@ -831,14 +831,13 @@ void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
|
||||
// the built-in header files.
|
||||
//
|
||||
switch(language) {
|
||||
case EShLangFragment:
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EvqFace, 1)));
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EvqFragCoord, 4)));
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EvqPointCoord, 2)));
|
||||
|
||||
case EShLangFragment: {
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EvqFace, 1)));
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EvqFragCoord, 4)));
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EvqFragColor, 4)));
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragDepth"), TType(EbtFloat, EvqFragDepth, 1)));
|
||||
|
||||
}
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EvqFragColor, 4)));
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragDepth"), TType(EbtFloat, EvqFragDepth, 1)));
|
||||
break;
|
||||
|
||||
case EShLangVertex:
|
||||
@ -846,7 +845,12 @@ void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EvqPointSize, 1)));
|
||||
symbolTable.insert(*new TVariable(NewPoolTString("gl_ClipVertex"), TType(EbtFloat, EvqClipVertex, 4)));
|
||||
break;
|
||||
default: break;
|
||||
|
||||
case EShLangTessControl:
|
||||
case EShLangTessEvaluation:
|
||||
case EShLangGeometry:
|
||||
// TODO: support these stages
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -76,6 +76,7 @@ void TParseContext::setVersion(int newVersion)
|
||||
defaultPrecision[EbtInt] = EpqMedium;
|
||||
defaultPrecision[EbtSampler2D] = EpqLow;
|
||||
defaultPrecision[EbtSamplerCube] = EpqLow;
|
||||
// TODO: give error when using float in frag shader without default precision
|
||||
}
|
||||
} else {
|
||||
for (int type = 0; type < EbtNumTypes; ++type)
|
||||
@ -294,7 +295,10 @@ void TParseContext::binaryOpError(int line, char* op, TString left, TString righ
|
||||
void TParseContext::variableErrorCheck(TIntermTyped*& nodePtr)
|
||||
{
|
||||
TIntermSymbol* symbol = nodePtr->getAsSymbolNode();
|
||||
if (symbol && symbol->getType().getBasicType() == EbtVoid) {
|
||||
if (! symbol)
|
||||
return;
|
||||
|
||||
if (symbol->getType().getBasicType() == EbtVoid) {
|
||||
error(symbol->getLine(), "undeclared identifier", symbol->getSymbol().c_str(), "");
|
||||
recover();
|
||||
|
||||
@ -307,6 +311,12 @@ void TParseContext::variableErrorCheck(TIntermTyped*& nodePtr)
|
||||
nodePtr = intermediate.addSymbol(fakeVariable->getUniqueId(),
|
||||
fakeVariable->getName(),
|
||||
fakeVariable->getType(), symbol->getLine());
|
||||
} else {
|
||||
switch (symbol->getQualifier().storage) {
|
||||
case EvqPointCoord:
|
||||
profileRequires(symbol->getLine(), ENoProfile, 120, 0, "gl_PointCoord");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,6 +382,7 @@ bool TParseContext::lValueErrorCheck(int line, char* op, TIntermTyped* node)
|
||||
case EvqVaryingIn: message = "can't modify a varying"; break;
|
||||
case EvqFace: message = "can't modify gl_FrontFace"; break;
|
||||
case EvqFragCoord: message = "can't modify gl_FragCoord"; break;
|
||||
case EvqPointCoord: message = "can't modify gl_PointCoord"; break;
|
||||
default:
|
||||
|
||||
//
|
||||
|
@ -217,8 +217,7 @@ bool InitializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language
|
||||
}
|
||||
|
||||
for (TBuiltInStrings::iterator i = BuiltInStrings[parseContext.language].begin();
|
||||
i != BuiltInStrings[parseContext.language].end();
|
||||
++i) {
|
||||
i != BuiltInStrings[parseContext.language].end(); ++i) {
|
||||
const char* builtInShaders[1];
|
||||
int builtInLengths[1];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user