summaryrefslogtreecommitdiffstats
path: root/tools/gfx/cuda/cuda-command-buffer.cpp
blob: efb2486f4970117621e362eb077e5eff789b27b9 (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
// cuda-command-buffer.cpp
#include "cuda-command-buffer.h"

namespace gfx
{
#ifdef GFX_ENABLE_CUDA
using namespace Slang;

namespace cuda
{

ICommandBuffer* CommandBufferImpl::getInterface(const Guid& guid)
{
    if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_ICommandBuffer)
        return static_cast<ICommandBuffer*>(this);
    return nullptr;
}

void CommandBufferImpl::init(DeviceImpl* device, TransientResourceHeapBase* transientHeap)
{
    m_device = device;
    m_transientHeap = transientHeap;
}

SLANG_NO_THROW void SLANG_MCALL CommandBufferImpl::encodeRenderCommands(
    IRenderPassLayout* renderPass,
    IFramebuffer* framebuffer,
    IRenderCommandEncoder** outEncoder)
{
    SLANG_UNUSED(renderPass);
    SLANG_UNUSED(framebuffer);
    *outEncoder = nullptr;
}

SLANG_NO_THROW void SLANG_MCALL
    CommandBufferImpl::encodeResourceCommands(IResourceCommandEncoder** outEncoder)
{
    m_resourceCommandEncoder.init(this);
    *outEncoder = &m_resourceCommandEncoder;
}

SLANG_NO_THROW void SLANG_MCALL
    CommandBufferImpl::encodeComputeCommands(IComputeCommandEncoder** outEncoder)
{
    m_computeCommandEncoder.init(this);
    *outEncoder = &m_computeCommandEncoder;
}

SLANG_NO_THROW void SLANG_MCALL
    CommandBufferImpl::encodeRayTracingCommands(IRayTracingCommandEncoder** outEncoder)
{
    *outEncoder = nullptr;
}

SLANG_NO_THROW Result SLANG_MCALL CommandBufferImpl::getNativeHandle(InteropHandle* outHandle)
{
    return SLANG_FAIL;
}

} // namespace cuda
#endif
} // namespace gfx