summaryrefslogtreecommitdiffstats
path: root/tools/gfx/metal/metal-texture.cpp
blob: 996a0b333ae04caedcf0a6368b8cab56961334bf (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
// metal-texture.cpp
#include "metal-texture.h"

#include "metal-util.h"

namespace gfx
{

using namespace Slang;

namespace metal
{

TextureResourceImpl::TextureResourceImpl(const Desc& desc, DeviceImpl* device)
    : Parent(desc), m_device(device)
{
}

TextureResourceImpl::~TextureResourceImpl() {}

Result TextureResourceImpl::getNativeResourceHandle(InteropHandle* outHandle)
{
    outHandle->api = InteropHandleAPI::Metal;
    outHandle->handleValue = reinterpret_cast<intptr_t>(m_texture.get());
    return SLANG_OK;
}

Result TextureResourceImpl::getSharedHandle(InteropHandle* outHandle)
{
    return SLANG_E_NOT_AVAILABLE;
}

Result TextureResourceImpl::setDebugName(const char* name)
{
    Parent::setDebugName(name);
    m_texture->setLabel(MetalUtil::createString(name).get());
    return SLANG_OK;
}

} // namespace metal
} // namespace gfx