{"id":359390,"date":"2024-05-21T00:31:41","date_gmt":"2024-05-21T00:31:41","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=359390"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=359390","title":{"rendered":"<span>\u0410\u0434 \u0420\u0435\u043d\u0434\u0435\u0440\u0430 2.0. \u041a\u043d\u0438\u0433\u0430 \u0432\u0442\u043e\u0440\u0430\u044f. \u041f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0442 \u043c\u0435\u043d\u044f, \u043a\u0430\u043a \u043e\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430<\/h2>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u0432\u0437\u044f\u0442\u0430\u00a0<a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book2\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>\u00a0\u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u044f\u0437\u044b\u043a. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435\u00a0<a href=\"https:\/\/simont.de\/\" rel=\"noopener noreferrer nofollow\">\u0430\u0432\u0442\u043e\u0440<\/a>\u00a0\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430<\/a>\u00a0\u0432\u00a0<code>GPU<\/code>\u00a0, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0434\u0435\u0442 \u0431\u043b\u043e\u043a \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430, \u0432\u0437\u044f\u0442\u043e\u0433\u043e \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u0430 \u0434\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u044f\u0437\u044b\u043a. \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0441 \u0446\u0435\u043b\u044c\u044e, \u0447\u0442\u043e\u0431\u044b \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0433 \u0432\u0438\u0434\u0435\u0442\u044c \u0442\u0435\u0440\u043c\u0438\u043d\u044b \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0432\u0435\u0440\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0441 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u043e\u043c.<\/p>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0441\u0435\u0440\u0438\u0439 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e\u0434 \u043e\u0431\u0449\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &#171;\u0410\u0434 \u0420\u0435\u043d\u0434\u0435\u0440\u0430 2.0&#187;. \u0421\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0441\u0442\u0430\u0442\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+(%D0%90%D0%B4+%D0%A0%D0%B5%D0%BD%D0%B4%D0%B5%D1%80%D0%B0+2.0)\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0434\u0435\u043b\u0430\u043b\u0441\u044f \u0441 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f GameDev. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0438\u0433\u0440\u044b \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Rendering+(%D0%A0%D0%B5%D0%BD%D0%B4%D0%B5%D1%80%D0%B8%D0%BD%D0%B3%2C+%D0%9E%D1%82%D1%80%D0%B8%D1%81%D0%BE%D0%B2%D0%BA%D0%B0%2C+%D0%92%D0%B8%D0%B7%D1%83%D0%B0%D0%BB%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F)\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/a>, \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0438 \u043c\u043d\u043e\u0433\u043e \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0443\u0442\u043e\u0447\u043d\u044f\u044e\u0449\u0438\u0435 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u043a\u0438 \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u0432.<\/p>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u0435\u0439 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043c\u043e\u0435\u043c \u0441\u0430\u0439\u0442\u0435\u00a0<a href=\"https:\/\/bekhan.org\/\" rel=\"noopener noreferrer nofollow\">bekhan.org<\/a>. \u0423\u0437\u043d\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u00a0<a href=\"https:\/\/bekhan.org\/About\/%D0%9C%D0%BE%D0%B8+%D1%81%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D1%81%D1%82%D0%B2%D0%B0\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430\u0445<\/a>.<\/p>\n<h2>Pipeline in Detail (\u041f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0432 \u0414\u0435\u0442\u0430\u043b\u044f\u0445)<\/h2>\n<p>Most of the constructive feedback I received about this article was \u201cNice explanation, but your\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">pipeline<\/a>\u00a0is 6 years old!\u201d. I wasn\u2019t sure what that exactly meant until\u00a0<a href=\"https:\/\/twitter.com\/pixeljetstream\" rel=\"noopener noreferrer nofollow\">Christoph Kubisch<\/a>\u00a0joined my fight in the\u00a0<code>Render Hell<\/code>. He is a Developer Technology Engineer working for\u00a0<a href=\"http:\/\/www.nvidia.com\/\" rel=\"noopener noreferrer nofollow\">NVIDIA<\/a>\u00a0and whatever question I had,\u00a0<a href=\"https:\/\/developer.nvidia.com\/content\/life-triangle-nvidias-logical-pipeline\" rel=\"noopener noreferrer nofollow\">he answered it<\/a>. And believe me, I had a lot! \ud83d\ude42<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043e\u0442\u0437\u044b\u0432\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%BF%D0%BE+%D1%8D%D1%82%D0%BE%D0%B9+%D1%81%D1%82%D0%B0%D1%82%D1%8C%D0%B5\" rel=\"noopener noreferrer nofollow\">\u043f\u043e \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u0431\u044b\u043b\u0438 \u0432 \u0434\u0443\u0445\u0435: &#171;\u0425\u043e\u0440\u043e\u0448\u0435\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435, \u043d\u043e \u0432\u0430\u0448\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/a>\u00a0\u0443\u0441\u0442\u0430\u0440\u0435\u043b \u043d\u0430 6 \u043b\u0435\u0442!&#187;. \u042f \u043d\u0435 \u0431\u044b\u043b \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u043e\u043a\u0430\u00a0<a href=\"https:\/\/twitter.com\/pixeljetstream\" rel=\"noopener noreferrer nofollow\">\u041a\u0440\u0438\u0441\u0442\u043e\u0444 \u041a\u0443\u0431\u0438\u0448<\/a>\u00a0\u043d\u0435 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043b\u0441\u044f \u043a\u00a0<code>\u043c\u043e\u0435\u0439 \u043a\u043d\u0438\u0433\u0435<\/code>. \u041e\u043d \u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c \u043d\u0430\u00a0<a href=\"http:\/\/www.nvidia.com\/\" rel=\"noopener noreferrer nofollow\">NVIDIA<\/a>, \u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b,\u00a0<a href=\"https:\/\/developer.nvidia.com\/content\/life-triangle-nvidias-logical-pipeline\" rel=\"noopener noreferrer nofollow\">\u043e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u043b<\/a>. \u0418 \u043f\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043c\u043d\u0435, \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432! \ud83d\ude42<\/p>\n<blockquote>\n<p>Our explanation is mostly based on\u00a0<code>NVIDIA<\/code>\u00a0architecture due the fact that Christoph is working for\u00a0<code>NVIDIA<\/code>. I hope you don\u2019t misunderstand this as an advertisement. We both just share the passion to explain stuff and I was really happy to have someone who could help me with that technical knowledge.<\/p>\n<p>Be aware that we omitted and simplified some details.  <\/p>\n<\/blockquote>\n<blockquote>\n<p>\u041d\u0430\u0448\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0431\u0430\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435\u00a0<code>NVIDIA<\/code>\u00a0\u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u041a\u0440\u0438\u0441\u0442\u043e\u0444 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430\u00a0<code>NVIDIA<\/code>. \u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u044b \u043d\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0435\u043a\u043b\u0430\u043c\u0443. \u041c\u044b \u043e\u0431\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u0430\u0441\u0442\u044c \u043a \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044e \u0432\u0435\u0449\u0435\u0439, \u0438 \u044f \u0431\u044b\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432, \u0447\u0442\u043e \u043d\u0430\u0448\u0435\u043b \u043a\u043e\u0433\u043e-\u0442\u043e, \u043a\u0442\u043e \u043c\u043e\u0433 \u043f\u043e\u043c\u043e\u0447\u044c \u043c\u043d\u0435 \u0441 \u044d\u0442\u0438\u043c\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0418\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u043c\u044b \u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0438 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438  <\/p>\n<\/blockquote>\n<p>Two\u00a0<strong>major<\/strong>\u00a0points of the\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">pipeline<\/a>\u00a0will be explained below, which\u00a0<strong>weren\u2019t<\/strong>\u00a0totally wrong explained\u00a0<a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1\" rel=\"noopener noreferrer nofollow\">here in book I<\/a>, but might not be clear enough:<\/p>\n<p>\u0414\u0432\u0430\u00a0<strong>\u0433\u043b\u0430\u0432\u043d\u044b\u0445<\/strong>\u00a0\u043c\u043e\u043c\u0435\u043d\u0442\u0430\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430<\/a>\u00a0\u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u044b \u043d\u0438\u0436\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435\u00a0<strong>\u043d\u0435 \u0431\u044b\u043b\u0438<\/strong>\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%BF%D0%BE%D0%BB%D0%BD%D0%BE%D1%81%D1%82%D1%8C%D1%8E+%D0%BD%D0%B5%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D1%8C%D0%BD%D0%BE\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e<\/a>\u00a0\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u044b\u00a0<a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c \u0432 \u043a\u043d\u0438\u0433\u0435 I<\/a>, \u043d\u043e \u043c\u043e\u0433\u043b\u0438 \u0431\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u044f\u0441\u043d\u044b\u043c\u0438:<\/p>\n<ol>\n<li>\n<p><strong>Not<\/strong>\u00a0everything is done by the \u201ctiny\u201d\u00a0<code>GPU<\/code>\u00a0cores!<\/p>\n<\/li>\n<li>\n<p>There can be\u00a0<strong>several parallel<\/strong>\u00a0running\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">pipelines<\/a>!  <\/p>\n<\/li>\n<\/ol>\n<ol>\n<li>\n<p><strong>\u041d\u0435<\/strong>\u00a0\u0432\u0441\u0451 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f &#171;\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438&#187; \u044f\u0434\u0440\u0430\u043c\u0438\u00a0<code>GPU<\/code>!<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c\u00a0<strong>\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/strong>\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u0432<\/a>!<\/p>\n<\/li>\n<\/ol>\n<p>Below I\u2019ll go into detail about it. <strong>Have fun<\/strong>!<\/p>\n<p>\u041d\u0438\u0436\u0435 \u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u044d\u0442\u043e\u043c.\u00a0<strong>\u041f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f<\/strong>!  <\/p>\n<h2>1. Not everything is done by the \u201ctiny\u201d GPU cores! (\u041d\u0435\u00a0\u0432\u0441\u0451 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f &#171;\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438&#187; \u044f\u0434\u0440\u0430\u043c\u0438 GPU!)<\/h2>\n<p>In the <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">pipeline<\/a> example <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">above<\/a> it might seem like every <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">pipeline<\/a> stage is done by the <code>GPU<\/code> Cores \u2013 This is <strong>NOT<\/strong> the case! In fact, most of the stuff is <strong>not<\/strong> done by them. In the new section in <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1#update12-1\" rel=\"noopener noreferrer nofollow\">\u201c1. Copy the data into system memory for fast access\u201d<\/a> you already saw that several components are necessary to just bring the data to a core. So what work do the cores actually do?<\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">\u0432\u044b\u0448\u0435<\/a> \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430<\/a> \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430<\/a> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u044f\u0434\u0440\u0430\u043c\u0438 <code>GPU<\/code> &#8212; \u044d\u0442\u043e <strong>\u041d\u0415<\/strong> \u0442\u0430\u043a! \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0437\u0430\u0434\u0430\u0447 <strong>\u043d\u0435<\/strong> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0438\u043c\u0438. \u0412 \u043d\u043e\u0432\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1#update12-1\" rel=\"noopener noreferrer nofollow\">\u201c1. \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430\u201d<\/a> \u0432\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u044f\u0434\u0440\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0422\u0430\u043a \u0447\u0442\u043e \u0436\u0435 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u044f\u0434\u0440\u0430?<\/p>\n<p>Let\u2019s observe one:<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0434\u043d\u043e \u0438\u0437 \u044f\u0434\u0435\u0440:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e897627c4d3097151f3f\" data-style=\"\" id=\"6549e897627c4d3097151f3f\" width=\"\"><\/div>\n<p>A core can receive commands and data. Then it executes the command by calculating the data in a <code>floating point<\/code> unit (<code>FP<\/code> UNIT) <strong>or<\/strong> an <code>integer<\/code> unit (<code>INT<\/code> UNIT). So you could say: A core can calculate <code>pixels<\/code> and <code>vertices<\/code> (maybe also other calculations like physics but let\u2019s focus on <code>graphic rendering<\/code>).<\/p>\n<p>\u042f\u0434\u0440\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b (\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438) \u0438 \u0434\u0430\u043d\u043d\u044b\u0435. \u0417\u0430\u0442\u0435\u043c \u043e\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u043b\u043e\u043a\u0435 \u0441 <code>\u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439<\/code> (<code>FP<\/code>-\u0431\u043b\u043e\u043a) <strong>\u0438\u043b\u0438<\/strong> \u0432 <code>\u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u043c<\/code> \u0431\u043b\u043e\u043a\u0435 (<code>INT<\/code>-\u0431\u043b\u043e\u043a). \u0422\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c: \u044f\u0434\u0440\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0438<\/code> \u0438 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code> (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a\u0436\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u0438\u0437\u0438\u043a\u0443, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043c\u0441\u044f \u043d\u0430 <code>\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0435<\/code>).<\/p>\n<p>Other important stuff like distribute the <code>render<\/code>-tasks, calculate <code>tessellation<\/code>, culling and preparing the fragments for the <code>pixel shader<\/code>, depth testing and writing <code>pixels<\/code> into the <code>frame buffer<\/code> are <strong>NOT<\/strong> done by the cores. This work is done by special, <strong>not<\/strong> programmable hardware blocks which are also placed in the <code>GPU<\/code>.<\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447 <code>\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430<\/code>, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 <code>\u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u0438<\/code>, \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code>, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u0438 \u0437\u0430\u043f\u0438\u0441\u044c <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code> \u0432 <code>\u0431\u0443\u0444\u0435\u0440 \u043a\u0430\u0434\u0440\u0430<\/code>, <strong>\u041d\u0415<\/strong> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u044f\u0434\u0440\u0430\u043c\u0438. \u042d\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 <strong>\u043d\u0435<\/strong> \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0431\u043b\u043e\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 <code>GPU<\/code>.<\/p>\n<p>Ok, after we know that now, let\u2019s move on to the next major point I have to clear out:<\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u044d\u0442\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0432\u0430\u0436\u043d\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u044f\u0441\u043d\u0438\u0442\u044c:<\/p>\n<h2>2. There can be several parallel running pipelines! (\u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u0432!)<\/h2>\n<p>First, I\u2019ll give you a short example what I mean with that headline. If you\u2019re still thirsty after this, I\u2019ll take you into an even <strong>more<\/strong> detailed explanation.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0432\u0430\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443 \u043f\u043e\u0434 \u044d\u0442\u0438\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0443 \u0432\u0430\u0441 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044e <strong>\u0431\u043e\u043b\u0435\u0435<\/strong> \u0434\u0435\u0442\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>But first, let\u2019s recap:<\/p>\n<p>\u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c:<\/p>\n<p>If we would only have <strong>one<\/strong> <code>GPU<\/code> Core, what could we calculate with it?<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e <strong>\u043e\u0434\u043d\u043e<\/strong> \u044f\u0434\u0440\u043e <code>GPU<\/code>, \u0447\u0442\u043e \u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e?<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/86c\/37f\/478\/86c37f478152ceff15bd59f6ebe3769b.png\" width=\"605\" height=\"150\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/86c\/37f\/478\/86c37f478152ceff15bd59f6ebe3769b.png\"\/><\/figure>\n<p>Correct: Nothing! Because the core needs someone who assigns him some work. This is done by a <code>Streaming Multiprocessor<\/code> (<code>SM<\/code>) which can handle a stream of <code>vertices<\/code>\/<code>pixels<\/code> which belong to <strong>one<\/strong> <code>shader<\/code>. OK, with that <code>SM<\/code> and one core we could calculate one <code>vertex<\/code>\/<code>pixel<\/code> at a time:<\/p>\n<p>\u0412\u0435\u0440\u043d\u043e: \u041d\u0438\u0447\u0435\u0433\u043e! \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044f\u0434\u0440\u0443 \u043d\u0443\u0436\u0435\u043d \u043a\u0442\u043e-\u0442\u043e, \u043a\u0442\u043e \u043f\u043e\u0440\u0443\u0447\u0438\u0442 \u0435\u043c\u0443 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0443. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0445 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432<\/code> (<code>SM<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043a <code>\u0432\u0435\u0440\u0448\u0438\u043d<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code>, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a <strong>\u043e\u0434\u043d\u043e\u043c\u0443<\/strong> <code>\u0448\u0435\u0439\u0434\u0435\u0440\u0443<\/code>. \u0425\u043e\u0440\u043e\u0448\u043e, \u0441 \u044d\u0442\u0438\u043c <code>SM<\/code> \u0438 \u043e\u0434\u043d\u0438\u043c \u044f\u0434\u0440\u043e\u043c \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043e\u0434\u043d\u0443 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u0443<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c<\/code> \u0437\u0430 \u0440\u0430\u0437:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4b3\/3fd\/a70\/4b33fda7007af6906694bde93caf277e.png\" width=\"605\" height=\"270\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4b3\/3fd\/a70\/4b33fda7007af6906694bde93caf277e.png\"\/><\/figure>\n<p>Of course, if we increase the amount of cores, there can be more <code>vertices<\/code>\/<code>pixels<\/code> calculated <strong>at the same time<\/strong>. But only if they belong to the same <code>shader<\/code>!<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0434\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 <code>\u0432\u0435\u0440\u0448\u0438\u043d<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code> <strong>\u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e<\/strong>. \u041d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 <code>\u0448\u0435\u0439\u0434\u0435\u0440\u0443<\/code>!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/58c\/871\/824\/58c871824a0fb25375a281e85917cc13.png\" width=\"605\" height=\"270\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/58c\/871\/824\/58c871824a0fb25375a281e85917cc13.png\"\/><\/figure>\n<p>This was already explained in my <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">first attempt<\/a> of explaining the <code>pipeline<\/code>! But now it gets interesting: What if we would add <strong>another<\/strong> <code>Streaming Multiprocessor<\/code> which cares about half of the cores?<\/p>\n<p>\u042d\u0442\u043e \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043e \u0432 \u043c\u043e\u0435\u0439 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435<\/a> \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c <code>\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/code>! \u041d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e: \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c <strong>\u0435\u0449\u0435 \u043e\u0434\u0438\u043d<\/strong> <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u043e\u0439 \u044f\u0434\u0435\u0440?<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/69d\/510\/33f\/69d51033f5e38fdefe927ca65f0c75f3.png\" width=\"605\" height=\"220\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/69d\/510\/33f\/69d51033f5e38fdefe927ca65f0c75f3.png\"\/><\/figure>\n<p>Now we can not only calculate <code>vertices<\/code>\/<code>pixels<\/code> in parallel, we can also take care about <strong>2 <\/strong><code>shader<\/code> streams at the same time! This means, we can for example run two different <code>pixel shaders<\/code> at the same time or run a <code>vertex shader<\/code> AND a <code>pixel shader<\/code> at the same time!<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u0438<\/code>, \u043d\u043e \u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c <strong>2 \u043f\u043e\u0442\u043e\u043a\u0430 <\/strong><code>\u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432<\/code>! \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0445 \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code> \u0438\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <code>\u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/code> \u0438 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/code> \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e!<\/p>\n<p>This rough example shall just give you a glimpse about that several different hardware blocks are involved and they all work in parallel so the <code>pipeline<\/code> is more flexible than I described in my <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">first attempt<\/a>.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u0433\u0440\u0443\u0431\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0430\u0442\u044c \u0432\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u0438 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u0447\u0442\u043e <code>\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/code> \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u0439, \u0447\u0435\u043c \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0432 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435<\/a>.<\/p>\n<p>Anyone still thirsty? Then let\u2019s get into more detail!<\/p>\n<p>\u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438? \u0422\u043e\u0433\u0434\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0433\u043b\u0443\u0431\u0438\u043c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438!<\/p>\n<h2>3. In-Depth look into the pipeline stages (\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u044d\u0442\u0430\u043f\u044b \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430)<\/h2>\n<h3>3.1 Overview (\u041e\u0431\u0437\u043e\u0440)<\/h3>\n<p>First of all: Why do we need a flexible\/parallel <code>pipeline<\/code>? The reason is, that you can\u2019t foresee, what workload you\u2019ll have. Especially with <code>tessellation<\/code> it might be, that there are suddenly 100.000 more <code>polygons<\/code> on the screen than one <code>frame<\/code> before. Therefore you need a flexible <code>pipeline<\/code> which handles totally different workloads.<\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e: \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0433\u0438\u0431\u043a\u0438\u0439\/\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 <code>\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/code>? \u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441 <code>\u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u0435\u0439<\/code> \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u0432\u0434\u0440\u0443\u0433 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u0430 100 000 <code>\u043f\u043e\u043b\u0438\u0433\u043e\u043d\u043e\u0432<\/code> \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0437\u0430 \u043e\u0434\u0438\u043d <code>\u043a\u0430\u0434\u0440<\/code> \u0434\u043e \u044d\u0442\u043e\u0433\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0433\u0438\u0431\u043a\u0438\u0439 <code>\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u043c\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u043c\u0438.<\/p>\n<p><strong>DON\u2019T WORRY!<\/strong> (<strong>\u041d\u0415 \u0411\u041e\u0419\u0422\u0415\u0421\u042c!<\/strong>)<\/p>\n<p>Please don\u2019t be afraid by looking at the two following images (like I am when i read a Wikipedia article and see formulas between the text)! Yes, this stuff isn\u2019t easy and even complex charts only show what a programmer needs to know and hide a lot of the \u201creal\u201d complexity. I only show it to give you a rough understand <strong>how<\/strong> complicated this stuff is. \ud83d\ude42<\/p>\n<p>\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043d\u0435 \u0431\u043e\u0439\u0442\u0435\u0441\u044c, \u0433\u043b\u044f\u0434\u044f \u043d\u0430 \u0434\u0432\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043a\u0430\u043a \u044f, \u043a\u043e\u0433\u0434\u0430 \u0447\u0438\u0442\u0430\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u0432 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438 \u0438 \u0432\u0438\u0436\u0443 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043a\u0441\u0442\u043e\u043c)! \u0414\u0430, \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u0438 \u0434\u0430\u0436\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u0438 \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u043e &#171;\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439&#187; \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u042f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u0442\u044c \u0432\u0430\u043c \u0433\u0440\u0443\u0431\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, <strong>\u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e<\/strong> \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c. \ud83d\ude42<\/p>\n<p>The following image shows a <code>GPU<\/code>. I have no idea about what is what, but it\u2019s kind of beautiful, isn\u2019t it?<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 <code>GPU<\/code>. \u042f \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u044e, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0447\u0442\u043e, \u043d\u043e \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u043d\u0435 \u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438?<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/6d4\/5ee\/460\/6d45ee460602362c6e56f9e1080d010f.jpg\" width=\"550\" height=\"544\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6d4\/5ee\/460\/6d45ee460602362c6e56f9e1080d010f.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>And here\u2019s an image from Christoph Kubisch\u2019 Article \u201cLife of a triangle\u201d. It shows parts of the work which is happening on a <code>GPU<\/code> in structured graphics.<\/p>\n<p>\u0418 \u0432\u043e\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u041a\u0440\u0438\u0441\u0442\u043e\u0444\u0430 \u041a\u0443\u0431\u0438\u0448\u0430 &#171;\u0416\u0438\u0437\u043d\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430&#187;. \u041e\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 <code>GPU<\/code> \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u0445.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/901\/565\/d0c\/901565d0c36f87a4611c5d05853d607b.png\" width=\"1500\" height=\"1627\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/901\/565\/d0c\/901565d0c36f87a4611c5d05853d607b.png\"\/><\/figure>\n<p>I hope you\u2019ve a rough idea about the complexity now and will realize how much the explanations below are simplified. Let\u2019s now have a detailed look on the whole <code>pipeline<\/code>.<\/p>\n<p>\u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0443 \u0432\u0430\u0441 \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432\u044b \u043f\u043e\u0439\u043c\u0435\u0442\u0435, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043d\u0438\u0436\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0435\u0441\u044c <code>\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/code>.<\/p>\n<h3>3.2 Application Stage (\u042d\u0442\u0430\u043f \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f)<\/h3>\n<p>It starts with the application or a game telling the <code>driver<\/code> that it wants something <code>rendered<\/code>.<\/p>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0438\u0433\u0440\u044b, \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0449\u0438\u0445 <code>\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0443<\/code>, \u0447\u0442\u043e \u043e\u043d\u043e \u0445\u043e\u0447\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e <code>\u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c<\/code>.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8976f566b30a5848ccb\" data-style=\"\" id=\"6549e8976f566b30a5848ccb\" width=\"\"><\/div>\n<h3>3.3 Driver Stage (\u042d\u0442\u0430\u043f \u0414\u0440\u0430\u0439\u0432\u0435\u0440\u0430)<\/h3>\n<p>The <code>driver<\/code> receives the commands from the application and puts them into a <code>command buffer<\/code> (this was already explained <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1#update11-2\" rel=\"noopener noreferrer nofollow\">here in book I<\/a>). After a while (or when the programmer forces it), the commands are send to the <code>GPU<\/code>.<\/p>\n<p><code>\u0414\u0440\u0430\u0439\u0432\u0435\u0440<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442 \u0438\u0445 \u0432 <code>\u0431\u0443\u0444\u0435\u0440 \u043a\u043e\u043c\u0430\u043d\u0434<\/code> (\u044d\u0442\u043e \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043e <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1#update11-2\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c \u0432 \u043a\u043d\u0438\u0433\u0435 I<\/a>). \u0421\u043f\u0443\u0441\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c), \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 <code>GPU<\/code>.<\/p>\n<p><strong>IMPORTANT<\/strong>: The <code>Driver<\/code> can be a bottle-neck.\u00a0<a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book3#update12-x\" rel=\"noopener noreferrer nofollow\">See Book III \u201c1. Many Draw Calls\u201d<\/a> for details.<\/p>\n<p><strong>\u0412\u0410\u0416\u041d\u041e<\/strong>: <code>\u0414\u0440\u0430\u0439\u0432\u0435\u0440<\/code> \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u0443\u0437\u043a\u0438\u043c \u043c\u0435\u0441\u0442\u043e\u043c. <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book3#update12-x\" rel=\"noopener noreferrer nofollow\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u041a\u043d\u0438\u0433\u0443 III &#171;1. \u041c\u043d\u043e\u0433\u043e \u0412\u044b\u0437\u043e\u0432\u043e\u0432 \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438&#187;<\/a> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e92d6f566b30a5848d45\" data-style=\"\" id=\"6549e92d6f566b30a5848d45\" width=\"\"><\/div>\n<h3>3.4 Read commands (\u0427\u0442\u0435\u043d\u0438\u0435 \u041a\u043e\u043c\u0430\u043d\u0434)<\/h3>\n<p>Now we\u2019re on the <code>graphic card<\/code>! The <code>Host Interface<\/code> reads commands to make them available for further use.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043d\u0430 <code>\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u0430\u0440\u0442\u0435<\/code>! <code>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0445\u043e\u0441\u0442\u0430<\/code> \u0447\u0438\u0442\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e9062fbe8876a62ca0b9\" data-style=\"\" id=\"6549e9062fbe8876a62ca0b9\" width=\"\"><\/div>\n<h3>3.5 Data Fetch (\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0414\u0430\u043d\u043d\u044b\u0445)<\/h3>\n<p>Some of the commands sent to the <code>GPU<\/code> can contain data or are instructions to copy data. The <code>GPU<\/code> typically has a dedicated engine to deal with copying data from <code>RAM<\/code> to <code>VRAM<\/code> and vice versa. This data could be anything filling <code>vertex buffers<\/code>, <code>textures<\/code> or other <code>shader<\/code> parameter buffers. Our frame would typically start with some camera matrices being sent.<\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 <code>GPU<\/code>, \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043b\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u043f\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u044b\u0447\u043d\u043e \u043d\u0430 <code>GPU<\/code> \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u0432\u0438\u0436\u043e\u043a \u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 <code>RAM<\/code> \u0432 <code>VRAM<\/code> \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0447\u0435\u043c \u0443\u0433\u043e\u0434\u043d\u043e, \u043d\u0430\u043f\u043e\u043b\u043d\u044f\u044f <code>\u0431\u0443\u0444\u0435\u0440\u044b \u0432\u0435\u0440\u0448\u0438\u043d<\/code>, <code>\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b<\/code> \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 <code>\u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432<\/code>. \u041e\u0431\u044b\u0447\u043d\u043e \u043d\u0430\u0448 \u043a\u0430\u0434\u0440 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446 \u043a\u0430\u043c\u0435\u0440\u044b.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8982fbe8876a62ca051\" data-style=\"\" id=\"6549e8982fbe8876a62ca051\" width=\"\"><\/div>\n<p><strong>Important<\/strong><\/p>\n<ol>\n<li>\n<p>I symbolize the data as geometries but in fact we\u2019re talking just about <code>vertex<\/code>-lists (<code>vertex buffer<\/code>). For a long time the <code>rendering<\/code> process doesn\u2019t care about the final <code>model<\/code>. Instead, most of the time, only single <code>vertices<\/code>\/<code>pixels<\/code> are worked with.<\/p>\n<\/li>\n<li>\n<p><code>Textures<\/code> <strong>only<\/strong> get copied, if they\u2019re not <strong>already<\/strong> in the <code>VRAM<\/code> on the <code>graphic card<\/code>!<\/p>\n<\/li>\n<li>\n<p>If <code>vertex buffer<\/code> are used a lot, they can stay in the <code>VRAM<\/code> like <code>textures<\/code> and don\u2019t have to be copied with every <code>draw call<\/code><\/p>\n<\/li>\n<li>\n<p><code>Vertex buffers<\/code> <strong>may<\/strong> stay in the <code>RAM<\/code> (not <code>VRAM<\/code>) if they change a lot. Then the <code>GPU<\/code> can read the data directly from <code>RAM<\/code> to its <code>Caches<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0412\u0430\u0436\u043d\u043e<\/strong><\/p>\n<ol>\n<li>\n<p>\u042f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043a \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0438\u0433\u0443\u0440\u044b, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043e \u0441\u043f\u0438\u0441\u043a\u0430\u0445 <code>\u0432\u0435\u0440\u0448\u0438\u043d<\/code> (<code>\u0431\u0443\u0444\u0435\u0440 \u0432\u0435\u0440\u0448\u0438\u043d<\/code>). \u041d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0434\u043e\u043b\u0433\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 <code>\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430<\/code> \u043d\u0435 \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 <code>\u043c\u043e\u0434\u0435\u043b\u0438<\/code>. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e, \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c\u0438<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>\u0422\u0435\u043a\u0441\u0442\u0443\u0440\u044b<\/code> \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f <strong>\u0442\u043e\u043b\u044c\u043a\u043e<\/strong> \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 <strong>\u0435\u0449\u0435<\/strong> \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 <code>VRAM<\/code> \u043d\u0430 <code>\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u0430\u0440\u0442\u0435<\/code>!<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 <code>\u0431\u0443\u0444\u0435\u0440\u044b \u0432\u0435\u0440\u0448\u0438\u043d<\/code> \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f, \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 <code>VRAM<\/code> \u043f\u043e\u0434\u043e\u0431\u043d\u043e <code>\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430\u043c<\/code> \u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u0430\u0436\u0434\u044b\u043c <code>\u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>\u0411\u0443\u0444\u0435\u0440\u044b \u0432\u0435\u0440\u0448\u0438\u043d<\/code> <strong>\u043c\u043e\u0433\u0443\u0442<\/strong> \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 <code>RAM<\/code> (\u043d\u0435 \u0432 <code>VRAM<\/code>), \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0447\u0430\u0441\u0442\u043e \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f. \u0422\u043e\u0433\u0434\u0430 <code>GPU<\/code> \u043c\u043e\u0436\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 <code>RAM<\/code> \u0432 \u0441\u0432\u043e\u0438 <code>\u043a\u044d\u0448\u0438<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>Now that all ingredients are ready the <code>Gigathread Engine<\/code> comes into play, it creates a thread for every <code>vertex<\/code>\/<code>pixel<\/code> and bundles them into a package. <code>NVIDIA<\/code> calls such a package: <code>Thread Block<\/code>. Additional threads may also be created for <code>vertices<\/code> after tessellation or for <code>geometry shaders<\/code> (will be explained later). <code>Thread blocks<\/code> are then distributed to the <code>Streaming Multiprocessors<\/code>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u044b \u0433\u043e\u0442\u043e\u0432\u044b, \u0432 \u0438\u0433\u0440\u0443 \u0432\u0441\u0442\u0443\u043f\u0430\u0435\u0442 <code>Gigathread Engine<\/code>. \u041e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u043e\u0442\u043e\u043a \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u044f<\/code> \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0438\u0445 \u0432 \u043f\u0430\u043a\u0435\u0442. <code>NVIDIA<\/code> \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0430\u043a\u0435\u0442: <code>\u0411\u043b\u043e\u043a \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/code>. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f <code>\u0432\u0435\u0440\u0448\u0438\u043d<\/code> \u043f\u043e\u0441\u043b\u0435 <code>\u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u0438<\/code> \u0438\u043b\u0438 \u0434\u043b\u044f <code>\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432<\/code> (\u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043e \u043f\u043e\u0437\u0436\u0435). <code>\u0411\u043b\u043e\u043a\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/code> \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u043c \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c<\/code>.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8983eb8e176bfe7a046\" data-style=\"\" id=\"6549e8983eb8e176bfe7a046\" width=\"\"><\/div>\n<h3>3.6 Vertex Fetch (\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0412\u0435\u0440\u0448\u0438\u043d)<\/h3>\n<p>A <code>Streaming Multiprocessor<\/code> is a collection of different hardware units and one of them is the <code>Polymorph Engine<\/code>. For the sake of simplicity I present them like separate guys. \ud83d\ude42 The <code>Polymorph Engine<\/code> gets the needed data and copies it into <code>caches<\/code> so cores can work faster. Why it is useful to copy data into <code>caches<\/code> was explained <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1#update12-1\" rel=\"noopener noreferrer nofollow\">here in book I<\/a>.<\/p>\n<p><code>\u041f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440<\/code> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0438\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>Polymorph Engine<\/code> . \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0438\u0445 \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439. \ud83d\ude42 <code>Polymorph Engine<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0438\u0445 \u0432 <code>\u043a\u044d\u0448\u0438<\/code>, \u0447\u0442\u043e\u0431\u044b \u044f\u0434\u0440\u0430 \u043c\u043e\u0433\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0417\u0430\u0447\u0435\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 <code>\u043a\u044d\u0448\u0438<\/code>, \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1#update12-1\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c \u0432 \u043a\u043d\u0438\u0433\u0435 I<\/a>.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8f17f26cf30b30311f5\" data-style=\"\" id=\"6549e8f17f26cf30b30311f5\" width=\"\"><\/div>\n<h3>3.7 Shader Execution (\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0428\u0435\u0439\u0434\u0435\u0440\u043e\u0432)<\/h3>\n<p>The main purpose of the <code>Streaming Multiprocessor<\/code> is executing program code written by the application developer, also called <code>shaders<\/code>. There is multiple types of <code>shaders<\/code> but each kind can run on any of these <code>Streaming Multiprocesors<\/code> and they all follow the same execution logic.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430<\/code> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e <code>\u0448\u0435\u0439\u0434\u0435\u0440\u0430\u043c\u0438<\/code>. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432 <code>\u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432<\/code>, \u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0438\u0437 \u044d\u0442\u0438\u0445 <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0445 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432<\/code>, \u0438 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>The <code>Streaming Multiprocessor<\/code> now takes his big <code>Thread Block<\/code> which he received from the <code>Gigathread Engine<\/code> and separates it into smaller chunks of work. He splits the <code>Thread Block<\/code> into heaps of 32 Threads. Such a smaller heap is called: <code>Warp<\/code>. In total, a <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Maxwell+(NVIDIA)\" rel=\"noopener noreferrer nofollow\">Maxwell<\/a> <code>Streaming Multiprocessor<\/code> (<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/SMM\" rel=\"noopener noreferrer nofollow\">SMM<\/a>) can \u201chold\u201d 64 of such <code>warps<\/code>. In my example and <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/SMM\" rel=\"noopener noreferrer nofollow\">SMM<\/a> there are 32 dedicated cores to work on the 32 Threads.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440<\/code> \u0431\u0435\u0440\u0435\u0442 \u0441\u0432\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 <code>\u0431\u043b\u043e\u043a \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0442 <code>Gigathread Engine<\/code>, \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u043d\u0430 \u043c\u0435\u043d\u044c\u0448\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b. \u041e\u043d \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 <code>\u0431\u043b\u043e\u043a \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/code> \u043d\u0430 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%BA%D1%83%D1%87%D0%B8+%D0%BF%D0%BE+32+%D0%BF%D0%BE%D1%82%D0%BE%D0%BA%D0%B0\" rel=\"noopener noreferrer nofollow\">\u043a\u0443\u0447\u0438 \u043f\u043e 32 \u043f\u043e\u0442\u043e\u043a\u0430<\/a>. \u0422\u0430\u043a\u0430\u044f \u043c\u0435\u043d\u044c\u0448\u0430\u044f \u043a\u0443\u0447\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f: <code>\u0412\u0430\u0440\u043f<\/code>. \u0412 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%BE%D0%B1%D1%89%D0%B5%D0%B9+%D1%81%D0%BB%D0%BE%D0%B6%D0%BD%D0%BE%D1%81%D1%82%D0%B8\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/a> <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440<\/code> (\u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435) <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Maxwell+(NVIDIA)\" rel=\"noopener noreferrer nofollow\">Maxwell<\/a> (<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/SMM\" rel=\"noopener noreferrer nofollow\">SMM<\/a>) \u043c\u043e\u0436\u0435\u0442 &#171;<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D1%81%D0%BE%D0%B4%D0%B5%D1%80%D0%B6%D0%B0%D1%82%D1%8C\" rel=\"noopener noreferrer nofollow\">\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c<\/a>&#187; 64 \u0442\u0430\u043a\u0438\u0445 <code>\u0432\u0430\u0440\u043f\u043e\u0432<\/code>. \u0412 \u043c\u043e\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438 \u0432 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/SMM\" rel=\"noopener noreferrer nofollow\">SMM<\/a> \u0435\u0441\u0442\u044c 32 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u044f\u0434\u0440\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 32 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8da962d8d30c1364ebc\" data-style=\"\" id=\"6549e8da962d8d30c1364ebc\" width=\"\"><\/div>\n<p>One <code>Warp<\/code> is then taken to be worked on. At this point the hardware should have all necessary data loaded into the registers so that the cores can work with it. We simplify the illustration here a bit: <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/SMM\" rel=\"noopener noreferrer nofollow\">SMM<\/a> for example has 4 <code>warp schedulers<\/code>, which each would let one <code>warp<\/code> work and manage a subset of the <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/SMM\" rel=\"noopener noreferrer nofollow\">SMM\u2019s<\/a> <code>warps<\/code>. (<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9D%D0%B5%D1%82%D0%BE%D1%87%D0%BD%D0%BE%D1%81%D1%82%D1%8C.+%D0%98%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5+%D1%82%D0%B5%D1%80%D0%BC%D0%B8%D0%BD%D0%B0+Streaming+Processor%2C+%D0%B2%D0%BC%D0%B5%D1%81%D1%82%D0%BE+Streaming+Multiprocessor\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/a>)<\/p>\n<p>\u041e\u0434\u0438\u043d <code>\u0432\u0430\u0440\u043f<\/code> \u0437\u0430\u0442\u0435\u043c \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b. \u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u044f\u0434\u0440\u0430 \u043c\u043e\u0433\u043b\u0438 \u0441 \u043d\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041c\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D1%83%D0%BF%D1%80%D0%BE%D1%89%D0%B0%D0%B5%D0%BC\" rel=\"noopener noreferrer nofollow\">\u0443\u043f\u0440\u043e\u0449\u0430\u0435\u043c<\/a> \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0437\u0434\u0435\u0441\u044c: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/SMM\" rel=\"noopener noreferrer nofollow\">SMM<\/a> \u0438\u043c\u0435\u0435\u0442 4 <code>\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0432\u0430\u0440\u043f\u043e\u0432<\/code>, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0434\u043d\u043e\u043c\u0443 <code>\u0432\u0430\u0440\u043f\u0443<\/code> <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/let+one+warp+work\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c<\/a> \u0438 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/manage+a+subset+of+the\" rel=\"noopener noreferrer nofollow\">\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c<\/a> <a href=\"https:\/\/bekhan.org\/Math\/Terms\/%D0%9F%D0%BE%D0%B4%D0%BC%D0%BD%D0%BE%D0%B6%D0%B5%D1%81%D1%82%D0%B2%D0%BE+(Subset)\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c<\/a> <code>\u0432\u0430\u0440\u043f\u043e\u0432<\/code> (\u0447\u0442\u043e &#171;\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f&#187; \u0432) <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/SMM\" rel=\"noopener noreferrer nofollow\">SMM<\/a>. (<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9D%D0%B5%D1%82%D0%BE%D1%87%D0%BD%D0%BE%D1%81%D1%82%D1%8C.+%D0%98%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5+%D1%82%D0%B5%D1%80%D0%BC%D0%B8%D0%BD%D0%B0+Streaming+Processor%2C+%D0%B2%D0%BC%D0%B5%D1%81%D1%82%D0%BE+Streaming+Multiprocessor\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/a>)<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e898962d8d30c1364e8e\" data-style=\"\" id=\"6549e898962d8d30c1364e8e\" width=\"\"><\/div>\n<p>The actual work begins now. The cores itself never see the whole <code>shader<\/code>-code but only <strong>one<\/strong> command of it at the time. They do their work and then the next command is given to them by the <code>Streaming Multiprocessor<\/code>. All cores execute the same command but on different data (<code>vertices<\/code>\/<code>pixels<\/code>). It\u2019s <strong>not<\/strong> possible that some cores work on command A and some on command B at the same time. This method is called <code>lock-step<\/code>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430. \u0421\u0430\u043c\u0438 \u044f\u0434\u0440\u0430 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u0438\u0434\u044f\u0442 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 <code>\u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code>, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e <strong>\u043e\u0434\u043d\u0443<\/strong> \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0437\u0430 \u0440\u0430\u0437. \u041e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u043c <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u043c \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u043c<\/code>. \u0412\u0441\u0435 \u044f\u0434\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043d\u043e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 (<code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u0438<\/code>). <strong>\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e<\/strong>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0434\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043d\u0430\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 A, \u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 B \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0448\u0430\u0433<\/code>.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8983eb8e176bfe7a048\" data-style=\"\" id=\"6549e8983eb8e176bfe7a048\" width=\"\"><\/div>\n<p>This <code>lock-step<\/code> method gets important if you have an <code>IF<\/code>-statement in your <code>shader<\/code> code which executes either <strong>one<\/strong> code block <strong>or<\/strong> another.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0448\u0430\u0433<\/code> \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0430\u0436\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432 \u043a\u043e\u0434\u0435 <code>\u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code> \u0435\u0441\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>IF<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043b\u0438\u0431\u043e <strong>\u043e\u0434\u0438\u043d<\/strong> \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430, <strong>\u043b\u0438\u0431\u043e<\/strong> \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8986f566b30a5848ccf\" data-style=\"\" id=\"6549e8986f566b30a5848ccf\" width=\"\"><\/div>\n<p>This <code>IF<\/code>-Statement makes <strong>some<\/strong> of our cores execute the left code and some the right code. It can\u2019t be done at the same time (like explained above). First one code-side would be executed and some cores would be \u201csleeping\u201d and <strong>then<\/strong> the other side is executed afterwards. <a href=\"http:\/\/scs.hosted.panopto.com\/Panopto\/Pages\/Viewer.aspx?id=11e89f91-6ae0-44bc-bfc7-cea41b1af542\" rel=\"noopener noreferrer nofollow\">Kayvon explains this here at 43:58 \u201cWhat about conditional execution?\u201d<\/a>.<\/p>\n<p>\u042d\u0442\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>IF<\/code> \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <strong>\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435<\/strong> \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u044f\u0434\u0435\u0440 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043b\u0435\u0432\u044b\u0439 \u043a\u043e\u0434, \u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 &#8212; \u043f\u0440\u0430\u0432\u044b\u0439. \u042d\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e (\u043a\u0430\u043a \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043e \u0432\u044b\u0448\u0435). \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043e\u0434\u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u043a\u043e\u0434\u0430, \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0434\u0440\u0430 \u0431\u0443\u0434\u0443\u0442 &#171;\u0441\u043f\u0430\u0442\u044c&#187;, \u0430 <strong>\u0437\u0430\u0442\u0435\u043c<\/strong> \u0434\u0440\u0443\u0433\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043f\u043e\u0437\u0436\u0435. <a href=\"http:\/\/scs.hosted.panopto.com\/Panopto\/Pages\/Viewer.aspx?id=11e89f91-6ae0-44bc-bfc7-cea41b1af542\" rel=\"noopener noreferrer nofollow\">\u041a\u0435\u0439\u0432\u043e\u043d \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u044d\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0430 43:58 &#171;\u0427\u0442\u043e \u043d\u0430\u0441\u0447\u0435\u0442 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f?&#187;<\/a>.<\/p>\n<p>In my example 16 <code>pixels<\/code>\/<code>vertices<\/code> would be worked on but it\u2019s of course possible to have <code>IF<\/code>-statements where only ONE <code>pixel<\/code>\/<code>vertex<\/code> is calculated and the other 31 cores <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/Get+Masked+Out+(%D0%9C%D0%B0%D1%81%D0%BA%D0%B8%D1%80%D1%83%D1%8E%D1%82%D1%81%D1%8F)\" rel=\"noopener noreferrer nofollow\">get masked out<\/a>. The same applies to loops, if only one core has to stay in the loop long, all the others become idle. This phenomenon is also called <code>divergent threads<\/code> and should be minimized. Ideally all threads in the <code>warp<\/code> hit the same side of the <code>IF<\/code>-condition, because then we can entirely jump over the non-active side.<\/p>\n<p>\u0412 \u043c\u043e\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043e 16 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code>\/<code>\u0432\u0435\u0440\u0448\u0438\u043d<\/code>, \u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <code>IF<\/code>, \u0433\u0434\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u041e\u0414\u0418\u041d <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c<\/code>\/<code>\u0432\u0435\u0440\u0448\u0438\u043d\u0430<\/code>, \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 31 \u044f\u0434\u0440\u043e <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/Get+Masked+Out+(%D0%9C%D0%B0%D1%81%D0%BA%D0%B8%D1%80%D1%83%D1%8E%D1%82%D1%81%D1%8F)\" rel=\"noopener noreferrer nofollow\">\u043c\u0430\u0441\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f<\/a>. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0446\u0438\u043a\u043b\u0430\u043c: \u0435\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u044f\u0434\u0440\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0446\u0438\u043a\u043b\u0435 \u0434\u043e\u043b\u0433\u043e, \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438. \u042d\u0442\u043e \u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>\u0440\u0430\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438<\/code> \u0438 \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0432 <code>\u0432\u0430\u0440\u043f\u0435<\/code> \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043f\u0430\u0434\u0430\u0442\u044c \u043d\u0430 \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u044f <code>IF<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8987f26cf30b30311a9\" data-style=\"\" id=\"6549e8987f26cf30b30311a9\" width=\"\"><\/div>\n<p>But why can the <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/SMM\" rel=\"noopener noreferrer nofollow\">SMM<\/a> hold 64 <code>warps<\/code>, when the cores can only work on very few at a time?? This is because sometimes you can\u2019t progress because you have to wait for some data. For example we need to calculate the lighting with the <a href=\"https:\/\/bekhan.org\/Math\/Terms\/Normal+(%D0%BD%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D1%8C)\" rel=\"noopener noreferrer nofollow\">normal<\/a> from our <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Normal+Map+(%D0%BA%D0%B0%D1%80%D1%82%D0%B0+%D0%BD%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D0%B5%D0%B9+%D0%B8%D0%BB%D0%B8+%D0%BD%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0%D1%8F+%D0%BA%D0%B0%D1%80%D1%82%D0%B0)\" rel=\"noopener noreferrer nofollow\">normal map texture<\/a> . Even if the <a href=\"https:\/\/bekhan.org\/Math\/Terms\/Normal+(%D0%BD%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D1%8C)\" rel=\"noopener noreferrer nofollow\">normal<\/a> was in the <code>cache<\/code> it takes a while to access it, and if it wasn\u2019t it can take a good while. Pro\u2019s call this <code>Memory Stall<\/code> and this is greatly <a href=\"http:\/\/scs.hosted.panopto.com\/Panopto\/Pages\/Viewer.aspx?id=11e89f91-6ae0-44bc-bfc7-cea41b1af542\" rel=\"noopener noreferrer nofollow\">explained by Kayvon<\/a>. Instead of doing nothing, the current <code>warp<\/code> will just be exchanged with one, where the necessary data is ready for use:<\/p>\n<p>\u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/SMM\" rel=\"noopener noreferrer nofollow\">SMM<\/a> \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c 64 <code>\u0432\u0430\u0440\u043f\u0430<\/code>, \u043a\u043e\u0433\u0434\u0430 \u044f\u0434\u0440\u0430 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0437\u0430 \u0440\u0430\u0437?? \u042d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0436\u0434\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u0441 <a href=\"https:\/\/bekhan.org\/Math\/Terms\/Normal+(%D0%BD%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D1%8C)\" rel=\"noopener noreferrer nofollow\">\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u044e<\/a> \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Normal+Map+(%D0%BA%D0%B0%D1%80%D1%82%D0%B0+%D0%BD%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D0%B5%D0%B9+%D0%B8%D0%BB%D0%B8+%D0%BD%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0%D1%8F+%D0%BA%D0%B0%D1%80%D1%82%D0%B0)\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u043a\u0430\u0440\u0442\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u0438<\/a>. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 <a href=\"https:\/\/bekhan.org\/Math\/Terms\/Normal+(%D0%BD%D0%BE%D1%80%D0%BC%D0%B0%D0%BB%D1%8C)\" rel=\"noopener noreferrer nofollow\">\u043d\u043e\u0440\u043c\u0430\u043b\u044c<\/a> \u0431\u044b\u043b\u0430 \u0432 <code>\u043a\u044d\u0448\u0435<\/code>, \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0435\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0438 \u0435\u0441\u043b\u0438 \u0435\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u044d\u0442\u043e <code>\u0437\u0430\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/code>, \u0438 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e <a href=\"http:\/\/scs.hosted.panopto.com\/Panopto\/Pages\/Viewer.aspx?id=11e89f91-6ae0-44bc-bfc7-cea41b1af542\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043e \u041a\u0435\u0439\u0432\u043e\u043d\u043e\u043c<\/a>. \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c, \u0442\u0435\u043a\u0443\u0449\u0438\u0439 <code>\u0432\u0430\u0440\u043f<\/code> \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u043e\u0442, \u0433\u0434\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e898e993b17686bb9fdd\" data-style=\"\" id=\"6549e898e993b17686bb9fdd\" width=\"\"><\/div>\n<p>The explanation above was a bit simplified. Modern <code>GPU<\/code> architecture doesn\u2019t <em>only<\/em> allow a <code>Streaming Multiprocessor<\/code> working at <strong>one<\/strong> <code>Warp<\/code> at the time. Look for example <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/Image+showing+a+%60Streaming+Multiprocessors%60+based+on+Maxwell+architecture+(SMM)\" rel=\"noopener noreferrer nofollow\">at this image<\/a> showing a <code>Streaming Multiprocessor<\/code> based on <code>Maxwell<\/code> architecture (<code>SMM<\/code>): <strong>One<\/strong> <code>Streaming Multiprocessor<\/code> has access to <strong>four<\/strong> <code>Warp schedulers<\/code>, each controlling 32 Cores. This makes him able to work on four <code>Warps<\/code> completely <strong>parallel<\/strong>. The book keeping for the work state of multiple threads is kept independently and is reflected by how many Threads the <code>SM<\/code> can hold in parallel, as noted on top.<\/p>\n<p>\u0412\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043e. \u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 <code>GPU<\/code> \u043d\u0435 <em>\u0442\u043e\u043b\u044c\u043a\u043e<\/em> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u043c\u0443 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0443<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 <strong>\u043e\u0434\u043d\u0438\u043c<\/strong> <code>\u0432\u0430\u0440\u043f\u043e\u043c<\/code> \u0437\u0430 \u0440\u0430\u0437. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/Image+showing+a+%60Streaming+Multiprocessors%60+based+on+Maxwell+architecture+(SMM)\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 \u044d\u0442\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443<\/a>, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0443\u044e <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440<\/code> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b <code>Maxwell<\/code> (<code>SMM<\/code>): <strong>\u041e\u0434\u0438\u043d<\/strong> <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440<\/code> \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a <strong>\u0447\u0435\u0442\u044b\u0440\u0435\u043c<\/strong> <code>\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430\u043c \u0432\u0430\u0440\u043f\u043e\u0432<\/code>, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 32 \u044f\u0434\u0440\u0430\u043c\u0438. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f <code>\u0432\u0430\u0440\u043f\u0430\u043c\u0438<\/code> \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e <strong>\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/strong>. \u0423\u0447\u0435\u0442 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0438 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 <code>SM<\/code> \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e, \u043a\u0430\u043a \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u0432\u044b\u0448\u0435.<\/p>\n<p>There is more than just waiting for memory that allows us to switch active scheduling as <a href=\"http:\/\/www.ece.rice.edu\/~gw2\/\" rel=\"noopener noreferrer nofollow\">Guohui Wang<\/a> noted:<\/p>\n<p>\u0415\u0441\u0442\u044c \u0435\u0449\u0451 \u043d\u0435\u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043a\u0430\u043a \u043e\u0442\u043c\u0435\u0442\u0438\u043b <a href=\"http:\/\/www.ece.rice.edu\/~gw2\/\" rel=\"noopener noreferrer nofollow\">Guohui Wang<\/a>:<\/p>\n<blockquote>\n<p>Since more than 4 <code>Warps<\/code> can run in parallel in <code>Maxwell<\/code>. Each <code>warp scheduler<\/code> can perform dual-issuing instruction in one clock clock to a <code>warp<\/code>, in this sense, every clock cycle we have up to 4 <code>warps<\/code> get their new instructions to work on (suppose at least 4 warps are ready by far). However, we also have instruction-level parallelism. That means when 4 <code>warps<\/code> are executing instructions (typically with 10-20 cycle latency), the next batch of 4 warps can accept new instructions in the next clock cycle. Therefore, it is possible to have more than 4 <code>warps<\/code> running in parallel if the resources are available. Actually, in one of the CUDA optimization video in GTC2013, more than 30 active <code>warps<\/code> are recommended to keep the <code>pipeline<\/code> fully occupied in a general case. You may want to revise the wording here to indicate that there will be multiple (more than 4) <code>warps<\/code> running in parallel, to avoid any potential confusion that people may think 4 <code>scheduler<\/code> could only hold 4 parallel <code>warps<\/code>.<br \/>\u2013 Guohui Wang<\/p>\n<\/blockquote>\n<blockquote>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 <code>Maxwell<\/code> \u043c\u043e\u0433\u0443\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 <code>\u0432\u0430\u0440\u043f\u043e\u0432<\/code>, \u043a\u0430\u0436\u0434\u044b\u0439 <code>\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0432\u0430\u0440\u043f\u043e\u0432<\/code> \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0432\u043e\u0439\u043d\u0443\u044e \u0432\u044b\u0434\u0430\u0447\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0437\u0430 \u043e\u0434\u0438\u043d \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0439 \u0446\u0438\u043a\u043b \u0434\u043b\u044f <code>\u0432\u0430\u0440\u043f\u0430<\/code>. \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0434\u043e \u0447\u0435\u0442\u044b\u0440\u0435\u0445 <code>\u0432\u0430\u0440\u043f\u043e\u0432<\/code> \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b (\u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0447\u0435\u0442\u044b\u0440\u0435 <code>\u0432\u0430\u0440\u043f\u0430<\/code> \u0433\u043e\u0442\u043e\u0432\u044b). \u041e\u0434\u043d\u0430\u043a\u043e \u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0447\u0435\u0442\u044b\u0440\u0435 <code>\u0432\u0430\u0440\u043f\u0430<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 (\u043e\u0431\u044b\u0447\u043d\u043e \u0441 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0432 10-20 \u0446\u0438\u043a\u043b\u043e\u0432), \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 <code>\u0432\u0430\u0440\u043f\u043e\u0432<\/code> \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u043c \u0446\u0438\u043a\u043b\u0435. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 <code>\u0432\u0430\u0440\u043f\u043e\u0432<\/code> \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0432\u0438\u0434\u0435\u043e \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 CUDA \u043d\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 GTC 2013 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <code>\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430<\/code> \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u044b\u043b\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0431\u043e\u043b\u0435\u0435 30 <code>\u0432\u0430\u0440\u043f\u043e\u0432<\/code>. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u0442\u043e\u0438\u0442 \u043f\u0435\u0440\u0435\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 (\u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u0442\u044b\u0440\u0435\u0445) \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 <code>\u0432\u0430\u0440\u043f\u043e\u0432<\/code> \u0438 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0447\u0442\u043e \u0447\u0435\u0442\u044b\u0440\u0435 <code>\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430<\/code> \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0432\u0430\u0440\u043f\u0430.<br \/>\u2013 Guohui Wang<\/p>\n<\/blockquote>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fb2\/b89\/06a\/fb2b8906af2f93adeb8c152300a36e5e.png\" width=\"605\" height=\"605\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fb2\/b89\/06a\/fb2b8906af2f93adeb8c152300a36e5e.png\"\/><\/figure>\n<p>But what are our threads actually working on? For example a <code>Vertex Shader<\/code>!<\/p>\n<p>\u041d\u043e \u043d\u0430\u0434 \u0447\u0435\u043c \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430\u0448\u0438 \u043f\u043e\u0442\u043e\u043a\u0438? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0434 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u043c<\/code>!<\/p>\n<h3>3.8 Vertex Shader (\u0412\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0428\u0435\u0439\u0434\u0435\u0440)<\/h3>\n<p>The <code>vertex shader<\/code> takes care of <strong>one<\/strong> <code>vertex<\/code> and modifies it how the programmer wants. Unlike normal software (e.g. Mail-Program) where you run <strong>one<\/strong> instance of the program and hand over a lot data which get taken care of (e.g. handling all the Mails), you run <strong>one<\/strong> instance of a <code>vertex shader<\/code> program <strong>for every<\/strong> <code>vertex<\/code> which then runs in in one thread managed by the <code>Streaming Multiprocessor<\/code>.<\/p>\n<p><code>\u0412\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/code> \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u043e\u0431 <strong>\u043e\u0434\u043d\u043e\u0439<\/strong> <code>\u0432\u0435\u0440\u0448\u0438\u043d\u0435<\/code> \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u0435\u0451 \u0442\u0430\u043a, \u043a\u0430\u043a \u0445\u043e\u0447\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b), \u0433\u0434\u0435 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 <strong>\u043e\u0434\u0438\u043d<\/strong> \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0435 \u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0441\u0435\u0445 \u043f\u0438\u0441\u0435\u043c), \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 <strong>\u043e\u0434\u0438\u043d<\/strong> \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b <code>\u0432\u0435\u0440\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code> <strong>\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439<\/strong> <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u043c <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u043c \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u043c<\/code>.<\/p>\n<p>Our <code>vertex shader<\/code> transforms <code>vertices<\/code> or its parameters (pos, color, uv) like you want:<\/p>\n<p>\u041d\u0430\u0448 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/code> \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code> \u0438\u043b\u0438 \u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b (\u043f\u043e\u0437\u0438\u0446\u0438\u044f, \u0446\u0432\u0435\u0442, uv) \u0442\u0430\u043a, \u043a\u0430\u043a \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8982fbe8876a62ca053\" data-style=\"\" id=\"6549e8982fbe8876a62ca053\" width=\"\"><\/div>\n<p>Some stages are only executed when <code>Tessellation<\/code> is used. Click the link below, if you want to see what happens when <code>Tessellation<\/code> gets into the game.<\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u0442\u0430\u043f\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <code>\u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u0438<\/code>. \u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0438\u0436\u0435, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 <code>\u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u044f<\/code> \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0432 \u0438\u0433\u0440\u0443.<\/p>\n<p><a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Tessellation+in+Book+II\" rel=\"noopener noreferrer nofollow\">Click here for Tessellation<\/a> (<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Tessellation+in+Book+II\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u0437\u0434\u0435\u0441\u044c \u0434\u043b\u044f \u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u0438<\/a>)<\/p>\n<h3>3.13 Primitive Assembly (\u0421\u0431\u043e\u0440\u043a\u0430 \u041f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432)<\/h3>\n<p>Towards the end of the <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/Geometry+Pipeline+(%D0%93%D0%B5%D0%BE%D0%BC%D0%B5%D1%82%D1%80%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">geometry pipeline<\/a> we gather the <code>vertices<\/code> that assemble our <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/%D0%9F%D1%80%D0%B8%D0%BC%D0%B8%D1%82%D0%B8%D0%B2+(Primitive)\" rel=\"noopener noreferrer nofollow\">primitive<\/a>: a <code>triangle<\/code>, <code>line<\/code> or <code>point<\/code>. The <code>vertices<\/code> either came from the <code>vertex shader<\/code>, or if <code>tessellation<\/code> was active from the <code>domain shader<\/code>.<\/p>\n<p>\u0411\u043b\u0438\u0436\u0435 \u043a \u043a\u043e\u043d\u0446\u0443 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/Geometry+Pipeline+(%D0%93%D0%B5%D0%BE%D0%BC%D0%B5%D1%82%D1%80%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430<\/a> \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 \u043d\u0430\u0448 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/%D0%9F%D1%80%D0%B8%D0%BC%D0%B8%D1%82%D0%B8%D0%B2+(Primitive)\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432<\/a>: <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a<\/code>, <code>\u043b\u0438\u043d\u0438\u044e<\/code> \u0438\u043b\u0438 <code>\u0442\u043e\u0447\u043a\u0443<\/code>. <code>\u0412\u0435\u0440\u0448\u0438\u043d\u044b<\/code> \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u043b\u0438\u0431\u043e \u0438\u0437 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code>, \u043b\u0438\u0431\u043e, \u0435\u0441\u043b\u0438 <code>\u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u044f<\/code> \u0431\u044b\u043b\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u0430, \u0438\u0437 <code>\u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code>.<\/p>\n<p>What <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%A0%D0%B5%D0%B6%D0%B8%D0%BC+%D0%9F%D1%80%D0%B8%D0%BC%D0%B8%D1%82%D0%B8%D0%B2%D0%B0\" rel=\"noopener noreferrer nofollow\">mode<\/a> (<code>triangle<\/code>, <code>line<\/code> or <code>point<\/code>) we are in was defined in the application for this <code>drawcall<\/code>. Normally we would just pass the <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/%D0%9F%D1%80%D0%B8%D0%BC%D0%B8%D1%82%D0%B8%D0%B2+(Primitive)\" rel=\"noopener noreferrer nofollow\">primitive<\/a> for final processing and <code>rasterzation<\/code>, but there is an optional stage that makes use of this information, the <code>Geometry Shader<\/code>.<\/p>\n<p>\u0412 \u043a\u0430\u043a\u043e\u043c <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%A0%D0%B5%D0%B6%D0%B8%D0%BC+%D0%9F%D1%80%D0%B8%D0%BC%D0%B8%D1%82%D0%B8%D0%B2%D0%B0\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u0436\u0438\u043c\u0435<\/a> (\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u043b\u0438\u043d\u0438\u044f \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0430) \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f, \u0431\u044b\u043b\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e <code>\u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438<\/code>. \u041e\u0431\u044b\u0447\u043d\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c (\u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u044d\u0442\u0430\u043f\u0430\u043c) <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/%D0%9F%D1%80%D0%B8%D0%BC%D0%B8%D1%82%D0%B8%D0%B2+(Primitive)\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432<\/a> \u0434\u043b\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 <code>\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/code>, \u043d\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u0442\u0430\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, &#8212; <code>\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/code>.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e898962d8d30c1364e92\" data-style=\"\" id=\"6549e898962d8d30c1364e92\" width=\"\"><\/div>\n<h3>3.14 Geometry Shader (\u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0428\u0435\u0439\u0434\u0435\u0440)<\/h3>\n<p>The <code>Geometry Shader<\/code> works on the final <code>primitives<\/code>. Similar to the <code>Hull Shader<\/code> it gets the <code>primitive\u2019s vertices<\/code> as input. It can modify those <code>vertices<\/code> and even generate a few new ones. It can also change the actual <code>primitive<\/code> mode. For example turn a point into two <code>triangles<\/code>, or the three visible sides of a cube.<\/p>\n<p><code>\u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 <code>\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c\u0438<\/code>. \u041f\u043e\u0434\u043e\u0431\u043d\u043e <code>\u0448\u0435\u0439\u0434\u0435\u0440\u0443 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438<\/code>, \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430<\/code> \u043d\u0430 \u0432\u0445\u043e\u0434. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u0438 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code> \u0438 \u0434\u0430\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u044b\u0445. \u0422\u0430\u043a\u0436\u0435 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c <code>\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0442\u043e\u0447\u043a\u0443 \u0432 \u0434\u0432\u0430 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430<\/code> \u0438\u043b\u0438 \u0442\u0440\u0438 \u0432\u0438\u0434\u0438\u043c\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u0443\u0431\u0430.<\/p>\n<p>However <code>geometry shader<\/code> is not really good for creating lots of new <code>vertices<\/code> or <code>triangles<\/code>, <code>tessellation<\/code> is best left to the <code>tessellation shaders<\/code>. The purpose of the <code>geometry shader<\/code> is rather special given it\u2019s the last stage prior preparing the primitive for <code>rasterization<\/code>. For example <code>geometry shader<\/code> plays a key-role in current <a href=\"https:\/\/research.nvidia.com\/publication\/interactive-indirect-illumination-using-voxel-cone-tracing\" rel=\"noopener noreferrer nofollow\">voxelization techniques<\/a>.<\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, <code>\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/code> \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043d\u043e\u0432\u044b\u0445 <code>\u0432\u0435\u0440\u0448\u0438\u043d<\/code> \u0438\u043b\u0438 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432<\/code>, <code>\u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u044e<\/code> \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0440\u0443\u0447\u0438\u0442\u044c <code>\u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u0430\u043c<\/code>. \u041f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code> \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u0442\u0430\u043f \u043f\u0435\u0440\u0435\u0434 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430 \u043a <code>\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/code> \u0438\u0433\u0440\u0430\u0435\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u0443\u044e \u0440\u043e\u043b\u044c \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 <a href=\"https:\/\/research.nvidia.com\/publication\/interactive-indirect-illumination-using-voxel-cone-tracing\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u0445\u043d\u0438\u043a\u0430\u0445 \u0432\u043e\u043a\u0441\u0435\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p><a href=\"https:\/\/open.gl\/geometry\" rel=\"noopener noreferrer nofollow\">Here<\/a> you can find good examples how to program &amp; use <code>geometry shaders<\/code>. And <a href=\"http:\/\/www.lighthouse3d.com\/tutorials\/glsl-core-tutorial\/pipeline33\/\" rel=\"noopener noreferrer nofollow\">this<\/a> is a great overview about the <code>openGL pipeline<\/code>.<\/p>\n<p><a href=\"https:\/\/open.gl\/geometry\" rel=\"noopener noreferrer nofollow\">\u0417\u0434\u0435\u0441\u044c<\/a> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432<\/code>. \u0410 <a href=\"http:\/\/www.lighthouse3d.com\/tutorials\/glsl-core-tutorial\/pipeline33\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e<\/a> \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043e\u0431\u0437\u043e\u0440 <code>\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 OpenGL<\/code>.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8983add78308984deb9\" data-style=\"\" id=\"6549e8983add78308984deb9\" width=\"\"><\/div>\n<h3>3.15 Viewport Transform &amp; Clipping (\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0412\u0438\u0434\u0430 \u0438 \u041e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435)<\/h3>\n<p>Until here the programmers seem to use a quadratic space for all the operations (i guess it\u2019s easier\/faster that way) but now this needs to be fit to the actual resolution of your monitor (or window where the game is rendered into). More info about this you can find <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/Image+Processing+and+Computer+Graphics.+Rendering+Pipeline\" rel=\"noopener noreferrer nofollow\">here<\/a> in the \u201cViewport Transform \/ Screen Mapping\u201d Section.<\/p>\n<p>\u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 (\u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a \u043f\u0440\u043e\u0449\u0435\/\u0431\u044b\u0441\u0442\u0440\u0435\u0435), \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u043e\u0431\u0438\u0442\u044c \u043a \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0432\u0430\u0448\u0435\u0433\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0430 (\u0438\u043b\u0438 \u043e\u043a\u043d\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0438\u0433\u0440\u0430). \u0411\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/Image+Processing+and+Computer+Graphics.+Rendering+Pipeline\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 &#171;Viewport Transform \/ Screen Mapping&#187;.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8986f566b30a5848cd1\" data-style=\"\" id=\"6549e8986f566b30a5848cd1\" width=\"\"><\/div>\n<p>Also <code>triangles<\/code> get cut if they overlap a certain security-border (<code>Guard Band<\/code>) of the scene (this is called: <code>Guard Band Clipping<\/code> and you find more infos <a href=\"http:\/\/www.byteboss.com\/288180.ppt\" rel=\"noopener noreferrer nofollow\">here<\/a> and <a href=\"http:\/\/developer.download.nvidia.com\/assets\/gamedev\/docs\/Guard_Band_Clipping.pdf\" rel=\"noopener noreferrer nofollow\">here<\/a>). The clipping is done because the <code>Rastizer<\/code> can only deal with <code>triangles<\/code> <strong>within<\/strong> the area it\u2019s working on:<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438<\/code> \u043e\u0431\u0440\u0435\u0437\u0430\u044e\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0449\u0438\u0442\u043d\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 (<code>Guard Band<\/code>) \u0441\u0446\u0435\u043d\u044b (\u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f: <code>\u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0437\u0430\u0449\u0438\u0442\u043d\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435<\/code>, \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 <a href=\"http:\/\/www.byteboss.com\/288180.ppt\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 <a href=\"http:\/\/developer.download.nvidia.com\/assets\/gamedev\/docs\/Guard_Band_Clipping.pdf\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>). \u041e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <code>\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440<\/code> \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438<\/code> <strong>\u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445<\/strong> \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e898e993b17686bb9fe1\" data-style=\"\" id=\"6549e898e993b17686bb9fe1\" width=\"\"><\/div>\n<h3>3.16 Triangles Journey (\u041f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u0422\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432)<\/h3>\n<p>This is not really a separate step in the <code>pipeline<\/code> but I found it very interesting so that it gets its own section.<\/p>\n<p>\u042d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u0442\u0430\u043f \u0432 <code>\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435<\/code>, \u043d\u043e \u043c\u043d\u0435 \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c, \u0447\u0442\u043e \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b.<\/p>\n<p>At this point we know the exact position, shading, etc. of several <code>vertices<\/code> which form <code>triangles<\/code>. These <code>triangles<\/code> need to be \u201cpainted\u201d and before we can do that, someone has to find out which <code>pixels<\/code> of the screen are covered by the triangles. This is done by so called <code>rasterizers<\/code>. It\u2019s important to know, that there are <strong>several<\/strong> available <strong>AND<\/strong> several of them can work at the <strong>same<\/strong> <code>triangle<\/code> if its big enough. Else it would mean that only <strong>one<\/strong> <code>rasterizer<\/code> is working when you have big <code>triangles<\/code> on screen and the others would have some vacation.<\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0437\u0430\u0442\u0435\u043d\u0435\u043d\u0438\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 <code>\u0432\u0435\u0440\u0448\u0438\u043d<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438<\/code>. \u042d\u0442\u0438 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438<\/code> \u043d\u0443\u0436\u043d\u043e \u00ab\u0437\u0430\u043a\u0440\u0430\u0441\u0438\u0442\u044c\u00bb, \u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u0442\u043e-\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0438<\/code> \u044d\u043a\u0440\u0430\u043d\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438<\/code>. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 <code>\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u044b<\/code>. \u0412\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e (\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432) \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e <strong>\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e<\/strong> \u0438 \u0447\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u043d\u0438\u0445 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0434 <strong>\u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435<\/strong> <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c<\/code>, \u0435\u0441\u043b\u0438 \u043e\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u043b\u043e \u0431\u044b, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432<\/code> \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e <strong>\u043e\u0434\u0438\u043d<\/strong> <code>\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440<\/code>, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043e\u0442\u0434\u044b\u0445\u0430\u0442\u044c.<\/p>\n<p>Therefore every <code>rasterizer<\/code> has the responsibility for certain parts of the screen. And if a <code>triangle<\/code> belongs to such a responsibility area (the <a href=\"https:\/\/bekhan.org\/Information+Technology\/Development\/Terms\/Bounding+Box+(%D0%9E%D0%B3%D1%80%D0%B0%D0%BD%D0%B8%D1%87%D0%B8%D0%B2%D0%B0%D1%8E%D1%89%D0%B0%D1%8F+%D0%BA%D0%BE%D1%80%D0%BE%D0%B1%D0%BA%D0%B0)\" rel=\"noopener noreferrer nofollow\">bounding box<\/a> of the <code>triangle<\/code> is taken to measure this), it is send to this <code>rasterizer<\/code> so that he can work on it.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 <code>\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440<\/code> \u043d\u0435\u0441\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u044d\u043a\u0440\u0430\u043d\u0430. \u0418 \u0435\u0441\u043b\u0438 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a<\/code> \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0442\u0430\u043a\u043e\u0439 \u0437\u043e\u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 (\u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0435\u0440\u0435\u0442\u0441\u044f <a href=\"https:\/\/bekhan.org\/Information+Technology\/Development\/Terms\/Bounding+Box+(%D0%9E%D0%B3%D1%80%D0%B0%D0%BD%D0%B8%D1%87%D0%B8%D0%B2%D0%B0%D1%8E%D1%89%D0%B0%D1%8F+%D0%BA%D0%BE%D1%80%D0%BE%D0%B1%D0%BA%D0%B0)\" rel=\"noopener noreferrer nofollow\">bounding box<\/a> <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430<\/code>), \u043e\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u043c\u0443 <code>\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0443<\/code>, \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u0442 \u043c\u043e\u0433 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0434 \u043d\u0438\u043c.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e89972e08276d7c02da3\" data-style=\"\" id=\"6549e89972e08276d7c02da3\" width=\"\"><\/div>\n<h3>3.17 Rasterizing (\u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f)<\/h3>\n<p>The <code>rasterizer<\/code> receives the <code>triangles<\/code> he\u2019s responsible for and first does a quick check if the triangle even <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/faces+forward\" rel=\"noopener noreferrer nofollow\">faces forward<\/a>. If not, it\u2019s thrown away (<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Backface+Culling+(%D0%9E%D1%82%D1%81%D0%B5%D1%87%D0%B5%D0%BD%D0%B8%D0%B5+%D0%97%D0%B0%D0%B4%D0%BD%D0%B8%D1%85+%D0%93%D1%80%D0%B0%D0%BD%D0%B5%D0%B9)\" rel=\"noopener noreferrer nofollow\">backface culling<\/a>). If the <code>triangle<\/code> is \u201cvalid\u201d, the <code>rasterizer<\/code> creates <code>pre-pixels<\/code>\/<code>fragments<\/code> by calculating the <code>edges<\/code> which connect the <code>vertices<\/code> (<code>edge setup<\/code>) and so seeing which <code>pixels<\/code> quads (2\u00d72 <code>pixels<\/code>) belong to the <code>triangle<\/code>.<\/p>\n<p><code>\u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438<\/code>, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043b\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/faces+forward\" rel=\"noopener noreferrer nofollow\">\u0432\u043f\u0435\u0440\u0435\u0434<\/a>. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u043e\u043d \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f (<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Backface+Culling+(%D0%9E%D1%82%D1%81%D0%B5%D1%87%D0%B5%D0%BD%D0%B8%D0%B5+%D0%97%D0%B0%D0%B4%D0%BD%D0%B8%D1%85+%D0%93%D1%80%D0%B0%D0%BD%D0%B5%D0%B9)\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u043d\u0438\u0445 \u0433\u0440\u0430\u043d\u0435\u0439<\/a>). \u0415\u0441\u043b\u0438 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a<\/code> &#171;\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439&#187;, <code>\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 <code>\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438<\/code>\/<code>\u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b<\/code>, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044f <code>\u0433\u0440\u0430\u043d\u0438<\/code>, \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0435 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code> (<code>\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0433\u0440\u0430\u043d\u0435\u0439<\/code>), \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u0438\u0434\u0438\u0442, \u043a\u0430\u043a\u0438\u0435 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0435<\/code> \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b (2\u00d72 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044f<\/code>) \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 <code>\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0443<\/code>.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e89972e08276d7c02da5\" data-style=\"\" id=\"6549e89972e08276d7c02da5\" width=\"\"><\/div>\n<p>If you\u2019re really into <code>rasterizing<\/code> and <code>micro-triangles<\/code>, you definitely should <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/Microtriangles+Presentation\" rel=\"noopener noreferrer nofollow\">check out this presentation<\/a>. And <a href=\"http:\/\/www.lighthouse3d.com\/tutorials\/glsl-tutorial\/rasterization-and-interpolation\/\" rel=\"noopener noreferrer nofollow\">this article<\/a> gives a good overview about it.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 <code>\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/code> \u0438 <code>\u043c\u0438\u043a\u0440\u043e\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438<\/code>, \u0432\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e \u0441\u0442\u043e\u0438\u0442 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/Microtriangles+Presentation\" rel=\"noopener noreferrer nofollow\">\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439<\/a>. \u0410 <a href=\"http:\/\/www.lighthouse3d.com\/tutorials\/glsl-tutorial\/rasterization-and-interpolation\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u0434\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435.<\/p>\n<p>That the <code>raster engine<\/code> always works with 2\u00d72 <code>pixels<\/code> which can make the <code>render<\/code> process inefficient. <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book3#update12-3\" rel=\"noopener noreferrer nofollow\">See Book III for details<\/a>.<\/p>\n<p>\u0422\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e <code>\u0440\u0430\u0441\u0442\u0435\u0440\u043d\u044b\u0439 \u0434\u0432\u0438\u0436\u043e\u043a<\/code> \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430\u043c\u0438 2\u00d72 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044f<\/code>, \u043c\u043e\u0436\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 <code>\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430<\/code> \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c. <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book3#update12-3\" rel=\"noopener noreferrer nofollow\">\u0421\u043c. \u041a\u043d\u0438\u0433\u0443 III \u0434\u043b\u044f \u0434\u0435\u0442\u0430\u043b\u0435\u0439<\/a>.<\/p>\n<p>After the <code>pre-pixels<\/code>\/<code>fragments<\/code> are created, there\u2019s a check if they would be even visible (or hidden by already <code>rendered<\/code> stuff):<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <code>\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code>\/<code>\u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/code> \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0431\u0443\u0434\u0443\u0442 \u043b\u0438 \u043e\u043d\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0438\u0434\u0438\u043c\u044b\u043c\u0438 (\u0438\u043b\u0438 \u0441\u043a\u0440\u044b\u0442\u044b\u043c\u0438 \u0443\u0436\u0435 <code>\u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u043d\u044b\u043c\u0438<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438):<\/p>\n<blockquote>\n<p><code>Pixels<\/code> produced by the <code>rasterizer<\/code> are sent to the <code>Z-cull unit<\/code>. The <code>Z-cull unit<\/code> takes a <code>pixel<\/code> tile and compares the depth of <code>pixels<\/code> in the tile with existing <code>pixels<\/code> in the <code>framebuffer<\/code>. <code>Pixel<\/code> tiles that lie entirely behind <code>framebuffer<\/code> <code>pixels<\/code> are culled from the <code>pipeline<\/code>, eliminating the need for further <code>pixel<\/code> shading work.<br \/>\u2013 <a href=\"http:\/\/www.hardwarebg.com\/b4k\/files\/nvidia_gf100_whitepaper.pdf\" rel=\"noopener noreferrer nofollow\">NVIDIA GF100 Whitepaper<\/a><\/p>\n<\/blockquote>\n<blockquote>\n<p><code>\u041f\u0438\u043a\u0441\u0435\u043b\u0438<\/code>, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 <code>\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c<\/code>, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 <code>\u0431\u043b\u043e\u043a Z-\u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f<\/code>. <code>\u0411\u043b\u043e\u043a Z-\u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f<\/code> \u0431\u0435\u0440\u0435\u0442 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0439<\/code> \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0433\u043b\u0443\u0431\u0438\u043d\u0443 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code> \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0435 \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c\u0438<\/code> \u0432 <code>\u043a\u0430\u0434\u0440\u043e\u0432\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435<\/code>. <code>\u041f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0435<\/code> \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0430 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c\u0438<\/code> <code>\u043a\u0430\u0434\u0440\u043e\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430<\/code>, \u043e\u0442\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u043e\u0442 <code>\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430<\/code>, \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u043e\u0442\u0442\u0435\u043d\u0435\u043d\u0438\u044e <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code>.<br \/>\u2013 <a href=\"http:\/\/www.hardwarebg.com\/b4k\/files\/nvidia_gf100_whitepaper.pdf\" rel=\"noopener noreferrer nofollow\">NVIDIA GF100 Whitepaper<\/a><\/p>\n<\/blockquote>\n<h3>3.18 Pixel Shader<\/h3>\n<p>After the <code>pre-pixels<\/code>\/<code>fragments<\/code> are generated they can be \u201cfilled\u201d. For every <code>pre-pixel<\/code>\/<code>fragment<\/code> a new thread is generated and again distributed to all the available cores (like it was done with all the <code>vertices<\/code>).<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <code>\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code>\/<code>\u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/code> \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c &#171;\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b&#187;. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e <code>\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044f<\/code>\/<code>\u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0438 \u0441\u043d\u043e\u0432\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u044f\u0434\u0440\u0430\u043c (\u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0441\u043e \u0432\u0441\u0435\u043c\u0438 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438<\/code>).<\/p>\n<p>\u201cAgain we <code>batch<\/code> up 32 <code>pixel<\/code> threads, or better say 8 times 2\u00d72 <code>pixel<\/code> quads, which is the smallest unit we will always work with in <code>pixel shaders<\/code>.\u201d<\/p>\n<p>&#171;\u0421\u043d\u043e\u0432\u0430 \u043c\u044b <code>\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u043c<\/code> 32 \u043f\u043e\u0442\u043e\u043a\u0430 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code>, \u0438\u043b\u0438 \u043b\u0443\u0447\u0448\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, 8 \u0440\u0430\u0437 \u043f\u043e 2\u00d72 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0445<\/code> \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0435\u0434\u0438\u043d\u0438\u0446\u0435\u0439, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0445 \u0448\u0435\u0439\u0434\u0435\u0440\u0430\u0445<\/code>.&#187;<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e8993add78308984debb\" data-style=\"\" id=\"6549e8993add78308984debb\" width=\"\"><\/div>\n<p>When the cores are done with their work, they write the results into the <code>registers<\/code> from where they are taken and put into the <code>caches<\/code> for the last step: <code>Raster Output (ROP)<\/code>.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f\u0434\u0440\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0430\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u043e\u043d\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 <code>\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b<\/code>, \u043e\u0442\u043a\u0443\u0434\u0430 \u043e\u043d\u0438 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 <code>\u043a\u044d\u0448\u0438<\/code> \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u0442\u0430\u043f\u0430: <code>\u0420\u0430\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u0432\u044b\u0432\u043e\u0434<\/code> (<code>ROP<\/code>).<\/p>\n<h3>3.19 Raster Output (\u0420\u0430\u0441\u0442\u0440\u043e\u0432\u044b\u0439 \u0432\u044b\u0432\u043e\u0434)<\/h3>\n<p>The final step is done by the so called \u201c<code>Raster Output<\/code>\u201d Units which move the final <code>pixel<\/code> data (just got from the <code>pixel shader<\/code>) from <code>L2 cache<\/code> into the <code>framebuffer<\/code> which lays around in the <code>VRAM<\/code>. The <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/GF100\" rel=\"noopener noreferrer nofollow\">GF100<\/a> as an example has 48 such <code>ROPs<\/code> and I interpret the dataflow (from <code>L2 cache<\/code> to <code>VRAM<\/code>) based on that they are placed really near to each other:<\/p>\n<p>\u0417\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u0442\u0430\u043f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u0431\u043b\u043e\u043a\u0430\u043c\u0438 &#171;<code>\u0420\u0430\u0441\u0442\u0440\u043e\u0432\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430<\/code>&#171;, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u044e\u0442 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code> (\u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code>) \u0438\u0437 <code>\u043a\u044d\u0448\u0430 L2<\/code> \u0432 <code>\u0431\u0443\u0444\u0435\u0440 \u043a\u0430\u0434\u0440\u0430<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <code>VRAM<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/GF100\" rel=\"noopener noreferrer nofollow\">GF100<\/a> \u0438\u043c\u0435\u0435\u0442 48 \u0442\u0430\u043a\u0438\u0445 <code>ROP<\/code>, \u0438 \u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u044e \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 (\u043e\u0442 <code>\u043a\u044d\u0448\u0430 L2<\/code> \u043a <code>VRAM<\/code>) \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u043d\u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u044b \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0438\u0437\u043a\u043e \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443:<\/p>\n<blockquote>\n<p>\u201c[\u2026] <code>L2 cache<\/code>, and <code>ROP<\/code> group are closely coupled [\u2026]\u201d<br \/>\u2013 <a href=\"http:\/\/www.hardwarebg.com\/b4k\/files\/nvidia_gf100_whitepaper.pdf\" rel=\"noopener noreferrer nofollow\">NVIDIA GF 100 Whitepaper<\/a><\/p>\n<\/blockquote>\n<blockquote>\n<p>\u201c[\u2026] <code>\u043a\u044d\u0448 L2<\/code> \u0438 \u0433\u0440\u0443\u043f\u043f\u0430 <code>ROP<\/code> \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b [\u2026]\u201d<br \/>\u2013 <a href=\"http:\/\/www.hardwarebg.com\/b4k\/files\/nvidia_gf100_whitepaper.pdf\" rel=\"noopener noreferrer nofollow\">NVIDIA GF 100 Whitepaper<\/a><\/p>\n<\/blockquote>\n<p>Besides of just moving <code>pixel<\/code> data, the <code>ROPs<\/code> also take care of <code>pixel<\/code> blending, coverage information for <code>anti aliasing<\/code> and \u201c<code>atomic operations<\/code>\u201d.<\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code>, <code>ROP<\/code> (\u0432 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u0447\u0438\u0441\u043b\u0435) \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0431\u043e\u0442\u044f\u0442\u0441\u044f \u043e <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u043c<\/code> \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0438, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0438 \u0434\u043b\u044f <code>\u0430\u043d\u0442\u0438\u0430\u043b\u0438\u0430\u0441\u0438\u043d\u0433\u0430<\/code> \u0438 <code>\u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/code>.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e899627c4d3097151f45\" data-style=\"\" id=\"6549e899627c4d3097151f45\" width=\"\"><\/div>\n<p>What a ride, it took a long time to bring all the information together so I hope you found this book useful.<\/p>\n<p>\u041a\u0430\u043a\u043e\u0435 \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435, \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u0430 \u043a\u043d\u0438\u0433\u0430 \u0431\u044b\u043b\u0430 \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u0430.<\/p>\n<p>The End.<\/p>\n<p>\u041a\u043e\u043d\u0435\u0446.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/772066\/\"> https:\/\/habr.com\/ru\/articles\/772066\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0442 \u043c\u0435\u043d\u044f, \u043a\u0430\u043a \u043e\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430<\/h2>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u0432\u0437\u044f\u0442\u0430\u00a0<a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book2\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>\u00a0\u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u044f\u0437\u044b\u043a. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435\u00a0<a href=\"https:\/\/simont.de\/\" rel=\"noopener noreferrer nofollow\">\u0430\u0432\u0442\u043e\u0440<\/a>\u00a0\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430<\/a>\u00a0\u0432\u00a0<code>GPU<\/code>\u00a0, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0434\u0435\u0442 \u0431\u043b\u043e\u043a \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430, \u0432\u0437\u044f\u0442\u043e\u0433\u043e \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u0430 \u0434\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u044f\u0437\u044b\u043a. \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0441 \u0446\u0435\u043b\u044c\u044e, \u0447\u0442\u043e\u0431\u044b \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0433 \u0432\u0438\u0434\u0435\u0442\u044c \u0442\u0435\u0440\u043c\u0438\u043d\u044b \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0432\u0435\u0440\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0441 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u043e\u043c.<\/p>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0441\u0435\u0440\u0438\u0439 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e\u0434 \u043e\u0431\u0449\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &#171;\u0410\u0434 \u0420\u0435\u043d\u0434\u0435\u0440\u0430 2.0&#187;. \u0421\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0441\u0442\u0430\u0442\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+(%D0%90%D0%B4+%D0%A0%D0%B5%D0%BD%D0%B4%D0%B5%D1%80%D0%B0+2.0)\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0434\u0435\u043b\u0430\u043b\u0441\u044f \u0441 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f GameDev. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0438\u0433\u0440\u044b \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Rendering+(%D0%A0%D0%B5%D0%BD%D0%B4%D0%B5%D1%80%D0%B8%D0%BD%D0%B3%2C+%D0%9E%D1%82%D1%80%D0%B8%D1%81%D0%BE%D0%B2%D0%BA%D0%B0%2C+%D0%92%D0%B8%D0%B7%D1%83%D0%B0%D0%BB%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F)\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/a>, \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0438 \u043c\u043d\u043e\u0433\u043e \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0443\u0442\u043e\u0447\u043d\u044f\u044e\u0449\u0438\u0435 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u043a\u0438 \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u0432.<\/p>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u0435\u0439 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043c\u043e\u0435\u043c \u0441\u0430\u0439\u0442\u0435\u00a0<a href=\"https:\/\/bekhan.org\/\" rel=\"noopener noreferrer nofollow\">bekhan.org<\/a>. \u0423\u0437\u043d\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u00a0<a href=\"https:\/\/bekhan.org\/About\/%D0%9C%D0%BE%D0%B8+%D1%81%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D1%81%D1%82%D0%B2%D0%B0\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430\u0445<\/a>.<\/p>\n<h2>Pipeline in Detail (\u041f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0432 \u0414\u0435\u0442\u0430\u043b\u044f\u0445)<\/h2>\n<p>Most of the constructive feedback I received about this article was \u201cNice explanation, but your\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">pipeline<\/a>\u00a0is 6 years old!\u201d. I wasn\u2019t sure what that exactly meant until\u00a0<a href=\"https:\/\/twitter.com\/pixeljetstream\" rel=\"noopener noreferrer nofollow\">Christoph Kubisch<\/a>\u00a0joined my fight in the\u00a0<code>Render Hell<\/code>. He is a Developer Technology Engineer working for\u00a0<a href=\"http:\/\/www.nvidia.com\/\" rel=\"noopener noreferrer nofollow\">NVIDIA<\/a>\u00a0and whatever question I had,\u00a0<a href=\"https:\/\/developer.nvidia.com\/content\/life-triangle-nvidias-logical-pipeline\" rel=\"noopener noreferrer nofollow\">he answered it<\/a>. And believe me, I had a lot! \ud83d\ude42<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043e\u0442\u0437\u044b\u0432\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%BF%D0%BE+%D1%8D%D1%82%D0%BE%D0%B9+%D1%81%D1%82%D0%B0%D1%82%D1%8C%D0%B5\" rel=\"noopener noreferrer nofollow\">\u043f\u043e \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u0431\u044b\u043b\u0438 \u0432 \u0434\u0443\u0445\u0435: &#171;\u0425\u043e\u0440\u043e\u0448\u0435\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435, \u043d\u043e \u0432\u0430\u0448\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/a>\u00a0\u0443\u0441\u0442\u0430\u0440\u0435\u043b \u043d\u0430 6 \u043b\u0435\u0442!&#187;. \u042f \u043d\u0435 \u0431\u044b\u043b \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u043e\u043a\u0430\u00a0<a href=\"https:\/\/twitter.com\/pixeljetstream\" rel=\"noopener noreferrer nofollow\">\u041a\u0440\u0438\u0441\u0442\u043e\u0444 \u041a\u0443\u0431\u0438\u0448<\/a>\u00a0\u043d\u0435 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043b\u0441\u044f \u043a\u00a0<code>\u043c\u043e\u0435\u0439 \u043a\u043d\u0438\u0433\u0435<\/code>. \u041e\u043d \u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c \u043d\u0430\u00a0<a href=\"http:\/\/www.nvidia.com\/\" rel=\"noopener noreferrer nofollow\">NVIDIA<\/a>, \u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b,\u00a0<a href=\"https:\/\/developer.nvidia.com\/content\/life-triangle-nvidias-logical-pipeline\" rel=\"noopener noreferrer nofollow\">\u043e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u043b<\/a>. \u0418 \u043f\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043c\u043d\u0435, \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432! \ud83d\ude42<\/p>\n<blockquote>\n<p>Our explanation is mostly based on\u00a0<code>NVIDIA<\/code>\u00a0architecture due the fact that Christoph is working for\u00a0<code>NVIDIA<\/code>. I hope you don\u2019t misunderstand this as an advertisement. We both just share the passion to explain stuff and I was really happy to have someone who could help me with that technical knowledge.<\/p>\n<p>Be aware that we omitted and simplified some details.  <\/p>\n<\/blockquote>\n<blockquote>\n<p>\u041d\u0430\u0448\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0431\u0430\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435\u00a0<code>NVIDIA<\/code>\u00a0\u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u041a\u0440\u0438\u0441\u0442\u043e\u0444 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430\u00a0<code>NVIDIA<\/code>. \u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u044b \u043d\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0435\u043a\u043b\u0430\u043c\u0443. \u041c\u044b \u043e\u0431\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u0430\u0441\u0442\u044c \u043a \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044e \u0432\u0435\u0449\u0435\u0439, \u0438 \u044f \u0431\u044b\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432, \u0447\u0442\u043e \u043d\u0430\u0448\u0435\u043b \u043a\u043e\u0433\u043e-\u0442\u043e, \u043a\u0442\u043e \u043c\u043e\u0433 \u043f\u043e\u043c\u043e\u0447\u044c \u043c\u043d\u0435 \u0441 \u044d\u0442\u0438\u043c\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0418\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u043c\u044b \u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0438 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438  <\/p>\n<\/blockquote>\n<p>Two\u00a0<strong>major<\/strong>\u00a0points of the\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">pipeline<\/a>\u00a0will be explained below, which\u00a0<strong>weren\u2019t<\/strong>\u00a0totally wrong explained\u00a0<a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1\" rel=\"noopener noreferrer nofollow\">here in book I<\/a>, but might not be clear enough:<\/p>\n<p>\u0414\u0432\u0430\u00a0<strong>\u0433\u043b\u0430\u0432\u043d\u044b\u0445<\/strong>\u00a0\u043c\u043e\u043c\u0435\u043d\u0442\u0430\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430<\/a>\u00a0\u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u044b \u043d\u0438\u0436\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435\u00a0<strong>\u043d\u0435 \u0431\u044b\u043b\u0438<\/strong>\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%BF%D0%BE%D0%BB%D0%BD%D0%BE%D1%81%D1%82%D1%8C%D1%8E+%D0%BD%D0%B5%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D1%8C%D0%BD%D0%BE\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e<\/a>\u00a0\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u044b\u00a0<a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c \u0432 \u043a\u043d\u0438\u0433\u0435 I<\/a>, \u043d\u043e \u043c\u043e\u0433\u043b\u0438 \u0431\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u044f\u0441\u043d\u044b\u043c\u0438:<\/p>\n<ol>\n<li>\n<p><strong>Not<\/strong>\u00a0everything is done by the \u201ctiny\u201d\u00a0<code>GPU<\/code>\u00a0cores!<\/p>\n<\/li>\n<li>\n<p>There can be\u00a0<strong>several parallel<\/strong>\u00a0running\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">pipelines<\/a>!  <\/p>\n<\/li>\n<\/ol>\n<ol>\n<li>\n<p><strong>\u041d\u0435<\/strong>\u00a0\u0432\u0441\u0451 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f &#171;\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438&#187; \u044f\u0434\u0440\u0430\u043c\u0438\u00a0<code>GPU<\/code>!<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c\u00a0<strong>\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/strong>\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445\u00a0<a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u0432<\/a>!<\/p>\n<\/li>\n<\/ol>\n<p>Below I\u2019ll go into detail about it. <strong>Have fun<\/strong>!<\/p>\n<p>\u041d\u0438\u0436\u0435 \u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u044d\u0442\u043e\u043c.\u00a0<strong>\u041f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f<\/strong>!  <\/p>\n<h2>1. Not everything is done by the \u201ctiny\u201d GPU cores! (\u041d\u0435\u00a0\u0432\u0441\u0451 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f &#171;\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438&#187; \u044f\u0434\u0440\u0430\u043c\u0438 GPU!)<\/h2>\n<p>In the <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">pipeline<\/a> example <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">above<\/a> it might seem like every <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">pipeline<\/a> stage is done by the <code>GPU<\/code> Cores \u2013 This is <strong>NOT<\/strong> the case! In fact, most of the stuff is <strong>not<\/strong> done by them. In the new section in <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1#update12-1\" rel=\"noopener noreferrer nofollow\">\u201c1. Copy the data into system memory for fast access\u201d<\/a> you already saw that several components are necessary to just bring the data to a core. So what work do the cores actually do?<\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">\u0432\u044b\u0448\u0435<\/a> \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430<\/a> \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Terms\/Graphic+Pipeline+(%D0%93%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BA%D0%BE%D0%BD%D0%B2%D0%B5%D0%B9%D0%B5%D1%80)\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430<\/a> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u044f\u0434\u0440\u0430\u043c\u0438 <code>GPU<\/code> &#8212; \u044d\u0442\u043e <strong>\u041d\u0415<\/strong> \u0442\u0430\u043a! \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0437\u0430\u0434\u0430\u0447 <strong>\u043d\u0435<\/strong> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0438\u043c\u0438. \u0412 \u043d\u043e\u0432\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"http:\/\/simonschreibt.de\/gat\/renderhell-book1#update12-1\" rel=\"noopener noreferrer nofollow\">\u201c1. \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430\u201d<\/a> \u0432\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u044f\u0434\u0440\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0422\u0430\u043a \u0447\u0442\u043e \u0436\u0435 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u044f\u0434\u0440\u0430?<\/p>\n<p>Let\u2019s observe one:<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0434\u043d\u043e \u0438\u0437 \u044f\u0434\u0435\u0440:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6549e897627c4d3097151f3f\" data-style=\"\" id=\"6549e897627c4d3097151f3f\" width=\"\"><\/div>\n<p>A core can receive commands and data. Then it executes the command by calculating the data in a <code>floating point<\/code> unit (<code>FP<\/code> UNIT) <strong>or<\/strong> an <code>integer<\/code> unit (<code>INT<\/code> UNIT). So you could say: A core can calculate <code>pixels<\/code> and <code>vertices<\/code> (maybe also other calculations like physics but let\u2019s focus on <code>graphic rendering<\/code>).<\/p>\n<p>\u042f\u0434\u0440\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b (\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438) \u0438 \u0434\u0430\u043d\u043d\u044b\u0435. \u0417\u0430\u0442\u0435\u043c \u043e\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u043b\u043e\u043a\u0435 \u0441 <code>\u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439<\/code> (<code>FP<\/code>-\u0431\u043b\u043e\u043a) <strong>\u0438\u043b\u0438<\/strong> \u0432 <code>\u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u043c<\/code> \u0431\u043b\u043e\u043a\u0435 (<code>INT<\/code>-\u0431\u043b\u043e\u043a). \u0422\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c: \u044f\u0434\u0440\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0438<\/code> \u0438 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code> (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a\u0436\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u0438\u0437\u0438\u043a\u0443, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043c\u0441\u044f \u043d\u0430 <code>\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0435<\/code>).<\/p>\n<p>Other important stuff like distribute the <code>render<\/code>-tasks, calculate <code>tessellation<\/code>, culling and preparing the fragments for the <code>pixel shader<\/code>, depth testing and writing <code>pixels<\/code> into the <code>frame buffer<\/code> are <strong>NOT<\/strong> done by the cores. This work is done by special, <strong>not<\/strong> programmable hardware blocks which are also placed in the <code>GPU<\/code>.<\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447 <code>\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430<\/code>, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 <code>\u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u0438<\/code>, \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code>, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u0438 \u0437\u0430\u043f\u0438\u0441\u044c <code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code> \u0432 <code>\u0431\u0443\u0444\u0435\u0440 \u043a\u0430\u0434\u0440\u0430<\/code>, <strong>\u041d\u0415<\/strong> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u044f\u0434\u0440\u0430\u043c\u0438. \u042d\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 <strong>\u043d\u0435<\/strong> \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0431\u043b\u043e\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 <code>GPU<\/code>.<\/p>\n<p>Ok, after we know that now, let\u2019s move on to the next major point I have to clear out:<\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u044d\u0442\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0432\u0430\u0436\u043d\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u044f\u0441\u043d\u0438\u0442\u044c:<\/p>\n<h2>2. There can be several parallel running pipelines! (\u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u0432!)<\/h2>\n<p>First, I\u2019ll give you a short example what I mean with that headline. If you\u2019re still thirsty after this, I\u2019ll take you into an even <strong>more<\/strong> detailed explanation.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0432\u0430\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443 \u043f\u043e\u0434 \u044d\u0442\u0438\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0443 \u0432\u0430\u0441 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044e <strong>\u0431\u043e\u043b\u0435\u0435<\/strong> \u0434\u0435\u0442\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>But first, let\u2019s recap:<\/p>\n<p>\u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c:<\/p>\n<p>If we would only have <strong>one<\/strong> <code>GPU<\/code> Core, what could we calculate with it?<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e <strong>\u043e\u0434\u043d\u043e<\/strong> \u044f\u0434\u0440\u043e <code>GPU<\/code>, \u0447\u0442\u043e \u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e?<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>Correct: Nothing! Because the core needs someone who assigns him some work. This is done by a <code>Streaming Multiprocessor<\/code> (<code>SM<\/code>) which can handle a stream of <code>vertices<\/code>\/<code>pixels<\/code> which belong to <strong>one<\/strong> <code>shader<\/code>. OK, with that <code>SM<\/code> and one core we could calculate one <code>vertex<\/code>\/<code>pixel<\/code> at a time:<\/p>\n<p>\u0412\u0435\u0440\u043d\u043e: \u041d\u0438\u0447\u0435\u0433\u043e! \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044f\u0434\u0440\u0443 \u043d\u0443\u0436\u0435\u043d \u043a\u0442\u043e-\u0442\u043e, \u043a\u0442\u043e \u043f\u043e\u0440\u0443\u0447\u0438\u0442 \u0435\u043c\u0443 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0443. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0445 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432<\/code> (<code>SM<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043a <code>\u0432\u0435\u0440\u0448\u0438\u043d<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code>, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a <strong>\u043e\u0434\u043d\u043e\u043c\u0443<\/strong> <code>\u0448\u0435\u0439\u0434\u0435\u0440\u0443<\/code>. \u0425\u043e\u0440\u043e\u0448\u043e, \u0441 \u044d\u0442\u0438\u043c <code>SM<\/code> \u0438 \u043e\u0434\u043d\u0438\u043c \u044f\u0434\u0440\u043e\u043c \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043e\u0434\u043d\u0443 <code>\u0432\u0435\u0440\u0448\u0438\u043d\u0443<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c<\/code> \u0437\u0430 \u0440\u0430\u0437:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>Of course, if we increase the amount of cores, there can be more <code>vertices<\/code>\/<code>pixels<\/code> calculated <strong>at the same time<\/strong>. But only if they belong to the same <code>shader<\/code>!<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0434\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 <code>\u0432\u0435\u0440\u0448\u0438\u043d<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/code> <strong>\u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e<\/strong>. \u041d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 <code>\u0448\u0435\u0439\u0434\u0435\u0440\u0443<\/code>!<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>This was already explained in my <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">first attempt<\/a> of explaining the <code>pipeline<\/code>! But now it gets interesting: What if we would add <strong>another<\/strong> <code>Streaming Multiprocessor<\/code> which cares about half of the cores?<\/p>\n<p>\u042d\u0442\u043e \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043e \u0432 \u043c\u043e\u0435\u0439 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435<\/a> \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c <code>\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/code>! \u041d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e: \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c <strong>\u0435\u0449\u0435 \u043e\u0434\u0438\u043d<\/strong> <code>\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u043e\u0439 \u044f\u0434\u0435\u0440?<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>Now we can not only calculate <code>vertices<\/code>\/<code>pixels<\/code> in parallel, we can also take care about <strong>2 <\/strong><code>shader<\/code> streams at the same time! This means, we can for example run two different <code>pixel shaders<\/code> at the same time or run a <code>vertex shader<\/code> AND a <code>pixel shader<\/code> at the same time!<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c <code>\u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/code>\/<code>\u043f\u0438\u043a\u0441\u0435\u043b\u0438<\/code>, \u043d\u043e \u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c <strong>2 \u043f\u043e\u0442\u043e\u043a\u0430 <\/strong><code>\u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432<\/code>! \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0445 \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/code> \u0438\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <code>\u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/code> \u0438 <code>\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/code> \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e!<\/p>\n<p>This rough example shall just give you a glimpse about that several different hardware blocks are involved and they all work in parallel so the <code>pipeline<\/code> is more flexible than I described in my <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">first attempt<\/a>.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u0433\u0440\u0443\u0431\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0430\u0442\u044c \u0432\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u0438 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u0447\u0442\u043e <code>\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/code> \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u0439, \u0447\u0435\u043c \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0432 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/bekhan.org\/Information+Technology\/Graphics\/Rendering\/Render+Hell+2.0\/Render+Hell+2.0+%E2%80%93+Book+II.+Pipeline\/Other\/%D0%9F%D0%B5%D1%80%D0%B2%D0%B0%D1%8F+%D0%BF%D0%BE%D0%BF%D1%8B%D1%82%D0%BA%D0%B0+%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B8%D1%82%D1%8C+%D0%BF%D0%B0%D0%B9%D0%BF%D0%BB%D0%B0%D0%B9%D0%BD\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0435<\/a>.<\/p>\n<p>Anyone still thirsty? Then let\u2019s get into more detail!<\/p>\n<p>\u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438? \u0422\u043e\u0433\u0434\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0433\u043b\u0443\u0431\u0438\u043c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438!<\/p>\n<h2>3. In-Depth look into the pipeline stages (\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u044d\u0442\u0430\u043f\u044b \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430)<\/h2>\n<h3>3.1 Overview (\u041e\u0431\u0437\u043e\u0440)<\/h3>\n<p>First of all: Why do we need a flexible\/parallel <code>pipeline<\/code>? The reason is, that you can\u2019t foresee, what workload you\u2019ll have. Especially with <code>tessellation<\/code> it might be, that there are suddenly 100.000 more <code>polygons<\/code> on the screen than one <code>frame<\/code> before. Therefore you need a flexible <code>pipeline<\/code> which handles totally different workloads.<\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e: \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0433\u0438\u0431\u043a\u0438\u0439\/\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 <code>\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/code>? \u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441 <code>\u0442\u0435\u0441\u0441\u0435\u043b\u044f\u0446\u0438\u0435\u0439<\/code> \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u0432\u0434\u0440\u0443\u0433 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u0430 100 000 <code>\u043f\u043e\u043b\u0438\u0433\u043e\u043d\u043e\u0432<\/code> \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0437\u0430 \u043e\u0434\u0438\u043d <code>\u043a\u0430\u0434\u0440<\/code> \u0434\u043e \u044d\u0442\u043e\u0433\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0433\u0438\u0431\u043a\u0438\u0439 <code>\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u043c\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u043c\u0438.<\/p>\n<p><strong>DON\u2019T WORRY!<\/strong> (<strong>\u041d\u0415 \u0411\u041e\u0419\u0422\u0415\u0421\u042c!<\/strong>)<\/p>\n<p>Please don\u2019t be afraid by looking at the two following images (like I am when i read a Wikipedia article and see formulas between the text)! Yes, this stuff isn\u2019t easy and even complex charts only show what a programmer needs to know and hide a lot of the \u201creal\u201d complexity. I only show it to give you a rough understand <strong>how<\/strong> complicated this stuff is. \ud83d\ude42<\/p>\n<p>\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043d\u0435 \u0431\u043e\u0439\u0442\u0435\u0441\u044c, \u0433\u043b\u044f\u0434\u044f \u043d\u0430 \u0434\u0432\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043a\u0430\u043a \u044f, \u043a\u043e\u0433\u0434\u0430 \u0447\u0438\u0442\u0430\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u0432 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438 \u0438 \u0432\u0438\u0436\u0443 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043a\u0441\u0442\u043e\u043c)! \u0414\u0430, \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u0438 \u0434\u0430\u0436\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u0438 \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u043e &#171;\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439&#187; \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u042f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u0442\u044c \u0432\u0430\u043c \u0433\u0440\u0443\u0431\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, <strong>\u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e<\/strong> \u0441\u043b\u043e\u0436\u043d\u043e\u0439<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-359390","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/359390","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=359390"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/359390\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=359390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=359390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=359390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}