@@ -539,25 +539,6 @@ VkDeviceSize ScreenshotHandler::GetCopyBufferSize(VkDevice
539
539
return memory_requirements.size ;
540
540
}
541
541
542
- uint32_t ScreenshotHandler::GetMemoryTypeIndex (const VkPhysicalDeviceMemoryProperties& memory_properties,
543
- uint32_t type_bits,
544
- VkMemoryPropertyFlags property_flags) const
545
- {
546
- uint32_t memory_type_index = std::numeric_limits<uint32_t >::max ();
547
-
548
- for (uint32_t i = 0 ; i < memory_properties.memoryTypeCount ; ++i)
549
- {
550
- if ((type_bits & (1 << i)) &&
551
- ((memory_properties.memoryTypes [i].propertyFlags & property_flags) == property_flags))
552
- {
553
- memory_type_index = i;
554
- break ;
555
- }
556
- }
557
-
558
- return memory_type_index;
559
- }
560
-
561
542
VkResult ScreenshotHandler::CreateCopyResource (VkDevice device,
562
543
const encode::VulkanDeviceTable* device_table,
563
544
const VkPhysicalDeviceMemoryProperties& memory_properties,
@@ -597,17 +578,17 @@ VkResult ScreenshotHandler::CreateCopyResource(VkDevice
597
578
device_table->GetBufferMemoryRequirements (device, copy_resource->buffer , &memory_requirements);
598
579
599
580
uint32_t memory_type_index =
600
- GetMemoryTypeIndex (memory_properties,
601
- memory_requirements.memoryTypeBits ,
602
- VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
581
+ graphics:: GetMemoryTypeIndex (memory_properties,
582
+ memory_requirements.memoryTypeBits ,
583
+ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
603
584
604
585
if (memory_type_index == std::numeric_limits<uint32_t >::max ())
605
586
{
606
587
/* fallback to coherent */
607
- memory_type_index =
608
- GetMemoryTypeIndex (memory_properties ,
609
- memory_requirements. memoryTypeBits ,
610
- VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
588
+ memory_type_index = graphics::GetMemoryTypeIndex (memory_properties,
589
+ memory_requirements. memoryTypeBits ,
590
+ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
591
+ VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
611
592
}
612
593
613
594
assert (memory_type_index != std::numeric_limits<uint32_t >::max ());
@@ -660,9 +641,8 @@ VkResult ScreenshotHandler::CreateCopyResource(VkDevice
660
641
VkMemoryRequirements memory_requirements;
661
642
device_table->GetImageMemoryRequirements (device, copy_resource->convert_image , &memory_requirements);
662
643
663
- uint32_t memory_type_index = GetMemoryTypeIndex (
644
+ uint32_t memory_type_index = graphics:: GetMemoryTypeIndex (
664
645
memory_properties, memory_requirements.memoryTypeBits , VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
665
-
666
646
assert (memory_type_index != std::numeric_limits<uint32_t >::max ());
667
647
668
648
VkMemoryAllocateInfo allocate_info = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };
0 commit comments