HLSL: Fix #1912: add attribute syntax for overriding image formats.
This commit is contained in:
@@ -58,6 +58,47 @@ namespace glslang {
|
||||
return EatConstantId;
|
||||
else if (name == "push_constant")
|
||||
return EatPushConstant;
|
||||
} else if (nameSpace == "spv") {
|
||||
if (name == "format_rgba32f") return EatFormatRgba32f;
|
||||
if (name == "format_rgba16f") return EatFormatRgba16f;
|
||||
if (name == "format_r32f") return EatFormatR32f;
|
||||
if (name == "format_rgba8") return EatFormatRgba8;
|
||||
if (name == "format_rgba8snorm") return EatFormatRgba8Snorm;
|
||||
if (name == "format_rg32f") return EatFormatRg32f;
|
||||
if (name == "format_rg16f") return EatFormatRg16f;
|
||||
if (name == "format_r11fg11fb10f") return EatFormatR11fG11fB10f;
|
||||
if (name == "format_r16f") return EatFormatR16f;
|
||||
if (name == "format_rgba16") return EatFormatRgba16;
|
||||
if (name == "format_rgb10a2") return EatFormatRgb10A2;
|
||||
if (name == "format_rg16") return EatFormatRg16;
|
||||
if (name == "format_rg8") return EatFormatRg8;
|
||||
if (name == "format_r16") return EatFormatR16;
|
||||
if (name == "format_r8") return EatFormatR8;
|
||||
if (name == "format_rgba16snorm") return EatFormatRgba16Snorm;
|
||||
if (name == "format_rg16snorm") return EatFormatRg16Snorm;
|
||||
if (name == "format_rg8snorm") return EatFormatRg8Snorm;
|
||||
if (name == "format_r16snorm") return EatFormatR16Snorm;
|
||||
if (name == "format_r8snorm") return EatFormatR8Snorm;
|
||||
if (name == "format_rgba32i") return EatFormatRgba32i;
|
||||
if (name == "format_rgba16i") return EatFormatRgba16i;
|
||||
if (name == "format_rgba8i") return EatFormatRgba8i;
|
||||
if (name == "format_r32i") return EatFormatR32i;
|
||||
if (name == "format_rg32i") return EatFormatRg32i;
|
||||
if (name == "format_rg16i") return EatFormatRg16i;
|
||||
if (name == "format_rg8i") return EatFormatRg8i;
|
||||
if (name == "format_r16i") return EatFormatR16i;
|
||||
if (name == "format_r8i") return EatFormatR8i;
|
||||
if (name == "format_rgba32ui") return EatFormatRgba32ui;
|
||||
if (name == "format_rgba16ui") return EatFormatRgba16ui;
|
||||
if (name == "format_rgba8ui") return EatFormatRgba8ui;
|
||||
if (name == "format_r32ui") return EatFormatR32ui;
|
||||
if (name == "format_rgb10a2ui") return EatFormatRgb10a2ui;
|
||||
if (name == "format_rg32ui") return EatFormatRg32ui;
|
||||
if (name == "format_rg16ui") return EatFormatRg16ui;
|
||||
if (name == "format_rg8ui") return EatFormatRg8ui;
|
||||
if (name == "format_r16ui") return EatFormatR16ui;
|
||||
if (name == "format_r8ui") return EatFormatR8ui;
|
||||
return EatFormatUnknown;
|
||||
} else if (nameSpace.size() > 0)
|
||||
return EatNone;
|
||||
|
||||
|
||||
0
hlsl/hlslGrammar.cpp
Executable file → Normal file
0
hlsl/hlslGrammar.cpp
Executable file → Normal file
0
hlsl/hlslGrammar.h
Executable file → Normal file
0
hlsl/hlslGrammar.h
Executable file → Normal file
43
hlsl/hlslParseHelper.cpp
Normal file → Executable file
43
hlsl/hlslParseHelper.cpp
Normal file → Executable file
@@ -1950,6 +1950,49 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr
|
||||
setSpecConstantId(loc, type.getQualifier(), value);
|
||||
}
|
||||
break;
|
||||
|
||||
// image formats
|
||||
case EatFormatRgba32f: type.getQualifier().layoutFormat = ElfRgba32f; break;
|
||||
case EatFormatRgba16f: type.getQualifier().layoutFormat = ElfRgba16f; break;
|
||||
case EatFormatR32f: type.getQualifier().layoutFormat = ElfR32f; break;
|
||||
case EatFormatRgba8: type.getQualifier().layoutFormat = ElfRgba8; break;
|
||||
case EatFormatRgba8Snorm: type.getQualifier().layoutFormat = ElfRgba8Snorm; break;
|
||||
case EatFormatRg32f: type.getQualifier().layoutFormat = ElfRg32f; break;
|
||||
case EatFormatRg16f: type.getQualifier().layoutFormat = ElfRg16f; break;
|
||||
case EatFormatR11fG11fB10f: type.getQualifier().layoutFormat = ElfR11fG11fB10f; break;
|
||||
case EatFormatR16f: type.getQualifier().layoutFormat = ElfR16f; break;
|
||||
case EatFormatRgba16: type.getQualifier().layoutFormat = ElfRgba16; break;
|
||||
case EatFormatRgb10A2: type.getQualifier().layoutFormat = ElfRgb10A2; break;
|
||||
case EatFormatRg16: type.getQualifier().layoutFormat = ElfRg16; break;
|
||||
case EatFormatRg8: type.getQualifier().layoutFormat = ElfRg8; break;
|
||||
case EatFormatR16: type.getQualifier().layoutFormat = ElfR16; break;
|
||||
case EatFormatR8: type.getQualifier().layoutFormat = ElfR8; break;
|
||||
case EatFormatRgba16Snorm: type.getQualifier().layoutFormat = ElfRgba16Snorm; break;
|
||||
case EatFormatRg16Snorm: type.getQualifier().layoutFormat = ElfRg16Snorm; break;
|
||||
case EatFormatRg8Snorm: type.getQualifier().layoutFormat = ElfRg8Snorm; break;
|
||||
case EatFormatR16Snorm: type.getQualifier().layoutFormat = ElfR16Snorm; break;
|
||||
case EatFormatR8Snorm: type.getQualifier().layoutFormat = ElfR8Snorm; break;
|
||||
case EatFormatRgba32i: type.getQualifier().layoutFormat = ElfRgba32i; break;
|
||||
case EatFormatRgba16i: type.getQualifier().layoutFormat = ElfRgba16i; break;
|
||||
case EatFormatRgba8i: type.getQualifier().layoutFormat = ElfRgba8i; break;
|
||||
case EatFormatR32i: type.getQualifier().layoutFormat = ElfR32i; break;
|
||||
case EatFormatRg32i: type.getQualifier().layoutFormat = ElfRg32i; break;
|
||||
case EatFormatRg16i: type.getQualifier().layoutFormat = ElfRg16i; break;
|
||||
case EatFormatRg8i: type.getQualifier().layoutFormat = ElfRg8i; break;
|
||||
case EatFormatR16i: type.getQualifier().layoutFormat = ElfR16i; break;
|
||||
case EatFormatR8i: type.getQualifier().layoutFormat = ElfR8i; break;
|
||||
case EatFormatRgba32ui: type.getQualifier().layoutFormat = ElfRgba32ui; break;
|
||||
case EatFormatRgba16ui: type.getQualifier().layoutFormat = ElfRgba16ui; break;
|
||||
case EatFormatRgba8ui: type.getQualifier().layoutFormat = ElfRgba8ui; break;
|
||||
case EatFormatR32ui: type.getQualifier().layoutFormat = ElfR32ui; break;
|
||||
case EatFormatRgb10a2ui: type.getQualifier().layoutFormat = ElfRgb10a2ui; break;
|
||||
case EatFormatRg32ui: type.getQualifier().layoutFormat = ElfRg32ui; break;
|
||||
case EatFormatRg16ui: type.getQualifier().layoutFormat = ElfRg16ui; break;
|
||||
case EatFormatRg8ui: type.getQualifier().layoutFormat = ElfRg8ui; break;
|
||||
case EatFormatR16ui: type.getQualifier().layoutFormat = ElfR16ui; break;
|
||||
case EatFormatR8ui: type.getQualifier().layoutFormat = ElfR8ui; break;
|
||||
case EatFormatUnknown: type.getQualifier().layoutFormat = ElfNone; break;
|
||||
|
||||
default:
|
||||
if (! allowEntry)
|
||||
warn(loc, "attribute does not apply to a type", "", "");
|
||||
|
||||
0
hlsl/hlslParseHelper.h
Executable file → Normal file
0
hlsl/hlslParseHelper.h
Executable file → Normal file
Reference in New Issue
Block a user