| 104 | } |
| 105 | |
| 106 | device_memory::device_memory(const device_queue& cqueue, |
| 107 | std::span<uint8_t> host_data_, |
| 108 | const MEMORY_FLAG flags_) : |
| 109 | dev(cqueue.get_device()), host_data(host_data_), flags(handle_memory_flags(flags_)) { |
| 110 | if ((flags_ & MEMORY_FLAG::READ_WRITE) == MEMORY_FLAG::NONE && |
| 111 | !has_flag<MEMORY_FLAG::RENDER_TARGET>(flags)) { |
| 112 | log_error("memory must be read-only, write-only or read-write!"); |
| 113 | } |
| 114 | if (has_flag<MEMORY_FLAG::USE_HOST_MEMORY>(flags_) && |
| 115 | has_flag<MEMORY_FLAG::VULKAN_SHARING>(flags_)) { |
| 116 | log_error("USE_HOST_MEMORY and VULKAN_SHARING are mutually exclusive!"); |
| 117 | } |
| 118 | if (has_flag<MEMORY_FLAG::USE_HOST_MEMORY>(flags_) && |
| 119 | has_flag<MEMORY_FLAG::METAL_SHARING>(flags_)) { |
| 120 | log_error("USE_HOST_MEMORY and METAL_SHARING are mutually exclusive!"); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | device_memory::~device_memory() { |
| 125 | dev.context->remove_from_resource_registry(this); |
nothing calls this directly
no test coverage detected