yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1// debug-command-queue.cpp 2#include "debug-command-queue.h" 3 4#include "debug-command-buffer.h" 5#include "debug-fence.h" 6#include "debug-helper-functions.h" 7#include "debug-transient-heap.h" 8 9namespace gfx 10{ 11using namespace Slang ; 12 13namespace debug 14{ 15 16const ICommandQueue ::Desc & DebugCommandQueue ::getDesc () 17{ 18SLANG_GFX_API_FUNC ; 19return baseObject -> getDesc (); 20} 21 22void DebugCommandQueue ::executeCommandBuffers ( 23GfxCount count , 24ICommandBuffer * const * commandBuffers , 25IFence * fence , 26uint64_t valueToSignal ) 27{ 28SLANG_GFX_API_FUNC ; 29List < ICommandBuffer *> innerCommandBuffers ; 30for (GfxIndex i = 0 ;i < count ;i ++ ) 31 { 32auto cmdBufferIn = commandBuffers [i ]; 33auto cmdBufferImpl = getDebugObj (cmdBufferIn ); 34auto innerCmdBuffer = getInnerObj (cmdBufferIn ); 35innerCommandBuffers .add (innerCmdBuffer ); 36if (cmdBufferImpl -> isOpen ) 37 { 38GFX_DIAGNOSE_ERROR_FORMAT ( 39"Command buffer %lld is still open. A command buffer must be closed " 40"before submitting to a command queue." , 41cmdBufferImpl -> uid ); 42 } 43if (i > 0 ) 44 { 45if (cmdBufferImpl -> m_transientHeap != getDebugObj (commandBuffers [0 ])-> m_transientHeap ) 46 { 47GFX_DIAGNOSE_ERROR ("Command buffers passed to a single executeCommandBuffers " 48"call must be allocated from the same transient heap." ); 49 } 50 } 51 } 52baseObject -> executeCommandBuffers ( 53count , 54innerCommandBuffers .getBuffer (), 55getInnerObj (fence ), 56valueToSignal ); 57if (fence ) 58 { 59getDebugObj (fence )-> maxValueToSignal = 60Math ::Max (getDebugObj (fence )-> maxValueToSignal ,valueToSignal ); 61 } 62} 63 64void DebugCommandQueue ::waitOnHost () 65{ 66SLANG_GFX_API_FUNC ; 67baseObject -> waitOnHost (); 68} 69 70Result DebugCommandQueue ::waitForFenceValuesOnDevice ( 71GfxCount fenceCount , 72IFence ** fences , 73uint64_t * waitValues ) 74{ 75SLANG_GFX_API_FUNC ; 76List < IFence *> innerFences ; 77for (GfxIndex i = 0 ;i < fenceCount ;++ i ) 78 { 79innerFences .add (getInnerObj (fences [i ])); 80 } 81return baseObject -> waitForFenceValuesOnDevice (fenceCount ,innerFences .getBuffer (),waitValues ); 82} 83 84Result DebugCommandQueue ::getNativeHandle (InteropHandle * outHandle ) 85{ 86SLANG_GFX_API_FUNC ; 87return baseObject -> getNativeHandle (outHandle ); 88} 89 90}// namespace debug 91}// namespace gfx