Esempio n. 1
0
 public static uint SelectMemoryType(Vulkan.VkPhysicalDeviceMemoryProperties memoryProperties, uint memoryTypeBits, VkMemoryPropertyFlags flags)
 {
     VkMemoryType[] types = GetMemoryTypes(memoryProperties);
     for (uint i = 0; i < types.Length; i++)
     {
         if ((memoryTypeBits & (1 << (int)i)) != 0 && ((uint)types[i].propertyFlags & (uint)flags) == (uint)flags)
         {
             return(i);
         }
     }
     throw new Exception("No Compatible Memory Found");
 }
Esempio n. 2
0
        private static VkMemoryType[] GetMemoryTypes(Vulkan.VkPhysicalDeviceMemoryProperties memoryProperties)
        {
            VkMemoryType[] types = new VkMemoryType[32];
            types[0]  = memoryProperties.memoryTypes_0;
            types[1]  = memoryProperties.memoryTypes_1;
            types[2]  = memoryProperties.memoryTypes_2;
            types[3]  = memoryProperties.memoryTypes_3;
            types[4]  = memoryProperties.memoryTypes_4;
            types[5]  = memoryProperties.memoryTypes_5;
            types[6]  = memoryProperties.memoryTypes_6;
            types[7]  = memoryProperties.memoryTypes_7;
            types[8]  = memoryProperties.memoryTypes_8;
            types[9]  = memoryProperties.memoryTypes_9;
            types[10] = memoryProperties.memoryTypes_10;
            types[11] = memoryProperties.memoryTypes_11;
            types[12] = memoryProperties.memoryTypes_12;
            types[13] = memoryProperties.memoryTypes_13;
            types[14] = memoryProperties.memoryTypes_14;
            types[15] = memoryProperties.memoryTypes_15;
            types[16] = memoryProperties.memoryTypes_16;
            types[17] = memoryProperties.memoryTypes_17;
            types[18] = memoryProperties.memoryTypes_18;
            types[19] = memoryProperties.memoryTypes_19;
            types[20] = memoryProperties.memoryTypes_20;
            types[21] = memoryProperties.memoryTypes_21;
            types[22] = memoryProperties.memoryTypes_22;
            types[23] = memoryProperties.memoryTypes_23;
            types[24] = memoryProperties.memoryTypes_24;
            types[25] = memoryProperties.memoryTypes_25;
            types[26] = memoryProperties.memoryTypes_26;
            types[27] = memoryProperties.memoryTypes_27;
            types[28] = memoryProperties.memoryTypes_28;
            types[29] = memoryProperties.memoryTypes_29;
            types[30] = memoryProperties.memoryTypes_30;
            types[31] = memoryProperties.memoryTypes_31;

            VkMemoryType[] types2 = new VkMemoryType[memoryProperties.memoryTypeCount];
            for (int i = 0; i < types2.Length; i++)
            {
                types2[i] = types[i];
            }
            return(types2);
        }