title: How to write into layered depth attachment in Vulkan
body: <p>I'm trying to implement shadow mapping into company's renderer, but I'm stuck upon writting depth results into depth attachment. I want to write into depth attachment normalized distance from light to fragment via <code>gl_FragDepth</code> output variable inside fragment shader, but render doc shows me that depth attachment is not updated by it at all. As depth attachment I'm using view for layered 2D image with 6 layers and <code>CubeCompatible</code> flag set, with <code>D32Sfloat</code> format and during subpass image has layout <code>DepthStencilAttachmentOptimal</code>. Each of cube face has its own view and is attached as depth attachment inside render pass rendering into it. Render pass has attachment description set up as:</p>
  
  <pre><code>format = shadowCubeMap.getDescription().format;
  samples = vk::SampleCountFlagBits::e1;
  loadOp = vk::AttachmentLoadOp::eLoad;
  storeOp = vk::AttachmentStoreOp::eStore;
  stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
  stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
  initialLayout = vk::ImageLayout::eDepthStencilAttachmentOptimal;
  finalLayout = vk::ImageLayout::eDepthStencilAttachmentOptimal;
  </code></pre>
  
  <p>And of course when creating pipeline for rp's subpass 0 (during which is set that layout stays eDepthStencilAttachmentOptimal), I setting up <code>PipelineDepthStencilState</code> as: </p>
  
  <pre><code>depthTestEnable = VK_TRUE;
  depthWriteEnable = VK_TRUE;
  depthCompareOp = vk::CompareOp::eLessOrEqual;
  </code></pre>
  
  <p>I checked several time that I have recorded cmd buffer properly (that I'm binding into cmd buffer state proper resources). </p>
  
  <p>Render doc shows me that there are some vertices forming triangle coming out from vertex shader that should be rasterized and processed by fragment shader where I should be able to compute depth and write it inside attachment via gl_FragDepth, but nothing is written inside it. Have anyone clue where the problem should lie? </p>
  
  <p>Sorry guys that I can't show you whole code, firstly all Vulkan code is abstracted via wrapper methods and objects, secondly and most importantly the code is proprietary.</p>
  
  <p>p.s: I don't know what any more info I should include, but ask me for more details, if you find something that should help solve this case. </p>