| 7223 | } |
| 7224 | |
| 7225 | std::string DeviceState::DescriptorHash::Describe(const DeviceState& device_state, uint64_t key) const { |
| 7226 | std::ostringstream ss; |
| 7227 | auto it = map.find(key); |
| 7228 | if (it == map.end()) { |
| 7229 | assert(false); |
| 7230 | return "[Bad Key]"; |
| 7231 | } |
| 7232 | |
| 7233 | vvlDescriptorType vvl_type = vvlDescriptorType::Invalid; |
| 7234 | |
| 7235 | bool first = true; |
| 7236 | // Loop all possible vvlDescriptorType (as might be multiple types) |
| 7237 | for (uint8_t i = 0; i < vvlDescriptorMaxBit; i++) { |
| 7238 | if (it->second.types & (1 << i)) { |
| 7239 | // ok to set the second time (if more than one type) |
| 7240 | // as they should be in the same group below |
| 7241 | vvl_type = static_cast<vvlDescriptorType>(i); |
| 7242 | VkDescriptorType vk_type = GetDescriptorTypeFromMask(vvl_type); |
| 7243 | if (!first) { |
| 7244 | ss << " | "; |
| 7245 | } |
| 7246 | ss << string_VkDescriptorType(vk_type); |
| 7247 | first = false; |
| 7248 | } |
| 7249 | } |
| 7250 | |
| 7251 | auto list_buffers = [&device_state, &ss](VkDeviceAddress address) { |
| 7252 | auto buffer_states = device_state.GetBuffersByAddress(address); |
| 7253 | if (buffer_states.empty()) { |
| 7254 | ss << "[No VkBuffer found]"; |
| 7255 | } |
| 7256 | for (uint32_t i = 0; i < buffer_states.size(); i++) { |
| 7257 | if (i != 0) { |
| 7258 | ss << " | "; |
| 7259 | } |
| 7260 | auto& buffer_state = buffer_states[i]; |
| 7261 | ss << buffer_state->Describe(device_state); |
| 7262 | } |
| 7263 | return !buffer_states.empty(); |
| 7264 | }; |
| 7265 | |
| 7266 | switch (vvl_type) { |
| 7267 | case vvlDescriptorType::UniformBuffer: |
| 7268 | case vvlDescriptorType::StorageBuffer: { |
| 7269 | ss << ", "; |
| 7270 | const VkDeviceAddressRangeEXT& range = it->second.data.buffer.range; |
| 7271 | // If we find buffers, just print that instead of the address range |
| 7272 | const bool found = list_buffers(range.address); |
| 7273 | if (!found) { |
| 7274 | ss << "address 0x" << std::hex << range.address << ", size " << std::dec << range.size; |
| 7275 | } |
| 7276 | break; |
| 7277 | } |
| 7278 | case vvlDescriptorType::ImageTexelBufferUniform: |
| 7279 | case vvlDescriptorType::ImageTexelBufferStorage: { |
| 7280 | const auto& texel_buffer = it->second.data.texel_buffer; |
| 7281 | ss << ", " << string_VkFormat(texel_buffer.format) << " "; |
| 7282 | const VkDeviceAddressRangeEXT& range = texel_buffer.range; |
nothing calls this directly
no test coverage detected