NOLINTNEXTLINE(readability-function-cognitive-complexity)
| 246 | |
| 247 | // NOLINTNEXTLINE(readability-function-cognitive-complexity) |
| 248 | static void update2_func(GraphicContext* ctx, CommandBuffer* buffer, const uint64_t* params, void* obj, GpuMemoryScenario scenario, |
| 249 | const Vector<GpuMemoryObject>& objects) |
| 250 | { |
| 251 | KYTY_PROFILER_BLOCK("TextureObject::update2_func"); |
| 252 | |
| 253 | EXIT_IF(obj == nullptr); |
| 254 | EXIT_IF(ctx == nullptr); |
| 255 | EXIT_IF(params == nullptr); |
| 256 | EXIT_IF(objects.IsEmpty()); |
| 257 | |
| 258 | auto* vk_obj = static_cast<TextureVulkanImage*>(obj); |
| 259 | |
| 260 | auto width = params[TextureObject::PARAM_WIDTH_HEIGHT] >> 32u; |
| 261 | auto height = params[TextureObject::PARAM_WIDTH_HEIGHT] & 0xffffffffu; |
| 262 | auto levels = params[TextureObject::PARAM_LEVELS] & 0xffffffffu; |
| 263 | |
| 264 | VkImageLayout vk_layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; |
| 265 | |
| 266 | EXIT_NOT_IMPLEMENTED(levels >= 16); |
| 267 | |
| 268 | uint32_t mip_width = width; |
| 269 | uint32_t mip_height = height; |
| 270 | |
| 271 | Vector<ImageImageCopy> regions(levels); |
| 272 | |
| 273 | if (objects.Size() == 1 && objects.At(0).type == GpuMemoryObjectType::StorageTexture && scenario == GpuMemoryScenario::Common) |
| 274 | { |
| 275 | auto* src_obj = static_cast<StorageTextureVulkanImage*>(objects.At(0).obj); |
| 276 | |
| 277 | for (uint32_t i = 0; i < levels; i++) |
| 278 | { |
| 279 | auto mipmap_offset = UtilCalcMipmapOffset(i, width, height); |
| 280 | |
| 281 | regions[i].src_image = src_obj; |
| 282 | regions[i].src_level = 0; |
| 283 | regions[i].dst_level = i; |
| 284 | regions[i].width = mip_width; |
| 285 | regions[i].height = mip_height; |
| 286 | regions[i].src_x = mipmap_offset.first; |
| 287 | regions[i].src_y = mipmap_offset.second; |
| 288 | regions[i].dst_x = 0; |
| 289 | regions[i].dst_y = 0; |
| 290 | |
| 291 | if (mip_width > 1) |
| 292 | { |
| 293 | mip_width /= 2; |
| 294 | } |
| 295 | if (mip_height > 1) |
| 296 | { |
| 297 | mip_height /= 2; |
| 298 | } |
| 299 | } |
| 300 | } else if (levels == objects.Size() && scenario == GpuMemoryScenario::Common) |
| 301 | { |
| 302 | for (uint32_t i = 0; i < levels; i++) |
| 303 | { |
| 304 | const auto& object = objects.At(i); |
| 305 |
no test coverage detected