blob: ae494c2fb4fb9b03a92a12cefcf0242b1a8363b0 (
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
|
// metal-resource-views.h
#pragma once
#include "metal-base.h"
#include "metal-buffer.h"
#include "metal-device.h"
#include "metal-texture.h"
namespace gfx
{
using namespace Slang;
namespace metal
{
class ResourceViewImpl : public ResourceViewBase
{
public:
enum class ViewType
{
Texture,
Buffer,
TexelBuffer,
};
public:
ResourceViewImpl(ViewType viewType, DeviceImpl* device)
: m_type(viewType), m_device(device)
{
}
ViewType m_type;
RefPtr<DeviceImpl> m_device;
};
class TextureResourceViewImpl : public ResourceViewImpl
{
public:
TextureResourceViewImpl(DeviceImpl* device)
: ResourceViewImpl(ViewType::Texture, device)
{
}
~TextureResourceViewImpl();
RefPtr<TextureResourceImpl> m_texture;
NS::SharedPtr<MTL::Texture> m_textureView;
virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
};
class BufferResourceViewImpl : public ResourceViewImpl
{
public:
BufferResourceViewImpl(DeviceImpl* device)
: ResourceViewImpl(ViewType::Buffer, device)
{
}
~BufferResourceViewImpl();
RefPtr<BufferResourceImpl> m_buffer;
Offset m_offset;
Size m_size;
virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
};
class TexelBufferResourceViewImpl : public ResourceViewImpl
{
public:
TexelBufferResourceViewImpl(DeviceImpl* device);
~TexelBufferResourceViewImpl();
RefPtr<BufferResourceImpl> m_buffer;
virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
};
class AccelerationStructureImpl : public AccelerationStructureBase
{
public:
RefPtr<BufferResourceImpl> m_buffer;
RefPtr<DeviceImpl> m_device;
public:
virtual SLANG_NO_THROW DeviceAddress SLANG_MCALL getDeviceAddress() override;
virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
~AccelerationStructureImpl();
};
} // namespace metal
} // namespace gfx
|