assert(qualifier == glslang::EvqIn ||
qualifier == glslang::EvqOut ||
qualifier == glslang::EvqInOut ||
+ qualifier == glslang::EvqUniform ||
qualifier == glslang::EvqConstReadOnly);
- return qualifier != glslang::EvqConstReadOnly;
+ return qualifier != glslang::EvqConstReadOnly &&
+ qualifier != glslang::EvqUniform;
}
// Is parameter pass-by-original?
0:12 Function Definition: fun4(u1;u1; ( temp 4-component vector of float)
0:12 Function Parameters:
0:12 'id1' ( in uint)
-0:12 'id2' ( in uint)
+0:12 'id2' ( uniform uint)
0:? Sequence
0:13 Branch: Return with expression
0:13 Construct vec4 ( temp 4-component vector of float)
0:13 Convert uint to float ( temp float)
0:13 component-wise multiply ( temp uint)
0:13 'id1' ( in uint)
-0:13 'id2' ( in uint)
+0:13 'id2' ( uniform uint)
0:17 Function Definition: fun1(i1; ( temp 4-component vector of float)
0:17 Function Parameters:
0:17 'index' ( in int)
0:12 Function Definition: fun4(u1;u1; ( temp 4-component vector of float)
0:12 Function Parameters:
0:12 'id1' ( in uint)
-0:12 'id2' ( in uint)
+0:12 'id2' ( uniform uint)
0:? Sequence
0:13 Branch: Return with expression
0:13 Construct vec4 ( temp 4-component vector of float)
0:13 Convert uint to float ( temp float)
0:13 component-wise multiply ( temp uint)
0:13 'id1' ( in uint)
-0:13 'id2' ( in uint)
+0:13 'id2' ( uniform uint)
0:17 Function Definition: fun1(i1; ( temp 4-component vector of float)
0:17 Function Parameters:
0:17 'index' ( in int)
makeVariableInOut(*(*it));
}
+ // Add uniform parameters to the $Global uniform block.
+ TVector<TVariable*> opaque_uniforms;
+ for (int i = 0; i < userFunction.getParamCount(); i++) {
+ TType& paramType = *userFunction[i].type;
+ TString& paramName = *userFunction[i].name;
+ if (paramType.getQualifier().storage == EvqUniform) {
+ if (!paramType.containsOpaque()) {
+ // Add it to the global uniform block.
+ growGlobalUniformBlock(loc, paramType, paramName);
+ } else {
+ // Declare it as a separate variable.
+ TVariable *var = makeInternalVariable(paramName.c_str(), paramType);
+ opaque_uniforms.push_back(var);
+ }
+ }
+ }
+
// Synthesize the call
pushScope(); // matches the one in handleFunctionBody()
TVector<TVariable*> argVars;
TIntermAggregate* synthBody = new TIntermAggregate();
auto inputIt = inputs.begin();
+ auto opaqueUniformIt = opaque_uniforms.begin();
TIntermTyped* callingArgs = nullptr;
for (int i = 0; i < userFunction.getParamCount(); i++) {
intermediate.addSymbol(**inputIt)));
inputIt++;
}
+ if (param.type->getQualifier().storage == EvqUniform) {
+ if (!param.type->containsOpaque()) {
+ // Look it up in the $Global uniform block.
+ intermediate.growAggregate(synthBody, handleAssign(loc, EOpAssign, arg,
+ handleVariable(loc, param.name)));
+ } else {
+ intermediate.growAggregate(synthBody, handleAssign(loc, EOpAssign, arg,
+ intermediate.addSymbol(**opaqueUniformIt)));
+ ++opaqueUniformIt;
+ }
+ }
}
// Call
type.getQualifier().storage = EvqConstReadOnly;
break;
case EvqGlobal:
- case EvqUniform:
case EvqTemporary:
type.getQualifier().storage = EvqIn;
break;