Placeholder fix for part of #1870.

Also fixes, in practice, https://github.com/KhronosGroup/GLSL/issues/83.
When the specification language is correctly created, glslang can be
revisited for correctness.  In the meantime, this seems like the best
"bug" to have relative to the specification.

Memory qualifiers are only relevant to parameters when they apply
to what the argument points to, as otherwise the argument is copied.

This leaves the fix from #1870 in place, and then more correctly
ignores memory qualifiers when something will be passed by copy.
This commit is contained in:
John Kessenich 2019-08-30 09:53:35 -06:00
parent 7de044c062
commit 92f5afdee0
2 changed files with 5 additions and 12 deletions

View File

@ -1,14 +1,6 @@
310.inheritMemory.frag
ERROR: 0:38: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 0:39: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 0:40: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 0:41: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 0:42: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 5 compilation errors. No code generated.
Shader version: 310
ERROR: node is still EOpNull!
0:? Sequence
0:18 Function Definition: non_ro_fun(f1[10]; ( global void)
0:18 Function Parameters:
0:18 'buff' ( in 10-element array of mediump float)
@ -120,7 +112,7 @@ Linked fragment stage:
Shader version: 310
ERROR: node is still EOpNull!
0:? Sequence
0:18 Function Definition: non_ro_fun(f1[10]; ( global void)
0:18 Function Parameters:
0:18 'buff' ( in 10-element array of mediump float)

View File

@ -1152,8 +1152,9 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
if (lValueErrorCheck(arguments->getLoc(), "assign", arg->getAsTyped()))
error(arguments->getLoc(), "Non-L-value cannot be passed for 'out' or 'inout' parameters.", "out", "");
}
TQualifier& argQualifier = arg->getAsTyped()->getQualifier();
if (argQualifier.isMemory()) {
const TType& argType = arg->getAsTyped()->getType();
const TQualifier& argQualifier = argType.getQualifier();
if (argQualifier.isMemory() && (argType.containsOpaque() || argType.isReference())) {
const char* message = "argument cannot drop memory qualifier when passed to formal parameter";
if (argQualifier.volatil && ! formalQualifier.volatil)
error(arguments->getLoc(), message, "volatile", "");