blob: e8b4fbb0afd7699ebbafeedb6fdf9bee96fce7b0 (
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
|
// vk-resource-views.h
#pragma once
#include "vk-base.h"
#include "vk-buffer.h"
#include "vk-device.h"
#include "vk-texture.h"
namespace gfx
{
using namespace Slang;
namespace vk
{
class ResourceViewImpl : public ResourceViewBase
{
public:
enum class ViewType
{
Texture,
TexelBuffer,
PlainBuffer,
};
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;
VkImageView m_view;
VkImageLayout m_layout;
virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
};
class TexelBufferResourceViewImpl : public ResourceViewImpl
{
public:
TexelBufferResourceViewImpl(DeviceImpl* device);
~TexelBufferResourceViewImpl();
RefPtr<BufferResourceImpl> m_buffer;
VkBufferView m_view;
virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
};
class PlainBufferResourceViewImpl : public ResourceViewImpl
{
public:
PlainBufferResourceViewImpl(DeviceImpl* device);
RefPtr<BufferResourceImpl> m_buffer;
VkDeviceSize offset;
VkDeviceSize size;
virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
};
class AccelerationStructureImpl : public AccelerationStructureBase
{
public:
VkAccelerationStructureKHR m_vkHandle = VK_NULL_HANDLE;
RefPtr<BufferResourceImpl> m_buffer;
VkDeviceSize m_offset;
VkDeviceSize m_size;
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 vk
} // namespace gfx
|