| 2947 | } |
| 2948 | |
| 2949 | void setFrameBuffer(FrameBufferHandle _fbh, bool _acquire = true) |
| 2950 | { |
| 2951 | BGFX_PROFILER_SCOPE("RendererContextVK::setFrameBuffer()", kColorFrame); |
| 2952 | |
| 2953 | BX_ASSERT(false |
| 2954 | || isValid(_fbh) |
| 2955 | || NULL != m_backBuffer.m_nwh |
| 2956 | , "Rendering to backbuffer in headless mode." |
| 2957 | ); |
| 2958 | |
| 2959 | FrameBufferVK& newFrameBuffer = isValid(_fbh) |
| 2960 | ? m_frameBuffers[_fbh.idx] |
| 2961 | : m_backBuffer |
| 2962 | ; |
| 2963 | |
| 2964 | FrameBufferVK& oldFrameBuffer = isValid(m_fbh) |
| 2965 | ? m_frameBuffers[m_fbh.idx] |
| 2966 | : m_backBuffer |
| 2967 | ; |
| 2968 | |
| 2969 | if (NULL == oldFrameBuffer.m_nwh |
| 2970 | && m_fbh.idx != _fbh.idx) |
| 2971 | { |
| 2972 | oldFrameBuffer.resolve(); |
| 2973 | |
| 2974 | for (uint8_t ii = 0, num = oldFrameBuffer.m_num; ii < num; ++ii) |
| 2975 | { |
| 2976 | TextureVK& texture = m_textures[oldFrameBuffer.m_texture[ii].idx]; |
| 2977 | texture.setImageMemoryBarrier(m_commandBuffer, texture.m_sampledLayout); |
| 2978 | if (VK_NULL_HANDLE != texture.m_singleMsaaImage) |
| 2979 | { |
| 2980 | texture.setImageMemoryBarrier(m_commandBuffer, texture.m_sampledLayout, true); |
| 2981 | } |
| 2982 | } |
| 2983 | |
| 2984 | if (isValid(oldFrameBuffer.m_depth) ) |
| 2985 | { |
| 2986 | TextureVK& texture = m_textures[oldFrameBuffer.m_depth.idx]; |
| 2987 | const bool writeOnly = 0 != (texture.m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); |
| 2988 | |
| 2989 | if (!writeOnly) |
| 2990 | { |
| 2991 | texture.setImageMemoryBarrier(m_commandBuffer, texture.m_sampledLayout); |
| 2992 | } |
| 2993 | } |
| 2994 | } |
| 2995 | |
| 2996 | if (NULL == newFrameBuffer.m_nwh) |
| 2997 | { |
| 2998 | for (uint8_t ii = 0, num = newFrameBuffer.m_num; ii < num; ++ii) |
| 2999 | { |
| 3000 | TextureVK& texture = m_textures[newFrameBuffer.m_texture[ii].idx]; |
| 3001 | texture.setImageMemoryBarrier( |
| 3002 | m_commandBuffer |
| 3003 | , VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL |
| 3004 | ); |
| 3005 | } |
| 3006 |
nothing calls this directly
no test coverage detected