Changeset d2d9286 in opengl-game for vulkan-ref.cpp
- Timestamp:
- Nov 7, 2019, 2:05:17 AM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- f985231
- Parents:
- 87c8f1a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-ref.cpp
r87c8f1a rd2d9286 823 823 } 824 824 825 /*** START OF REFACTORED CODE ***/826 825 void addDescriptorInfo(GraphicsPipelineInfo& info, VkDescriptorType type, VkShaderStageFlags stageFlags, vector<VkDescriptorBufferInfo>* bufferData, VkDescriptorImageInfo* imageData) { 827 826 info.descriptorInfoList.push_back({ type, stageFlags, bufferData, imageData }); … … 1160 1159 view = createImageView(image, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_ASPECT_COLOR_BIT); 1161 1160 } 1162 /*** END OF REFACTORED CODE ***/1163 1161 1164 1162 void populateImageFromSDLTexture(SDL_Texture* texture, VkImage& image) { … … 1205 1203 } 1206 1204 1207 /*** START OF REFACTORED CODE ***/1208 1205 void createImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, 1209 1206 VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory) { … … 1653 1650 vkCmdBeginRenderPass(commandBuffers[i], &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE); 1654 1651 1655 /*** END OF REFACTORED CODE ***/1656 1652 createGraphicsPipelineCommands(scenePipeline, i); 1657 1653 createGraphicsPipelineCommands(overlayPipeline, i); 1658 /*** START OF REFACTORED CODE ***/1659 1654 1660 1655 vkCmdEndRenderPass(commandBuffers[i]); … … 1670 1665 vkCmdBindDescriptorSets(commandBuffers[currentImage], VK_PIPELINE_BIND_POINT_GRAPHICS, info.pipelineLayout, 0, 1, 1671 1666 &info.descriptorSets[currentImage], 0, nullptr); 1672 /*** END OF REFACTORED CODE ***/1673 1667 1674 1668 VkBuffer vertexBuffers[] = { info.vertexBuffer }; … … 1679 1673 1680 1674 vkCmdDrawIndexed(commandBuffers[currentImage], static_cast<uint32_t>(info.numIndices), 1, 0, 0, 0); 1681 /*** START OF REFACTORED CODE ***/1682 1675 } 1683 1676 … … 1791 1784 1792 1785 uint32_t imageIndex; 1793 /*** END OF REFACTORED CODE ***/1794 1786 1795 1787 VkResult result = vkAcquireNextImageKHR(device, swapChain, numeric_limits<uint64_t>::max(), … … 1802 1794 throw runtime_error("failed to acquire swap chain image!"); 1803 1795 } 1796 /*** END OF REFACTORED CODE ***/ 1804 1797 1805 1798 updateUniformBuffer(imageIndex); 1806 1799 1800 /*** START OF REFACTORED CODE ***/ 1807 1801 VkSubmitInfo submitInfo = {}; 1808 1802 submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; … … 1848 1842 } 1849 1843 1850 /*** START OF REFACTORED CODE ***/1851 1844 currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT; 1852 1845 currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT; … … 1854 1847 1855 1848 void drawUI() { 1856 /*** END OF REFACTORED CODE ***/1857 1849 // TODO: Since I currently don't use any other render targets, 1858 1850 // I may as well set this once before the render loop … … 1861 1853 SDL_SetRenderDrawColor(gRenderer, 0x00, 0x00, 0x00, 0x00); 1862 1854 SDL_RenderClear(gRenderer); 1855 /*** END OF REFACTORED CODE ***/ 1863 1856 1864 1857 SDL_Rect rect; … … 1877 1870 SDL_RenderCopy(gRenderer, uiImage, nullptr, &rect); 1878 1871 1872 /*** START OF REFACTORED CODE ***/ 1879 1873 SDL_SetRenderDrawColor(gRenderer, 0x00, 0x00, 0xFF, 0xFF); 1880 1874 SDL_RenderDrawLine(gRenderer, 50, 5, 150, 500); 1881 1875 1882 1876 populateImageFromSDLTexture(uiOverlay, sdlOverlayImage); 1883 /*** START OF REFACTORED CODE ***/1884 1877 } 1885 1878 /*** END OF REFACTORED CODE ***/ … … 1903 1896 } 1904 1897 1898 /*** START OF REFACTORED CODE ***/ 1905 1899 void recreateSwapChain() { 1906 1900 gui->refreshWindowSize(); … … 1913 1907 1914 1908 vkDeviceWaitIdle(device); 1909 /*** END OF REFACTORED CODE ***/ 1915 1910 1916 1911 cleanupSwapChain(); … … 1921 1916 1922 1917 createBufferResources(); 1923 }1924 1925 1918 /*** START OF REFACTORED CODE ***/ 1919 } 1920 1926 1921 void createBufferResources() { 1927 1922 createDepthResources(); … … 2045 2040 vkFreeMemory(device, pipeline.indexBufferMemory, nullptr); 2046 2041 } 2047 /*** END OF REFACTORED CODE ***/2048 2042 2049 2043 static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback( … … 2076 2070 }; 2077 2071 2078 /*** START OF REFACTORED CODE ***/2079 2072 int main(int argc, char* argv[]) { 2080 2073
Note:
See TracChangeset
for help on using the changeset viewer.