summaryrefslogtreecommitdiffstats
path: root/tools/gfx/d3d12/d3d12-buffer.h
blob: b58426af6f1bcb797a167757654f0c1cc7b57625 (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
// d3d12-buffer.h
#pragma once

#include "d3d12-base.h"

namespace gfx
{
namespace d3d12
{

using namespace Slang;

class BufferResourceImpl : public gfx::BufferResource
{
public:
    typedef BufferResource Parent;

    BufferResourceImpl(const Desc& desc);

    ~BufferResourceImpl();

    D3D12Resource m_resource; ///< The resource in gpu memory, allocated on the correct heap
                              ///< relative to the cpu access flag

    D3D12_RESOURCE_STATES m_defaultState;

    virtual SLANG_NO_THROW DeviceAddress SLANG_MCALL getDeviceAddress() override;

    virtual SLANG_NO_THROW Result SLANG_MCALL
    getNativeResourceHandle(InteropHandle* outHandle) override;

    virtual SLANG_NO_THROW Result SLANG_MCALL getSharedHandle(InteropHandle* outHandle) override;

    virtual SLANG_NO_THROW Result SLANG_MCALL
    map(MemoryRange* rangeToRead, void** outPointer) override;

    virtual SLANG_NO_THROW Result SLANG_MCALL unmap(MemoryRange* writtenRange) override;

    virtual SLANG_NO_THROW Result SLANG_MCALL setDebugName(const char* name) override;
};

} // namespace d3d12
} // namespace gfx