| 109 | } |
| 110 | |
| 111 | compute_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_) : |
| 116 | dev(cqueue.get_device()), host_data(host_data_), flags(handle_memory_flags(flags_, opengl_type_)), |
| 117 | has_external_gl_object(external_gl_object_ != 0), opengl_type(opengl_type_), |
| 118 | gl_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 | |
| 136 | compute_memory::~compute_memory() { |
| 137 | dev.context->remove_from_resource_registry(this); |
nothing calls this directly
no test coverage detected