public void CreateCubeModel(VkDevice device, VkPhysicalDevice physicalDevice) { var cubeVertices = CubeModel.GetVertices(); var cubeIndices = CubeModel.GetIndices(); var vbSize = Marshal.SizeOf <CubeModel.Vertex>() * cubeVertices.Length; var ibSize = Marshal.SizeOf <ushort>() * cubeIndices.Length; VkMemoryPropertyFlags flags = VkMemoryPropertyFlags.VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VkMemoryPropertyFlags.VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; SampleHelpers.CreateBuffer(device, physicalDevice, vbSize, VkBufferUsageFlags.VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, flags, out m_vertexBuffer, out m_vertexBufferMemory); SampleHelpers.CreateBuffer(device, physicalDevice, ibSize, VkBufferUsageFlags.VK_BUFFER_USAGE_INDEX_BUFFER_BIT, flags, out m_indexBuffer, out m_indexBufferMemory); // 初期データの書き込み. MappedMemoryStream mapped; VulkanAPI.vkMapMemory(device, m_vertexBufferMemory, 0, VkDeviceSize.VK_WHOLE_SIZE, 0, out mapped); mapped.Write(cubeVertices); VulkanAPI.vkUnmapMemory(device, m_vertexBufferMemory); VulkanAPI.vkMapMemory(device, m_indexBufferMemory, 0, VkDeviceSize.VK_WHOLE_SIZE, 0, out mapped); mapped.Write(cubeIndices); VulkanAPI.vkUnmapMemory(device, m_indexBufferMemory); m_resourceManager.Regist(m_vertexBuffer, m_vertexBufferMemory); m_resourceManager.Regist(m_indexBuffer, m_indexBufferMemory); }