| 30 | namespace fl { |
| 31 | |
| 32 | vulkan_argument_buffer::vulkan_argument_buffer(const device_function& func_, |
| 33 | std::shared_ptr<device_buffer> storage_buffer_, |
| 34 | const toolchain::function_info& arg_info_, |
| 35 | const vulkan_descriptor_set_layout_t& layout_, |
| 36 | std::vector<VkDeviceSize>&& argument_offsets_, |
| 37 | std::span<uint8_t> mapped_host_memory_, |
| 38 | std::shared_ptr<device_buffer> constant_buffer_storage_, |
| 39 | std::span<uint8_t> constant_buffer_mapping_) : |
| 40 | argument_buffer(func_, storage_buffer_), arg_info(arg_info_), layout(layout_), argument_offsets(argument_offsets_), |
| 41 | mapped_host_memory(mapped_host_memory_), constant_buffer_storage(constant_buffer_storage_), constant_buffer_mapping(constant_buffer_mapping_) { |
| 42 | if (mapped_host_memory.data() == nullptr || mapped_host_memory.size_bytes() == 0) { |
| 43 | throw std::runtime_error("argument buffer host memory has not been mapped"); |
| 44 | } |
| 45 | if (constant_buffer_storage && (constant_buffer_mapping.data() == nullptr || constant_buffer_mapping.size_bytes() == 0)) { |
| 46 | throw std::runtime_error("constant buffer for argument buffer exists, but no host memory has been mapped"); |
| 47 | } |
| 48 | if (has_flag<toolchain::FUNCTION_FLAGS::USES_SOFT_PRINTF>(arg_info.flags)) { |
| 49 | throw std::runtime_error("should not have soft-printf flag in argument buffer function info"); |
| 50 | } |
| 51 | #if defined(FLOOR_DEBUG) |
| 52 | if ((((const vulkan_buffer*)storage_buffer.get())->get_vulkan_buffer_usage() & VK_BUFFER_USAGE_2_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT) == 0) { |
| 53 | throw std::runtime_error("argument buffer storage has not been created with descriptor buffer support"); |
| 54 | } |
| 55 | #endif |
| 56 | } |
| 57 | |
| 58 | vulkan_argument_buffer::~vulkan_argument_buffer() { |
| 59 | // ensure buffers are unmapped when they are heap-allocated |
nothing calls this directly
no test coverage detected