@@ -2861,7 +2861,8 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
2861
2861
2862
2862
requiredMemoryPropertyFlags =
2863
2863
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
2864
- VK_MEMORY_PROPERTY_HOST_COHERENT_BIT ;
2864
+ VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
2865
+ VK_MEMORY_PROPERTY_HOST_CACHED_BIT ;
2865
2866
2866
2867
while (VULKAN_INTERNAL_FindBufferMemoryRequirements (
2867
2868
renderer ,
@@ -2897,6 +2898,49 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
2897
2898
}
2898
2899
}
2899
2900
2901
+ /* Bind failed, try again without CACHED */
2902
+ if (bindResult != 1 )
2903
+ {
2904
+ memoryTypeIndex = 0 ;
2905
+ requiredMemoryPropertyFlags =
2906
+ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
2907
+ VK_MEMORY_PROPERTY_HOST_COHERENT_BIT ;
2908
+
2909
+ while (VULKAN_INTERNAL_FindBufferMemoryRequirements (
2910
+ renderer ,
2911
+ buffer ,
2912
+ requiredMemoryPropertyFlags ,
2913
+ & memoryRequirements ,
2914
+ & memoryTypeIndex
2915
+ )) {
2916
+ bindResult = FNA3D_Memory_BindResource (
2917
+ renderer -> allocator ,
2918
+ memoryTypeIndex ,
2919
+ memoryRequirements .size ,
2920
+ memoryRequirements .alignment ,
2921
+ (renderer -> memoryProperties .memoryTypes [memoryTypeIndex ].propertyFlags &
2922
+ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT ) != 0 ,
2923
+ (renderer -> memoryProperties .memoryTypes [memoryTypeIndex ].propertyFlags &
2924
+ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT ) != 0 ,
2925
+ isTransferBuffer ,
2926
+ size ,
2927
+ 0 ,
2928
+ (FNA3D_MemoryPlatformHandle ) (size_t ) buffer ,
2929
+ bufferHandle ,
2930
+ usedRegion
2931
+ );
2932
+
2933
+ if (bindResult == 1 )
2934
+ {
2935
+ break ;
2936
+ }
2937
+ else /* Bind failed, try the next heap */
2938
+ {
2939
+ memoryTypeIndex += 1 ;
2940
+ }
2941
+ }
2942
+ }
2943
+
2900
2944
return bindResult ;
2901
2945
}
2902
2946
0 commit comments