MCPcopy Create free account
hub / github.com/a2flo/floor / device_memory

Method device_memory

src/device/device_memory.cpp:106–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106device_memory::device_memory(const device_queue& cqueue,
107 std::span<uint8_t> host_data_,
108 const MEMORY_FLAG flags_) :
109dev(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
124device_memory::~device_memory() {
125 dev.context->remove_from_resource_registry(this);

Callers

nothing calls this directly

Calls 2

handle_memory_flagsFunction · 0.85
get_deviceMethod · 0.80

Tested by

no test coverage detected