Files
test/intern/cycles/device/metal/graphics_interop.h
Brecht Van Lommel ecd54ba4e4 Cycles: Metal graphics interop
This is trivial with unified memory, and avoids one memory copy.

Pull Request: https://projects.blender.org/blender/blender/pulls/137363
2025-04-28 11:38:56 +02:00

47 lines
1.2 KiB
C++

/* SPDX-FileCopyrightText: 2025 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#ifdef WITH_METAL
# include "device/graphics_interop.h"
# include "session/display_driver.h"
CCL_NAMESPACE_BEGIN
class MetalDevice;
class MetalDeviceQueue;
class MetalDeviceGraphicsInterop : public DeviceGraphicsInterop {
public:
explicit MetalDeviceGraphicsInterop(MetalDeviceQueue *queue);
MetalDeviceGraphicsInterop(const MetalDeviceGraphicsInterop &other) = delete;
MetalDeviceGraphicsInterop(MetalDeviceGraphicsInterop &&other) noexcept = delete;
~MetalDeviceGraphicsInterop() override;
MetalDeviceGraphicsInterop &operator=(const MetalDeviceGraphicsInterop &other) = delete;
MetalDeviceGraphicsInterop &operator=(MetalDeviceGraphicsInterop &&other) = delete;
void set_buffer(const GraphicsInteropBuffer &interop_buffer) override;
device_ptr map() override;
void unmap() override;
protected:
MetalDeviceQueue *queue_ = nullptr;
MetalDevice *device_ = nullptr;
/* Native handle. */
void *buffer_ = nullptr;
size_t size_ = 0;
/* The destination was requested to be cleared. */
bool need_clear_ = false;
};
CCL_NAMESPACE_END
#endif