mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-10 04:20:06 +00:00
Finish GL_ARB_shading_language_420pack: *ProgramTexelOffset built-in constants. Also, make comma operation not fold constants.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@26602 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
0b9e112da6
commit
bae44b74d4
@ -96,3 +96,6 @@ void bar23444()
|
||||
const float b = 2 * a1;
|
||||
int a = gl_MinProgramTexelOffset + gl_MaxProgramTexelOffset;
|
||||
}
|
||||
|
||||
const int comma0 = (2, 3); // ERROR
|
||||
int comma1[(2, 3)]; // ERROR
|
||||
|
@ -71,7 +71,7 @@ layout(std140) uniform blocke {
|
||||
layout(offset = 32) vec3 b; // ERROR
|
||||
} spinste;
|
||||
|
||||
int aconste[gl_MaxTransformFeedbackBuffers]; // ERROR ??
|
||||
int aconste[gl_MaxTransformFeedbackBuffers]; // ERROR
|
||||
int bconste[gl_MaxTransformFeedbackInterleavedComponents]; // ERROR
|
||||
|
||||
out bblck2 {
|
||||
|
@ -14,10 +14,7 @@ ERROR: 0:84: 'textureGatherOffset(...)' : not supported for this version or the
|
||||
ERROR: 0:85: 'textureGatherOffset(...)' : not supported for this version or the enabled extensions
|
||||
WARNING: 0:88: '#extension' : extension is only partially supported: GL_ARB_gpu_shader5
|
||||
ERROR: 0:120: 'line continuation' : not supported for this version or the enabled extensions
|
||||
WARNING: 0:123: '#extension' : extension is only partially supported: GL_ARB_shading_language_420pack
|
||||
ERROR: 0:126: 'uniform block' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:138: 'gl_MinProgramTexelOffset' : undeclared identifier
|
||||
ERROR: 0:138: 'gl_MaxProgramTexelOffset' : undeclared identifier
|
||||
ERROR: 0:140: 'length' : does not operate on this type: bool
|
||||
ERROR: 0:140: 'boolb' : can't use function syntax on variable
|
||||
ERROR: 0:141: 'length' : does not operate on this type: float
|
||||
@ -28,7 +25,7 @@ ERROR: 0:143: 'length' : method does not accept any arguments
|
||||
ERROR: 0:146: 'gl_FogFragCoord' : identifiers starting with "gl_" are reserved
|
||||
ERROR: 0:151: 'int' : must be qualified as flat in
|
||||
ERROR: 0:151: 'redeclaration' : cannot change the type of gl_FogFragCoord
|
||||
ERROR: 26 compilation errors. No code generated.
|
||||
ERROR: 24 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 130
|
||||
@ -343,9 +340,8 @@ ERROR: node is still EOpNull!
|
||||
0:138 'a' (3-component vector of float)
|
||||
0:138 Constant:
|
||||
0:138 0 (const int)
|
||||
0:138 add (float)
|
||||
0:138 'gl_MinProgramTexelOffset' (float)
|
||||
0:138 'gl_MaxProgramTexelOffset' (float)
|
||||
0:138 Constant:
|
||||
0:138 -1.000000
|
||||
0:140 Constant:
|
||||
0:140 0.000000
|
||||
0:141 Constant:
|
||||
@ -698,9 +694,8 @@ ERROR: node is still EOpNull!
|
||||
0:138 'a' (3-component vector of float)
|
||||
0:138 Constant:
|
||||
0:138 0 (const int)
|
||||
0:138 add (float)
|
||||
0:138 'gl_MinProgramTexelOffset' (float)
|
||||
0:138 'gl_MaxProgramTexelOffset' (float)
|
||||
0:138 Constant:
|
||||
0:138 -1.000000
|
||||
0:140 Constant:
|
||||
0:140 0.000000
|
||||
0:141 Constant:
|
||||
|
@ -31,9 +31,9 @@ ERROR: 0:76: 'binding' : sampler binding not less than gl_MaxCombinedTextureImag
|
||||
ERROR: 0:85: 'patch' : not supported in this stage: vertex
|
||||
ERROR: 0:85: '' : vertex input cannot be further qualified
|
||||
ERROR: 0:86: 'patch' : not supported in this stage: vertex
|
||||
ERROR: 0:97: 'gl_MinProgramTexelOffset' : undeclared identifier
|
||||
ERROR: 0:97: 'gl_MaxProgramTexelOffset' : undeclared identifier
|
||||
ERROR: 0:97: '=' : cannot convert from 'float' to 'int'
|
||||
ERROR: 0:100: '=' : global const initializers must be constant 'const int'
|
||||
ERROR: 0:101: '' : constant expression required
|
||||
ERROR: 0:101: '' : array size must be a constant integer expression
|
||||
ERROR: 33 compilation errors. No code generated.
|
||||
|
||||
|
||||
@ -141,6 +141,11 @@ ERROR: node is still EOpNull!
|
||||
0:96 Constant:
|
||||
0:96 2.000000
|
||||
0:96 'a1' (float)
|
||||
0:97 Sequence
|
||||
0:97 move second child to first child (int)
|
||||
0:97 'a' (int)
|
||||
0:97 Constant:
|
||||
0:97 -1 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 'v2' (smooth out 2-component vector of float)
|
||||
0:? 'bad' (in 10-element array of 4-component vector of float)
|
||||
@ -173,6 +178,8 @@ ERROR: node is still EOpNull!
|
||||
0:? 'anon@3' (out block{out implicitly-sized array of float gl_ClipDistance, })
|
||||
0:? 'patchIn' (patch in 4-component vector of float)
|
||||
0:? 'patchOut' (smooth patch out 4-component vector of float)
|
||||
0:? 'comma0' (int)
|
||||
0:? 'comma1' (1-element array of int)
|
||||
0:? 'gl_VertexID' (gl_VertexId int)
|
||||
0:? 'gl_InstanceID' (gl_InstanceId int)
|
||||
|
||||
@ -284,6 +291,11 @@ ERROR: node is still EOpNull!
|
||||
0:96 Constant:
|
||||
0:96 2.000000
|
||||
0:96 'a1' (float)
|
||||
0:97 Sequence
|
||||
0:97 move second child to first child (int)
|
||||
0:97 'a' (int)
|
||||
0:97 Constant:
|
||||
0:97 -1 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 'v2' (smooth out 2-component vector of float)
|
||||
0:? 'bad' (in 10-element array of 4-component vector of float)
|
||||
@ -316,6 +328,8 @@ ERROR: node is still EOpNull!
|
||||
0:? 'anon@3' (out block{out 1-element array of float gl_ClipDistance, })
|
||||
0:? 'patchIn' (patch in 4-component vector of float)
|
||||
0:? 'patchOut' (smooth patch out 4-component vector of float)
|
||||
0:? 'comma0' (int)
|
||||
0:? 'comma1' (1-element array of int)
|
||||
0:? 'gl_VertexID' (gl_VertexId int)
|
||||
0:? 'gl_InstanceID' (gl_InstanceId int)
|
||||
|
||||
|
@ -64,8 +64,14 @@ ERROR: node is still EOpNull!
|
||||
0:175 Function Definition: foo985( (void)
|
||||
0:175 Function Parameters:
|
||||
0:175 Sequence
|
||||
0:175 Constant:
|
||||
0:175 6 (const int)
|
||||
0:175 add (int)
|
||||
0:175 Constant:
|
||||
0:175 2 (const int)
|
||||
0:175 Comma (int)
|
||||
0:175 Constant:
|
||||
0:175 3 (const int)
|
||||
0:175 Constant:
|
||||
0:175 4 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 'sum' (float)
|
||||
0:? 'selected4' (int)
|
||||
@ -132,8 +138,14 @@ ERROR: node is still EOpNull!
|
||||
0:175 Function Definition: foo985( (void)
|
||||
0:175 Function Parameters:
|
||||
0:175 Sequence
|
||||
0:175 Constant:
|
||||
0:175 6 (const int)
|
||||
0:175 add (int)
|
||||
0:175 Constant:
|
||||
0:175 2 (const int)
|
||||
0:175 Comma (int)
|
||||
0:175 Constant:
|
||||
0:175 3 (const int)
|
||||
0:175 Constant:
|
||||
0:175 4 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 'sum' (float)
|
||||
0:? 'selected4' (int)
|
||||
|
@ -1978,6 +1978,12 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
|
||||
s.append(builtInConstant);
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxVaryingComponents = %d;", resources.maxVaryingComponents);
|
||||
s.append(builtInConstant);
|
||||
|
||||
// GL_ARB_shading_language_420pack
|
||||
snprintf(builtInConstant, maxSize, "const mediump int gl_MinProgramTexelOffset = %d;", resources.minProgramTexelOffset);
|
||||
s.append(builtInConstant);
|
||||
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxProgramTexelOffset = %d;", resources.maxProgramTexelOffset);
|
||||
s.append(builtInConstant);
|
||||
}
|
||||
|
||||
// geometry
|
||||
@ -2338,7 +2344,7 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
||||
}
|
||||
|
||||
//
|
||||
// Add context-dependent (resource-specific) built-ins not yet handled. These
|
||||
// Add context-dependent (resource-specific) built-ins not handled by the above. These
|
||||
// would be ones that need to be programmatically added because they cannot
|
||||
// be added by simple text strings. For these, also
|
||||
// 1) Map built-in functions to operators, for those that will turn into an operation node
|
||||
@ -2352,9 +2358,12 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
||||
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &GL_ARB_enhanced_layouts);
|
||||
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &GL_ARB_enhanced_layouts);
|
||||
}
|
||||
if (profile != EEsProfile && version >= 130 && version < 420) {
|
||||
symbolTable.setVariableExtensions("gl_MinProgramTexelOffset", 1, &GL_ARB_shading_language_420pack);
|
||||
symbolTable.setVariableExtensions("gl_MaxProgramTexelOffset", 1, &GL_ARB_shading_language_420pack);
|
||||
}
|
||||
|
||||
switch(language) {
|
||||
|
||||
case EShLangFragment:
|
||||
// Set up gl_FragData based on current array size.
|
||||
if (version == 100 || IncludeLegacy(version, profile) || (! ForwardCompatibility && profile != EEsProfile && version < 420)) {
|
||||
|
@ -96,7 +96,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
||||
}
|
||||
|
||||
//
|
||||
// Need a new node holding things together then. Make
|
||||
// Need a new node holding things together. Make
|
||||
// one and promote it to the right type.
|
||||
//
|
||||
TIntermBinary* node = new TIntermBinary(op);
|
||||
@ -113,6 +113,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
||||
|
||||
//
|
||||
// If they are both constants, they must be folded.
|
||||
// (Unless it's the sequence (comma) operator, but that's handled in addComma().)
|
||||
//
|
||||
|
||||
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
|
||||
@ -716,18 +717,21 @@ TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nod
|
||||
|
||||
TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc loc)
|
||||
{
|
||||
if (left->getType().getQualifier().storage == EvqConst &&
|
||||
right->getType().getQualifier().storage == EvqConst) {
|
||||
// However, the lowest precedence operators of the sequence operator ( , ) and the assignment operators
|
||||
// ... are not included in the operators that can create a constant expression.
|
||||
//
|
||||
//if (left->getType().getQualifier().storage == EvqConst &&
|
||||
// right->getType().getQualifier().storage == EvqConst) {
|
||||
|
||||
return right;
|
||||
} else {
|
||||
TIntermTyped *commaAggregate = growAggregate(left, right, loc);
|
||||
commaAggregate->getAsAggregate()->setOperator(EOpComma);
|
||||
commaAggregate->setType(right->getType());
|
||||
commaAggregate->getWritableType().getQualifier().makeTemporary();
|
||||
// return right;
|
||||
//}
|
||||
|
||||
return commaAggregate;
|
||||
}
|
||||
TIntermTyped *commaAggregate = growAggregate(left, right, loc);
|
||||
commaAggregate->getAsAggregate()->setOperator(EOpComma);
|
||||
commaAggregate->setType(right->getType());
|
||||
commaAggregate->getWritableType().getQualifier().makeTemporary();
|
||||
|
||||
return commaAggregate;
|
||||
}
|
||||
|
||||
TIntermTyped* TIntermediate::addMethod(TIntermTyped* object, const TType& type, const TString* name, TSourceLoc loc)
|
||||
|
@ -124,7 +124,7 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil
|
||||
TSymbolTable& symbolTable)
|
||||
{
|
||||
TIntermediate intermediate(language, version, profile);
|
||||
|
||||
|
||||
TParseContext parseContext(symbolTable, intermediate, true, version, profile, language, infoSink);
|
||||
TPpContext ppContext(parseContext);
|
||||
TScanContext scanContext(parseContext);
|
||||
@ -181,7 +181,7 @@ void InitializeStageSymbolTable(TBuiltIns& builtIns, int version, EProfile profi
|
||||
bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile)
|
||||
{
|
||||
TBuiltIns builtIns;
|
||||
builtIns.initialize(version, profile);
|
||||
builtIns.initialize(version, profile);
|
||||
|
||||
// do the common tables
|
||||
InitializeSymbolTable(builtIns.getCommonString(), version, profile, EShLangVertex, infoSink, *commonTable[EPcGeneral]);
|
||||
@ -207,9 +207,9 @@ bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& inf
|
||||
{
|
||||
TBuiltIns builtIns;
|
||||
|
||||
builtIns.initialize(*resources, version, profile, language);
|
||||
builtIns.initialize(*resources, version, profile, language);
|
||||
InitializeSymbolTable(builtIns.getCommonString(), version, profile, language, infoSink, symbolTable);
|
||||
IdentifyBuiltIns(version, profile, language, symbolTable, *resources);
|
||||
IdentifyBuiltIns(version, profile, language, symbolTable, *resources);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ void TParseContext::initializeExtensionBehavior()
|
||||
|
||||
extensionBehavior[GL_ARB_texture_rectangle] = EBhDisable;
|
||||
extensionBehavior[GL_3DL_array_objects] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_shading_language_420pack] = EBhDisablePartial;
|
||||
extensionBehavior[GL_ARB_shading_language_420pack] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_texture_gather] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_gpu_shader5] = EBhDisablePartial;
|
||||
extensionBehavior[GL_ARB_separate_shader_objects] = EBhDisable;
|
||||
|
Loading…
Reference in New Issue
Block a user