From f44d89a398ab3f9e4bab49299a30c582fa1c21eb Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 16 Feb 2017 20:35:17 -0800 Subject: [PATCH] Implement GL_EXT_shader_image_load_formatted --- Test/baseResults/310.comp.out | 8 +- Test/baseResults/310.frag.out | 10 +- Test/baseResults/420.vert.out | 2 +- Test/baseResults/spv.image.load-formatted.frag.out | 352 +++++++++++++++++++++ Test/spv.image.load-formatted.frag | 74 +++++ glslang/MachineIndependent/ParseHelper.cpp | 7 +- glslang/MachineIndependent/Versions.cpp | 2 + glslang/MachineIndependent/Versions.h | 1 + 8 files changed, 444 insertions(+), 12 deletions(-) create mode 100644 Test/baseResults/spv.image.load-formatted.frag.out create mode 100644 Test/spv.image.load-formatted.frag diff --git a/Test/baseResults/310.comp.out b/Test/baseResults/310.comp.out index a5be10e..e063626 100644 --- a/Test/baseResults/310.comp.out +++ b/Test/baseResults/310.comp.out @@ -16,7 +16,7 @@ ERROR: 0:47: 'local_size' : can only apply to 'in' ERROR: 0:61: 'assign' : l-value required "ro" (can't modify a readonly buffer) ERROR: 0:66: 'buffer' : buffers can be declared only as blocks ERROR: 0:68: 'sampler/image' : type requires declaration of default precision qualifier -ERROR: 0:76: '' : image variables not declared 'writeonly' must have a format layout qualifier +ERROR: 0:76: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es ERROR: 0:81: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:82: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:87: 'imageAtomicCompSwap' : required extension not requested: GL_OES_shader_image_atomic @@ -54,12 +54,12 @@ ERROR: 0:171: 'samplerCubeArray' : Reserved word. ERROR: 0:171: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:172: 'iimage2DRect' : Reserved word. ERROR: 0:172: 'sampler/image' : type requires declaration of default precision qualifier -ERROR: 0:172: '' : image variables not declared 'writeonly' must have a format layout qualifier +ERROR: 0:172: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es ERROR: 0:173: 'image2DMS' : Reserved word. -ERROR: 0:173: '' : image variables not declared 'writeonly' must have a format layout qualifier +ERROR: 0:173: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es ERROR: 0:174: 'uimage2DMSArray' : Reserved word. ERROR: 0:174: 'sampler/image' : type requires declaration of default precision qualifier -ERROR: 0:174: '' : image variables not declared 'writeonly' must have a format layout qualifier +ERROR: 0:174: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es ERROR: 0:181: 'rgba32f' : format requires readonly or writeonly memory qualifier ERROR: 0:182: 'rgba8i' : format requires readonly or writeonly memory qualifier ERROR: 0:183: 'rgba16ui' : format requires readonly or writeonly memory qualifier diff --git a/Test/baseResults/310.frag.out b/Test/baseResults/310.frag.out index 34cae95..7033d4f 100644 --- a/Test/baseResults/310.frag.out +++ b/Test/baseResults/310.frag.out @@ -19,13 +19,13 @@ ERROR: 0:44: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, ERROR: 0:45: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset] ERROR: 0:45: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset] ERROR: 0:66: 'sampler/image' : type requires declaration of default precision qualifier -ERROR: 0:66: '' : image variables not declared 'writeonly' must have a format layout qualifier +ERROR: 0:66: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es ERROR: 0:67: 'sampler/image' : type requires declaration of default precision qualifier -ERROR: 0:67: '' : image variables not declared 'writeonly' must have a format layout qualifier +ERROR: 0:67: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es ERROR: 0:68: 'sampler/image' : type requires declaration of default precision qualifier -ERROR: 0:68: '' : image variables not declared 'writeonly' must have a format layout qualifier +ERROR: 0:68: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es ERROR: 0:69: 'sampler/image' : type requires declaration of default precision qualifier -ERROR: 0:69: '' : image variables not declared 'writeonly' must have a format layout qualifier +ERROR: 0:69: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es ERROR: 0:73: 'binding' : requires block, or sampler/image, or atomic-counter type ERROR: 0:77: 'location' : location is too large ERROR: 0:81: 'location' : too large for fragment output @@ -36,7 +36,7 @@ ERROR: 0:83: 'layout-id value' : cannot be negative ERROR: 0:96: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:110: 'out' : cannot be bool ERROR: 0:111: 'image2D' : sampler/image types can only be used in uniform variables or function parameters: imageOut -ERROR: 0:111: '' : image variables not declared 'writeonly' must have a format layout qualifier +ERROR: 0:111: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es ERROR: 0:112: 'out' : cannot be a matrix ERROR: 0:114: 'in' : cannot be bool ERROR: 0:115: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: ino diff --git a/Test/baseResults/420.vert.out b/Test/baseResults/420.vert.out index b8e1306..cc6b13f 100644 --- a/Test/baseResults/420.vert.out +++ b/Test/baseResults/420.vert.out @@ -33,7 +33,7 @@ ERROR: 0:85: '' : vertex input cannot be further qualified ERROR: 0:86: 'patch' : not supported in this stage: vertex ERROR: 0:100: '=' : global const initializers must be constant 'const int' ERROR: 0:101: '' : array size must be a constant integer expression -ERROR: 0:107: '' : image variables not declared 'writeonly' must have a format layout qualifier +ERROR: 0:107: 'image variables declared 'writeonly' without a format layout qualifier' : not supported for this version or the enabled extensions ERROR: 0:114: 'imageAtomicMin' : only supported on image with format r32i or r32ui ERROR: 0:115: 'imageAtomicMax' : no matching overloaded function found ERROR: 0:119: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter diff --git a/Test/baseResults/spv.image.load-formatted.frag.out b/Test/baseResults/spv.image.load-formatted.frag.out new file mode 100644 index 0000000..172a3a1 --- /dev/null +++ b/Test/baseResults/spv.image.load-formatted.frag.out @@ -0,0 +1,352 @@ +spv.image.load-formatted.frag +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 240 + + Capability Shader + Capability SampledRect + Capability Sampled1D + Capability SampledCubeArray + Capability SampledBuffer + Capability ImageMSArray + Capability ImageQuery + Capability StorageImageReadWithoutFormat + Capability StorageImageWriteWithoutFormat + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 132 142 152 233 237 239 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_shader_image_load_formatted" + Name 4 "main" + Name 9 "iv" + Name 15 "i1D" + Name 27 "i2D" + Name 38 "i3D" + Name 45 "iCube" + Name 55 "iCubeArray" + Name 62 "i2DRect" + Name 72 "i1DArray" + Name 82 "i2DArray" + Name 89 "iBuffer" + Name 98 "i2DMS" + Name 108 "i2DMSArray" + Name 127 "v" + Name 132 "ic1D" + Name 142 "ic2D" + Name 152 "ic3D" + Name 228 "wo2D" + Name 233 "fragData" + Name 237 "ic4D" + Name 239 "value" + Decorate 15(i1D) DescriptorSet 0 + Decorate 15(i1D) Binding 0 + Decorate 27(i2D) DescriptorSet 0 + Decorate 27(i2D) Binding 1 + Decorate 38(i3D) DescriptorSet 0 + Decorate 38(i3D) Binding 2 + Decorate 45(iCube) DescriptorSet 0 + Decorate 45(iCube) Binding 3 + Decorate 55(iCubeArray) DescriptorSet 0 + Decorate 55(iCubeArray) Binding 4 + Decorate 62(i2DRect) DescriptorSet 0 + Decorate 62(i2DRect) Binding 5 + Decorate 72(i1DArray) DescriptorSet 0 + Decorate 72(i1DArray) Binding 6 + Decorate 82(i2DArray) DescriptorSet 0 + Decorate 82(i2DArray) Binding 7 + Decorate 89(iBuffer) DescriptorSet 0 + Decorate 89(iBuffer) Binding 8 + Decorate 98(i2DMS) DescriptorSet 0 + Decorate 98(i2DMS) Binding 9 + Decorate 108(i2DMSArray) DescriptorSet 0 + Decorate 108(i2DMSArray) Binding 10 + Decorate 132(ic1D) Flat + Decorate 142(ic2D) Flat + Decorate 152(ic3D) Flat + Decorate 228(wo2D) DescriptorSet 0 + Decorate 228(wo2D) Binding 1 + Decorate 228(wo2D) NonReadable + Decorate 237(ic4D) Flat + Decorate 239(value) Flat + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 10: 6(int) Constant 0 + 11: 7(ivec3) ConstantComposite 10 10 10 + 12: TypeFloat 32 + 13: TypeImage 12(float) 1D nonsampled format:Unknown + 14: TypePointer UniformConstant 13 + 15(i1D): 14(ptr) Variable UniformConstant + 18: TypeInt 32 0 + 19: 18(int) Constant 0 + 20: TypePointer Function 6(int) + 25: TypeImage 12(float) 2D nonsampled format:Unknown + 26: TypePointer UniformConstant 25 + 27(i2D): 26(ptr) Variable UniformConstant + 29: TypeVector 6(int) 2 + 36: TypeImage 12(float) 3D nonsampled format:Unknown + 37: TypePointer UniformConstant 36 + 38(i3D): 37(ptr) Variable UniformConstant + 43: TypeImage 12(float) Cube nonsampled format:Unknown + 44: TypePointer UniformConstant 43 + 45(iCube): 44(ptr) Variable UniformConstant + 53: TypeImage 12(float) Cube array nonsampled format:Unknown + 54: TypePointer UniformConstant 53 + 55(iCubeArray): 54(ptr) Variable UniformConstant + 60: TypeImage 12(float) Rect nonsampled format:Unknown + 61: TypePointer UniformConstant 60 + 62(i2DRect): 61(ptr) Variable UniformConstant + 70: TypeImage 12(float) 1D array nonsampled format:Unknown + 71: TypePointer UniformConstant 70 + 72(i1DArray): 71(ptr) Variable UniformConstant + 80: TypeImage 12(float) 2D array nonsampled format:Unknown + 81: TypePointer UniformConstant 80 + 82(i2DArray): 81(ptr) Variable UniformConstant + 87: TypeImage 12(float) Buffer nonsampled format:Unknown + 88: TypePointer UniformConstant 87 + 89(iBuffer): 88(ptr) Variable UniformConstant + 96: TypeImage 12(float) 2D multi-sampled nonsampled format:Unknown + 97: TypePointer UniformConstant 96 + 98(i2DMS): 97(ptr) Variable UniformConstant + 106: TypeImage 12(float) 2D array multi-sampled nonsampled format:Unknown + 107: TypePointer UniformConstant 106 + 108(i2DMSArray): 107(ptr) Variable UniformConstant + 125: TypeVector 12(float) 4 + 126: TypePointer Function 125(fvec4) + 128: 12(float) Constant 0 + 129: 125(fvec4) ConstantComposite 128 128 128 128 + 131: TypePointer Input 6(int) + 132(ic1D): 131(ptr) Variable Input + 141: TypePointer Input 29(ivec2) + 142(ic2D): 141(ptr) Variable Input + 151: TypePointer Input 7(ivec3) + 152(ic3D): 151(ptr) Variable Input + 210: 6(int) Constant 1 + 216: 6(int) Constant 2 + 220: 6(int) Constant 3 + 226: 6(int) Constant 4 + 228(wo2D): 26(ptr) Variable UniformConstant + 232: TypePointer Output 125(fvec4) + 233(fragData): 232(ptr) Variable Output + 235: TypeVector 6(int) 4 + 236: TypePointer Input 235(ivec4) + 237(ic4D): 236(ptr) Variable Input + 238: TypePointer Input 18(int) + 239(value): 238(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 9(iv): 8(ptr) Variable Function + 127(v): 126(ptr) Variable Function + Store 9(iv) 11 + 16: 13 Load 15(i1D) + 17: 6(int) ImageQuerySize 16 + 21: 20(ptr) AccessChain 9(iv) 19 + 22: 6(int) Load 21 + 23: 6(int) IAdd 22 17 + 24: 20(ptr) AccessChain 9(iv) 19 + Store 24 23 + 28: 25 Load 27(i2D) + 30: 29(ivec2) ImageQuerySize 28 + 31: 7(ivec3) Load 9(iv) + 32: 29(ivec2) VectorShuffle 31 31 0 1 + 33: 29(ivec2) IAdd 32 30 + 34: 7(ivec3) Load 9(iv) + 35: 7(ivec3) VectorShuffle 34 33 3 4 2 + Store 9(iv) 35 + 39: 36 Load 38(i3D) + 40: 7(ivec3) ImageQuerySize 39 + 41: 7(ivec3) Load 9(iv) + 42: 7(ivec3) IAdd 41 40 + Store 9(iv) 42 + 46: 43 Load 45(iCube) + 47: 29(ivec2) ImageQuerySize 46 + 48: 7(ivec3) Load 9(iv) + 49: 29(ivec2) VectorShuffle 48 48 0 1 + 50: 29(ivec2) IAdd 49 47 + 51: 7(ivec3) Load 9(iv) + 52: 7(ivec3) VectorShuffle 51 50 3 4 2 + Store 9(iv) 52 + 56: 53 Load 55(iCubeArray) + 57: 7(ivec3) ImageQuerySize 56 + 58: 7(ivec3) Load 9(iv) + 59: 7(ivec3) IAdd 58 57 + Store 9(iv) 59 + 63: 60 Load 62(i2DRect) + 64: 29(ivec2) ImageQuerySize 63 + 65: 7(ivec3) Load 9(iv) + 66: 29(ivec2) VectorShuffle 65 65 0 1 + 67: 29(ivec2) IAdd 66 64 + 68: 7(ivec3) Load 9(iv) + 69: 7(ivec3) VectorShuffle 68 67 3 4 2 + Store 9(iv) 69 + 73: 70 Load 72(i1DArray) + 74: 29(ivec2) ImageQuerySize 73 + 75: 7(ivec3) Load 9(iv) + 76: 29(ivec2) VectorShuffle 75 75 0 1 + 77: 29(ivec2) IAdd 76 74 + 78: 7(ivec3) Load 9(iv) + 79: 7(ivec3) VectorShuffle 78 77 3 4 2 + Store 9(iv) 79 + 83: 80 Load 82(i2DArray) + 84: 7(ivec3) ImageQuerySize 83 + 85: 7(ivec3) Load 9(iv) + 86: 7(ivec3) IAdd 85 84 + Store 9(iv) 86 + 90: 87 Load 89(iBuffer) + 91: 6(int) ImageQuerySize 90 + 92: 20(ptr) AccessChain 9(iv) 19 + 93: 6(int) Load 92 + 94: 6(int) IAdd 93 91 + 95: 20(ptr) AccessChain 9(iv) 19 + Store 95 94 + 99: 96 Load 98(i2DMS) + 100: 29(ivec2) ImageQuerySize 99 + 101: 7(ivec3) Load 9(iv) + 102: 29(ivec2) VectorShuffle 101 101 0 1 + 103: 29(ivec2) IAdd 102 100 + 104: 7(ivec3) Load 9(iv) + 105: 7(ivec3) VectorShuffle 104 103 3 4 2 + Store 9(iv) 105 + 109: 106 Load 108(i2DMSArray) + 110: 7(ivec3) ImageQuerySize 109 + 111: 7(ivec3) Load 9(iv) + 112: 7(ivec3) IAdd 111 110 + Store 9(iv) 112 + 113: 96 Load 98(i2DMS) + 114: 6(int) ImageQuerySamples 113 + 115: 20(ptr) AccessChain 9(iv) 19 + 116: 6(int) Load 115 + 117: 6(int) IAdd 116 114 + 118: 20(ptr) AccessChain 9(iv) 19 + Store 118 117 + 119: 106 Load 108(i2DMSArray) + 120: 6(int) ImageQuerySamples 119 + 121: 20(ptr) AccessChain 9(iv) 19 + 122: 6(int) Load 121 + 123: 6(int) IAdd 122 120 + 124: 20(ptr) AccessChain 9(iv) 19 + Store 124 123 + Store 127(v) 129 + 130: 13 Load 15(i1D) + 133: 6(int) Load 132(ic1D) + 134: 125(fvec4) ImageRead 130 133 + 135: 125(fvec4) Load 127(v) + 136: 125(fvec4) FAdd 135 134 + Store 127(v) 136 + 137: 13 Load 15(i1D) + 138: 6(int) Load 132(ic1D) + 139: 125(fvec4) Load 127(v) + ImageWrite 137 138 139 + 140: 25 Load 27(i2D) + 143: 29(ivec2) Load 142(ic2D) + 144: 125(fvec4) ImageRead 140 143 + 145: 125(fvec4) Load 127(v) + 146: 125(fvec4) FAdd 145 144 + Store 127(v) 146 + 147: 25 Load 27(i2D) + 148: 29(ivec2) Load 142(ic2D) + 149: 125(fvec4) Load 127(v) + ImageWrite 147 148 149 + 150: 36 Load 38(i3D) + 153: 7(ivec3) Load 152(ic3D) + 154: 125(fvec4) ImageRead 150 153 + 155: 125(fvec4) Load 127(v) + 156: 125(fvec4) FAdd 155 154 + Store 127(v) 156 + 157: 36 Load 38(i3D) + 158: 7(ivec3) Load 152(ic3D) + 159: 125(fvec4) Load 127(v) + ImageWrite 157 158 159 + 160: 43 Load 45(iCube) + 161: 7(ivec3) Load 152(ic3D) + 162: 125(fvec4) ImageRead 160 161 + 163: 125(fvec4) Load 127(v) + 164: 125(fvec4) FAdd 163 162 + Store 127(v) 164 + 165: 43 Load 45(iCube) + 166: 7(ivec3) Load 152(ic3D) + 167: 125(fvec4) Load 127(v) + ImageWrite 165 166 167 + 168: 53 Load 55(iCubeArray) + 169: 7(ivec3) Load 152(ic3D) + 170: 125(fvec4) ImageRead 168 169 + 171: 125(fvec4) Load 127(v) + 172: 125(fvec4) FAdd 171 170 + Store 127(v) 172 + 173: 53 Load 55(iCubeArray) + 174: 7(ivec3) Load 152(ic3D) + 175: 125(fvec4) Load 127(v) + ImageWrite 173 174 175 + 176: 60 Load 62(i2DRect) + 177: 29(ivec2) Load 142(ic2D) + 178: 125(fvec4) ImageRead 176 177 + 179: 125(fvec4) Load 127(v) + 180: 125(fvec4) FAdd 179 178 + Store 127(v) 180 + 181: 60 Load 62(i2DRect) + 182: 29(ivec2) Load 142(ic2D) + 183: 125(fvec4) Load 127(v) + ImageWrite 181 182 183 + 184: 70 Load 72(i1DArray) + 185: 29(ivec2) Load 142(ic2D) + 186: 125(fvec4) ImageRead 184 185 + 187: 125(fvec4) Load 127(v) + 188: 125(fvec4) FAdd 187 186 + Store 127(v) 188 + 189: 70 Load 72(i1DArray) + 190: 29(ivec2) Load 142(ic2D) + 191: 125(fvec4) Load 127(v) + ImageWrite 189 190 191 + 192: 80 Load 82(i2DArray) + 193: 7(ivec3) Load 152(ic3D) + 194: 125(fvec4) ImageRead 192 193 + 195: 125(fvec4) Load 127(v) + 196: 125(fvec4) FAdd 195 194 + Store 127(v) 196 + 197: 80 Load 82(i2DArray) + 198: 7(ivec3) Load 152(ic3D) + 199: 125(fvec4) Load 127(v) + ImageWrite 197 198 199 + 200: 87 Load 89(iBuffer) + 201: 6(int) Load 132(ic1D) + 202: 125(fvec4) ImageRead 200 201 + 203: 125(fvec4) Load 127(v) + 204: 125(fvec4) FAdd 203 202 + Store 127(v) 204 + 205: 87 Load 89(iBuffer) + 206: 6(int) Load 132(ic1D) + 207: 125(fvec4) Load 127(v) + ImageWrite 205 206 207 + 208: 96 Load 98(i2DMS) + 209: 29(ivec2) Load 142(ic2D) + 211: 125(fvec4) ImageRead 208 209 Sample 210 + 212: 125(fvec4) Load 127(v) + 213: 125(fvec4) FAdd 212 211 + Store 127(v) 213 + 214: 96 Load 98(i2DMS) + 215: 29(ivec2) Load 142(ic2D) + 217: 125(fvec4) Load 127(v) + ImageWrite 214 215 217 Sample 216 + 218: 106 Load 108(i2DMSArray) + 219: 7(ivec3) Load 152(ic3D) + 221: 125(fvec4) ImageRead 218 219 Sample 220 + 222: 125(fvec4) Load 127(v) + 223: 125(fvec4) FAdd 222 221 + Store 127(v) 223 + 224: 106 Load 108(i2DMSArray) + 225: 7(ivec3) Load 152(ic3D) + 227: 125(fvec4) Load 127(v) + ImageWrite 224 225 227 Sample 226 + 229: 25 Load 228(wo2D) + 230: 29(ivec2) Load 142(ic2D) + 231: 125(fvec4) Load 127(v) + ImageWrite 229 230 231 + 234: 125(fvec4) Load 127(v) + Store 233(fragData) 234 + Return + FunctionEnd diff --git a/Test/spv.image.load-formatted.frag b/Test/spv.image.load-formatted.frag new file mode 100644 index 0000000..b0adc73 --- /dev/null +++ b/Test/spv.image.load-formatted.frag @@ -0,0 +1,74 @@ +#version 450 + +#extension GL_EXT_shader_image_load_formatted : require + +layout(binding = 0) uniform image1D i1D; +layout(binding = 1) uniform image2D i2D; +layout(binding = 2) uniform image3D i3D; +layout(binding = 3) uniform imageCube iCube; +layout(binding = 4) uniform imageCubeArray iCubeArray; +layout(binding = 5) uniform image2DRect i2DRect; +layout(binding = 6) uniform image1DArray i1DArray; +layout(binding = 7) uniform image2DArray i2DArray; +layout(binding = 8) uniform imageBuffer iBuffer; +layout(binding = 9) uniform image2DMS i2DMS; +layout(binding = 10) uniform image2DMSArray i2DMSArray; + +flat in int ic1D; +flat in ivec2 ic2D; +flat in ivec3 ic3D; +flat in ivec4 ic4D; + +writeonly layout(binding = 1) uniform image2D wo2D; + +flat in uint value; + +out vec4 fragData; + +void main() +{ + ivec3 iv = ivec3(0); + iv.x += imageSize(i1D); + iv.xy += imageSize(i2D); + iv.xyz += imageSize(i3D); + iv.xy += imageSize(iCube); + iv.xyz += imageSize(iCubeArray); + iv.xy += imageSize(i2DRect); + iv.xy += imageSize(i1DArray); + iv.xyz += imageSize(i2DArray); + iv.x += imageSize(iBuffer); + iv.xy += imageSize(i2DMS); + iv.xyz += imageSize(i2DMSArray); + + iv.x += imageSamples(i2DMS); + iv.x += imageSamples(i2DMSArray); + + vec4 v = vec4(0.0); + v += imageLoad(i1D, ic1D); + imageStore(i1D, ic1D, v); + v += imageLoad(i2D, ic2D); + imageStore(i2D, ic2D, v); + v += imageLoad(i3D, ic3D); + imageStore(i3D, ic3D, v); + v += imageLoad(iCube, ic3D); + imageStore(iCube, ic3D, v); + v += imageLoad(iCubeArray, ic3D); + imageStore(iCubeArray, ic3D, v); + v += imageLoad(i2DRect, ic2D); + imageStore(i2DRect, ic2D, v); + v += imageLoad(i1DArray, ic2D); + imageStore(i1DArray, ic2D, v); + v += imageLoad(i2DArray, ic3D); + imageStore(i2DArray, ic3D, v); + v += imageLoad(iBuffer, ic1D); + imageStore(iBuffer, ic1D, v); + v += imageLoad(i2DMS, ic2D, 1); + imageStore(i2DMS, ic2D, 2, v); + v += imageLoad(i2DMSArray, ic3D, 3); + imageStore(i2DMSArray, ic3D, 4, v); + + imageStore(wo2D, ic2D, v); + + fragData = v; +} + diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index daa8acc..db77b41 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -4499,8 +4499,11 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) } } } - } else if (type.isImage() && ! qualifier.writeonly) - error(loc, "image variables not declared 'writeonly' must have a format layout qualifier", "", ""); + } else if (type.isImage() && ! qualifier.writeonly) { + const char *explanation = "image variables declared 'writeonly' without a format layout qualifier"; + requireProfile(loc, ECoreProfile | ECompatibilityProfile, explanation); + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 0, E_GL_EXT_shader_image_load_formatted, explanation); + } if (qualifier.layoutPushConstant && type.getBasicType() != EbtBlock) error(loc, "can only be used with a block", "push_constant", ""); diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 6387538..0bcd3af 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -182,6 +182,7 @@ void TParseVersions::initializeExtensionBehavior() // extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members extensionBehavior[E_GL_EXT_shader_non_constant_global_initializers] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_image_load_formatted] = EBhDisable; // #line and #include extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable; @@ -303,6 +304,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_ARB_sparse_texture_clamp 1\n" // "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members "#define GL_EXT_shader_non_constant_global_initializers 1\n" + "#define GL_EXT_shader_image_load_formatted 1\n" #ifdef AMD_EXTENSIONS "#define GL_AMD_shader_ballot 1\n" diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 474e410..b99033f 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -130,6 +130,7 @@ const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture // const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers"; +const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_load_formatted"; // #line and #include const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive"; -- 2.7.4