MCPcopy Create free account
hub / github.com/RenderKit/oidn / HIPExternalBuffer

Method HIPExternalBuffer

devices/hip/hip_external_buffer.cpp:30–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28 }
29
30 HIPExternalBuffer::HIPExternalBuffer(Engine* engine,
31 ExternalMemoryTypeFlags handleType,
32 void* handle, const void* name, size_t byteSize)
33 : USMBuffer(engine)
34 {
35 hipExternalMemoryHandleDesc handleDesc{};
36 handleDesc.handle.win32.handle = handle;
37 handleDesc.handle.win32.name = name;
38 handleDesc.size = byteSize;
39
40 if (handleType & ExternalMemoryTypeFlag::Dedicated)
41 {
42 handleDesc.flags = hipExternalMemoryDedicated;
43 handleType ^= ExternalMemoryTypeFlag::Dedicated;
44 }
45
46 if (handleType == ExternalMemoryTypeFlag::OpaqueWin32)
47 handleDesc.type = hipExternalMemoryHandleTypeOpaqueWin32;
48 else if (handleType == ExternalMemoryTypeFlag::OpaqueWin32KMT)
49 handleDesc.type = hipExternalMemoryHandleTypeOpaqueWin32Kmt;
50 else if (handleType == ExternalMemoryTypeFlag::D3D11Texture ||
51 handleType == ExternalMemoryTypeFlag::D3D11Resource)
52 {
53 handleDesc.type = hipExternalMemoryHandleTypeD3D11Resource;
54 handleDesc.flags = hipExternalMemoryDedicated; // mandatory
55 }
56 else if (handleType == ExternalMemoryTypeFlag::D3D11TextureKMT ||
57 handleType == ExternalMemoryTypeFlag::D3D11ResourceKMT)
58 {
59 handleDesc.type = hipExternalMemoryHandleTypeD3D11ResourceKmt;
60 handleDesc.flags = hipExternalMemoryDedicated; // mandatory
61 }
62 else if (handleType == ExternalMemoryTypeFlag::D3D12Heap)
63 handleDesc.type = hipExternalMemoryHandleTypeD3D12Heap;
64 else if (handleType == ExternalMemoryTypeFlag::D3D12Resource)
65 {
66 handleDesc.type = hipExternalMemoryHandleTypeD3D12Resource;
67 handleDesc.flags = hipExternalMemoryDedicated; // mandatory
68 }
69 else
70 throw Exception(Error::InvalidArgument, "external memory type not supported by the device");
71
72 init(handleDesc);
73 }
74
75 void HIPExternalBuffer::init(const hipExternalMemoryHandleDesc& handleDesc)
76 {

Callers

nothing calls this directly

Calls 2

ExceptionFunction · 0.85
initFunction · 0.85

Tested by

no test coverage detected