HLSL: Fix #1912: add attribute syntax for nonreadable/nonwritable

This commit is contained in:
John Kessenich 2019-09-29 18:02:19 -06:00
parent 2d9b0a3550
commit 8a97d38913
5 changed files with 323 additions and 86 deletions

View file

@ -98,7 +98,9 @@ namespace glslang {
if (name == "format_rg8ui") return EatFormatRg8ui;
if (name == "format_r16ui") return EatFormatR16ui;
if (name == "format_r8ui") return EatFormatR8ui;
return EatFormatUnknown;
if (name == "nonwritable") return EatNonWritable;
if (name == "nonreadable") return EatNonReadable;
} else if (nameSpace.size() > 0)
return EatNone;

View file

@ -1993,6 +1993,9 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr
case EatFormatR8ui: type.getQualifier().layoutFormat = ElfR8ui; break;
case EatFormatUnknown: type.getQualifier().layoutFormat = ElfNone; break;
case EatNonWritable: type.getQualifier().readonly = true; break;
case EatNonReadable: type.getQualifier().writeonly = true; break;
default:
if (! allowEntry)
warn(loc, "attribute does not apply to a type", "", "");