HLSL: Fix #1912: add attribute syntax for overriding image formats.
authorJohn Kessenich <cepheus@frii.com>
Fri, 27 Sep 2019 21:14:18 +0000 (15:14 -0600)
committerJohn Kessenich <cepheus@frii.com>
Sat, 28 Sep 2019 17:39:15 +0000 (11:39 -0600)
14 files changed:
Test/baseResults/hlsl.format.rwtexture.frag.out [new file with mode: 0755]
Test/hlsl.format.rwtexture.frag [new file with mode: 0755]
glslang/MachineIndependent/Constant.cpp [changed mode: 0755->0644]
glslang/MachineIndependent/ShaderLang.cpp [changed mode: 0755->0644]
glslang/MachineIndependent/SymbolTable.cpp [changed mode: 0755->0644]
glslang/MachineIndependent/SymbolTable.h [changed mode: 0755->0644]
glslang/MachineIndependent/attribute.h
glslang/MachineIndependent/parseVersions.h [changed mode: 0755->0644]
gtests/Hlsl.FromFile.cpp [changed mode: 0644->0755]
hlsl/hlslAttributes.cpp
hlsl/hlslGrammar.cpp [changed mode: 0755->0644]
hlsl/hlslGrammar.h [changed mode: 0755->0644]
hlsl/hlslParseHelper.cpp [changed mode: 0644->0755]
hlsl/hlslParseHelper.h [changed mode: 0755->0644]

diff --git a/Test/baseResults/hlsl.format.rwtexture.frag.out b/Test/baseResults/hlsl.format.rwtexture.frag.out
new file mode 100755 (executable)
index 0000000..2ecd514
--- /dev/null
@@ -0,0 +1,297 @@
+hlsl.format.rwtexture.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+using depth_any
+0:? Sequence
+0:30  Function Definition: @main( ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30    Function Parameters: 
+0:?     Sequence
+0:33      move second child to first child ( temp 4-component vector of float)
+0:33        Color: direct index for structure ( temp 4-component vector of float)
+0:33          'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:33          Constant:
+0:33            0 (const int)
+0:33        Constant:
+0:33          1.000000
+0:33          1.000000
+0:33          1.000000
+0:33          1.000000
+0:34      move second child to first child ( temp float)
+0:34        Depth: direct index for structure ( temp float)
+0:34          'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:34          Constant:
+0:34            1 (const int)
+0:34        Constant:
+0:34          1.000000
+0:36      Branch: Return with expression
+0:36        'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30  Function Definition: main( ( temp void)
+0:30    Function Parameters: 
+0:?     Sequence
+0:30      Sequence
+0:30        move second child to first child ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30          'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30          Function Call: @main( ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30        move second child to first child ( temp 4-component vector of float)
+0:?           '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float)
+0:30          Color: direct index for structure ( temp 4-component vector of float)
+0:30            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30            Constant:
+0:30              0 (const int)
+0:30        move second child to first child ( temp float)
+0:?           '@entryPointOutput.Depth' ( out float FragDepth)
+0:30          Depth: direct index for structure ( temp float)
+0:30            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30            Constant:
+0:30              1 (const int)
+0:?   Linker Objects
+0:?     'g_sSamp' (layout( binding=0) uniform sampler)
+0:?     'g_tTex1df4' (layout( binding=0 rgba32f) uniform image1D)
+0:?     'g_tTex1di4' (layout( rg32f) uniform iimage1D)
+0:?     'g_tTex1du4' (layout( rgba8_snorm) uniform uimage1D)
+0:?     'g_tTex2df4' (layout( rgba8i) uniform image2D)
+0:?     'g_tTex2di4' (layout( r11f_g11f_b10f) uniform iimage2D)
+0:?     'g_tTex2du4' (layout( r8_snorm) uniform uimage2D)
+0:?     'g_tTex3df4' (layout( rg8) uniform image3D)
+0:?     'g_tTex3di4' (layout( rgba16i) uniform iimage3D)
+0:?     'g_tTex3du4' (layout( r8i) uniform uimage3D)
+0:?     'g_tTex1df4a' (layout( rgba8ui) uniform image1DArray)
+0:?     'g_tTex1di4a' (layout( rg32ui) uniform iimage1DArray)
+0:?     'g_tTex1du4a' (layout( r16ui) uniform uimage1DArray)
+0:?     'g_tTex2df4a' (layout( rgb10_a2ui) uniform image2DArray)
+0:?     'g_tTex2di4a' (layout( r8ui) uniform iimage2DArray)
+0:?     'g_tTex2du4a' (layout( rgba16f) uniform uimage2DArray)
+0:?     '@entryPointOutput.Depth' ( out float FragDepth)
+0:?     '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+using depth_any
+0:? Sequence
+0:30  Function Definition: @main( ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30    Function Parameters: 
+0:?     Sequence
+0:33      move second child to first child ( temp 4-component vector of float)
+0:33        Color: direct index for structure ( temp 4-component vector of float)
+0:33          'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:33          Constant:
+0:33            0 (const int)
+0:33        Constant:
+0:33          1.000000
+0:33          1.000000
+0:33          1.000000
+0:33          1.000000
+0:34      move second child to first child ( temp float)
+0:34        Depth: direct index for structure ( temp float)
+0:34          'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:34          Constant:
+0:34            1 (const int)
+0:34        Constant:
+0:34          1.000000
+0:36      Branch: Return with expression
+0:36        'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30  Function Definition: main( ( temp void)
+0:30    Function Parameters: 
+0:?     Sequence
+0:30      Sequence
+0:30        move second child to first child ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30          'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30          Function Call: @main( ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30        move second child to first child ( temp 4-component vector of float)
+0:?           '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float)
+0:30          Color: direct index for structure ( temp 4-component vector of float)
+0:30            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30            Constant:
+0:30              0 (const int)
+0:30        move second child to first child ( temp float)
+0:?           '@entryPointOutput.Depth' ( out float FragDepth)
+0:30          Depth: direct index for structure ( temp float)
+0:30            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:30            Constant:
+0:30              1 (const int)
+0:?   Linker Objects
+0:?     'g_sSamp' (layout( binding=0) uniform sampler)
+0:?     'g_tTex1df4' (layout( binding=0 rgba32f) uniform image1D)
+0:?     'g_tTex1di4' (layout( rg32f) uniform iimage1D)
+0:?     'g_tTex1du4' (layout( rgba8_snorm) uniform uimage1D)
+0:?     'g_tTex2df4' (layout( rgba8i) uniform image2D)
+0:?     'g_tTex2di4' (layout( r11f_g11f_b10f) uniform iimage2D)
+0:?     'g_tTex2du4' (layout( r8_snorm) uniform uimage2D)
+0:?     'g_tTex3df4' (layout( rg8) uniform image3D)
+0:?     'g_tTex3di4' (layout( rgba16i) uniform iimage3D)
+0:?     'g_tTex3du4' (layout( r8i) uniform uimage3D)
+0:?     'g_tTex1df4a' (layout( rgba8ui) uniform image1DArray)
+0:?     'g_tTex1di4a' (layout( rg32ui) uniform iimage1DArray)
+0:?     'g_tTex1du4a' (layout( r16ui) uniform uimage1DArray)
+0:?     'g_tTex2df4a' (layout( rgb10_a2ui) uniform image2DArray)
+0:?     'g_tTex2di4a' (layout( r8ui) uniform iimage2DArray)
+0:?     'g_tTex2du4a' (layout( rgba16f) uniform uimage2DArray)
+0:?     '@entryPointOutput.Depth' ( out float FragDepth)
+0:?     '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80007
+// Id's are bound by 85
+
+                              Capability Shader
+                              Capability Image1D
+                              Capability StorageImageExtendedFormats
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 29 33
+                              ExecutionMode 4 OriginUpperLeft
+                              ExecutionMode 4 DepthReplacing
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 8  "PS_OUTPUT"
+                              MemberName 8(PS_OUTPUT) 0  "Color"
+                              MemberName 8(PS_OUTPUT) 1  "Depth"
+                              Name 10  "@main("
+                              Name 13  "psout"
+                              Name 26  "flattenTemp"
+                              Name 29  "@entryPointOutput.Color"
+                              Name 33  "@entryPointOutput.Depth"
+                              Name 38  "g_sSamp"
+                              Name 41  "g_tTex1df4"
+                              Name 44  "g_tTex1di4"
+                              Name 48  "g_tTex1du4"
+                              Name 51  "g_tTex2df4"
+                              Name 54  "g_tTex2di4"
+                              Name 57  "g_tTex2du4"
+                              Name 60  "g_tTex3df4"
+                              Name 63  "g_tTex3di4"
+                              Name 66  "g_tTex3du4"
+                              Name 69  "g_tTex1df4a"
+                              Name 72  "g_tTex1di4a"
+                              Name 75  "g_tTex1du4a"
+                              Name 78  "g_tTex2df4a"
+                              Name 81  "g_tTex2di4a"
+                              Name 84  "g_tTex2du4a"
+                              Decorate 29(@entryPointOutput.Color) Location 0
+                              Decorate 33(@entryPointOutput.Depth) BuiltIn FragDepth
+                              Decorate 38(g_sSamp) DescriptorSet 0
+                              Decorate 38(g_sSamp) Binding 0
+                              Decorate 41(g_tTex1df4) DescriptorSet 0
+                              Decorate 41(g_tTex1df4) Binding 0
+                              Decorate 44(g_tTex1di4) DescriptorSet 0
+                              Decorate 44(g_tTex1di4) Binding 0
+                              Decorate 48(g_tTex1du4) DescriptorSet 0
+                              Decorate 48(g_tTex1du4) Binding 0
+                              Decorate 51(g_tTex2df4) DescriptorSet 0
+                              Decorate 51(g_tTex2df4) Binding 0
+                              Decorate 54(g_tTex2di4) DescriptorSet 0
+                              Decorate 54(g_tTex2di4) Binding 0
+                              Decorate 57(g_tTex2du4) DescriptorSet 0
+                              Decorate 57(g_tTex2du4) Binding 0
+                              Decorate 60(g_tTex3df4) DescriptorSet 0
+                              Decorate 60(g_tTex3df4) Binding 0
+                              Decorate 63(g_tTex3di4) DescriptorSet 0
+                              Decorate 63(g_tTex3di4) Binding 0
+                              Decorate 66(g_tTex3du4) DescriptorSet 0
+                              Decorate 66(g_tTex3du4) Binding 0
+                              Decorate 69(g_tTex1df4a) DescriptorSet 0
+                              Decorate 69(g_tTex1df4a) Binding 0
+                              Decorate 72(g_tTex1di4a) DescriptorSet 0
+                              Decorate 72(g_tTex1di4a) Binding 0
+                              Decorate 75(g_tTex1du4a) DescriptorSet 0
+                              Decorate 75(g_tTex1du4a) Binding 0
+                              Decorate 78(g_tTex2df4a) DescriptorSet 0
+                              Decorate 78(g_tTex2df4a) Binding 0
+                              Decorate 81(g_tTex2di4a) DescriptorSet 0
+                              Decorate 81(g_tTex2di4a) Binding 0
+                              Decorate 84(g_tTex2du4a) DescriptorSet 0
+                              Decorate 84(g_tTex2du4a) Binding 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+    8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
+               9:             TypeFunction 8(PS_OUTPUT)
+              12:             TypePointer Function 8(PS_OUTPUT)
+              14:             TypeInt 32 1
+              15:     14(int) Constant 0
+              16:    6(float) Constant 1065353216
+              17:    7(fvec4) ConstantComposite 16 16 16 16
+              18:             TypePointer Function 7(fvec4)
+              20:     14(int) Constant 1
+              21:             TypePointer Function 6(float)
+              28:             TypePointer Output 7(fvec4)
+29(@entryPointOutput.Color):     28(ptr) Variable Output
+              32:             TypePointer Output 6(float)
+33(@entryPointOutput.Depth):     32(ptr) Variable Output
+              36:             TypeSampler
+              37:             TypePointer UniformConstant 36
+     38(g_sSamp):     37(ptr) Variable UniformConstant
+              39:             TypeImage 6(float) 1D nonsampled format:Rgba32f
+              40:             TypePointer UniformConstant 39
+  41(g_tTex1df4):     40(ptr) Variable UniformConstant
+              42:             TypeImage 14(int) 1D nonsampled format:Rg32f
+              43:             TypePointer UniformConstant 42
+  44(g_tTex1di4):     43(ptr) Variable UniformConstant
+              45:             TypeInt 32 0
+              46:             TypeImage 45(int) 1D nonsampled format:Rgba8Snorm
+              47:             TypePointer UniformConstant 46
+  48(g_tTex1du4):     47(ptr) Variable UniformConstant
+              49:             TypeImage 6(float) 2D nonsampled format:Rgba8i
+              50:             TypePointer UniformConstant 49
+  51(g_tTex2df4):     50(ptr) Variable UniformConstant
+              52:             TypeImage 14(int) 2D nonsampled format:R11fG11fB10f
+              53:             TypePointer UniformConstant 52
+  54(g_tTex2di4):     53(ptr) Variable UniformConstant
+              55:             TypeImage 45(int) 2D nonsampled format:R8Snorm
+              56:             TypePointer UniformConstant 55
+  57(g_tTex2du4):     56(ptr) Variable UniformConstant
+              58:             TypeImage 6(float) 3D nonsampled format:Rg8
+              59:             TypePointer UniformConstant 58
+  60(g_tTex3df4):     59(ptr) Variable UniformConstant
+              61:             TypeImage 14(int) 3D nonsampled format:Rgba16i
+              62:             TypePointer UniformConstant 61
+  63(g_tTex3di4):     62(ptr) Variable UniformConstant
+              64:             TypeImage 45(int) 3D nonsampled format:R8i
+              65:             TypePointer UniformConstant 64
+  66(g_tTex3du4):     65(ptr) Variable UniformConstant
+              67:             TypeImage 6(float) 1D array nonsampled format:Rgba8ui
+              68:             TypePointer UniformConstant 67
+ 69(g_tTex1df4a):     68(ptr) Variable UniformConstant
+              70:             TypeImage 14(int) 1D array nonsampled format:Rg32ui
+              71:             TypePointer UniformConstant 70
+ 72(g_tTex1di4a):     71(ptr) Variable UniformConstant
+              73:             TypeImage 45(int) 1D array nonsampled format:R16ui
+              74:             TypePointer UniformConstant 73
+ 75(g_tTex1du4a):     74(ptr) Variable UniformConstant
+              76:             TypeImage 6(float) 2D array nonsampled format:Rgb10a2ui
+              77:             TypePointer UniformConstant 76
+ 78(g_tTex2df4a):     77(ptr) Variable UniformConstant
+              79:             TypeImage 14(int) 2D array nonsampled format:R8ui
+              80:             TypePointer UniformConstant 79
+ 81(g_tTex2di4a):     80(ptr) Variable UniformConstant
+              82:             TypeImage 45(int) 2D array nonsampled format:Rgba16f
+              83:             TypePointer UniformConstant 82
+ 84(g_tTex2du4a):     83(ptr) Variable UniformConstant
+         4(main):           2 Function None 3
+               5:             Label
+ 26(flattenTemp):     12(ptr) Variable Function
+              27:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 26(flattenTemp) 27
+              30:     18(ptr) AccessChain 26(flattenTemp) 15
+              31:    7(fvec4) Load 30
+                              Store 29(@entryPointOutput.Color) 31
+              34:     21(ptr) AccessChain 26(flattenTemp) 20
+              35:    6(float) Load 34
+                              Store 33(@entryPointOutput.Depth) 35
+                              Return
+                              FunctionEnd
+      10(@main():8(PS_OUTPUT) Function None 9
+              11:             Label
+       13(psout):     12(ptr) Variable Function
+              19:     18(ptr) AccessChain 13(psout) 15
+                              Store 19 17
+              22:     21(ptr) AccessChain 13(psout) 20
+                              Store 22 16
+              23:8(PS_OUTPUT) Load 13(psout)
+                              ReturnValue 23
+                              FunctionEnd
diff --git a/Test/hlsl.format.rwtexture.frag b/Test/hlsl.format.rwtexture.frag
new file mode 100755 (executable)
index 0000000..d92f590
--- /dev/null
@@ -0,0 +1,37 @@
+SamplerState       g_sSamp : register(s0);
+
+[[spv::format_rgba32f]]    RWTexture1D <float4> g_tTex1df4 : register(t0);
+[[spv::format_rg32f]]      RWTexture1D <int4>   g_tTex1di4;
+[[spv::format_rgba8snorm]] RWTexture1D <uint4>  g_tTex1du4;
+
+[[spv::format_rgba8i]]       RWTexture2D <float4> g_tTex2df4;
+[[spv::format_r11fg11fb10f]] RWTexture2D <int4>   g_tTex2di4;
+[[spv::format_r8snorm]]      RWTexture2D <uint4>  g_tTex2du4;
+
+[[spv::format_rg8]]     RWTexture3D <float4> g_tTex3df4;
+[[spv::format_rgba16i]] RWTexture3D <int4>   g_tTex3di4;
+[[spv::format_r8i]]     RWTexture3D <uint4>  g_tTex3du4;
+
+[[spv::format_rgba8ui]] RWTexture1DArray <float4> g_tTex1df4a;
+[[spv::format_rg32ui]]  RWTexture1DArray <int4>   g_tTex1di4a;
+[[spv::format_r16ui]]   RWTexture1DArray <uint4>  g_tTex1du4a;
+
+[[spv::format_rgb10a2ui]] RWTexture2DArray <float4> g_tTex2df4a;
+[[spv::format_r8ui]]      RWTexture2DArray <int4>   g_tTex2di4a;
+[[spv::format_rgba16f]]   RWTexture2DArray <uint4>  g_tTex2du4a;
+
+struct PS_OUTPUT
+{
+    float4 Color : SV_Target0;
+    float  Depth : SV_Depth;
+};
+
+PS_OUTPUT main()
+{
+   PS_OUTPUT psout;
+
+   psout.Color = 1.0;
+   psout.Depth = 1.0;
+
+   return psout;
+}
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 844ce45..92f3d63 100644 (file)
@@ -76,7 +76,47 @@ namespace glslang {
         EatMaxIterations,
         EatIterationMultiple,
         EatPeelCount,
-        EatPartialCount
+        EatPartialCount,
+        EatFormatRgba32f,
+        EatFormatRgba16f,
+        EatFormatR32f,
+        EatFormatRgba8,
+        EatFormatRgba8Snorm,
+        EatFormatRg32f,
+        EatFormatRg16f,
+        EatFormatR11fG11fB10f,
+        EatFormatR16f,
+        EatFormatRgba16,
+        EatFormatRgb10A2,
+        EatFormatRg16,
+        EatFormatRg8,
+        EatFormatR16,
+        EatFormatR8,
+        EatFormatRgba16Snorm,
+        EatFormatRg16Snorm,
+        EatFormatRg8Snorm,
+        EatFormatR16Snorm,
+        EatFormatR8Snorm,
+        EatFormatRgba32i,
+        EatFormatRgba16i,
+        EatFormatRgba8i,
+        EatFormatR32i,
+        EatFormatRg32i,
+        EatFormatRg16i,
+        EatFormatRg8i,
+        EatFormatR16i,
+        EatFormatR8i,
+        EatFormatRgba32ui,
+        EatFormatRgba16ui,
+        EatFormatRgba8ui,
+        EatFormatR32ui,
+        EatFormatRgb10a2ui,
+        EatFormatRg32ui,
+        EatFormatRg16ui,
+        EatFormatRg8ui,
+        EatFormatR16ui,
+        EatFormatR8ui,
+        EatFormatUnknown
     };
 
     class TIntermAggregate;
old mode 100755 (executable)
new mode 100644 (file)
old mode 100644 (file)
new mode 100755 (executable)
index 7738c80..59c687d
@@ -230,6 +230,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.hull.void.tesc", "main"},
         {"hlsl.hull.ctrlpt-1.tesc", "main"},
         {"hlsl.hull.ctrlpt-2.tesc", "main"},
+        {"hlsl.format.rwtexture.frag", "main"},
         {"hlsl.groupid.comp", "main"},
         {"hlsl.identifier.sample.frag", "main"},
         {"hlsl.if.frag", "PixelShaderFunction"},
index 261cec3..05d4ae3 100644 (file)
@@ -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;
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100644 (file)
new mode 100755 (executable)
index 1549e3a..8d389f5
@@ -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", "", "");
old mode 100755 (executable)
new mode 100644 (file)