UraniumCompute 0.1.0
A GPU accelerated parallel task scheduler
IResourceBinding.h
1#pragma once
2#include <UnCompute/Backend/IDeviceMemory.h>
3
4namespace UN
5{
7 enum class KernelResourceKind
8 {
9 Buffer,
10 ConstantBuffer,
11 RWBuffer,
12 SampledTexture,
13 RWTexture,
14 Sampler
15 };
16
19 {
20 Int32 BindingIndex = -1;
21 KernelResourceKind Kind = KernelResourceKind::Buffer;
22
23 inline KernelResourceDesc() = default;
24
25 inline KernelResourceDesc(Int32 bindingIndex, KernelResourceKind kind)
26 : BindingIndex(bindingIndex)
27 , Kind(kind)
28 {
29 }
30 };
31
34 {
35 const char* Name = nullptr;
37
38 inline ResourceBindingDesc() = default;
39
40 inline ResourceBindingDesc(const char* name, const ArraySlice<const KernelResourceDesc>& layout)
41 : Name(name)
42 , Layout(layout)
43 {
44 }
45 };
46
47 class IBuffer;
48
51 {
52 public:
54
55 [[nodiscard]] virtual const DescriptorType& GetDesc() const = 0;
56
63 virtual ResultCode SetVariable(Int32 bindingIndex, IBuffer* pBuffer) = 0;
64
65 virtual ResultCode Init(const DescriptorType& desc) = 0;
66 };
67} // namespace UN
This class represents a non-owning slice of contiguously stored elements.
Definition: ArraySlice.h:12
An interface for backend-specific buffers that store the data on the device.
Definition: IBuffer.h:26
Base interface for all compute backend objects.
Definition: IDeviceObject.h:30
Resource binding object used to bind resources to a compute kernel.
Definition: IResourceBinding.h:51
virtual ResultCode SetVariable(Int32 bindingIndex, IBuffer *pBuffer)=0
Set kernel variable.
Kernel resource descriptor.
Definition: IResourceBinding.h:19
Int32 BindingIndex
Binding index in the compute shader source.
Definition: IResourceBinding.h:20
KernelResourceKind Kind
Kind of resource that is bound to a kernel.
Definition: IResourceBinding.h:21
Resource binding descriptor.
Definition: IResourceBinding.h:34
const char * Name
Resource binding debug name.
Definition: IResourceBinding.h:35
ArraySlice< const KernelResourceDesc > Layout
Array of kernel resource descriptors.
Definition: IResourceBinding.h:36