{"id":316943,"date":"2021-01-26T09:00:10","date_gmt":"2021-01-26T09:00:10","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=316943"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=316943","title":{"rendered":"Vulkan. \u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. Window surface"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u042f \u0438\u0437 IT-\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 CGTribe \u0438 \u0437\u0434\u0435\u0441\u044c \u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0436\u0443 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043a Vulkan API. \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u2014 <a href=\"https:\/\/vulkan-tutorial.com\/\" rel=\"nofollow noopener noreferrer\">vulkan-tutorial.com<\/a>.<\/p>\n<p>  \u041c\u043e\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0443 \u0433\u043b\u0430\u0432\u044b Window surface \u0438\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0430 Drawing a triangle, \u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b\u0430 Presentation. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">1. <a href=\"http:\/\/habr.com\/ru\/post\/462137\/\">\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>  2. <a href=\"http:\/\/habr.com\/ru\/post\/524992\/\">\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0431\u0437\u043e\u0440<\/a><\/p>\n<p>  3. <a href=\"https:\/\/habr.com\/ru\/post\/526320\/\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/a><\/p>\n<p>  4. <a href=\"https:\/\/habr.com\/ru\/post\/531196\/\">\u0420\u0438\u0441\u0443\u0435\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a<\/a><\/p>\n<ol>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/531196\/\">\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0431\u043e\u0442\u0435<\/a><br \/> \n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/531196\/#base\">\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043e\u0434<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/531196\/#two\">\u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 (instance)<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/535342\/\">\u0421\u043b\u043e\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/537208\/#phys\">\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/537208\/#logic\">\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0438<\/a><\/li>\n<\/ul>\n<\/li>\n<li>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435<br \/> \n<ul>\n<li>Window surface<\/li>\n<li>Swap chain<\/li>\n<li>Image views<\/li>\n<\/ul>\n<\/li>\n<li>\u041e\u0441\u043d\u043e\u0432\u044b \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 (pipeline)<\/li>\n<li>\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430<\/li>\n<li>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043f\u043e\u043a\u0430\u0437\u0430<\/li>\n<\/ol>\n<p>  5. \u0411\u0443\u0444\u0435\u0440\u044b \u0432\u0435\u0440\u0448\u0438\u043d<\/p>\n<ol>\n<li>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 \u0432\u0435\u0440\u0448\u0438\u043d<\/li>\n<li>Staging \u0431\u0443\u0444\u0435\u0440<\/li>\n<li>\u0411\u0443\u0444\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/li>\n<\/ol>\n<p>  6. Uniform-\u0431\u0443\u0444\u0435\u0440\u044b<\/p>\n<ol>\n<li>\u0414\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 layout \u0438 \u0431\u0443\u0444\u0435\u0440\u0430<\/li>\n<li>\u0414\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u043f\u0443\u043b\u0430 \u0438 sets<\/li>\n<\/ol>\n<p>  7. \u0422\u0435\u043a\u0441\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/p>\n<ol>\n<li>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/li>\n<li>Image view \u0438 image sampler<\/li>\n<li>\u041a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 image sampler<\/li>\n<\/ol>\n<p>  8. \u0411\u0443\u0444\u0435\u0440 \u0433\u043b\u0443\u0431\u0438\u043d\u044b<\/p>\n<p>  9. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/p>\n<p>  10. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0438\u043f-\u043a\u0430\u0440\u0442<\/p>\n<p>  11. Multisampling<\/p>\n<p>  FAQ<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438  <\/div>\n<\/p><\/div>\n<h2>Window surface<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"#one\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 window surface<\/a><\/li>\n<li><a href=\"#two\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/a><\/li>\n<li><a href=\"#three\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/a><\/li>\n<\/ul>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 Vulkan API \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043e\u043a\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439. \u0427\u0442\u043e\u0431\u044b Vulkan \u043c\u043e\u0433 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f WSI (Window System Integration). \u0412 \u044d\u0442\u043e\u0439 \u0433\u043b\u0430\u0432\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u043f\u0440\u043e \u043e\u0434\u043d\u043e \u0438\u0437 \u043d\u0438\u0445 \u2014 <b><code>VK_KHR_surface<\/code><\/b>. \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <b><code>VkSurfaceKHR<\/code><\/b> \u2014 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430 \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u042d\u0442\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043f\u0440\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u043e\u043a\u043d\u0430 GLFW, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 \u0440\u0430\u043d\u0435\u0435. <\/p>\n<p>  <b><code>VK_KHR_surface<\/code><\/b> \u2013 \u044d\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 Vulkan \u0443\u0440\u043e\u0432\u043d\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430. \u0423 \u043d\u0430\u0441 \u043e\u043d\u043e \u0443\u0436\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <b><code>glfwGetRequiredInstanceExtensions<\/code><\/b>. \u0412 \u0441\u043f\u0438\u0441\u043a\u0435 \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f WSI, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0433\u043b\u0430\u0432\u0430\u0445.<\/p>\n<p>  Window surface \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 VkInstance, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0432\u044b\u0431\u043e\u0440 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e window surfaces \u2014 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 Vulkan. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u043d\u0435\u0433\u043e, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d offscreen \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0445 \u0445\u0430\u043a\u043e\u0432, \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u0434\u043b\u044f OpenGL. <br \/>  <a name=\"one\"><\/a><\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 window surface<\/h2>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0447\u043b\u0435\u043d \u043a\u043b\u0430\u0441\u0441\u0430 <b><code>surface<\/code><\/b> \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 <b><code>debugMessenger<\/code><\/b>. <\/p>\n<pre><code class=\"cpp\">VkSurfaceKHR surface;<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <b><code>VkSurfaceKHR<\/code><\/b> \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. \u0422\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432 Windows \u043d\u0443\u0436\u043d\u044b \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b <b><code>HWND<\/code><\/b> \u0438 <b><code>HMODULE<\/code><\/b>. \u0414\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c \u0443 Vulkan \u0435\u0441\u0442\u044c \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e-\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432 Windows \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <b><code>VK_KHR_win32_surface<\/code><\/b>. \u041e\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <b><code>glfwGetRequiredInstanceExtensions<\/code><\/b>.<\/p>\n<p>  \u041c\u044b \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f surface \u0432 Windows, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043e\u043d\u043e \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f. \u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 GLFW, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c, \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u043e\u0431\u0435\u0440\u0442\u043a\u0430 <b><code>glfwCreateWindowSurface<\/code><\/b>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u043a\u043e\u0434. \u041d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435 \u043f\u043b\u043e\u0445\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043a\u0443\u043b\u0438\u0441\u0430\u043c\u0438.<\/p>\n<p>  Window surface \u2013 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 Vulkan, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <b><code>VkWin32SurfaceCreateInfoKHR<\/code><\/b>, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0433\u043e. \u0412 \u043d\u0435\u0439 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0436\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: <b><code>hwnd<\/code><\/b>\u00a0\u0438 <b><code>hinstance<\/code><\/b> \u2014 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b \u043e\u043a\u043d\u0430 \u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<pre><code class=\"cpp\">VkWin32SurfaceCreateInfoKHR createInfo{}; createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; createInfo.hwnd = glfwGetWin32Window(window); createInfo.hinstance = GetModuleHandle(nullptr);<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u044b\u0440\u043e\u0433\u043e <b><code>HWND<\/code><\/b> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<b><code>glfwGetWin32Window<\/code><\/b>,\u00a0\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f\u00a0<b><code>HINSTANCE<\/code><\/b>\u00a0&#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f <b><code>GetModuleHandle<\/code><\/b>. <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c surface \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b><code>vkCreateWin32SurfaceKHR<\/code><\/b>, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b: \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Vulkan, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e surface, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f WSI, \u043d\u043e \u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u0447\u0430\u0441\u0442\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u0430 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a Vulkan, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0435\u0435 \u044f\u0432\u043d\u043e. <\/p>\n<pre><code class=\"cpp\">if (vkCreateWin32SurfaceKHR(instance, &amp;createInfo, nullptr, &amp;surface) != VK_SUCCESS) {     throw std::runtime_error(&quot;failed to create window surface!&quot;); }<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u0435\u043d. \u0414\u043b\u044f Linux, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <b><code>vkCreateXcbSurfaceKHR<\/code><\/b>. <\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f <b><code>glfwCreateWindowSurface<\/code><\/b> \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0443 \u0440\u0430\u0431\u043e\u0442\u0443, \u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. \u0418\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c \u0435\u0435 \u0432 \u043d\u0430\u0448\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b><code>createSurface<\/code><\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 <b><code>initVulkan<\/code><\/b> \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 <b><code>createInstance<\/code><\/b> \u0438 <b><code>setupDebugMessenger<\/code><\/b>. <\/p>\n<pre><code class=\"cpp\">void initVulkan() {     createInstance();     setupDebugMessenger();     createSurface();     pickPhysicalDevice();     createLogicalDevice(); }  void createSurface() {  }<\/code><\/pre>\n<p>  \u0412\u043c\u0435\u0441\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 GLFW \u043d\u0443\u0436\u043d\u044b \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438: <\/p>\n<pre><code class=\"cpp\">void createSurface() {     if (glfwCreateWindowSurface(instance, window, nullptr, &amp;surface) != VK_SUCCESS) {         throw std::runtime_error(&quot;failed to create window surface!&quot;);     } }<\/code><\/pre>\n<p>  \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b: <b><code><a href=\"https:\/\/www.khronos.org\/registry\/vulkan\/specs\/1.2-extensions\/man\/html\/VkInstance.html\" rel=\"nofollow noopener noreferrer\">VkInstance<\/a><\/code><\/b>, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u043a\u043d\u043e GLFW, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <b><code><a href=\"https:\/\/www.khronos.org\/registry\/vulkan\/specs\/1.2-extensions\/man\/html\/VkResult.html\" rel=\"nofollow noopener noreferrer\">VkResult<\/a><\/code><\/b>.<\/p>\n<p>  \u0423 GLFW \u043d\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f surface, \u043d\u043e \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Vulkan: <\/p>\n<pre><code class=\"cpp\">void cleanup() {         ...         vkDestroySurfaceKHR(instance, surface, nullptr);         vkDestroyInstance(instance, nullptr);         ...     }<\/code><\/pre>\n<p>  \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c surface \u0434\u043e VkInstance. <br \/>  <a name=\"two\"><\/a><\/p>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>  \u0425\u043e\u0442\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Vulkan \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0441 \u043e\u043a\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u044d\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c\u00a0<b><code>isDeviceSuitable<\/code><\/b>,\u00a0\u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u043c\u0438, \u0447\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 surface, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043a\u043e\u043c\u0430\u043d\u0434, \u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e surface. <\/p>\n<p>  \u0412\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f, \u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <b><code>QueueFamilyIndices<\/code><\/b>, \u0447\u0442\u043e\u0431\u044b \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442. <\/p>\n<pre><code class=\"cpp\">struct QueueFamilyIndices {     std::optional&lt;uint32_t&gt; graphicsFamily;     std::optional&lt;uint32_t&gt; presentFamily;      bool isComplete() {         return graphicsFamily.has_value() &amp;&amp; presentFamily.has_value();     } };<\/code><\/pre>\n<p>  \u0418\u0437\u043c\u0435\u043d\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b><code>findQueueFamilies<\/code><\/b>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 surface \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u043a\u043d\u0430. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b><code>vkGetPhysicalDeviceSurfaceSupportKHR<\/code><\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b: \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u0438 surface. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0442\u043e\u0442 \u0436\u0435 \u0446\u0438\u043a\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <b><code>VK_QUEUE_GRAPHICS_BIT<\/code><\/b>: <\/p>\n<pre><code class=\"cpp\">VkBool32 presentSupport = false; vkGetPhysicalDeviceSurfaceSupportKHR(device, i, surface, &amp;presentSupport);<\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <b><code>VkBool32<\/code><\/b> \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430: <\/p>\n<pre><code class=\"cpp\">if (presentSupport) {     indices.presentFamily = i; }<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439, \u043d\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438\u0445, \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u044f\u043c\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0442\u0434\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438. <br \/>  <a name=\"three\"><\/a><\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f <\/h2>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 <b><code><a href=\"https:\/\/www.khronos.org\/registry\/vulkan\/specs\/1.2-extensions\/man\/html\/VkQueue.html\" rel=\"nofollow noopener noreferrer\">VkQueue<\/a><\/code><\/b>. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"cpp\">VkQueue presentQueue; <\/code><\/pre>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e <b><code><a href=\"https:\/\/www.khronos.org\/registry\/vulkan\/specs\/1.2-extensions\/man\/html\/VkDeviceQueueCreateInfo.html\" rel=\"nofollow noopener noreferrer\">VkDeviceQueueCreateInfo<\/a><\/code><\/b>, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432. \u042d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<b> <code>std::set<\/code><\/b>, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u0438\u0437 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445: <\/p>\n<pre><code class=\"cpp\">#include &lt;set&gt;  ...  QueueFamilyIndices indices = findQueueFamilies(physicalDevice);  std::vector&lt;VkDeviceQueueCreateInfo&gt; queueCreateInfos; std::set&lt;uint32_t&gt; uniqueQueueFamilies = {indices.graphicsFamily.value(), indices.presentFamily.value()};  float queuePriority = 1.0f; for (uint32_t queueFamily : uniqueQueueFamilies) {     VkDeviceQueueCreateInfo queueCreateInfo{};     queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;     queueCreateInfo.queueFamilyIndex = queueFamily;     queueCreateInfo.queueCount = 1;     queueCreateInfo.pQueuePriorities = &amp;queuePriority;     queueCreateInfos.push_back(queueCreateInfo); }<\/code><\/pre>\n<p>  \u0418\u0437\u043c\u0435\u043d\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <b><code><a href=\"https:\/\/www.khronos.org\/registry\/vulkan\/specs\/1.2-extensions\/man\/html\/VkDeviceCreateInfo.html\" rel=\"nofollow noopener noreferrer\">VkDeviceCreateInfo<\/a><\/code><\/b>, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0430 \u043d\u0430 \u043d\u0430\u0448 \u0432\u0435\u043a\u0442\u043e\u0440: <\/p>\n<pre><code class=\"cpp\">createInfo.queueCreateInfoCount = static_cast&lt;uint32_t&gt;(queueCreateInfos.size()); createInfo.pQueueCreateInfos = queueCreateInfos.data();<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u0435\u0441\u043b\u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e \u0434\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e \u0438 \u0442\u043e\u0436\u0435, \u0442\u043e \u0435\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043e\u0434\u0438\u043d \u0440\u0430\u0437. <\/p>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u0415\u0441\u043b\u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u043e\u0434\u043d\u043e, \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. <\/p>\n<pre><code class=\"cpp\">vkGetDeviceQueue(device, indices.presentFamily.value(), 0, &amp;presentQueue);<\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0433\u043b\u0430\u0432\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c swap chains \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. <\/p>\n<p>  <a href=\"https:\/\/vulkan-tutorial.com\/code\/05_window_surface.cpp\" rel=\"nofollow noopener noreferrer\">\u041a\u043e\u0434 C++<\/a><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/539174\/\"> https:\/\/habr.com\/ru\/post\/539174\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u042f \u0438\u0437 IT-\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 CGTribe \u0438 \u0437\u0434\u0435\u0441\u044c \u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0436\u0443 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043a Vulkan API. \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u2014 <a href=\"https:\/\/vulkan-tutorial.com\/\" rel=\"nofollow noopener noreferrer\">vulkan-tutorial.com<\/a>.<\/p>\n<p>  \u041c\u043e\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0443 \u0433\u043b\u0430\u0432\u044b Window surface \u0438\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0430 Drawing a triangle, \u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b\u0430 Presentation. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">1. <a href=\"http:\/\/habr.com\/ru\/post\/462137\/\">\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>  2. <a href=\"http:\/\/habr.com\/ru\/post\/524992\/\">\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0431\u0437\u043e\u0440<\/a><\/p>\n<p>  3. <a href=\"https:\/\/habr.com\/ru\/post\/526320\/\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/a><\/p>\n<p>  4. <a href=\"https:\/\/habr.com\/ru\/post\/531196\/\">\u0420\u0438\u0441\u0443\u0435\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a<\/a><\/p>\n<ol>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/531196\/\">\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0431\u043e\u0442\u0435<\/a><br \/> \n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/531196\/#base\">\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043e\u0434<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/531196\/#two\">\u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 (instance)<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/535342\/\">\u0421\u043b\u043e\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/537208\/#phys\">\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/537208\/#logic\">\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0438<\/a><\/li>\n<\/ul>\n<\/li>\n<li>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435<br \/> \n<ul>\n<li>Window surface<\/li>\n<li>Swap chain<\/li>\n<li>Image views<\/li>\n<\/ul>\n<\/li>\n<li>\u041e\u0441\u043d\u043e\u0432\u044b \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 (pipeline)<\/li>\n<li>\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430<\/li>\n<li>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043f\u043e\u043a\u0430\u0437\u0430<\/li>\n<\/ol>\n<p>  5. \u0411\u0443\u0444\u0435\u0440\u044b \u0432\u0435\u0440\u0448\u0438\u043d<\/p>\n<ol>\n<li>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 \u0432\u0435\u0440\u0448\u0438\u043d<\/li>\n<li>Staging \u0431\u0443\u0444\u0435\u0440<\/li>\n<li>\u0411\u0443\u0444\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/li>\n<\/ol>\n<p>  6. Uniform-\u0431\u0443\u0444\u0435\u0440\u044b<\/p>\n<ol>\n<li>\u0414\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 layout \u0438 \u0431\u0443\u0444\u0435\u0440\u0430<\/li>\n<li>\u0414\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u043f\u0443\u043b\u0430 \u0438 sets<\/li>\n<\/ol>\n<p>  7. \u0422\u0435\u043a\u0441\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/p>\n<ol>\n<li>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/li>\n<li>Image view \u0438 image sampler<\/li>\n<li>\u041a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 image sampler<\/li>\n<\/ol>\n<p>  8. \u0411\u0443\u0444\u0435\u0440 \u0433\u043b\u0443\u0431\u0438\u043d\u044b<\/p>\n<p>  9. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/p>\n<p>  10. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0438\u043f-\u043a\u0430\u0440\u0442<\/p>\n<p>  11. Multisampling<\/p>\n<p>  FAQ  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-316943","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/316943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=316943"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/316943\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=316943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=316943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=316943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}