title: Compiling GLSL written for OpenGL ES versions to Vulkan
body: <p>My question is similar to <a href="https://stackoverflow.com/questions/37056159/using-different-push-constants-in-different-shader-stages">this one</a> but part of the (useful) given answer isn't compatible with compiling GLSL for vulkan based on OpenGL ES ESSL 3.10.</p>
  
  <p>In order to use a separate section of the push constant memory in the vertex shader and the fragment shader, the suggested solution is to use layout(offset = #) before the first member of the push constant structure.</p>
  
  <p>Attempting to do this in GLSL ES 310 code leads to the error "'offset on block member': not supported with this profile: es".</p>
  
  <p>Is there a supported way to declare such an offset that is compatible with es?</p>
  
  <p>The only workaround I've found is to declare a bunch of dummy variables in the fragment shader. When I do so, I get validation layer errors if I don't declare the full range of the fragment shader's push constant buffer in VkPipelineLayoutCreateInfo. After fixing that, I get validation layer warnings about "vkCreatePipelineLayout() call has push constants with overlapping ranges".</p>
  
  <p>Obviously I can ignore warnings, but if there's a tidier solution, then that would be much more preferable.</p>
  
  <p>Simple example, this compiles successfully with VulkanSDK\1.0.13.0\Bin\glslangValidator.exe:</p>
  
  <pre><code>#version 430
  #extension GL_ARB_enhanced_layouts: enable
  
  layout(std140, push_constant) uniform PushConstants
  {
          layout(offset=64) mat4 matWorldViewProj;
  } ubuf;
  
  layout(location = 0) in vec4 i_Position;
  
  void main() {
      gl_Position = ubuf.matWorldViewProj * i_Position;
  }
  </code></pre>
  
  <p>Whereas this does not:</p>
  
  <pre><code>#version 310 es
  #extension GL_ARB_enhanced_layouts: enable
  
  layout(std140, push_constant) uniform PushConstants
  {
          layout(offset=64) mat4 matWorldViewProj;
  } ubuf;
  
  layout(location = 0) in vec4 i_Position;
  
  void main() {
      gl_Position = ubuf.matWorldViewProj * i_Position;
  }
  </code></pre>
  
  <p>Converting all my 310 ES shader code to 430 would solve my problem, but that wouldn't be ideal. GL_ARB_enhanced_layouts doesn't apply to 310 ES code, so my question is not about why it doesn't work, but rather, do I have any options in ES to achieve the same goal?</p>