| 348 | } |
| 349 | |
| 350 | void GPUTextureVulkan::initHandles() |
| 351 | { |
| 352 | // Cache properties |
| 353 | const int32 arraySize = ArraySize(); |
| 354 | const int32 mipLevels = MipLevels(); |
| 355 | const bool isArray = arraySize > 1; |
| 356 | const bool isCubeMap = IsCubeMap(); |
| 357 | const bool isVolume = IsVolume(); |
| 358 | const auto format = Format(); |
| 359 | const auto msaa = MultiSampleLevel(); |
| 360 | VkExtent3D extent; |
| 361 | extent.width = Width(); |
| 362 | extent.height = Height(); |
| 363 | extent.depth = Depth(); |
| 364 | |
| 365 | // Create resource views |
| 366 | if (isVolume) |
| 367 | { |
| 368 | // Create handle for whole 3d texture |
| 369 | _handleVolume.Init(_device, this, _image, mipLevels, format, msaa, extent, VK_IMAGE_VIEW_TYPE_3D, mipLevels, 0); |
| 370 | |
| 371 | // Init per slice views |
| 372 | _handlesPerSlice.Resize(Depth(), false); |
| 373 | if (_desc.HasPerSliceViews()) |
| 374 | { |
| 375 | for (int32 sliceIndex = 0; sliceIndex < Depth(); sliceIndex++) |
| 376 | { |
| 377 | _handlesPerSlice[sliceIndex].Init(_device, this, _image, mipLevels, format, msaa, extent, VK_IMAGE_VIEW_TYPE_2D, mipLevels, 0, 1, sliceIndex); |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | else if (isArray) |
| 382 | { |
| 383 | // Resize handles |
| 384 | _handlesPerSlice.Resize(ArraySize(), false); |
| 385 | |
| 386 | // Create per array slice handles |
| 387 | for (int32 arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) |
| 388 | { |
| 389 | _handlesPerSlice[arrayIndex].Init(_device, this, _image, mipLevels, format, msaa, extent, VK_IMAGE_VIEW_TYPE_2D, mipLevels, 0, 1, arrayIndex); |
| 390 | } |
| 391 | |
| 392 | // Create whole array handle |
| 393 | if (isCubeMap) |
| 394 | { |
| 395 | _handleArray.Init(_device, this, _image, mipLevels, format, msaa, extent, VK_IMAGE_VIEW_TYPE_CUBE, mipLevels, 0, arraySize, 0); |
| 396 | } |
| 397 | else |
| 398 | { |
| 399 | _handleArray.Init(_device, this, _image, mipLevels, format, msaa, extent, VK_IMAGE_VIEW_TYPE_2D_ARRAY, mipLevels, 0, arraySize, 0); |
| 400 | } |
| 401 | } |
| 402 | else |
| 403 | { |
| 404 | // Create single handle for the whole texture |
| 405 | _handlesPerSlice.Resize(1, false); |
| 406 | if (isCubeMap) |
| 407 | { |
nothing calls this directly
no test coverage detected