From f6873f7e49aec5dd360c26fe2c7fd15b35d075e4 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 19 Apr 2019 04:57:43 -0600 Subject: [PATCH] GLSL: Add error check for an argument dropping the 'restrict' qualifier --- Test/baseResults/310.comp.out | 3 ++- glslang/MachineIndependent/ParseHelper.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Test/baseResults/310.comp.out b/Test/baseResults/310.comp.out index b4136b0a..4b65ea11 100644 --- a/Test/baseResults/310.comp.out +++ b/Test/baseResults/310.comp.out @@ -29,6 +29,7 @@ ERROR: 0:94: 'writeonly' : argument cannot drop memory qualifier when passed to ERROR: 0:97: '' : memory qualifiers cannot be used on this type ERROR: 0:98: '' : memory qualifiers cannot be used on this type ERROR: 0:109: 'format' : image formats must match +ERROR: 0:110: 'restrict' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:110: 'format' : image formats must match ERROR: 0:111: 'format' : image formats must match ERROR: 0:114: 'image load-store format' : not supported with this profile: es @@ -86,7 +87,7 @@ WARNING: 0:238: '#define' : names containing consecutive underscores are reserve ERROR: 0:244: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group ERROR: 0:245: 'gl_ViewIndex' : undeclared identifier ERROR: 0:255: 'gl_ViewIndex' : undeclared identifier -ERROR: 85 compilation errors. No code generated. +ERROR: 86 compilation errors. No code generated. Shader version: 310 diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 593089c9..8f575fbb 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -1156,6 +1156,8 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction error(arguments->getLoc(), message, "readonly", ""); if (argQualifier.writeonly && ! formalQualifier.writeonly) error(arguments->getLoc(), message, "writeonly", ""); + if (!builtIn && argQualifier.restrict && ! formalQualifier.restrict) + error(arguments->getLoc(), message, "restrict", ""); } if (!builtIn && argQualifier.layoutFormat != formalQualifier.layoutFormat) { // we have mismatched formats, which should only be allowed if writeonly