diff --git a/Test/310.comp b/Test/310.comp
index d6b2c97d8a33f02d1809590f117d7d7edfda94e0..3252728c8063dce60200eb9ddaf53274efe798b0 100644
--- a/Test/310.comp
+++ b/Test/310.comp
@@ -78,8 +78,8 @@ uniform writeonly iimage2DArray ii2da;
 
 layout(r32i) uniform iimage2D iimg2D;
 layout(rgba32i) uniform readonly iimage2D iimg2Drgba;
-layout(rgba32f) uniform readonly image2D img2Drgba;
-layout(r32ui) uniform uimage2D uimg2D;
+layout(rgba32f) uniform readonly image2D img2Drgba;   // ERROR, no default
+layout(r32ui) uniform uimage2D uimg2D;                // ERROR, no default
 
 void qux()
 {
@@ -111,9 +111,9 @@ void passrc()
     passr(iimg2D);
 }
 
-layout(rg8i)     uniform readonly uimage2D i1bad; // ERROR, type mismatch
-layout(rgba32i)  uniform readonly image2D i2bad;  // ERROR, type mismatch
-layout(rgba32f)  uniform readonly uimage2D i3bad; // ERROR, type mismatch
+highp layout(rg8i)     uniform readonly uimage2D i1bad; // ERROR, type mismatch
+highp layout(rgba32i)  uniform readonly image2D i2bad;  // ERROR, type mismatch
+highp layout(rgba32f)  uniform readonly uimage2D i3bad; // ERROR, type mismatch
 layout(r8_snorm) uniform readonly iimage2D i4bad; // ERROR, type mismatch
 layout(rgba32ui) uniform readonly iimage2D i5bad; // ERROR, type mismatch
 layout(r8ui)     uniform readonly iimage2D i6bad; // ERROR, type mismatch
@@ -170,17 +170,17 @@ precise int pfoo;  // ERROR, reserved
 dmat2x4 dm;                     // ERROR
 uniform samplerCubeArray sca;   // ERROR
 uniform iimage2DRect i2dr;      // ERROR
-uniform image2DMS i2dms;        // ERROR
+highp uniform image2DMS i2dms;  // ERROR
 uniform uimage2DMSArray u2dmsa; // ERROR
 
-layout(r32f)  coherent volatile restrict readonly writeonly uniform  image2D okay1;
-layout(r32i)  coherent volatile restrict readonly           uniform iimage2D okay2;
-layout(r32ui) coherent volatile restrict          writeonly uniform uimage2D okay3;
-layout(r32f)  coherent volatile restrict                    uniform  image2D okay4;
+highp layout(r32f)  coherent volatile restrict readonly writeonly uniform  image2D okay1;
+      layout(r32i)  coherent volatile restrict readonly           uniform iimage2D okay2;
+highp layout(r32ui) coherent volatile restrict          writeonly uniform uimage2D okay3;
+highp layout(r32f)  coherent volatile restrict                    uniform  image2D okay4;
  
-layout(rgba32f)  coherent volatile restrict                 uniform  image2D badQ1;  // ERROR, bad qualifiers
-layout(rgba8i)   coherent volatile restrict                 uniform iimage2D badQ2;  // ERROR, bad qualifiers
-layout(rgba16ui) coherent volatile restrict                 uniform uimage2D badQ3;  // ERROR, bad qualifiers
+highp layout(rgba32f)  coherent volatile restrict                 uniform  image2D badQ1;  // ERROR, bad qualifiers
+      layout(rgba8i)   coherent volatile restrict                 uniform iimage2D badQ2;  // ERROR, bad qualifiers
+highp layout(rgba16ui) coherent volatile restrict                 uniform uimage2D badQ3;  // ERROR, bad qualifiers
 
 writeonly buffer woblock
 {
diff --git a/Test/310.frag b/Test/310.frag
index b08391a54350df21439e1f4b0e5711b648c15844..e9f0395004157457049bc790098d7068c3b6cb8e 100644
--- a/Test/310.frag
+++ b/Test/310.frag
@@ -62,11 +62,11 @@ void foo23()
 
 layout(binding=3) uniform sampler2D s1;
 layout(binding=3) uniform sampler2D s2; // ERROR: overlapping bindings?  Don't see that in the 310 spec.
-layout(binding=2) uniform writeonly image2D      i2D;
-layout(binding=4) uniform readonly  image3D      i3D;
-layout(binding=5) uniform           imageCube    iCube;
-layout(binding=6) uniform           image2DArray i2DA;
-layout(binding=6) uniform coherent volatile restrict image2D i2Dqualified;
+highp layout(binding=2) uniform writeonly image2D      i2D;
+      layout(binding=4) uniform readonly  image3D      i3D;    // ERROR, no default precision
+      layout(binding=5) uniform           imageCube    iCube;  // ERROR, no default precision
+      layout(binding=6) uniform           image2DArray i2DA;   // ERROR, no default precision
+      layout(binding=6) uniform coherent volatile restrict image2D i2Dqualified;    // ERROR, no default precision
 
 layout(binding = 1) uniform bb {
     int foo;
@@ -93,7 +93,7 @@ layout(shared) uniform bshar {
 in smooth vec4 smoothIn;
 in flat int flatIn;
 
-uniform sampler2DMS s2dms;
+uniform sampler2DMS s2dms;  // ERROR, no default precision qualifier
 
 void foots()
 {
@@ -108,7 +108,7 @@ void foots()
 }
 
 out bool bout;          // ERROR
-out image2D imageOut;   // ERROR
+highp out image2D imageOut;   // ERROR
 out mat2x3 mout;        // ERROR
 
 in bool inb;         // ERROR
@@ -201,7 +201,7 @@ uniform int sIndex;
 layout(binding = 0) uniform atomic_uint auArray[2];
 uniform ubName { int i; } ubInst[4];
 buffer bbName { int i; } bbInst[4];
-uniform writeonly image2D iArray[5];
+highp uniform writeonly image2D iArray[5];
 const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
 
 void pfooBad()
diff --git a/Test/310.vert b/Test/310.vert
index 58ed7480c993854f3e7fe5a04890e722fc1790ad..92a50e2ef0f1a6c516464168a7ac817e0f7a4df6 100644
--- a/Test/310.vert
+++ b/Test/310.vert
@@ -147,7 +147,7 @@ uniform int sIndex;
 layout(binding = 0) uniform atomic_uint auArray[2];
 uniform ubName { int i; } ubInst[4];
 buffer bbName { int i; } bbInst[4];
-uniform writeonly image2D iArray[5];
+highp uniform writeonly image2D iArray[5];
 const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
 
 void pfooBad()
@@ -158,10 +158,10 @@ void pfooBad()
     auArray[sIndex + 1];
     ubInst[1];
     bbInst[2];
-    ubInst[sIndex + 1];      // ERRRO, not supported
-    bbInst[sIndex];          // ERRRO, not supported
+    ubInst[sIndex + 1];      // ERROR, not supported
+    bbInst[sIndex];          // ERROR, not supported
     iArray[2];
-    iArray[sIndex * 2];      // ERRRO, not supported
+    iArray[sIndex * 2];      // ERROR, not supported
     textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));     // ERROR, offset not constant
     textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);  // ERROR, not available
 }
diff --git a/Test/baseResults/310.comp.out b/Test/baseResults/310.comp.out
index 67129d1d370c3c18f41d827c956f6b4bce0807b2..b56f070295b163247a525ab62b085dd1fc2bb3c5 100644
--- a/Test/baseResults/310.comp.out
+++ b/Test/baseResults/310.comp.out
@@ -17,6 +17,8 @@ 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: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
 ERROR: 0:88: 'imageAtomicAdd' : required extension not requested: GL_OES_shader_image_atomic
 ERROR: 0:89: 'imageAtomicMin' : required extension not requested: GL_OES_shader_image_atomic
@@ -79,7 +81,7 @@ ERROR: 0:227: 'input block' : not supported in this stage: compute
 ERROR: 0:231: 'output block' : not supported in this stage: compute
 WARNING: 0:235: 't__' : identifiers containing consecutive underscores ("__") are reserved 
 WARNING: 0:238: '#define' : names containing consecutive underscores are reserved: __D
-ERROR: 77 compilation errors.  No code generated.
+ERROR: 79 compilation errors.  No code generated.
 
 
 Shader version: 310
@@ -143,7 +145,7 @@ ERROR: node is still EOpNull!
 0:87        'i' (temp highp int)
 0:87        'i' (temp highp int)
 0:88      imageAtomicAdd (global highp uint)
-0:88        'uimg2D' (layout(r32ui ) uniform highp uimage2D)
+0:88        'uimg2D' (layout(r32ui ) uniform mediump uimage2D)
 0:88        Construct ivec2 (temp highp 2-component vector of int)
 0:88          'i' (temp highp int)
 0:88          'i' (temp highp int)
@@ -177,7 +179,7 @@ ERROR: node is still EOpNull!
 0:92          0 (const int)
 0:92          0 (const int)
 0:93      imageLoad (global highp 4-component vector of float)
-0:93        'img2Drgba' (layout(rgba32f ) readonly uniform lowp image2D)
+0:93        'img2Drgba' (layout(rgba32f ) readonly uniform mediump image2D)
 0:93        Construct ivec2 (temp highp 2-component vector of int)
 0:93          'i' (temp highp int)
 0:93          'i' (temp highp int)
@@ -467,14 +469,14 @@ ERROR: node is still EOpNull!
 0:?     'ii2da' (writeonly uniform highp iimage2DArray)
 0:?     'iimg2D' (layout(r32i ) uniform highp iimage2D)
 0:?     'iimg2Drgba' (layout(rgba32i ) readonly uniform highp iimage2D)
-0:?     'img2Drgba' (layout(rgba32f ) readonly uniform lowp image2D)
-0:?     'uimg2D' (layout(r32ui ) uniform highp uimage2D)
+0:?     'img2Drgba' (layout(rgba32f ) readonly uniform mediump image2D)
+0:?     'uimg2D' (layout(r32ui ) uniform mediump uimage2D)
 0:?     'vol' (volatile temp highp float)
 0:?     'vol2' (readonly temp highp int)
 0:?     'qualim1' (layout(r32i ) coherent readonly uniform highp iimage2D)
 0:?     'qualim2' (layout(r32i ) coherent restrict readonly uniform highp iimage2D)
 0:?     'i1bad' (layout(rg8i ) readonly uniform highp uimage2D)
-0:?     'i2bad' (layout(rgba32i ) readonly uniform lowp image2D)
+0:?     'i2bad' (layout(rgba32i ) readonly uniform highp image2D)
 0:?     'i3bad' (layout(rgba32f ) readonly uniform highp uimage2D)
 0:?     'i4bad' (layout(r8_snorm ) readonly uniform highp iimage2D)
 0:?     'i5bad' (layout(rgba32ui ) readonly uniform highp iimage2D)
@@ -489,13 +491,13 @@ ERROR: node is still EOpNull!
 0:?     'dm' (global 2X4 matrix of double)
 0:?     'sca' (uniform mediump samplerCubeArray)
 0:?     'i2dr' (uniform mediump iimage2DRect)
-0:?     'i2dms' (uniform lowp image2DMS)
+0:?     'i2dms' (uniform highp image2DMS)
 0:?     'u2dmsa' (uniform mediump uimage2DMSArray)
-0:?     'okay1' (layout(r32f ) coherent volatile restrict readonly writeonly uniform lowp image2D)
+0:?     'okay1' (layout(r32f ) coherent volatile restrict readonly writeonly uniform highp image2D)
 0:?     'okay2' (layout(r32i ) coherent volatile restrict readonly uniform highp iimage2D)
 0:?     'okay3' (layout(r32ui ) coherent volatile restrict writeonly uniform highp uimage2D)
-0:?     'okay4' (layout(r32f ) coherent volatile restrict uniform lowp image2D)
-0:?     'badQ1' (layout(rgba32f ) coherent volatile restrict uniform lowp image2D)
+0:?     'okay4' (layout(r32f ) coherent volatile restrict uniform highp image2D)
+0:?     'badQ1' (layout(rgba32f ) coherent volatile restrict uniform highp image2D)
 0:?     'badQ2' (layout(rgba8i ) coherent volatile restrict uniform highp iimage2D)
 0:?     'badQ3' (layout(rgba16ui ) coherent volatile restrict uniform highp uimage2D)
 0:?     'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
@@ -570,7 +572,7 @@ ERROR: node is still EOpNull!
 0:87        'i' (temp highp int)
 0:87        'i' (temp highp int)
 0:88      imageAtomicAdd (global highp uint)
-0:88        'uimg2D' (layout(r32ui ) uniform highp uimage2D)
+0:88        'uimg2D' (layout(r32ui ) uniform mediump uimage2D)
 0:88        Construct ivec2 (temp highp 2-component vector of int)
 0:88          'i' (temp highp int)
 0:88          'i' (temp highp int)
@@ -604,7 +606,7 @@ ERROR: node is still EOpNull!
 0:92          0 (const int)
 0:92          0 (const int)
 0:93      imageLoad (global highp 4-component vector of float)
-0:93        'img2Drgba' (layout(rgba32f ) readonly uniform lowp image2D)
+0:93        'img2Drgba' (layout(rgba32f ) readonly uniform mediump image2D)
 0:93        Construct ivec2 (temp highp 2-component vector of int)
 0:93          'i' (temp highp int)
 0:93          'i' (temp highp int)
@@ -894,14 +896,14 @@ ERROR: node is still EOpNull!
 0:?     'ii2da' (writeonly uniform highp iimage2DArray)
 0:?     'iimg2D' (layout(r32i ) uniform highp iimage2D)
 0:?     'iimg2Drgba' (layout(rgba32i ) readonly uniform highp iimage2D)
-0:?     'img2Drgba' (layout(rgba32f ) readonly uniform lowp image2D)
-0:?     'uimg2D' (layout(r32ui ) uniform highp uimage2D)
+0:?     'img2Drgba' (layout(rgba32f ) readonly uniform mediump image2D)
+0:?     'uimg2D' (layout(r32ui ) uniform mediump uimage2D)
 0:?     'vol' (volatile temp highp float)
 0:?     'vol2' (readonly temp highp int)
 0:?     'qualim1' (layout(r32i ) coherent readonly uniform highp iimage2D)
 0:?     'qualim2' (layout(r32i ) coherent restrict readonly uniform highp iimage2D)
 0:?     'i1bad' (layout(rg8i ) readonly uniform highp uimage2D)
-0:?     'i2bad' (layout(rgba32i ) readonly uniform lowp image2D)
+0:?     'i2bad' (layout(rgba32i ) readonly uniform highp image2D)
 0:?     'i3bad' (layout(rgba32f ) readonly uniform highp uimage2D)
 0:?     'i4bad' (layout(r8_snorm ) readonly uniform highp iimage2D)
 0:?     'i5bad' (layout(rgba32ui ) readonly uniform highp iimage2D)
@@ -916,13 +918,13 @@ ERROR: node is still EOpNull!
 0:?     'dm' (global 2X4 matrix of double)
 0:?     'sca' (uniform mediump samplerCubeArray)
 0:?     'i2dr' (uniform mediump iimage2DRect)
-0:?     'i2dms' (uniform lowp image2DMS)
+0:?     'i2dms' (uniform highp image2DMS)
 0:?     'u2dmsa' (uniform mediump uimage2DMSArray)
-0:?     'okay1' (layout(r32f ) coherent volatile restrict readonly writeonly uniform lowp image2D)
+0:?     'okay1' (layout(r32f ) coherent volatile restrict readonly writeonly uniform highp image2D)
 0:?     'okay2' (layout(r32i ) coherent volatile restrict readonly uniform highp iimage2D)
 0:?     'okay3' (layout(r32ui ) coherent volatile restrict writeonly uniform highp uimage2D)
-0:?     'okay4' (layout(r32f ) coherent volatile restrict uniform lowp image2D)
-0:?     'badQ1' (layout(rgba32f ) coherent volatile restrict uniform lowp image2D)
+0:?     'okay4' (layout(r32f ) coherent volatile restrict uniform highp image2D)
+0:?     'badQ1' (layout(rgba32f ) coherent volatile restrict uniform highp image2D)
 0:?     'badQ2' (layout(rgba8i ) coherent volatile restrict uniform highp iimage2D)
 0:?     'badQ3' (layout(rgba16ui ) coherent volatile restrict uniform highp uimage2D)
 0:?     'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
diff --git a/Test/baseResults/310.frag.out b/Test/baseResults/310.frag.out
index 0d2ad8d0f562b08366fb31d65d8b985ba52f8370..905a9ca9bd6d70c56fe5b892d7d0fe0e409842fb 100644
--- a/Test/baseResults/310.frag.out
+++ b/Test/baseResults/310.frag.out
@@ -20,9 +20,11 @@ ERROR: 0:45: '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: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: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: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: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:73: 'binding' : requires block, or sampler/image, or atomic-counter type 
 ERROR: 0:77: 'location' : location is too large 
@@ -31,6 +33,7 @@ ERROR: 0:82: 'location' : too large for fragment output
 ERROR: 0:82: 'location' : overlapping use of location 40
 ERROR: 0:83: 'non-literal layout-id value' : not supported with this profile: es
 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 
@@ -130,7 +133,7 @@ ERROR: 0:427: 'blend equation' : can only apply to a standalone qualifier
 ERROR: 0:428: 'blend equation' : can only apply to a standalone qualifier 
 ERROR: 0:429: 'blend_support' : unknown blend equation 
 ERROR: 0:431: 'fragment-shader array-of-array output' : not supported with this profile: es
-ERROR: 122 compilation errors.  No code generated.
+ERROR: 125 compilation errors.  No code generated.
 
 
 Shader version: 310
@@ -351,7 +354,7 @@ ERROR: node is still EOpNull!
 0:102      move second child to first child (temp highp 2-component vector of int)
 0:102        'v2' (temp highp 2-component vector of int)
 0:102        textureSize (global highp 2-component vector of int)
-0:102          's2dms' (uniform highp sampler2DMS)
+0:102          's2dms' (uniform mediump sampler2DMS)
 0:103      move second child to first child (temp highp 2-component vector of int)
 0:103        'v2' (temp highp 2-component vector of int)
 0:103        imageQuerySize (global highp 2-component vector of int)
@@ -363,7 +366,7 @@ ERROR: node is still EOpNull!
 0:105      move second child to first child (temp highp 2-component vector of int)
 0:105        'v2' (temp highp 2-component vector of int)
 0:105        imageQuerySize (global highp 2-component vector of int)
-0:105          'iCube' (layout(binding=5 ) uniform lowp imageCube)
+0:105          'iCube' (layout(binding=5 ) uniform mediump imageCube)
 0:106      move second child to first child (temp highp 3-component vector of int)
 0:106        'v3' (temp highp 3-component vector of int)
 0:106        imageQuerySize (global highp 3-component vector of int)
@@ -371,7 +374,7 @@ ERROR: node is still EOpNull!
 0:107      move second child to first child (temp highp 2-component vector of int)
 0:107        'v2' (temp highp 2-component vector of int)
 0:107        imageQuerySize (global highp 2-component vector of int)
-0:107          'i2Dqualified' (layout(binding=6 ) coherent volatile restrict uniform highp image2D)
+0:107          'i2Dqualified' (layout(binding=6 ) coherent volatile restrict uniform mediump image2D)
 0:165  Function Definition: fooIO( (global void)
 0:165    Function Parameters: 
 0:167    Sequence
@@ -928,9 +931,9 @@ ERROR: node is still EOpNull!
 0:?     's2' (layout(binding=3 ) uniform highp sampler2D)
 0:?     'i2D' (layout(binding=2 ) writeonly uniform highp image2D)
 0:?     'i3D' (layout(binding=4 ) readonly uniform mediump image3D)
-0:?     'iCube' (layout(binding=5 ) uniform lowp imageCube)
+0:?     'iCube' (layout(binding=5 ) uniform mediump imageCube)
 0:?     'i2DA' (layout(binding=6 ) uniform mediump image2DArray)
-0:?     'i2Dqualified' (layout(binding=6 ) coherent volatile restrict uniform highp image2D)
+0:?     'i2Dqualified' (layout(binding=6 ) coherent volatile restrict uniform mediump image2D)
 0:?     'bbi' (layout(binding=1 column_major shared ) uniform block{layout(column_major shared ) uniform mediump int foo, layout(binding=2 column_major shared ) uniform mediump float f})
 0:?     'centroidIn' (centroid smooth in mediump 4-component vector of float)
 0:?     'bigl' (uniform mediump 4-component vector of float)
@@ -941,7 +944,7 @@ ERROR: node is still EOpNull!
 0:?     'bshari' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump int i})
 0:?     'smoothIn' (smooth in mediump 4-component vector of float)
 0:?     'flatIn' (flat in mediump int)
-0:?     's2dms' (uniform highp sampler2DMS)
+0:?     's2dms' (uniform mediump sampler2DMS)
 0:?     'bout' (out bool)
 0:?     'imageOut' (out highp image2D)
 0:?     'mout' (out mediump 2X3 matrix of float)
@@ -1232,7 +1235,7 @@ ERROR: node is still EOpNull!
 0:102      move second child to first child (temp highp 2-component vector of int)
 0:102        'v2' (temp highp 2-component vector of int)
 0:102        textureSize (global highp 2-component vector of int)
-0:102          's2dms' (uniform highp sampler2DMS)
+0:102          's2dms' (uniform mediump sampler2DMS)
 0:103      move second child to first child (temp highp 2-component vector of int)
 0:103        'v2' (temp highp 2-component vector of int)
 0:103        imageQuerySize (global highp 2-component vector of int)
@@ -1244,7 +1247,7 @@ ERROR: node is still EOpNull!
 0:105      move second child to first child (temp highp 2-component vector of int)
 0:105        'v2' (temp highp 2-component vector of int)
 0:105        imageQuerySize (global highp 2-component vector of int)
-0:105          'iCube' (layout(binding=5 ) uniform lowp imageCube)
+0:105          'iCube' (layout(binding=5 ) uniform mediump imageCube)
 0:106      move second child to first child (temp highp 3-component vector of int)
 0:106        'v3' (temp highp 3-component vector of int)
 0:106        imageQuerySize (global highp 3-component vector of int)
@@ -1252,7 +1255,7 @@ ERROR: node is still EOpNull!
 0:107      move second child to first child (temp highp 2-component vector of int)
 0:107        'v2' (temp highp 2-component vector of int)
 0:107        imageQuerySize (global highp 2-component vector of int)
-0:107          'i2Dqualified' (layout(binding=6 ) coherent volatile restrict uniform highp image2D)
+0:107          'i2Dqualified' (layout(binding=6 ) coherent volatile restrict uniform mediump image2D)
 0:165  Function Definition: fooIO( (global void)
 0:165    Function Parameters: 
 0:167    Sequence
@@ -1809,9 +1812,9 @@ ERROR: node is still EOpNull!
 0:?     's2' (layout(binding=3 ) uniform highp sampler2D)
 0:?     'i2D' (layout(binding=2 ) writeonly uniform highp image2D)
 0:?     'i3D' (layout(binding=4 ) readonly uniform mediump image3D)
-0:?     'iCube' (layout(binding=5 ) uniform lowp imageCube)
+0:?     'iCube' (layout(binding=5 ) uniform mediump imageCube)
 0:?     'i2DA' (layout(binding=6 ) uniform mediump image2DArray)
-0:?     'i2Dqualified' (layout(binding=6 ) coherent volatile restrict uniform highp image2D)
+0:?     'i2Dqualified' (layout(binding=6 ) coherent volatile restrict uniform mediump image2D)
 0:?     'bbi' (layout(binding=1 column_major shared ) uniform block{layout(column_major shared ) uniform mediump int foo, layout(binding=2 column_major shared ) uniform mediump float f})
 0:?     'centroidIn' (centroid smooth in mediump 4-component vector of float)
 0:?     'bigl' (uniform mediump 4-component vector of float)
@@ -1822,7 +1825,7 @@ ERROR: node is still EOpNull!
 0:?     'bshari' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump int i})
 0:?     'smoothIn' (smooth in mediump 4-component vector of float)
 0:?     'flatIn' (flat in mediump int)
-0:?     's2dms' (uniform highp sampler2DMS)
+0:?     's2dms' (uniform mediump sampler2DMS)
 0:?     'bout' (out bool)
 0:?     'imageOut' (out highp image2D)
 0:?     'mout' (out mediump 2X3 matrix of float)
diff --git a/Test/baseResults/310.vert.out b/Test/baseResults/310.vert.out
index 9ce13f444f18f4bc0047d1361568668d2d8cad76..b8b39f592f51885f67c42de2978a54249fc260fe 100644
--- a/Test/baseResults/310.vert.out
+++ b/Test/baseResults/310.vert.out
@@ -291,8 +291,8 @@ ERROR: node is still EOpNull!
 0:156          'inf' (in highp 2-component vector of float)
 0:156          'ing' (in highp 2-component vector of float)
 0:156          'h' (noContraction temp highp 2-component vector of float)
-0:157      indirect index (temp highp sampler2D)
-0:157        'sArray' (uniform 4-element array of highp sampler2D)
+0:157      indirect index (temp lowp sampler2D)
+0:157        'sArray' (uniform 4-element array of lowp sampler2D)
 0:157        add (temp highp int)
 0:157          'sIndex' (uniform highp int)
 0:157          Constant:
@@ -330,19 +330,19 @@ ERROR: node is still EOpNull!
 0:164          'sIndex' (uniform highp int)
 0:164          Constant:
 0:164            2 (const int)
-0:165      textureGatherOffset (global highp 4-component vector of float)
-0:165        direct index (temp highp sampler2D)
-0:165          'sArray' (uniform 4-element array of highp sampler2D)
+0:165      textureGatherOffset (global lowp 4-component vector of float)
+0:165        direct index (temp lowp sampler2D)
+0:165          'sArray' (uniform 4-element array of lowp sampler2D)
 0:165          Constant:
 0:165            0 (const int)
 0:165        Constant:
 0:165          0.100000
 0:165          0.100000
-0:165        Convert float to int (temp highp 2-component vector of int)
+0:165        Convert float to int (temp lowp 2-component vector of int)
 0:165          'inf' (in highp 2-component vector of float)
-0:166      textureGatherOffsets (global highp 4-component vector of float)
-0:166        direct index (temp highp sampler2D)
-0:166          'sArray' (uniform 4-element array of highp sampler2D)
+0:166      textureGatherOffsets (global lowp 4-component vector of float)
+0:166        direct index (temp lowp sampler2D)
+0:166          'sArray' (uniform 4-element array of lowp sampler2D)
 0:166          Constant:
 0:166            0 (const int)
 0:166        Constant:
@@ -366,8 +366,8 @@ ERROR: node is still EOpNull!
 0:174          'inf' (in highp 2-component vector of float)
 0:174          'ing' (in highp 2-component vector of float)
 0:174          'h' (noContraction temp highp 2-component vector of float)
-0:175      indirect index (temp highp sampler2D)
-0:175        'sArray' (uniform 4-element array of highp sampler2D)
+0:175      indirect index (temp lowp sampler2D)
+0:175        'sArray' (uniform 4-element array of lowp sampler2D)
 0:175        add (temp highp int)
 0:175          'sIndex' (uniform highp int)
 0:175          Constant:
@@ -394,19 +394,19 @@ ERROR: node is still EOpNull!
 0:179          'sIndex' (uniform highp int)
 0:179          Constant:
 0:179            2 (const int)
-0:180      textureGatherOffset (global highp 4-component vector of float)
-0:180        direct index (temp highp sampler2D)
-0:180          'sArray' (uniform 4-element array of highp sampler2D)
+0:180      textureGatherOffset (global lowp 4-component vector of float)
+0:180        direct index (temp lowp sampler2D)
+0:180          'sArray' (uniform 4-element array of lowp sampler2D)
 0:180          Constant:
 0:180            0 (const int)
 0:180        Constant:
 0:180          0.100000
 0:180          0.100000
-0:180        Convert float to int (temp highp 2-component vector of int)
+0:180        Convert float to int (temp lowp 2-component vector of int)
 0:180          'inf' (in highp 2-component vector of float)
-0:181      textureGatherOffsets (global highp 4-component vector of float)
-0:181        direct index (temp highp sampler2D)
-0:181          'sArray' (uniform 4-element array of highp sampler2D)
+0:181      textureGatherOffsets (global lowp 4-component vector of float)
+0:181        direct index (temp lowp sampler2D)
+0:181          'sArray' (uniform 4-element array of lowp sampler2D)
 0:181          Constant:
 0:181            0 (const int)
 0:181        Constant:
@@ -421,9 +421,9 @@ ERROR: node is still EOpNull!
 0:181          0 (const int)
 0:181          0 (const int)
 0:181          0 (const int)
-0:182      textureGatherOffsets (global highp 4-component vector of float)
-0:182        direct index (temp highp sampler2D)
-0:182          'sArray' (uniform 4-element array of highp sampler2D)
+0:182      textureGatherOffsets (global lowp 4-component vector of float)
+0:182        direct index (temp lowp sampler2D)
+0:182          'sArray' (uniform 4-element array of lowp sampler2D)
 0:182          Constant:
 0:182            0 (const int)
 0:182        Constant:
@@ -927,7 +927,7 @@ ERROR: node is still EOpNull!
 0:?     'us2dms' (uniform highp usampler2DMS)
 0:?     'us2dmsa' (uniform mediump usampler2DMSArray)
 0:?     'outb' (smooth out bool)
-0:?     'outo' (smooth out highp sampler2D)
+0:?     'outo' (smooth out lowp sampler2D)
 0:?     'outa' (smooth out 4-element array of highp float)
 0:?     'outaa' (smooth out 4-element array of 2-element array of highp float)
 0:?     'outs' (smooth out structure{global highp float f})
@@ -949,7 +949,7 @@ ERROR: node is still EOpNull!
 0:?     'inf' (in highp 2-component vector of float)
 0:?     'ing' (in highp 2-component vector of float)
 0:?     'offsets' (uniform 4-element array of highp 2-component vector of int)
-0:?     'sArray' (uniform 4-element array of highp sampler2D)
+0:?     'sArray' (uniform 4-element array of lowp sampler2D)
 0:?     'sIndex' (uniform highp int)
 0:?     'auArray' (layout(binding=0 offset=0 ) uniform 2-element array of highp atomic_uint)
 0:?     'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform highp int i})
@@ -1222,8 +1222,8 @@ ERROR: node is still EOpNull!
 0:156          'inf' (in highp 2-component vector of float)
 0:156          'ing' (in highp 2-component vector of float)
 0:156          'h' (noContraction temp highp 2-component vector of float)
-0:157      indirect index (temp highp sampler2D)
-0:157        'sArray' (uniform 4-element array of highp sampler2D)
+0:157      indirect index (temp lowp sampler2D)
+0:157        'sArray' (uniform 4-element array of lowp sampler2D)
 0:157        add (temp highp int)
 0:157          'sIndex' (uniform highp int)
 0:157          Constant:
@@ -1261,19 +1261,19 @@ ERROR: node is still EOpNull!
 0:164          'sIndex' (uniform highp int)
 0:164          Constant:
 0:164            2 (const int)
-0:165      textureGatherOffset (global highp 4-component vector of float)
-0:165        direct index (temp highp sampler2D)
-0:165          'sArray' (uniform 4-element array of highp sampler2D)
+0:165      textureGatherOffset (global lowp 4-component vector of float)
+0:165        direct index (temp lowp sampler2D)
+0:165          'sArray' (uniform 4-element array of lowp sampler2D)
 0:165          Constant:
 0:165            0 (const int)
 0:165        Constant:
 0:165          0.100000
 0:165          0.100000
-0:165        Convert float to int (temp highp 2-component vector of int)
+0:165        Convert float to int (temp lowp 2-component vector of int)
 0:165          'inf' (in highp 2-component vector of float)
-0:166      textureGatherOffsets (global highp 4-component vector of float)
-0:166        direct index (temp highp sampler2D)
-0:166          'sArray' (uniform 4-element array of highp sampler2D)
+0:166      textureGatherOffsets (global lowp 4-component vector of float)
+0:166        direct index (temp lowp sampler2D)
+0:166          'sArray' (uniform 4-element array of lowp sampler2D)
 0:166          Constant:
 0:166            0 (const int)
 0:166        Constant:
@@ -1297,8 +1297,8 @@ ERROR: node is still EOpNull!
 0:174          'inf' (in highp 2-component vector of float)
 0:174          'ing' (in highp 2-component vector of float)
 0:174          'h' (noContraction temp highp 2-component vector of float)
-0:175      indirect index (temp highp sampler2D)
-0:175        'sArray' (uniform 4-element array of highp sampler2D)
+0:175      indirect index (temp lowp sampler2D)
+0:175        'sArray' (uniform 4-element array of lowp sampler2D)
 0:175        add (temp highp int)
 0:175          'sIndex' (uniform highp int)
 0:175          Constant:
@@ -1325,19 +1325,19 @@ ERROR: node is still EOpNull!
 0:179          'sIndex' (uniform highp int)
 0:179          Constant:
 0:179            2 (const int)
-0:180      textureGatherOffset (global highp 4-component vector of float)
-0:180        direct index (temp highp sampler2D)
-0:180          'sArray' (uniform 4-element array of highp sampler2D)
+0:180      textureGatherOffset (global lowp 4-component vector of float)
+0:180        direct index (temp lowp sampler2D)
+0:180          'sArray' (uniform 4-element array of lowp sampler2D)
 0:180          Constant:
 0:180            0 (const int)
 0:180        Constant:
 0:180          0.100000
 0:180          0.100000
-0:180        Convert float to int (temp highp 2-component vector of int)
+0:180        Convert float to int (temp lowp 2-component vector of int)
 0:180          'inf' (in highp 2-component vector of float)
-0:181      textureGatherOffsets (global highp 4-component vector of float)
-0:181        direct index (temp highp sampler2D)
-0:181          'sArray' (uniform 4-element array of highp sampler2D)
+0:181      textureGatherOffsets (global lowp 4-component vector of float)
+0:181        direct index (temp lowp sampler2D)
+0:181          'sArray' (uniform 4-element array of lowp sampler2D)
 0:181          Constant:
 0:181            0 (const int)
 0:181        Constant:
@@ -1352,9 +1352,9 @@ ERROR: node is still EOpNull!
 0:181          0 (const int)
 0:181          0 (const int)
 0:181          0 (const int)
-0:182      textureGatherOffsets (global highp 4-component vector of float)
-0:182        direct index (temp highp sampler2D)
-0:182          'sArray' (uniform 4-element array of highp sampler2D)
+0:182      textureGatherOffsets (global lowp 4-component vector of float)
+0:182        direct index (temp lowp sampler2D)
+0:182          'sArray' (uniform 4-element array of lowp sampler2D)
 0:182          Constant:
 0:182            0 (const int)
 0:182        Constant:
@@ -1858,7 +1858,7 @@ ERROR: node is still EOpNull!
 0:?     'us2dms' (uniform highp usampler2DMS)
 0:?     'us2dmsa' (uniform mediump usampler2DMSArray)
 0:?     'outb' (smooth out bool)
-0:?     'outo' (smooth out highp sampler2D)
+0:?     'outo' (smooth out lowp sampler2D)
 0:?     'outa' (smooth out 4-element array of highp float)
 0:?     'outaa' (smooth out 4-element array of 2-element array of highp float)
 0:?     'outs' (smooth out structure{global highp float f})
@@ -1880,7 +1880,7 @@ ERROR: node is still EOpNull!
 0:?     'inf' (in highp 2-component vector of float)
 0:?     'ing' (in highp 2-component vector of float)
 0:?     'offsets' (uniform 4-element array of highp 2-component vector of int)
-0:?     'sArray' (uniform 4-element array of highp sampler2D)
+0:?     'sArray' (uniform 4-element array of lowp sampler2D)
 0:?     'sIndex' (uniform highp int)
 0:?     'auArray' (layout(binding=0 offset=0 ) uniform 2-element array of highp atomic_uint)
 0:?     'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform highp int i})
diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp
index eb9100bd05c7525ad0055c1bbdc51376244ef2a8..72f827cf71487cee21e519d98177f4067d6fd775 100644
--- a/glslang/MachineIndependent/ParseHelper.cpp
+++ b/glslang/MachineIndependent/ParseHelper.cpp
@@ -2871,11 +2871,17 @@ void TParseContext::setDefaultPrecision(const TSourceLoc& loc, TPublicType& publ
 // correlates with the declaration of defaultSamplerPrecision[]
 int TParseContext::computeSamplerTypeIndex(TSampler& sampler)
 {
-    int arrayIndex   = sampler.arrayed   ? 1 : 0;
-    int shadowIndex   = sampler.shadow   ? 1 : 0;
-    int externalIndex = sampler.external ? 1 : 0;
+    int arrayIndex    = sampler.arrayed ? 1 : 0;
+    int shadowIndex   = sampler.shadow  ? 1 : 0;
+    int externalIndex = sampler.external? 1 : 0;
+    int imageIndex    = sampler.image   ? 1 : 0;
+    int msIndex       = sampler.ms      ? 1 : 0;
 
-    return EsdNumDims * (EbtNumTypes * (2 * (2 * arrayIndex + shadowIndex) + externalIndex) + sampler.type) + sampler.dim;
+    int flattened = EsdNumDims * (EbtNumTypes * (2 * (2 * (2 * (2 * arrayIndex + msIndex) + imageIndex) + shadowIndex) +
+                                                 externalIndex) + sampler.type) + sampler.dim;
+    assert(flattened < maxSamplerIndex);
+
+    return flattened;
 }
 
 TPrecisionQualifier TParseContext::getDefaultPrecision(TPublicType& publicType)
diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h
index a4775e718754b5c5bc698705f6d0692d428048d9..5b4a9df0ee47165af044ac191aaa25a11004891d 100644
--- a/glslang/MachineIndependent/ParseHelper.h
+++ b/glslang/MachineIndependent/ParseHelper.h
@@ -335,7 +335,7 @@ protected:
     TParseContext& operator=(TParseContext&);
 
     const bool parsingBuiltins;        // true if parsing built-in symbols/functions
-    static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2)); // see computeSamplerTypeIndex()
+    static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2 * 2 * 2)); // see computeSamplerTypeIndex()
     TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex];
     bool afterEOF;
     TQualifier globalBufferDefaults;