Changeset f5d5686 in opengl-game
- Timestamp:
- Jul 26, 2019, 8:23:44 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 621664a
- Parents:
- 88ebdc8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
r88ebdc8 rf5d5686 173 173 VkPipelineLayout pipelineLayout; 174 174 VkPipeline graphicsPipeline; 175 VkCommandPool commandPool;176 175 VkDescriptorPool descriptorPool; 177 176 vector<VkDescriptorSet> descriptorSets; 177 178 VkCommandPool commandPool; 179 180 VkImage textureImage; 181 VkDeviceMemory textureImageMemory; 178 182 179 183 VkBuffer vertexBuffer; … … 192 196 vector<VkSemaphore> renderFinishedSemaphores; 193 197 vector<VkFence> inFlightFences; 194 195 VkImage textureImage;196 VkDeviceMemory textureImageMemory;197 198 198 199 size_t currentFrame = 0; … … 960 961 961 962 vkDestroyBuffer(device, stagingBuffer, nullptr); 962 vk DestroyMemory(device, stagingBufferMemory, nullptr);963 vkFreeMemory(device, stagingBufferMemory, nullptr); 963 964 } 964 965 965 966 void createImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, 966 VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory) { 967 VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, 968 VkDeviceMemory& imageMemory) { 967 969 VkImageCreateInfo imageInfo = {}; 968 970 imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; … … 999 1001 } 1000 1002 1001 void transitionImageLayout(VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout) { 1003 void transitionImageLayout(VkImage image, VkFormat format, VkImageLayout oldLayout, 1004 VkImageLayout newLayout) { 1002 1005 VkCommandBuffer commandBuffer = beginSingleTimeCommands(); 1003 1006 … … 1014 1017 barrier.subresourceRange.baseArrayLayer = 0; 1015 1018 barrier.subresourceRange.layerCount = 1; 1016 1017 VkPipelineStageFlags source Flags;1018 VkPipelineStageFlags destination Flags;1019 1020 VkPipelineStageFlags sourceStage; 1021 VkPipelineStageFlags destinationStage; 1019 1022 1020 1023 if (oldLayout == VK_IMAGE_LAYOUT_UNDEFINED && newLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) { … … 1036 1039 vkCmdPipelineBarrier( 1037 1040 commandBuffer, 1038 source Flags, destinationFlags,1041 sourceStage, destinationStage, 1039 1042 0, 1040 1043 0, nullptr, … … 1053 1056 region.bufferRowLength = 0; 1054 1057 region.bufferImageHeight = 0; 1055 1056 1058 region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; 1057 1059 region.imageSubresource.mipLevel = 0; 1058 1060 region.imageSubresource.baseArrayLayer = 0; 1059 1061 region.imageSubresource.layerCount = 1; 1060 1061 1062 region.imageOffset = { 0, 0, 0 }; 1062 1063 region.imageExtent = { width, height, 1 }; … … 1459 1460 1460 1461 vkDestroyImage(device, textureImage, nullptr); 1461 vk DestroyMemory(device, textureImageMemory, nullptr);1462 vkFreeMemory(device, textureImageMemory, nullptr); 1462 1463 1463 1464 vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
Note:
See TracChangeset
for help on using the changeset viewer.