MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / endCopyEncoder

Method endCopyEncoder

RenderSystems/Vulkan/src/OgreVulkanQueue.cpp:954–1038  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

952 }
953 //-------------------------------------------------------------------------
954 void VulkanQueue::endCopyEncoder()
955 {
956 if( mEncoderState != EncoderCopyOpen )
957 return;
958
959 if( mCopyEndReadDstBufferFlags || !mImageMemBarrierPtrs.empty() )
960 {
961 VkPipelineStageFlags dstStage = 0;
962
963 uint32 numMemBarriers = 0u;
964 VkMemoryBarrier memBarrier;
965 if( mCopyEndReadDstBufferFlags )
966 {
967 makeVkStruct( memBarrier, VK_STRUCTURE_TYPE_MEMORY_BARRIER );
968 memBarrier.srcAccessMask = mCopyEndReadSrcBufferFlags & c_srcValidAccessFlags;
969 memBarrier.dstAccessMask = mCopyEndReadDstBufferFlags;
970
971 // Evaluate the stages we can unblock when our transfers are done
972 dstStage |= deriveStageFromBufferAccessFlags( memBarrier.dstAccessMask );
973 numMemBarriers = 1u;
974 }
975
976 dstStage |= deriveStageFromTextureAccessFlags( mCopyEndReadDstTextureFlags );
977
978 if( dstStage == 0u )
979 {
980 // Nothing needs to wait for us. Can happen if all we're
981 // doing is copying from read-only textures (rare)
982 dstStage = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
983
984#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
985 FastArray<TextureGpu *>::const_iterator itor = mImageMemBarrierPtrs.begin();
986 FastArray<TextureGpu *>::const_iterator endt = mImageMemBarrierPtrs.end();
987
988 while( itor != endt )
989 {
990 OGRE_ASSERT_MEDIUM( !( *itor )->isRenderToTexture() && !( *itor )->isUav() &&
991 "endCopyEncoder says nothing will wait on this texture(s) but "
992 "we don't know if a subsequent stage will write to it" );
993 ++itor;
994 }
995#endif
996 }
997
998 // Wait until earlier render, compute and transfers are done
999 // Block render, compute and transfers until we're done
1000 vkCmdPipelineBarrier( mCurrentCmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT,
1001 dstStage & mOwnerDevice->mSupportedStages, 0, numMemBarriers,
1002 &memBarrier, 0u, 0, static_cast<uint32_t>( mImageMemBarriers.size() ),
1003 mImageMemBarriers.begin() );
1004
1005 mImageMemBarriers.clear();
1006 mImageMemBarrierPtrs.clear();
1007
1008 BarrierSolver &solver = mRenderSystem->getBarrierSolver();
1009 TextureGpuDownloadMap::const_iterator itor = mCopyDownloadTextures.begin();
1010 TextureGpuDownloadMap::const_iterator endt = mCopyDownloadTextures.end();
1011

Callers 9

runBounceMethod · 0.45
updateMethod · 0.45
buildRelativeMethod · 0.45
analyzeBarriersMethod · 0.45
analyzeBarriersMethod · 0.45
analyzeBarriersMethod · 0.45
analyzeBarriersMethod · 0.45
analyzeBarriersMethod · 0.45

Calls 10

makeVkStructFunction · 0.85
isRenderToTextureMethod · 0.80
isUavMethod · 0.80
assumeTransitionMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
getCurrentLayoutMethod · 0.45

Tested by 1

analyzeBarriersMethod · 0.36