MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / initHandles

Method initHandles

Source/Engine/GraphicsDevice/Vulkan/GPUTextureVulkan.cpp:350–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350void 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 {

Callers

nothing calls this directly

Calls 15

ArraySizeFunction · 0.85
MipLevelsFunction · 0.85
MultiSampleLevelFunction · 0.85
EnumHasAnyFlagsFunction · 0.85
HasStencilFunction · 0.85
IsCubeMapFunction · 0.50
IsVolumeFunction · 0.50
FormatFunction · 0.50
WidthFunction · 0.50
HeightFunction · 0.50
DepthFunction · 0.50
HasPerMipViewsFunction · 0.50

Tested by

no test coverage detected