If the depth attachment is in "load" mode we need to copy the depth values over to the depth aspect of our new depth/stencil buffer.
(ctx context.Context,
cb CommandBuilder,
gs *api.GlobalState,
st *State,
a arena.Arena,
device VkDevice,
queue VkQueue,
cmdBuffer VkCommandBuffer,
renderInfo renderInfo,
alloc func(v ...interface{}) api.AllocResult,
addCleanup func(func()),
out transform.Writer,
)
| 1806 | // If the depth attachment is in "load" mode we need to copy the depth values |
| 1807 | // over to the depth aspect of our new depth/stencil buffer. |
| 1808 | func (s *stencilOverdraw) loadExistingDepthValues(ctx context.Context, |
| 1809 | cb CommandBuilder, |
| 1810 | gs *api.GlobalState, |
| 1811 | st *State, |
| 1812 | a arena.Arena, |
| 1813 | device VkDevice, |
| 1814 | queue VkQueue, |
| 1815 | cmdBuffer VkCommandBuffer, |
| 1816 | renderInfo renderInfo, |
| 1817 | alloc func(v ...interface{}) api.AllocResult, |
| 1818 | addCleanup func(func()), |
| 1819 | out transform.Writer, |
| 1820 | ) error { |
| 1821 | if renderInfo.depthIdx == ^uint32(0) { |
| 1822 | return nil |
| 1823 | } |
| 1824 | rpInfo := st.RenderPasses().Get(renderInfo.renderPass) |
| 1825 | daInfo := rpInfo.AttachmentDescriptions().Get(renderInfo.depthIdx) |
| 1826 | |
| 1827 | if daInfo.LoadOp() != VkAttachmentLoadOp_VK_ATTACHMENT_LOAD_OP_LOAD { |
| 1828 | return nil |
| 1829 | } |
| 1830 | |
| 1831 | fbInfo := st.Framebuffers().Get(renderInfo.framebuffer) |
| 1832 | |
| 1833 | oldImageView := fbInfo.ImageAttachments().Get(renderInfo.depthIdx) |
| 1834 | newImageView := fbInfo.ImageAttachments().Get(uint32(fbInfo.ImageAttachments().Len() - 1)) |
| 1835 | |
| 1836 | oldImageDesc := imageDesc{ |
| 1837 | oldImageView.Image(), |
| 1838 | oldImageView.SubresourceRange(), |
| 1839 | daInfo.InitialLayout(), |
| 1840 | VkImageAspectFlagBits_VK_IMAGE_ASPECT_DEPTH_BIT, |
| 1841 | } |
| 1842 | newImageDesc := imageDesc{ |
| 1843 | newImageView.Image(), |
| 1844 | newImageView.SubresourceRange(), |
| 1845 | VkImageLayout_VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, |
| 1846 | VkImageAspectFlagBits_VK_IMAGE_ASPECT_DEPTH_BIT, |
| 1847 | } |
| 1848 | |
| 1849 | return s.transferDepthValues(ctx, cb, gs, st, a, |
| 1850 | device, queue, cmdBuffer, |
| 1851 | fbInfo.Width(), fbInfo.Height(), |
| 1852 | oldImageDesc, newImageDesc, |
| 1853 | alloc, addCleanup, out) |
| 1854 | } |
| 1855 | |
| 1856 | // If the depth attachment is in "store" mode we need to copy the depth values |
| 1857 | // over from the depth aspect of our new depth/stencil buffer. |
no test coverage detected