summaryrefslogtreecommitdiffstats
path: root/tools/gfx/cuda/cuda-texture.h
blob: 4af2b323bcfb7dd62693772214711b731578dc02 (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
// cuda-texture.h
#pragma once
#include "cuda-base.h"
#include "cuda-context.h"

namespace gfx
{
#ifdef GFX_ENABLE_CUDA
using namespace Slang;

namespace cuda
{

class TextureResourceImpl : public TextureResource
{
public:
    TextureResourceImpl(const TextureResource::Desc& desc)
        : TextureResource(desc)
    {
    }
    ~TextureResourceImpl();

    uint64_t getBindlessHandle();

    // The texObject is for reading 'texture' like things. This is an opaque type, that's backed by
    // a long long
    CUtexObject m_cudaTexObj = CUtexObject();

    // The surfObj is for reading/writing 'texture like' things, but not for sampling.
    CUsurfObject m_cudaSurfObj = CUsurfObject();

    CUarray m_cudaArray = CUarray();
    CUmipmappedArray m_cudaMipMappedArray = CUmipmappedArray();

    void* m_cudaExternalMemory = nullptr;

    RefPtr<CUDAContext> m_cudaContext;

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

} // namespace cuda
#endif
} // namespace gfx