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

Method compute_memory

compute/compute_memory.cpp:111–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111compute_memory::compute_memory(const compute_queue& cqueue,
112 std::span<uint8_t> host_data_,
113 const COMPUTE_MEMORY_FLAG flags_,
114 const uint32_t opengl_type_,
115 const uint32_t external_gl_object_) :
116dev(cqueue.get_device()), host_data(host_data_), flags(handle_memory_flags(flags_, opengl_type_)),
117has_external_gl_object(external_gl_object_ != 0), opengl_type(opengl_type_),
118gl_object(has_external_gl_object ? external_gl_object_ : 0) {
119 if((flags_ & COMPUTE_MEMORY_FLAG::READ_WRITE) == COMPUTE_MEMORY_FLAG::NONE) {
120 log_error("memory must be read-only, write-only or read-write!");
121 }
122 if(has_flag<COMPUTE_MEMORY_FLAG::USE_HOST_MEMORY>(flags_) &&
123 has_flag<COMPUTE_MEMORY_FLAG::OPENGL_SHARING>(flags_)) {
124 log_error("USE_HOST_MEMORY and OPENGL_SHARING are mutually exclusive!");
125 }
126 if(has_flag<COMPUTE_MEMORY_FLAG::USE_HOST_MEMORY>(flags_) &&
127 has_flag<COMPUTE_MEMORY_FLAG::VULKAN_SHARING>(flags_)) {
128 log_error("USE_HOST_MEMORY and VULKAN_SHARING are mutually exclusive!");
129 }
130 if(has_flag<COMPUTE_MEMORY_FLAG::USE_HOST_MEMORY>(flags_) &&
131 has_flag<COMPUTE_MEMORY_FLAG::METAL_SHARING>(flags_)) {
132 log_error("USE_HOST_MEMORY and METAL_SHARING are mutually exclusive!");
133 }
134}
135
136compute_memory::~compute_memory() {
137 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