summaryrefslogtreecommitdiffstats
path: root/tools/gfx/cpu/cpu-buffer.h
blob: 9b1866c7485db52a6894c0f33377b41125cce0e9 (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
// cpu-buffer.h
#pragma once
#include "cpu-base.h"

namespace gfx
{
using namespace Slang;

namespace cpu
{

class BufferResourceImpl : public BufferResource
{
public:
    BufferResourceImpl(const Desc& _desc)
        : BufferResource(_desc)
    {
    }

    ~BufferResourceImpl();

    Result init();

    Result setData(size_t offset, size_t size, void const* data);

    void* m_data = nullptr;

    virtual SLANG_NO_THROW DeviceAddress SLANG_MCALL getDeviceAddress() 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;
};

} // namespace cpu
} // namespace gfx