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