From 250716cef6f007c9030c287003cdc643462257f4 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Wed, 17 Apr 2019 02:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3CreateVulkanBuffer=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=9C=AA=E6=AD=A3=E7=A1=AE=E8=B5=8B=E5=80=BC=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/Vulkan/RenderSurface.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/example/Vulkan/RenderSurface.cpp b/example/Vulkan/RenderSurface.cpp index cc89729c..243cb65f 100644 --- a/example/Vulkan/RenderSurface.cpp +++ b/example/Vulkan/RenderSurface.cpp @@ -31,11 +31,9 @@ namespace if(rsa->CheckMemoryType(mem_reqs.memoryTypeBits,VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,&alloc_info.memoryTypeIndex)) { - VkDeviceMemory mem; - - if(vkAllocateMemory(rsa->device,&alloc_info,nullptr,&mem)==VK_SUCCESS) + if(vkAllocateMemory(rsa->device,&alloc_info,nullptr,&vb.memory)==VK_SUCCESS) { - if(vkBindBufferMemory(rsa->device,vb.buffer,mem,0)==VK_SUCCESS) + if(vkBindBufferMemory(rsa->device,vb.buffer,vb.memory,0)==VK_SUCCESS) { vb.info.buffer=vb.buffer; vb.info.offset=0; @@ -44,7 +42,7 @@ namespace return(true); } - vkFreeMemory(rsa->device,mem,nullptr); + vkFreeMemory(rsa->device,vb.memory,nullptr); } }