{"id":299668,"date":"2020-03-04T15:00:40","date_gmt":"2020-03-04T15:00:40","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=299668"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=299668","title":{"rendered":"\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/473102\/\">\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043b\u0435\u0434\u0438\u043b\u0438 \u0437\u0430 \u043c\u043e\u0435\u0439 \u0441\u0435\u0440\u0438\u0435\u0439 \u043f\u043e\u0441\u0442\u043e\u0432 <a href=\"https:\/\/tayfunkayhan.wordpress.com\/2018\/11\/24\/rasterization-in-one-weekend\/\" rel=\"nofollow\">\u00ab\u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430 \u043e\u0434\u043d\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435\u00bb<\/a>, \u043d\u043e \u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0438 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438 \u0434\u0435\u043c\u043e, \u0442\u043e \u0434\u043b\u044f \u0432\u0430\u0441 \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0441\u044e\u0440\u043f\u0440\u0438\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u044f \u0441\u043a\u0430\u0436\u0443, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u043d\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0435\u0440\u0438\u0438 \u043f\u043e\u0441\u0442\u043e\u0432 \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043c\u0443\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u043d\u043e\u0439 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<p>  \u041a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b <a rel=\"nofollow\" href=\"https:\/\/github.com\/NotCamelCase\/Tyler\">Tyler<\/a> \u2014 \u0442\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041c\u043e\u0435\u0439 \u0446\u0435\u043b\u044c\u044e \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u044b\u043b\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c. \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u043b\u044e\u0434\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u044f\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0432 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 \u0438 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0435\u0439. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043e \u0432 \u0441\u0435\u0440\u0438\u0438 <a href=\"https:\/\/tayfunkayhan.wordpress.com\/2018\/11\/24\/rasterization-in-one-weekend\/\" rel=\"nofollow\">\u00ab\u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430 \u043e\u0434\u043d\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435\u00bb<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u0435\u0451. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u0435\u0451 \u0438\u0437\u0443\u0447\u0438\u043b\u0438, \u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0439 \u2014 \u044f \u043d\u0435 \u0445\u043e\u0447\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0438 \u0442\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u0445.<\/p>\n<h2>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0431\u0437\u043e\u0440<\/h2>\n<p>  <a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Tiled_rendering\">\u0422\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/a> (tile-based rendering \u0438\u043b\u0438 tiled rendering) \u2014 \u044d\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c <em>immediate-mode<\/em>-\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u043e\u043c; \u0432 \u043d\u0451\u043c render target (RT) \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 <em>\u0442\u0430\u0439\u043b\u044b<\/em> (\u0442.\u0435. \u0441\u0443\u0431\u0440\u0435\u0433\u0438\u043e\u043d\u044b \u043a\u0430\u0434\u0440\u043e\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430), \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u0432 \u0442\u0430\u0439\u043b\u044b \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/607\/72c\/cfb\/60772ccfb0d154ed83231fb06351590e.png\"><\/div>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u00ab\u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438\u00bb, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u043e \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u044d\u0442\u043e\u0439 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 immediate-mode: \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0430\u0439\u043b\u0430 \u0431\u0443\u0444\u0435\u0440\u0430\u043c\u0438 \u0446\u0432\u0435\u0442\u043e\u0432\/\u0433\u043b\u0443\u0431\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u00ab\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0439\u00bb DRAM \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u043a\u044d\u0448\u0430 \u043d\u0430 \u0447\u0438\u043f\u0435.<a name=\"habracut\"><\/a> \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u044d\u0442\u0430 \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0449\u0430\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u0443\u044e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430 <a rel=\"nofollow\" href=\"https:\/\/www.imgtec.com\/blog\/a-look-at-the-powervr-graphics-architecture-tile-based-rendering\/\">\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445<\/a> <a rel=\"nofollow\" href=\"https:\/\/developer.arm.com\/solutions\/graphics\/developer-guides\/tile-based-rendering\/single-page\">\u043c\u0430\u043b\u043e\u043c\u043e\u0449\u043d\u044b\u0445<\/a> GPU. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u043d\u0438\u0436\u0435: \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0438 \u0437\u0430\u0442\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u0436\u0435, \u0430 \u0432 \u043d\u0438\u0436\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <em>\u043e\u0442\u043b\u043e\u0436\u0435\u043d\u044b<\/em>.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/79a\/38c\/a9a\/79a38ca9a84a3869c05be320f2423141.jpg\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/355\/879\/289\/355879289b4983c1fceab9fbb38fdbbb.jpg\"><\/div>\n<p>  <i><a rel=\"nofollow\" href=\"https:\/\/www.imgtec.com\/blog\/a-look-at-the-powervr-graphics-architecture-tile-based-rendering\/\">\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440 Immediate-mode \u0438 Tile-based (PowerVR)<\/a><\/i><\/p>\n<p>  \u041d\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0435 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0430\u0439\u043b\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0430\u0439\u043b, \u0430 \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u0442\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0432\u043e \u0432\u0441\u0435\u0445 \u0442\u0430\u0439\u043b\u0430\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 <em>\u0438\u043b\u0438<\/em>, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u043b\u0443\u0447\u0448\u0435, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0432 \u0442\u0430\u043a\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0434\u0435\u0442\u0430\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0438\u0436\u0435 \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Tyler.<\/p>\n<p>  \u042d\u0442\u043e\u0442 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 3D-\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u044d\u0442\u0430\u043f\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438, \u043e\u0442 \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0434\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435:<\/p>\n<ul>\n<li>\u0412\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/li>\n<li>Clipper (\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u044b\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432!)<\/li>\n<li>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0438 \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432<\/li>\n<li>\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0449\u0438\u043a<\/li>\n<li>\u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440<\/li>\n<li>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/li>\n<\/ul>\n<p>  Tyler \u0438\u043c\u0435\u0435\u0442 \u043f\u0441\u0435\u0432\u0434\u043e-API \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430, \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e API, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u044f \u0441\u0441\u044b\u043b\u0430\u044e\u0441\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440 <a rel=\"nofollow\" href=\"https:\/\/github.com\/NotCamelCase\/Tyler-Samples\/blob\/master\/SceneRendering\/SceneRendering.cpp\">Scene Rendering<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0444\u0430\u0439\u043b \u0441\u0446\u0435\u043d\u044b .OBJ \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0448\u0435\u0439, \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u0438 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u044b\u0439 \u0441\u0446\u0435\u043d\u0443 \u0432 \u043e\u043a\u043d\u0435.<\/p>\n<h6>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/h6>\n<p>  <\/p>\n<pre><code class=\"cpp\">\/\/ Create and initialize the rasterizer rendering context RenderContext* pRenderContext = new RenderContext(config); pRenderContext-&amp;gt;Initialize()  \/\/ Allocate color &amp;amp; depth buffers uint8_t* pColorBuffer = ... \/\/ Color buffer format == R8G8B8A8_UNORM float* pDepthBuffer = ... \/\/ Depth buffer format == D32_FLOAT  \/\/ Set up main FBO Framebuffer fbo = {}; fbo.m_pColorBuffer = pColorBuffer; fbo.m_pDepthBuffer = pDepthBuffer; fbo.m_Width = opt.m_ScreenWidth; fbo.m_Height = opt.m_ScreenHeight;  \/\/ Single vec3 attribute is used to pass vertex normal VS -&amp;gt; FS ShaderMetadata metadata = { 0, 1 \/*vertex normal*\/, 0 };  \/\/ Emulate passing of constants data to shaders Constants cb; cb.m_ModelViewProj = proj * view * model;  \/\/ We will have single index and vertex buffer to draw indexed mesh std::vector&lt;Vertex&amp;gt; vertexBuffer; std::vector&lt;uint32_t&amp;gt; indexBuffer; \/\/ Store data of all scene objects to be drawn std::vector&lt;Mesh&amp;gt; objects;  \/\/ Load .OBJ scene model data and generate vertex\/index buffers, etc. InitializeSceneObjects(opt.m_OBJName, objects, vertexBuffer, indexBuffer);  \/\/ Bind FBO to be used in subsequent render pass once pRenderContext-&amp;gt;BindFramebuffer(&amp;amp;fbo);  \/\/ Bind VBO and set buffer stride pRenderContext-&amp;gt;BindVertexBuffer(vertexBuffer.data(), sizeof(Vertex)); \/\/ Bind IBO pRenderContext-&amp;gt;BindIndexBuffer(indexBuffer.data());  \/\/ Bind shader constants pRenderContext-&amp;gt;BindConstantBuffer(&amp;amp;cb);  \/\/ Bind shader, constant buffer, texture(s) pRenderContext-&amp;gt;BindShaders(VS, FS, metadata);<\/code><\/pre>\n<p>  <\/p>\n<h6>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430<\/h6>\n<p>  <\/p>\n<pre><code class=\"cpp\">                \/\/ Clear RT                 pRenderContext-&amp;gt;BeginRenderPass(                     true, \/*clearColor*\/                     glm::vec4(0, 0, 0, 1) \/*colorValue*\/,                     true, \/*clearDepth*\/                     FLT_MAX \/*depthValue*\/);                  \/\/ Draw meshes                 for (uint32_t obj = 0; obj &lt; objects.size(); obj++)                 {                     Mesh&amp;amp; mesh = objects[obj];                      view = glm::lookAt(testParams.m_EyePos, testParams.m_LookAtPos, glm::vec3(0, 1, 0));                     \/\/model = glm::rotate(model, glm::radians(0.5f), glm::vec3(0, 1, 0));                     cb.m_ModelViewProj = proj * view * model;                      \/\/ Kick off draw. Note that it blocks callee until drawcall is completed                     pRenderContext-&amp;gt;DrawIndexed(mesh.m_IdxCount, mesh.m_IdxOffset);                 }                  pRenderContext-&amp;gt;EndRenderPass();<\/code><\/pre>\n<p>  \u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043c\u0430\u0433\u0438\u0438: \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 <a rel=\"nofollow\" href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/RasterizerConfig.h\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439<\/a>, \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0431\u0443\u0444\u0435\u0440\u0430 \u043a\u0430\u0434\u0440\u043e\u0432, \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0432\u0435\u0440\u0448\u0438\u043d\/\u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432 \u0438 \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0440\u0435\u043d\u0434\u0435\u0440\u044f\u0442\u0441\u044f \u043f\u043e\u0434 \u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u0435\u0448\u0443 \u0437\u0430 \u0440\u0430\u0437. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0432\u043e\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440; \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 18, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0437\u0432\u0430\u0432\u0448\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u044d\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 API \u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0435 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u044b: \u043e\u043d\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0437\u0430 \u0440\u0430\u0437 \u0438 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0434\u043e \u0435\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f; \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0443\u0436\u0430\u0441\u043d\u043e \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u00ab\u043f\u0430\u043a\u0435\u0442\u044b\u00bb (<em>batches<\/em>) \u043a\u043e\u043c\u0430\u043d\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0432 \u0431\u0443\u0444\u0435\u0440 \u043a\u043e\u043c\u0430\u043d\u0434 \u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044e. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u044d\u0442\u043e\u0433\u043e: 1) \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0433\u043e <a rel=\"nofollow\" href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/display\/video-memory-management-and-gpu-scheduling\">\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442<\/a> CPU &lt;-&gt; GPU \u0438 2) \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 GPU.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u043d\u044f\u043b\u0438, \u043a\u0430\u043a \u0441\u044d\u043c\u043f\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u0442\u0435 \u043d\u0430 <a rel=\"nofollow\" href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/tree\/master\/Tyler\">\u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432<\/a> \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0442\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0444\u0430\u0439\u043b\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <a rel=\"nofollow\" href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/PipelineThread.cpp\">Pipeline Thread<\/a> \u0438 \u0432 <a rel=\"nofollow\" href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/RenderEngine.cpp\">Render Engine<\/a>, \u0430 \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. <em>Render Engine<\/em> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0442\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0433\u0440\u0443\u043f\u043f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0430\u0439\u043b\u0430 \u0438 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u043c\u0430\u0441\u043e\u043a \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 <em>Pipeline Threads<\/em>, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 <em>\u043f\u043e\u0442\u043e\u043a<\/em> \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u044d\u0442\u0430\u043f\u043e\u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430. \u041a\u0430\u043a \u0436\u0435 Render Engine <a href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/RenderEngine.cpp#L186\" rel=\"nofollow\">\u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442<\/a> \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430?<\/p>\n<pre><code class=\"cpp\">\/\/ Prepare for next drawcall ApplyPreDrawcallStateInvalidations();  uint32_t numRemainingPrims = primCount;  uint32_t drawElemsPrev = 0u; uint32_t numIter = 0;  while (numRemainingPrims &amp;gt; 0) {     \/\/ Prepare for next draw iteration     ApplyPreDrawIterationStateInvalidations();      \/\/ How many prims are to be processed this iteration &amp;amp; prims per thread     uint32_t iterationSize = (numRemainingPrims &amp;gt;= m_RenderConfig.m_MaxDrawIterationSize) ? m_RenderConfig.m_MaxDrawIterationSize : numRemainingPrims;     uint32_t perIterationRemainder = iterationSize % m_RenderConfig.m_NumPipelineThreads;     uint32_t primsPerThread = iterationSize \/ m_RenderConfig.m_NumPipelineThreads;      for (uint32_t threadIdx = 0; threadIdx &lt; m_RenderConfig.m_NumPipelineThreads; threadIdx++)     {         uint32_t currentDrawElemsStart = drawElemsPrev;         uint32_t currentDrawElemsEnd = (threadIdx == (m_RenderConfig.m_NumPipelineThreads - 1)) ?             \/\/ If number of remaining primitives in iteration is not multiple of number of threads, have the last thread cover the remaining range             (currentDrawElemsStart + primsPerThread + perIterationRemainder) :             currentDrawElemsStart + primsPerThread;          \/\/ Threads must have been initialized and idle by now!         PipelineThread* pThread = m_PipelineThreads[threadIdx];          \/\/ Assign computed draw elems range for thread         pThread-&amp;gt;m_ActiveDrawParams.m_ElemsStart = currentDrawElemsStart;         pThread-&amp;gt;m_ActiveDrawParams.m_ElemsEnd = currentDrawElemsEnd;         pThread-&amp;gt;m_ActiveDrawParams.m_VertexOffset = vertexOffset;         pThread-&amp;gt;m_ActiveDrawParams.m_IsIndexed = isIndexed;          \/\/ PipelineThread drawcall input prepared, it can start processing of drawcall         pThread-&amp;gt;m_CurrentState.store(ThreadStatus::DRAWCALL_TOP, std::memory_order_release);          drawElemsPrev = currentDrawElemsEnd;         numRemainingPrims -= (currentDrawElemsEnd - currentDrawElemsStart);     }      \/\/ All threads are assigned draw parameters, let them work now     m_DrawcallSetupComplete.store(true, std::memory_order_release);      \/\/ Stall main thread until all active threads complete given draw iteration     WaitForPipelineThreadsToCompleteProcessingDrawcall(); }<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u043f\u043e \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435, \u0430 \u0447\u0442\u043e \u043d\u0430\u0441\u0447\u0451\u0442 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439? \u041e\u043d\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u044b \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0443\u0437\u043d\u0430\u0442\u044c, \u0431\u0443\u0434\u0435\u0442 \u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c 6 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0438\u043b\u0438 5 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u0438 \u043c\u044b \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0445\u043e\u0442\u0438\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440; \u0442\u0430\u043a \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c <em>\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/em>! \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0437\u0430\u0434\u0430\u0451\u043c \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 (\u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u043c\u044b \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c, \u043a\u0430\u043a\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439) \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432, \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0438\u0445 \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u043d\u0430\u0431\u043e\u0440\u0430\u043c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043d\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u043e \u0437\u0430 \u043e\u0434\u043d\u0443 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e. \u042d\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a \u0441 \u044d\u0442\u043e\u0439 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0435 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u044b.<\/p>\n<h6>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438: 3 \u043f\u043e\u0442\u043e\u043a\u0430, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u043e 6 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432 \u043d\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e<\/h6>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/388\/f22\/9c0\/388f229c048cb35137c8046fe3e71802.png\"><\/div>\n<p>  \u041c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432 \u043d\u0435 \u043a\u0440\u0430\u0442\u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0438 \u0438\u0445. \u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u043e\u043f\u0440\u0430\u0432\u0434\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0431\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442 \u043d\u0430\u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043a\u044d\u0448\u0430\u0445 \u043f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0435\u0439. \u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0432\u0445\u043e\u0434\u0438\u043b\u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u044b \u043d\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u043a\u0430 \u0435\u0441\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438; \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0439 \u0444\u043b\u0430\u0433 <em>m_DrawcallSetupComplete<\/em> \u0434\u043b\u044f \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u0434\u0430\u0451\u0442\u0441\u044f \u0437\u0435\u043b\u0451\u043d\u044b\u0439 \u0441\u0432\u0435\u0442 \u0438 \u043c\u044b \u0436\u0434\u0451\u043c, \u043f\u043e\u043a\u0430 <em>\u0432\u0441\u0435<\/em> \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0437\u0432\u0430\u0432\u0448\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0443\u0432\u0438\u0434\u0435\u043b\u0438, \u043a\u0430\u043a \u043f\u043e\u0442\u043e\u043a\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0430\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440.<\/p>\n<h2>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438<\/h2>\n<p>  \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0435\u0440\u0448\u0438\u043d, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0445 \u0438\u0437 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432. \u041e\u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u044d\u0442\u0430\u043f\u043e\u0432 \u0437\u0430\u0442\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0448\u0438\u043d, \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0433\u0440\u0443\u043f\u043f. \u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u043a \u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e!<\/p>\n<h6>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438. \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0435\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435<\/h6>\n<p>  <\/p>\n<pre><code class=\"cpp\">for (uint32_t drawIdx = m_ActiveDrawParams.m_ElemsStart, primIdx = m_ActiveDrawParams.m_ElemsStart % m_RenderConfig.m_MaxDrawIterationSize;     drawIdx &lt; m_ActiveDrawParams.m_ElemsEnd;     drawIdx++, primIdx++) {     \/\/ drawIdx = Assigned prim indices which will be only used to fetch indices     \/\/ primIdx = Prim index relative to current iteration      \/\/ Clip-space vertices to be retrieved from VS     glm::vec4 v0Clip, v1Clip, v2Clip;      \/\/ VS     ExecuteVertexShader&lt;IsIndexed&amp;gt;(drawIdx, primIdx, &amp;amp;v0Clip, &amp;amp;v1Clip, &amp;amp;v2Clip);      \/\/ Bbox of the primitive which will be computed during clipping     Rect2D bbox;      \/\/ CLIPPER     if (!ExecuteFullTriangleClipping(primIdx, v0Clip, v1Clip, v2Clip, &amp;amp;bbox))     {         \/\/ Triangle clipped, proceed iteration with next primitive         continue;     }      \/\/ TRIANGLE SETUP &amp;amp; CULL     if (!ExecuteTriangleSetupAndCull(primIdx, v0Clip, v1Clip, v2Clip))     {         \/\/ Triangle culled, proceed iteration with next primitive         continue;     }      \/\/ BINNER     ExecuteBinner(primIdx, v0Clip, v1Clip, v2Clip, bbox); }<\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0432\u0435\u0439\u0435\u0440, \u043a\u0430\u043a \u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441 \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430 (VS), \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\/\u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0438\u0437 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0432\u0435\u0440\u0448\u0438\u043d\/\u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0438 \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b VS, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0449\u0435\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0437\u0430\u0442\u0435\u043d\u0451\u043d\u043d\u044b\u043c \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u044d\u0448 \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430, \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u0415\u0441\u043b\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0448\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 VS$, \u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 VS, \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432\u0435\u0440\u0448\u0438\u043d \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0437 \u043a\u044d\u0448\u0430, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0451\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0435\u0440\u0448\u0438\u043d. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c VS \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u043a\u043e\u043f\u0438\u044e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0435\u0440\u0448\u0438\u043d \u0432 VS$. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c <a href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/PipelineThread.cpp#L1320\" rel=\"nofollow\"><em>CalculateInterpolationCoefficients<\/em>()<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u0435\u0440\u0448\u0438\u043d \u043f\u0435\u0440\u0435\u0434 \u0438\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 FS. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 \u043a\u043e\u043f\u0438\u044e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432\u0435\u0440\u0448\u0438\u043d, \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0441\u044c \u0432 L1\/L2\/L3 (\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043e\u0442 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0434\u043e \u043d\u0430\u0438\u0445\u0443\u0434\u0448\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f), \u043f\u043e\u043a\u0430 \u043f\u043e\u0442\u043e\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u0430\u043f\u044b \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f VS \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u0435\u0440\u0448\u0438\u043d \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c \u043f\u043e \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0435 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0432 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432, \u0442.\u0435. \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u044d\u043a\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043c\u044b \u0443\u0441\u0435\u043a\u0430\u0435\u043c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u043f\u043e \u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u043d\u044b\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0417\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442?<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/2aa\/7af\/468\/2aa7af468ba08e21b72fb24237ed0b48.png\"><\/div>\n<p>  \u041d\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 X-W (\u0432\u0437\u044f\u0442\u043e\u0433\u043e \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u0411\u043b\u0438\u043d\u043d\u0430 <em>Calculating Screen Coverage<\/em>) \u0442\u0451\u043c\u043d\u043e-\u0441\u0435\u0440\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0442\u043e\u0447\u043a\u0438 \u043f\u0435\u0440\u0435\u0434 \u0433\u043b\u0430\u0437\u043e\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u0438\u0434\u0438\u043c\u044b\u0435, \u0430 \u043d\u0438\u0436\u043d\u044f\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u043e\u0447\u043a\u0438 \u0437\u0430 \u0433\u043b\u0430\u0437\u043e\u043c. \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043b\u0438 \u0432\u0441\u0435 <em>\u0442\u0440\u0438<\/em> \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0438\u043b\u0438 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 <em>Trivial-Accept<\/em> (TA) \u0438\u043b\u0438 \u0436\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043d\u0430\u0440\u0443\u0436\u0438, \u0438\u043b\u0438 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 <em>Trivial-Reject<\/em> (TR). \u0415\u0441\u043b\u0438 \u0432 TA, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u043e\u0435 \u0434\u0435\u043b\u0435\u043d\u0438\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 W), \u0430 \u0435\u0441\u043b\u0438 \u0432 TR, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0435\u043a\u0430\u0442\u044c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044f\u043c\u0438 \u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e. \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u043e\u0439 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u0430\u043d\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u0434\u0430\u0436\u0435 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0432\u0438\u0434\u0438\u043c\u044b\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b, \u0447\u0442\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u043e\u0441\u044c \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u043e\u0441\u0442\u0430\u0445 \u0438 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u00ab\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u00bb (\u0442.\u0435. \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043d\u0435 \u0432 TR \u0438 \u043d\u0435 \u0432 TA), \u0442\u043e \u043c\u044b \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c (\u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u043a\u043e\u043d\u0441\u0435\u0440\u0432\u0430\u0442\u0438\u0432\u043d\u043e!) \u043a\u0430\u043a \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u0441\u0435\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u043b\u043d\u044b\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u044d\u0442\u0430\u043f\u043e\u043c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 (Triangle Setup and Culling), \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0440\u0451\u0431\u0435\u0440. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u00ab\u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430 \u043e\u0434\u043d\u0443 \u043d\u0435\u0434\u0435\u043b\u044e\u00bb, \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b <a href=\"http:\/\/citeseerx.ist.psu.edu\/viewdoc\/download?doi=10.1.1.18.5738&amp;amp;rep=rep1&amp;amp;type=pdf\" rel=\"nofollow\">\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438<\/a> \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0443\u043c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <em>\u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0435\u0440\u0448\u0438\u043d<\/em>:<\/p>\n<pre><code class=\"cpp\">    \/\/ First, transform clip-space (x, y, z, w) vertices to device-space 2D homogeneous coordinates (x, y, w)     const glm::vec4 v0Homogen = TO_HOMOGEN(v0Clip, fbWidth, fbHeight);     const glm::vec4 v1Homogen = TO_HOMOGEN(v1Clip, fbWidth, fbHeight);     const glm::vec4 v2Homogen = TO_HOMOGEN(v2Clip, fbWidth, fbHeight);      \/\/ To calculate EE coefficients, we need to set up a &quot;vertex matrix&quot; and invert it     \/\/ M = |  x0  x1  x2  |     \/\/     |  y0  y1  y2  |     \/\/     |  w0  w1  w2  |      \/\/ Alternatively, we can rely on the following relation between an inverse and adjoint of a matrix: inv(M) = adj(M)\/det(M)     \/\/ Since we use homogeneous coordinates, it's sufficient to only compute adjoint matrix:     \/\/ A = |  a0  b0  c0  |     \/\/     |  a1  b1  c1  |     \/\/     |  a2  b2  c2  |      float a0 = (v2Homogen.y * v1Homogen.w) - (v1Homogen.y * v2Homogen.w);     float a1 = (v0Homogen.y * v2Homogen.w) - (v2Homogen.y * v0Homogen.w);     float a2 = (v1Homogen.y * v0Homogen.w) - (v0Homogen.y * v1Homogen.w);      float b0 = (v1Homogen.x * v2Homogen.w) - (v2Homogen.x * v1Homogen.w);     float b1 = (v2Homogen.x * v0Homogen.w) - (v0Homogen.x * v2Homogen.w);     float b2 = (v0Homogen.x * v1Homogen.w) - (v1Homogen.x * v0Homogen.w);      float c0 = (v2Homogen.x * v1Homogen.y) - (v1Homogen.x * v2Homogen.y);     float c1 = (v0Homogen.x * v2Homogen.y) - (v2Homogen.x * v0Homogen.y);     float c2 = (v1Homogen.x * v0Homogen.y) - (v0Homogen.x * v1Homogen.y);      \/\/ Additionally,     \/\/ det(M) == 0 -&amp;gt; degenerate\/zero-area triangle     \/\/ det(M) &lt; 0  -&amp;gt; back-facing triangle     float detM = (c0 * v0Homogen.w) + (c1 * v1Homogen.w) + (c2 * v2Homogen.w);      \/\/ Assign computed EE coefficients for given primitive     m_pRenderEngine-&amp;gt;m_SetupBuffers.m_pEdgeCoefficients[3 * primIdx + 0] = { a0, b0, c0 };     m_pRenderEngine-&amp;gt;m_SetupBuffers.m_pEdgeCoefficients[3 * primIdx + 1] = { a1, b1, c1 };     m_pRenderEngine-&amp;gt;m_SetupBuffers.m_pEdgeCoefficients[3 * primIdx + 2] = { a2, b2, c2 };<\/code><\/pre>\n<p>  \u0415\u0449\u0451 \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>\u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435<\/em> \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0440\u0451\u0431\u0435\u0440 \u0438 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u0430\u043d\u043e\u0432, \u0438 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u043b\u0438 \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f <em>\u043a\u0430\u0436\u0434\u043e\u0433\u043e<\/em> \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u0442\u044c \u0443\u0437\u043a\u0438\u043c \u043c\u0435\u0441\u0442\u043e\u043c, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u043e\u0440\u043c\u0430\u043b\u0435\u0439 + \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0442\u0435\u043a\u0441\u0442\u0443\u0440. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 (Triangle Setup) \u043c\u044b \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043a \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0442\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043a <em><a href=\"https:\/\/www.gamasutra.com\/view\/feature\/4190\/sponsored_feature_rasterization_.php?print=1\" rel=\"nofollow\">\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e (Binning)<\/a><\/em> (\u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u043d\u043e \u0431\u044b\u043b\u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u044b \u043d\u0435 \u043a\u0435\u043c \u0438\u043d\u044b\u043c, \u043a\u0430\u043a \u0441\u0430\u043c\u0438\u043c \u041c\u0430\u0439\u043a\u043b\u043e\u043c \u0410\u0431\u0440\u0430\u0448\u0435\u043c). \u0420\u043e\u043b\u044c <a href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/PipelineThread.cpp#L558\" rel=\"nofollow\">Binning-\u0430<\/a> \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435 \u043e\u0433\u0440\u043e\u043c\u043d\u0430: \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0442\u0430\u0439\u043b\u044b \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b, \u0438\u043b\u0438, \u0438\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u043a\u0438\u0435 \u0442\u0430\u0439\u043b\u044b. \u0421\u0442\u043e\u0438\u0442 \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u0439\u043b \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043b\u0430\u0441\u0442\u044c render target, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 8\u00d78 \u0431\u043b\u043e\u043a\u043e\u0432.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0438 \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438. \u0418 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e: \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0430\u0439\u043b\u0430 \u043c\u044b \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432 <em>\u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0442\u043e\u043a<\/em>. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0433\u0440\u0443\u043f\u043f\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432, \u043f\u043e\u0437\u0436\u0435 \u043f\u0440\u043e\u0439\u0434\u044f \u043f\u043e \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a9d\/12f\/acc\/a9d12facc45941f9f8a2d22917cdbe43.png\"><\/div>\n<p>  <i>\u0426\u0432\u0435\u0442\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0435\u043b\u043a\u0430\u043c\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u0440\u0451\u0431\u0435\u0440, \u0430 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c \u2014 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<\/i><\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430, \u0435\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0440\u0451\u0431\u0435\u0440, \u0433\u0440\u0443\u043f\u043f\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>Trivial-Accept: \u0442\u0430\u0439\u043b, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0439\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043a\u0440\u044b\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c<\/li>\n<li>Trivial-Reject: \u0442\u0430\u0439\u043b, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0439\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430<\/li>\n<li>Overlap: \u0442\u0430\u0439\u043b, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0439\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0441 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c<\/li>\n<\/ul>\n<p>  \u0427\u0435\u043c \u0436\u0435 \u044d\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u043e? \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u0430\u0439\u043b\u0430 64\u00d764 \u043f\u0438\u043a\u0441\u0435\u043b\u044f; \u0442\u043e\u0433\u0434\u0430 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u0435 (Trivial-Reject) \u0442\u0430\u0439\u043b\u0430 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0437\u043e\u043c \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c 64\u00d764 \u043f\u043e\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u0435 (Trivial-Accept) \u0442\u0430\u0439\u043b\u0430 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e 64\u00d764 \u043f\u0438\u043a\u0441\u0435\u043b\u044f \u0432\u0438\u0434\u0438\u043c\u044b \u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c <em>\u0432\u0435\u0441\u044c<\/em> \u0442\u0430\u0439\u043b! Overlap \u2014 \u043d\u0430\u0438\u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0437\u0434\u0435\u0441\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0442\u0430\u0439\u043b \u0438 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0433\u0434\u0435 \u043c\u044b \u0441\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0431\u043b\u043e\u043a\u043e\u0432 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0440\u0451\u0431\u0435\u0440 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u043b\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435.<\/p>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (binning) \u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0442\u0430\u0439\u043b\u043e\u0432, \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430:<\/p>\n<pre><code class=\"cpp\">    \/\/ Given a tile size and frame buffer dimensions, find min\/max range of the tiles that fall within bbox computed above     \/\/ which we're going to iterate over, in order to determine if the primitive should be binned or not      \/\/ Use floor(), min indices are inclusive     uint32_t minTileX = static_cast&lt;uint32_t&amp;gt;(glm::floor(bbox.m_MinX \/ m_RenderConfig.m_TileSize));     uint32_t minTileY = static_cast&lt;uint32_t&amp;gt;(glm::floor(bbox.m_MinY \/ m_RenderConfig.m_TileSize));      \/\/ Use ceil(), max indices are exclusive     uint32_t maxTileX = static_cast&lt;uint32_t&amp;gt;(glm::ceil(bbox.m_MaxX \/ m_RenderConfig.m_TileSize));     uint32_t maxTileY = static_cast&lt;uint32_t&amp;gt;(glm::ceil(bbox.m_MaxY \/ m_RenderConfig.m_TileSize));<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0440\u0451\u0431\u0435\u0440 \u043c\u044b \u0437\u0430\u0434\u0430\u0451\u043c \u0443\u0433\u043b\u044b TR \u0438 TA <em>\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u0431\u0440\u0430<\/em>:<\/p>\n<pre><code class=\"cpp\">    \/\/ Fetch edge equation coefficients computed in triangle setup     glm::vec3 ee0 = m_pRenderEngine-&gt;m_SetupBuffers.m_pEdgeCoefficients[3 * primIdx + 0];     glm::vec3 ee1 = m_pRenderEngine-&gt;m_SetupBuffers.m_pEdgeCoefficients[3 * primIdx + 1];     glm::vec3 ee2 = m_pRenderEngine-&gt;m_SetupBuffers.m_pEdgeCoefficients[3 * primIdx + 2];      \/\/ Normalize edge functions     ee0 \/= (glm::abs(ee0.x) + glm::abs(ee0.y));     ee1 \/= (glm::abs(ee1.x) + glm::abs(ee1.y));     ee2 \/= (glm::abs(ee2.x) + glm::abs(ee2.y));      \/\/ Indices of tile corners:     \/\/ LL -&gt; 0  LR -&gt; 1     \/\/ UL -&gt; 2  UR -&gt; 3      static const glm::vec2 scTileCornerOffsets[] =     {         { 0.f, 0.f},                                            \/\/ LL         { m_RenderConfig.m_TileSize, 0.f },                     \/\/ LR         { 0.f, m_RenderConfig.m_TileSize },                     \/\/ UL         { m_RenderConfig.m_TileSize, m_RenderConfig.m_TileSize} \/\/ UR     };      \/\/ (x, y) -&gt; sample location | (a, b, c) -&gt; edge equation coefficients     \/\/ E(x, y) = (a * x) + (b * y) + c     \/\/ E(x + s, y + t) = E(x, y) + (a * s) + (b * t)      \/\/ Based on edge normal n=(a, b), set up tile TR corners for each edge     const uint8_t edge0TRCorner = (ee0.y &gt;= 0.f) ? ((ee0.x &gt;= 0.f) ? 3u : 2u) : (ee0.x &gt;= 0.f) ? 1u : 0u;     const uint8_t edge1TRCorner = (ee1.y &gt;= 0.f) ? ((ee1.x &gt;= 0.f) ? 3u : 2u) : (ee1.x &gt;= 0.f) ? 1u : 0u;     const uint8_t edge2TRCorner = (ee2.y &gt;= 0.f) ? ((ee2.x &gt;= 0.f) ? 3u : 2u) : (ee2.x &gt;= 0.f) ? 1u : 0u;      \/\/ TA corner is the one diagonal from TR corner calculated above     const uint8_t edge0TACorner = 3u - edge0TRCorner;     const uint8_t edge1TACorner = 3u - edge1TRCorner;     const uint8_t edge2TACorner = 3u - edge2TRCorner;<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3c6\/80e\/129\/3c680e1294aa1b90eb6af223e4f8b56a.png\"><\/div>\n<p>  <i>\u041e\u0442\u043c\u0435\u0447\u0435\u043d \u0443\u0433\u043e\u043b TR \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0430\u0439\u043b\u0430 \u0440\u0435\u0431\u0440\u0430 2 (\u043e\u0441\u044c X \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u043f\u0440\u0430\u0432\u043e, \u043e\u0441\u044c Y \u2014 \u0432\u043d\u0438\u0437!)<\/i><\/p>\n<p>  \u0423\u0433\u043e\u043b TR \u0442\u0430\u0439\u043b\u0430 \u2014 \u044d\u0442\u043e \u0443\u0433\u043e\u043b, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0439\u0441\u044f <em>\u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u043e<\/em> \u0432 \u0440\u0435\u0431\u0440\u0435, \u0430 \u0443\u0433\u043e\u043b TA \u2014 <em>\u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043d\u0430\u0440\u0443\u0436\u0438<\/em>. \u0423\u0433\u043b\u044b TR \u0438 TA \u043d\u0443\u0436\u043d\u044b \u043d\u0430\u043c \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0440\u0438\u0434\u0451\u043c \u043a \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u0443\u0433\u043e\u043b TR <em>\u043b\u044e\u0431\u043e\u0433\u043e<\/em> \u0440\u0435\u0431\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0440\u0435\u0431\u0440\u0430, \u0442\u043e \u0432\u0435\u0441\u044c \u0442\u0430\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u0443\u0433\u043b\u044b TA <em>\u0432\u0441\u0435\u0445<\/em> \u0440\u0451\u0431\u0435\u0440 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0440\u0451\u0431\u0435\u0440, \u0442\u043e \u0432\u0435\u0441\u044c \u0442\u0430\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 (\u0438\u043b\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442), \u0430 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c.<\/p>\n<p>  \u0421\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0438\u0441\u043a\u0430 \u044d\u0442\u0438\u0445 \u0443\u0433\u043b\u043e\u0432 \u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0442\u0430\u0439\u043b\u043e\u0432\u0433\u043e \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430: \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0443\u0433\u043b\u044b TR\/TA \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430\u043a\u043b\u043e\u043d\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u0440\u0435\u0431\u0440\u0430 =(a, b) (<em>a, b<\/em> \u2014 \u044d\u0442\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b x \u0438 y \u043d\u043e\u0440\u043c\u0430\u043b\u0438). \u041d\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0435\u0431\u0440\u0430 2 (\u0442.\u0435. \u0434\u043b\u044f \u0441\u0438\u043d\u0435\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0438) \u0443\u0433\u043e\u043b TR \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u044b\u0439 \u043d\u0438\u0436\u043d\u0438\u0439. \u041f\u043e\u0447\u0435\u043c\u0443? \u0414\u043b\u044f \u0440\u0435\u0431\u0440\u0430 2 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e (<em>a &gt; 0)<\/em>, \u0442\u043e \u0435\u0441\u0442\u044c \u0440\u0435\u0431\u0440\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0443\u0434\u043b\u0438\u043d\u044f\u0442\u044c\u0441\u044f \u0432\u043b\u0435\u0432\u043e, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u0430\u0432\u044b\u0445 \u0443\u0433\u043b\u043e\u0432 (\u043d\u0438\u0436\u043d\u0438\u0439 \u0438\u043b\u0438 \u0432\u0435\u0440\u0445\u043d\u0438\u0439) \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0431\u043b\u0438\u0436\u0435 \u043a \u0440\u0435\u0431\u0440\u0443, \u0447\u0435\u043c \u043b\u0435\u0432\u044b\u0439. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, <em>(b &gt; 0)<\/em>, \u0442\u043e \u0435\u0441\u0442\u044c \u0443\u0433\u043e\u043b TR \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0430\u0432\u044b\u043c \u043d\u0438\u0436\u043d\u0438\u043c \u0443\u0433\u043b\u043e\u043c. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0443\u0433\u043b\u0430 TA: \u0438\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0443 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0443, \u0438\u043b\u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0434\u0430\u043b\u044c\u043d\u0438\u0439 \u0443\u0433\u043e\u043b \u043e\u0442 \u0443\u0433\u043b\u0430 TR \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043d\u0430\u0440\u0443\u0436\u0438, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u043e\u0442 \u0443\u0433\u043b\u0430 TR, \u0447\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e.<\/p>\n<pre><code class=\"cpp\">\/\/ Iterate over calculated range of tiles for (uint32_t ty = minTileY, tyy = 0; ty &lt; maxTileY; ty++, tyy++) {     for (uint32_t tx = minTileX, txx = 0; tx &lt; maxTileX; tx++, txx++)     {         \/\/ Using EE coefficients calculated in TriangleSetup stage and positive half-space tests, determine one of three cases possible for each tile:         \/\/ 1) TrivialReject -- tile within tri's bbox does not intersect tri -&amp;gt; move on         \/\/ 2) TrivialAccept -- tile within tri's bbox is completely within tri -&amp;gt; emit a full-tile coverage mask         \/\/ 3) Overlap       -- tile within tri's bbox intersects tri -&amp;gt; bin the triangle to given tile for further rasterization where block\/pixel-level coverage masks will be emitted          \/\/ (txx, tyy) = how many steps are done per dimension         const float txxOffset = static_cast&lt;float&amp;gt;(txx * m_RenderConfig.m_TileSize);         const float tyyOffset = static_cast&lt;float&amp;gt;(tyy * m_RenderConfig.m_TileSize);          \/\/ Step from edge function computed above for the first tile in bbox         float edgeFuncTR0 = edgeFunc0 + ((ee0.x * (scTileCornerOffsets[edge0TRCorner].x + txxOffset)) + (ee0.y * (scTileCornerOffsets[edge0TRCorner].y + tyyOffset)));         float edgeFuncTR1 = edgeFunc1 + ((ee1.x * (scTileCornerOffsets[edge1TRCorner].x + txxOffset)) + (ee1.y * (scTileCornerOffsets[edge1TRCorner].y + tyyOffset)));         float edgeFuncTR2 = edgeFunc2 + ((ee2.x * (scTileCornerOffsets[edge2TRCorner].x + txxOffset)) + (ee2.y * (scTileCornerOffsets[edge2TRCorner].y + tyyOffset)));          \/\/ If TR corner of the tile is outside any edge, reject whole tile         bool TRForEdge0 = (edgeFuncTR0 &lt; 0.f);         bool TRForEdge1 = (edgeFuncTR1 &lt; 0.f);         bool TRForEdge2 = (edgeFuncTR2 &lt; 0.f);         if (TRForEdge0 || TRForEdge1 || TRForEdge2)         {             LOG(&quot;Tile %d TR'd by thread %d\\n&quot;, m_pRenderEngine-&amp;gt;GetGlobalTileIndex(tx, ty), m_ThreadIdx);              \/\/ TrivialReject             \/\/ Tile is completely outside of one or more edges             continue;         }         else         {             \/\/ Tile is partially or completely inside one or more edges, do TrivialAccept tests first              \/\/ Compute edge functions at TA corners based on edge function at first tile origin             float edgeFuncTA0 = edgeFunc0 + ((ee0.x * (scTileCornerOffsets[edge0TACorner].x + txxOffset)) + (ee0.y * (scTileCornerOffsets[edge0TACorner].y + tyyOffset)));             float edgeFuncTA1 = edgeFunc1 + ((ee1.x * (scTileCornerOffsets[edge1TACorner].x + txxOffset)) + (ee1.y * (scTileCornerOffsets[edge1TACorner].y + tyyOffset)));             float edgeFuncTA2 = edgeFunc2 + ((ee2.x * (scTileCornerOffsets[edge2TACorner].x + txxOffset)) + (ee2.y * (scTileCornerOffsets[edge2TACorner].y + tyyOffset)));              \/\/ If TA corner of the tile is outside all edges, accept whole tile             bool TAForEdge0 = (edgeFuncTA0 &amp;gt;= 0.f);             bool TAForEdge1 = (edgeFuncTA1 &amp;gt;= 0.f);             bool TAForEdge2 = (edgeFuncTA2 &amp;gt;= 0.f);             if (TAForEdge0 &amp;amp;&amp;amp; TAForEdge1 &amp;amp;&amp;amp; TAForEdge2)             {                 \/\/ TrivialAccept                 \/\/ Tile is completely inside of the triangle, no further rasterization is needed,                 \/\/ whole tile will be fragment-shaded!                  LOG(&quot;Tile %d TA'd by thread %d\\n&quot;, m_pRenderEngine-&amp;gt;GetGlobalTileIndex(tx, ty), m_ThreadIdx);                  \/\/ Append tile to the rasterizer queue                 m_pRenderEngine-&amp;gt;EnqueueTileForRasterization(m_pRenderEngine-&amp;gt;GetGlobalTileIndex(tx, ty));                  CoverageMask mask;                 mask.m_SampleX = static_cast&lt;uint32_t&amp;gt;(tilePosX + txxOffset); \/\/ Based off of first tile position calculated above                 mask.m_SampleY = static_cast&lt;uint32_t&amp;gt;(tilePosY + tyyOffset); \/\/ Based off of first tile position calculated above                 mask.m_PrimIdx = primIdx;                 mask.m_Type = CoverageMaskType::TILE;                  \/\/ Emit full-tile coverage mask                 m_pRenderEngine-&amp;gt;AppendCoverageMask(                     m_ThreadIdx,                     m_pRenderEngine-&amp;gt;GetGlobalTileIndex(tx, ty),                     mask);             }             else             {                 LOG(&quot;Tile %d binned by thread %d\\n&quot;, m_pRenderEngine-&amp;gt;GetGlobalTileIndex(tx, ty), m_ThreadIdx);                  \/\/ Overlap                 \/\/ Tile is partially covered by the triangle, bin the triangle for the tile                 m_pRenderEngine-&amp;gt;BinPrimitiveForTile(                     m_ThreadIdx,                     m_pRenderEngine-&amp;gt;GetGlobalTileIndex(tx, ty),                     primIdx);             }         }     } }<\/code><\/pre>\n<p>  \u041d\u0430\u0439\u0434\u044f \u0443\u0433\u043b\u044b TR \u0438 TA \u0432\u0441\u0435\u0445 \u0442\u0440\u0451\u0445 \u0440\u0451\u0431\u0435\u0440, \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0446\u0438\u043a\u043b, \u0433\u0434\u0435 \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0442\u0430\u0439\u043b\u044b \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 [minTile{X|Y}, maxTile{X|Y}), \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u0430\u0439\u043b\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0438\/\u0441\u043d\u0430\u0440\u0443\u0436\u0438. \u042d\u0442\u043e \u0442\u043e\u0442 \u0436\u0435 \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 <a href=\"https:\/\/tayfunkayhan.wordpress.com\/2018\/11\/24\/rasterization-in-one-weekend-part-i\/\" rel=\"nofollow\">\u0440\u0430\u043d\u0435\u0435<\/a>; \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0435\u0441\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0443\u0433\u043b\u043e\u0432 TR\/TA \u0442\u0430\u0439\u043b\u043e\u0432. \u0415\u0441\u043b\u0438 \u0442\u0430\u0439\u043b \u043e\u0442\u0431\u0440\u043e\u0448\u0435\u043d \u043f\u043e TR, \u043c\u044b \u0434\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u0415\u0441\u043b\u0438 \u0442\u0430\u0439\u043b \u043e\u0434\u043e\u0431\u0440\u0435\u043d \u043f\u043e TA, \u0442\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c <a href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/CoverageMaskBuffer.h\" rel=\"nofollow\">\u043c\u0430\u0441\u043a\u0443 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f<\/a> \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0442\u0430\u0439\u043b\u0430 (\u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0442\u0430\u0439\u043b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430), \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c. \u0412 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0442\u0430\u0439\u043b \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u043c, \u043c\u044b <em>\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c<\/em> \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u043f\u043e\u0442\u043e\u043a\u0430 \u0442\u0430\u0439\u043b\u0430, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">void RenderEngine::BinPrimitiveForTile(uint32_t threadIdx, uint32_t tileIdx, uint32_t primIdx) {     \/\/ Add primIdx to the per-thread bin of a tile      std::vector&lt;uint32_t&amp;gt;&amp;amp; tileBin = m_BinList[tileIdx][threadIdx];      if (tileBin.empty())     {         \/\/ First encounter of primitive for tile, enqueue it for rasterization         EnqueueTileForRasterization(tileIdx);     }     else     {         \/\/ Tile must have been already appended to the work queue         ASSERT(m_TileList[tileIdx].m_IsTileQueued.test_and_set());     }      \/\/ Append primIdx to the tile's bin     tileBin.push_back(primIdx); }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cpp\">void RenderEngine::EnqueueTileForRasterization(uint32_t tileIdx) {     \/\/ Append the tile to the rasterizer queue if not already done     if (!m_TileList[tileIdx].m_IsTileQueued.test_and_set(std::memory_order_acq_rel))     {         \/\/ Tile not queued up for rasterization, do so now         m_RasterizerQueue.InsertTileIndex(tileIdx);     } }<\/code><\/pre>\n<p>  <a href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/TileQueue.h\" rel=\"nofollow\">\u041e\u0447\u0435\u0440\u0435\u0434\u044c \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/a> \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 FIFO \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0442\u0430\u0439\u043b\u043e\u0432, \u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0442\u0430\u0439\u043b \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u043c) \u0438\u043b\u0438 \u0437\u0430\u0442\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u043f\u043e\u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043d\u043e (\u0442\u0430\u0439\u043b\u044b, \u043e\u0434\u043e\u0431\u0440\u0435\u043d\u043d\u044b\u0435 \u043f\u043e TA) \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u044d\u0442\u0430\u043f\u0430\u0445. \u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 <a rel=\"nofollow\" href=\"https:\/\/github.com\/NotCamelCase\/Tyler-Samples\/blob\/master\/HelloTriangle\/HelloTriangle.cpp\">Hello, Triangle!<\/a> \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0435 \u0442\u0430\u0439\u043b\u044b:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/57f\/bde\/dc0\/57fbdedc0138a573e369449d0a2f9936.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/44c\/f29\/151\/44cf291519c72a5f10b2bab8e5dbb2da.png\"><\/div>\n<p>  <\/p>\n<h2>\u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u044d\u0442\u0430\u043f\u0443 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u0438\u0432\u0430\u044e\u0442, \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442 \u044d\u0442\u0430\u043f\u0430 \u043f\u043e\u0441\u0442\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438 (post-binning), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0431\u044b\u043b\u0438 \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0442\u0430\u0439\u043b\u044b \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442 \u0432\u0441\u0435 \u044d\u0442\u0430\u043f\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438, \u043e\u043d\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0430\u0439\u043b\u044b \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<pre><code class=\"cpp\">\/\/ To preserve rendering order, we must ensure that all threads finish binning primitives to tiles \/\/ before rasterization is started. To do that, we will stall all threads to sync @DRAWCALL_RASTERIZATION \/\/ Set state to post binning and stall until all PipelineThreads complete binning m_CurrentState.store(ThreadStatus::DRAWCALL_SYNC_POINT_POST_BINNER, std::memory_order_release); m_pRenderEngine-&gt;WaitForPipelineThreadsToCompleteBinning();<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043d\u044f\u043b\u0438 \u0438\u0434\u0435\u044e \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u0441\u0443\u0442\u044c \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430: \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a TR\/TA, \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0431\u043b\u043e\u043a\u043e\u0432, \u0441\u043f\u0443\u0441\u043a\u0430\u044f\u0441\u044c \u0441 \u0443\u0440\u043e\u0432\u043d\u044f \u0442\u0430\u0439\u043b\u043e\u0432:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a01\/c82\/480\/a01c8248040dc112b075e245538383eb.png\"><\/div>\n<p>  \u041f\u043e\u0442\u043e\u043a\u0438 <a href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/PipelineThread.cpp#L721\" rel=\"nofollow\">\u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442<\/a> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u0430\u0439\u043b\u0430 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u044d\u0442\u043e\u0442 \u0442\u0430\u0439\u043b, \u0441\u043d\u043e\u0432\u0430 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044f \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e <em>\u0432\u0441\u0435\u043c<\/em> \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u043a <em>\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u0439\u043b\u0443<\/em>.<\/p>\n<p>  \u041a\u0430\u043a \u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 <em>\u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0431\u043b\u043e\u043a\u043e\u0432<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0443\u0433\u043b\u044b TR\/TA <em>\u0431\u043b\u043e\u043a\u043e\u0432<\/em> \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0440\u0451\u0431\u0435\u0440 \u0438 \u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 \u0432\u0435\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044f, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u043f\u043e\u0434\u0432\u0435\u0440\u0433\u043d\u0443\u0442\u044c \u0431\u043b\u043e\u043a\u0438 TR \u0438\u043b\u0438 TA, \u0438\u043b\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0415\u0441\u043b\u0438 \u0431\u043b\u043e\u043a \u0441\u043d\u043e\u0432\u0430 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f TR, \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u0415\u0441\u043b\u0438 \u043e\u043d \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 TA, \u0442\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u0430\u0441\u043a\u0443 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0435\u0449\u0451 \u043d\u0438\u0436\u0435, \u043d\u0430 \u0443\u0440\u043e\u0432\u0435\u043d\u044c <em>\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/em>, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0440\u0451\u0431\u0435\u0440 \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u043a\u0438 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. \u0423\u0434\u043e\u0431\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f SIMD \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e:<\/p>\n<pre><code class=\"cpp\">\/\/ Position of the block that we're testing at pixel level float blockPosX = (firstBlockWithinBBoxX + bxxOffset); float blockPosY = (firstBlockWithinBBoxY + byyOffset);  \/\/ Compute E(x, y) = (x * a) + (y * b) c at block origin once __m128 sseEdge0FuncAtBlockOrigin = _mm_set1_ps(ee0.z + ((ee0.x * blockPosX) + (ee0.y * blockPosY))); __m128 sseEdge1FuncAtBlockOrigin = _mm_set1_ps(ee1.z + ((ee1.x * blockPosX) + (ee1.y * blockPosY))); __m128 sseEdge2FuncAtBlockOrigin = _mm_set1_ps(ee2.z + ((ee2.x * blockPosX) + (ee2.y * blockPosY)));  \/\/ Store edge 0 equation coefficients __m128 sseEdge0A4 = _mm_set_ps1(ee0.x); __m128 sseEdge0B4 = _mm_set_ps1(ee0.y);  \/\/ Store edge 1 equation coefficients __m128 sseEdge1A4 = _mm_set_ps1(ee1.x); __m128 sseEdge1B4 = _mm_set_ps1(ee1.y);  \/\/ Store edge 2 equation coefficients __m128 sseEdge2A4 = _mm_set_ps1(ee2.x); __m128 sseEdge2B4 = _mm_set_ps1(ee2.y);  \/\/ Generate masks used for tie-breaking rules (not to double-shade along shared edges) __m128 sseEdge0A4PositiveOrB4NonNegativeA4Zero = _mm_or_ps(_mm_cmpgt_ps(sseEdge0A4, _mm_setzero_ps()),     _mm_and_ps(_mm_cmpge_ps(sseEdge0B4, _mm_setzero_ps()), _mm_cmpeq_ps(sseEdge0A4, _mm_setzero_ps())));  __m128 sseEdge1A4PositiveOrB4NonNegativeA4Zero = _mm_or_ps(_mm_cmpgt_ps(sseEdge1A4, _mm_setzero_ps()),     _mm_and_ps(_mm_cmpge_ps(sseEdge1B4, _mm_setzero_ps()), _mm_cmpeq_ps(sseEdge1A4, _mm_setzero_ps())));  __m128 sseEdge2A4PositiveOrB4NonNegativeA4Zero = _mm_or_ps(_mm_cmpgt_ps(sseEdge2A4, _mm_setzero_ps()),     _mm_and_ps(_mm_cmpge_ps(sseEdge2B4, _mm_setzero_ps()), _mm_cmpeq_ps(sseEdge2A4, _mm_setzero_ps())));  for (uint32_t py = 0; py &lt; g_scPixelBlockSize; py++) {     \/\/ Store Y positions in current row (all samples on the same row has the same Y position)     __m128 sseY4 = _mm_set_ps1(py + 0.5f);      for (uint32_t px = 0; px &lt; g_scNumEdgeTestsPerRow; px++)     {         \/\/ E(x, y) = (x * a) + (y * b) + c         \/\/ E(x + s, y + t) = E(x, y) + s * a + t * b          \/\/ Store X positions of 4 consecutive samples         __m128 sseX4 = _mm_setr_ps(             g_scSIMDWidth * px + 0.5f,             g_scSIMDWidth * px + 1.5f,             g_scSIMDWidth * px + 2.5f,             g_scSIMDWidth * px + 3.5f);          \/\/ a * s         __m128 sseEdge0TermA = _mm_mul_ps(sseEdge0A4, sseX4);         __m128 sseEdge1TermA = _mm_mul_ps(sseEdge1A4, sseX4);         __m128 sseEdge2TermA = _mm_mul_ps(sseEdge2A4, sseX4);          \/\/ b * t         __m128 sseEdge0TermB = _mm_mul_ps(sseEdge0B4, sseY4);         __m128 sseEdge1TermB = _mm_mul_ps(sseEdge1B4, sseY4);         __m128 sseEdge2TermB = _mm_mul_ps(sseEdge2B4, sseY4);          \/\/ E(x+s, y+t) = E(x,y) + a*s + t*b         __m128 sseEdgeFunc0 = _mm_add_ps(sseEdge0FuncAtBlockOrigin, _mm_add_ps(sseEdge0TermA, sseEdge0TermB));         __m128 sseEdgeFunc1 = _mm_add_ps(sseEdge1FuncAtBlockOrigin, _mm_add_ps(sseEdge1TermA, sseEdge1TermB));         __m128 sseEdgeFunc2 = _mm_add_ps(sseEdge2FuncAtBlockOrigin, _mm_add_ps(sseEdge2TermA, sseEdge2TermB));          \/\/E(x, y):         \/\/    E(x, y) &amp;gt; 0         \/\/        ||         \/\/    !E(x, y) &lt; 0 &amp;amp;&amp;amp; (a &amp;gt; 0 || (a = 0 &amp;amp;&amp;amp; b &amp;gt;= 0))         \/\/          \/\/ Edge 0 test         __m128 sseEdge0Positive = _mm_cmpgt_ps(sseEdgeFunc0, _mm_setzero_ps());         __m128 sseEdge0Negative = _mm_cmplt_ps(sseEdgeFunc0, _mm_setzero_ps());         __m128 sseEdge0FuncMask = _mm_or_ps(sseEdge0Positive,             _mm_andnot_ps(sseEdge0Negative, sseEdge0A4PositiveOrB4NonNegativeA4Zero));          \/\/ Edge 1 test         __m128 sseEdge1Positive = _mm_cmpgt_ps(sseEdgeFunc1, _mm_setzero_ps());         __m128 sseEdge1Negative = _mm_cmplt_ps(sseEdgeFunc1, _mm_setzero_ps());         __m128 sseEdge1FuncMask = _mm_or_ps(sseEdge1Positive,             _mm_andnot_ps(sseEdge1Negative, sseEdge1A4PositiveOrB4NonNegativeA4Zero));          \/\/ Edge 2 test         __m128 sseEdge2Positive = _mm_cmpgt_ps(sseEdgeFunc2, _mm_setzero_ps());         __m128 sseEdge2Negative = _mm_cmplt_ps(sseEdgeFunc2, _mm_setzero_ps());         __m128 sseEdge2FuncMask = _mm_or_ps(sseEdge2Positive,             _mm_andnot_ps(sseEdge2Negative, sseEdge2A4PositiveOrB4NonNegativeA4Zero));          \/\/ Combine resulting masks of all three edges         __m128 sseEdgeFuncResult = _mm_and_ps(sseEdge0FuncMask,             _mm_and_ps(sseEdge1FuncMask, sseEdge2FuncMask));          uint16_t maskInt = static_cast&lt;uint16_t&amp;gt;(_mm_movemask_ps(sseEdgeFuncResult));          \/\/ If at least one sample is visible, emit coverage mask for the tile         if (maskInt != 0x0)         {             \/\/ Quad mask points to the first sample             CoverageMask mask;             mask.m_SampleX = static_cast&lt;uint32_t&amp;gt;(blockPosX + (g_scSIMDWidth * px));             mask.m_SampleY = static_cast&lt;uint32_t&amp;gt;(blockPosY + py);             mask.m_PrimIdx = primIdx;             mask.m_Type = CoverageMaskType::QUAD;             mask.m_QuadMask = maskInt;              \/\/ Emit a quad mask             m_pRenderEngine-&amp;gt;AppendCoverageMask(m_ThreadIdx, nextTileIdx, mask);         }     } }<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u0438\u0442\u0435 \u043c\u0435\u043d\u044f \u0437\u0430 \u044d\u0442\u043e\u0442 \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u044b\u0439 SIMD-\u0441\u0443\u043f (\u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u044f \u0432\u0438\u043d\u044e \u0432 \u043d\u0451\u043c MSVC, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043a\u043e\u0434), \u0442\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0451\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e: \u043c\u044b \u0431\u0435\u0440\u0451\u043c 4 \u043f\u0438\u043a\u0441\u0435\u043b\u044f \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u0431\u043b\u043e\u043a\u0430, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440 8\u00d78, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0451\u0431\u0435\u0440 \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0441\u043a\u0443 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b \u0438\u0437 4 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432. \u0415\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0430 \u0442\u0430\u043a\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0438\u0434\u0438\u043c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u0441\u044d\u043c\u043f\u043b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <em>if (maskInt != 0x0<\/em>), \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u0430\u0441\u043a\u0443 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c, \u043f\u043e\u043a\u0430 \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043d\u0435 \u043e\u0431\u043e\u0439\u0434\u0451\u043c \u0432\u0441\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0432 \u0431\u043b\u043e\u043a\u0435. \u041f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435. \u0412 \u044d\u0442\u043e\u043c \u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043c\u044b\u0441\u043b \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430!<\/p>\n<p>  \u0425\u0438\u0442\u0440\u043e\u0441\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043b\u0438\u0448\u043d\u0438\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u044b \u043d\u0430 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u043f\u0440\u0430\u0432\u0434\u044b\u0432\u0430\u044e\u0442 \u0441\u0435\u0431\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0447\u0435\u043d\u044c \u043c\u0435\u043b\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0442\u0430\u0439\u043b\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043e\u0434\u0438\u043d \u0431\u043b\u043e\u043a, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u0445 \u0443\u0440\u043e\u0432\u043d\u044f\u0445; \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445 \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043c\u0435\u043b\u043a\u0438\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/p>\n<h2>\u0417\u0430\u0442\u0435\u043d\u0435\u043d\u0438\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/h2>\n<p>  \u0414\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0432 \u044d\u0442\u0430\u043f\u0430 \u043f\u043e\u0441\u0442\u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0441 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"cpp\">\/\/ Rasterization completed, set state to post raster and \/\/ stall until all PipelineThreads complete rasterization. \/\/ We need this sync because when (N-x) threads finish rasterization and \/\/ reach the end of tile queue while x threads are still busy rasterizing tile blocks, \/\/ we must ensure that none of the (N-x) non-busy threads will go ahead and start fragment-shading tiles \/\/ whose blocks could be currently still rasterized by x remaining threads m_CurrentState.store(ThreadStatus::DRAWCALL_SYNC_POINT_POST_RASTER, std::memory_order_release); m_pRenderEngine-&gt;WaitForPipelineThreadsToCompleteRasterization();<\/code><\/pre>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0432 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u0438 \u044d\u0442\u0430\u043f\u0430 \u0437\u0430\u0442\u0435\u043d\u0435\u043d\u0438\u044f \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 (FS) \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u044f \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u044d\u0442\u0430\u043f\u0443 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430. \u041a\u0430\u043a \u0438 \u044d\u0442\u0430\u043f \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u044d\u0442\u0430\u043f FS \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0442\u0430\u0439\u043b\u0430\u043c\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0430\u0441\u043a\u0438 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (Binning), \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"cpp\">auto&amp;amp; currentSlot = pCoverageMaskBuffer-&amp;gt;m_AllocationList[numAlloc];  for (uint32_t numMask = 0; numMask &lt; currentSlot.m_AllocationCount; numMask++) {     ASSERT(pCoverageMaskBuffer-&amp;gt;m_AllocationList[numAlloc].m_pData != nullptr);      CoverageMask* pMask = &amp;amp;currentSlot.m_pData[numMask];      \/\/ In many cases, next N coverage masks will have been generated for the same primitive     \/\/ that we're fragment-shading at tile, block or fragment levels here,     \/\/ it could be optimized so that the EE coefficients of the same primitive won't be fetched     \/\/ from memory over and over again, unsure what gain, if anything it'd yield...      \/\/ First fetch EE coefficients that will be used (in addition to edge in\/out tests) for perspective-correct interpolation of vertex attributes     const glm::vec3 ee0 = m_pRenderEngine-&amp;gt;m_SetupBuffers.m_pEdgeCoefficients[3 * pMask-&amp;gt;m_PrimIdx + 0];     const glm::vec3 ee1 = m_pRenderEngine-&amp;gt;m_SetupBuffers.m_pEdgeCoefficients[3 * pMask-&amp;gt;m_PrimIdx + 1];     const glm::vec3 ee2 = m_pRenderEngine-&amp;gt;m_SetupBuffers.m_pEdgeCoefficients[3 * pMask-&amp;gt;m_PrimIdx + 2];      \/\/ Store edge 0 coefficients     __m128 sseA4Edge0 = _mm_set_ps1(ee0.x);     __m128 sseB4Edge0 = _mm_set_ps1(ee0.y);     __m128 sseC4Edge0 = _mm_set_ps1(ee0.z);      \/\/ Store edge 1 equation coefficients     __m128 sseA4Edge1 = _mm_set_ps1(ee1.x);     __m128 sseB4Edge1 = _mm_set_ps1(ee1.y);     __m128 sseC4Edge1 = _mm_set_ps1(ee1.z);      \/\/ Store edge 2 equation coefficients     __m128 sseA4Edge2 = _mm_set_ps1(ee2.x);     __m128 sseB4Edge2 = _mm_set_ps1(ee2.y);     __m128 sseC4Edge2 = _mm_set_ps1(ee2.z);      const SIMDEdgeCoefficients simdEERegs =     {         sseA4Edge0,         sseA4Edge1,         sseA4Edge2,         sseB4Edge0,         sseB4Edge1,         sseB4Edge2,         sseC4Edge0,         sseC4Edge1,         sseC4Edge2,     };      switch (pMask-&amp;gt;m_Type)     {     case CoverageMaskType::TILE:         LOG(&quot;Thread %d fragment-shading tile %d\\n&quot;, m_ThreadIdx, nextTileIdx);         FragmentShadeTile(pMask-&amp;gt;m_SampleX, pMask-&amp;gt;m_SampleY, pMask-&amp;gt;m_PrimIdx, simdEERegs);         break;     case CoverageMaskType::BLOCK:         LOG(&quot;Thread %d fragment-shading blocks\\n&quot;, m_ThreadIdx);         FragmentShadeBlock(pMask-&amp;gt;m_SampleX, pMask-&amp;gt;m_SampleY, pMask-&amp;gt;m_PrimIdx, simdEERegs);         break;     case CoverageMaskType::QUAD:         LOG(&quot;Thread %d fragment-shading coverage masks\\n&quot;, m_ThreadIdx, ee0, ee1, ee2);         FragmentShadeQuad(pMask, simdEERegs);         break;     default:         ASSERT(false);         break;     } }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 FS, \u043d\u0430\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u0438\u0441\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u043e\u0434\u0430, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 <a href=\"http:\/\/citeseerx.ist.psu.edu\/viewdoc\/download?doi=10.1.1.18.5738&amp;amp;rep=rep1&amp;amp;type=pdf\" rel=\"nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0434\u0430\u0432\u0430\u043b \u0432\u044b\u0448\u0435. \u0421\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0431\u0430\u0437\u0438\u0441\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b) \u043b\u044e\u0431\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ca7\/77a\/b0e\/ca777ab0e68b2069946140da44616045.png\"><\/div>\n<p>  <\/p>\n<pre><code class=\"cpp\">void PipelineThread::ComputeParameterBasisFunctions(     uint32_t sampleX,     uint32_t sampleY,     const SIMDEdgeCoefficients&amp; simdEERegs,     __m128* pSSEf0XY,     __m128* pSSEf1XY) {     \/\/ R(x, y) = F0(x, y) + F1(x, y) + F2(x, y)     \/\/ r = 1\/(F0(x, y) + F1(x, y) + F2(x, y))      \/\/ Store X positions of 4 consecutive samples     __m128 sseX4 = _mm_setr_ps(         sampleX + 0.5f,         sampleX + 1.5f,         sampleX + 2.5f,         sampleX + 3.5f); \/\/ x x+1 x+2 x+3      \/\/ Store Y positions of 4 samples in a row (constant)     __m128 sseY4 = _mm_set_ps1(sampleY); \/\/ y y y y      \/\/ Compute F0(x,y)     __m128 sseF0XY4 = _mm_add_ps(simdEERegs.m_SSEC4Edge0,         _mm_add_ps(             _mm_mul_ps(sseY4, simdEERegs.m_SSEB4Edge0),             _mm_mul_ps(sseX4, simdEERegs.m_SSEA4Edge0)));      \/\/ Compute F1(x,y)     __m128 sseF1XY4 = _mm_add_ps(simdEERegs.m_SSEC4Edge1,         _mm_add_ps(             _mm_mul_ps(sseY4, simdEERegs.m_SSEB4Edge1),             _mm_mul_ps(sseX4, simdEERegs.m_SSEA4Edge1)));      \/\/ Compute F2(x,y)     __m128 sseF2XY4 = _mm_add_ps(simdEERegs.m_SSEC4Edge2,         _mm_add_ps(             _mm_mul_ps(sseY4, simdEERegs.m_SSEB4Edge2),             _mm_mul_ps(sseX4, simdEERegs.m_SSEA4Edge2)));      \/\/ Compute F(x,y) = F0(x,y) + F1(x,y) + F2(x,y)     __m128 sseR4 = _mm_add_ps(sseF2XY4, _mm_add_ps(sseF0XY4, sseF1XY4));      \/\/ Compute perspective correction factor     sseR4 = _mm_rcp_ps(sseR4);      \/\/ Assign final f0(x,y) &amp; f1(x,y)     *pSSEf0XY = _mm_mul_ps(sseR4, sseF0XY4);     *pSSEf1XY = _mm_mul_ps(sseR4, sseF1XY4);      \/\/ Basis functions f0, f1, f2 sum to 1, e.g. f0(x,y) + f1(x,y) + f2(x,y) = 1 so we'll skip computing f2(x,y) explicitly }<\/code><\/pre>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u0441\u043e\u043a \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f (\u0442\u0430\u0439\u043b\u043e\u0432\/\u0431\u043b\u043e\u043a\u043e\u0432\/\u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432) \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u044b \u043e\u0431\u0437\u043e\u0440\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043c\u0430\u0441\u043a\u0438 \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0441\u0436\u0430\u0442\u044b\u0439 \u043f\u0443\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u0442\u0440\u0435\u043c\u0438\u043c\u0441\u044f \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SIMD.<\/p>\n<pre><code class=\"cpp\">void PipelineThread::FragmentShadeQuad(CoverageMask* pMask, const SIMDEdgeCoefficients&amp; simdEERegs) {     FragmentShader FS = m_pRenderEngine-&gt;m_FragmentShader;      \/\/ Vertex attributes to be interpolated and passed to FS     InterpolatedAttributes interpolatedAttribs;      \/\/ Parameter interpolation basis functions     __m128 ssef0XY, ssef1XY;      \/\/ Calculate basis functions f0(x,y) &amp; f1(x,y) once     ComputeParameterBasisFunctions(         pMask-&gt;m_SampleX,         pMask-&gt;m_SampleY,         simdEERegs,                     &amp;ssef0XY,         &amp;ssef1XY);      \/\/ Interpolate depth values prior to depth test     __m128 sseZInterpolated = InterpolateDepthValues(pMask-&gt;m_PrimIdx, ssef0XY, ssef1XY);      \/\/ Load current depth buffer contents     __m128 sseDepthCurrent = m_pRenderEngine-&gt;FetchDepthBuffer(pMask-&gt;m_SampleX, pMask-&gt;m_SampleY);      \/\/ Perform LESS_THAN_EQUAL depth test     __m128 sseDepthRes = _mm_cmple_ps(sseZInterpolated, sseDepthCurrent);      \/\/ Interpolate active vertex attributes     InterpolateVertexAttributes(pMask-&gt;m_PrimIdx, ssef0XY, ssef1XY, &amp;interpolatedAttribs);      \/\/ 4-sample fragment colors     FragmentOutput fragmentOutput;      \/\/ Invoke FS and update color\/depth buffer with fragment output     FS(&amp;interpolatedAttribs, m_pRenderEngine-&gt;m_pConstantBuffer, &amp;fragmentOutput);      \/\/ Generate color mask from 4-bit int mask set during rasterization     __m128i sseColorMask = _mm_setr_epi32(         pMask-&gt;m_QuadMask &amp; g_scQuadMask0,         pMask-&gt;m_QuadMask &amp; g_scQuadMask1,         pMask-&gt;m_QuadMask &amp; g_scQuadMask2,         pMask-&gt;m_QuadMask &amp; g_scQuadMask3);      sseColorMask = _mm_cmpeq_epi32(sseColorMask,         _mm_set_epi64x(0x800000004, 0x200000001));      \/\/ AND depth mask &amp; coverage mask for quads of fragments     __m128 sseWriteMask = _mm_and_ps(sseDepthRes, _mm_castsi128_ps(sseColorMask));      \/\/ Write interpolated Z values     m_pRenderEngine-&gt;UpdateDepthBuffer(sseWriteMask, sseZInterpolated, pMask-&gt;m_SampleX, pMask-&gt;m_SampleY);      \/\/ Write fragment output     m_pRenderEngine-&gt;UpdateColorBuffer(sseWriteMask, fragmentOutput, pMask-&gt;m_SampleX, pMask-&gt;m_SampleY); }<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u0438\u0441\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e Z \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0442\u0435\u0441\u0442 \u0433\u043b\u0443\u0431\u0438\u043d. \u0417\u0430\u043f\u043e\u043c\u043d\u0438\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0435\u0441\u0442\u0430 \u0433\u043b\u0443\u0431\u0438\u043d, \u043c\u044b \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435 VS, \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0438\u0445 \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 FS, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439, \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u0434\u043b\u044f \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u0438\u0437 4 \u0441\u044d\u043c\u043f\u043b\u043e\u0432. \u0414\u043b\u044f \u0442\u0430\u0439\u043b\u043e\u0432\/\u0431\u043b\u043e\u043a\u043e\u0432 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043c\u0430\u0441\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0442\u0435\u0441\u0442\u0430 \u0433\u043b\u0443\u0431\u0438\u043d, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043e\u0434\u043e\u0431\u0440\u0435\u043d\u043d\u044b\u0435 TA \u0442\u0430\u0439\u043b\u044b\/\u0431\u043b\u043e\u043a\u0438 \u0432\u0438\u0434\u0438\u043c\u044b. \u0414\u043b\u044f \u0447\u0435\u0442\u044b\u0440\u0451\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u043a\u0430 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0430\u0441\u043a\u0443 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u043c\u0430\u0441\u043a\u0435 \u0432 \u0431\u0443\u0444\u0435\u0440 \u043a\u0430\u0434\u0440\u043e\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <em>\u0433\u043b\u0443\u0431\u0438\u043d\u044b<\/em> \u0438 <em>\u0446\u0432\u0435\u0442\u0430<\/em>. \u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0442\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<h2>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0438\u0434\u0435\u0438 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0435\u0433\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\u041f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 <a href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/RasterizerConfig.h\" rel=\"nofollow\">\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/a>, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0430\u0439\u043b\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u0442.\u0434., \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0432\u0441\u0451 \u044d\u0442\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/li>\n<li>\u0417\u0430\u043c\u0435\u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 TR \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b TA, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0442\u0430\u0439\u043b\u043e\u0432, \u043e\u0442\u0431\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0445 TR<\/li>\n<li>\u0418\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>tileIdx<\/em> \u0432 <a href=\"https:\/\/github.com\/NotCamelCase\/Tyler\/blob\/master\/Tyler\/RenderState.h#L64\" rel=\"nofollow\">\u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/a> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0435\u0451 \u0432 FS \u0434\u043b\u044f \u0440\u0430\u0441\u043a\u0440\u0430\u0448\u0438\u0432\u0430\u043d\u044f \u0447\u0430\u0441\u0442\u0435\u0439 \u043c\u0435\u0448\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0439\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u0441\u044f<\/li>\n<li>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 AVX (\u0438\u043b\u0438 \u0434\u0430\u0436\u0435 AVX-512!), \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u043d \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u0445 (\u0441\u043f\u043e\u0439\u043b\u0435\u0440: \u044f <a href=\"https:\/\/drive.google.com\/file\/d\/1uK3Pumx61FZBd1zZ5NkR6ZT4BqeAl79R\/view?usp=drivesdk\" rel=\"nofollow\">\u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u0434\u043b\u044f AVX<\/a>, \u0447\u0442\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u0446\u0435\u043d \u0434\u0430\u043b\u043e \u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 30-50%)<\/li>\n<li>\u041d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u00ab\u0431\u0443\u0442\u044b\u043b\u043e\u0447\u043d\u044b\u0445 \u0433\u043e\u0440\u043b\u044b\u0448\u0435\u043a\u00bb \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0446\u0435\u043d \u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0438\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/li>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0430 \u0438 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f <em>\u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430<\/em> \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435<\/li>\n<\/ul>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0441\u0435\u043c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e! \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043d\u0438\u0445 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438, \u0442\u043e \u043d\u0430\u0439\u0434\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 Hello, Triangle! <a href=\"https:\/\/drive.google.com\/drive\/folders\/1q2NflVNszUL_E1ok82IM-pNO6JJDN0T_?usp=sharing\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 Scene Rendering <a href=\"https:\/\/drive.google.com\/drive\/folders\/1XWwevSh1g2bVXc_SY7dipwse4FnfDlOk?usp=sharing\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a> (\u0438 \u043f\u0430\u043a\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 <a rel=\"nofollow\" href=\"https:\/\/drive.google.com\/file\/d\/1vPfRflqhnO0-K_3SeBDg-diDe0uYrsJ1\/view?usp=sharing\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u044b)<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/124\/a6b\/664\/124a6b6641f5c341aa2951534c82f10c.png\"><\/div>\n<p>  <i>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0446\u0435\u043d\u0430 Sponza \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 275k \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u043d\u0430\u044f \u043d\u0430 \u043c\u043e\u0451\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435 \u0441 Intel i7 6700-HQ \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0437\u0430 60 \u043c\u0441<\/i><\/p>\n<h2>\u0421\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b<\/h2>\n<p>  \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u044f \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u043b\u0441\u044f\/\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043b\/\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u0435 \u0438\u0445:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.gamasutra.com\/view\/feature\/4190\/sponsored_feature_rasterization_.php?print=1\" rel=\"nofollow\">Rasterization on Larrabee \u2014 Adaptive Rasterization Helps Boost Efficiency<\/a><\/li>\n<li><a href=\"https:\/\/pdfs.semanticscholar.org\/082e\/452fea9591687e8c5eea51e6c7c5ff1f18aa.pdf\" rel=\"nofollow\">A Modern Approach to Software Rasterization<\/a><\/li>\n<li><a href=\"http:\/\/citeseerx.ist.psu.edu\/viewdoc\/download?doi=10.1.1.18.5738&amp;amp;rep=rep1&amp;amp;type=pdf\" rel=\"nofollow\">Incremental and Hierarchical Hilbert Order Edge Equation Polygon Rasterization<\/a><\/li>\n<li><a href=\"https:\/\/www.csee.umbc.edu\/~olano\/papers\/2dh-tri\/\" rel=\"nofollow\">Triangle Scan Conversion using 2D Homogeneous Coordinates<\/a><\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/473102\/\"> https:\/\/habr.com\/ru\/post\/473102\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/473102\/\">\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043b\u0435\u0434\u0438\u043b\u0438 \u0437\u0430 \u043c\u043e\u0435\u0439 \u0441\u0435\u0440\u0438\u0435\u0439 \u043f\u043e\u0441\u0442\u043e\u0432 <a href=\"https:\/\/tayfunkayhan.wordpress.com\/2018\/11\/24\/rasterization-in-one-weekend\/\" rel=\"nofollow\">\u00ab\u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430 \u043e\u0434\u043d\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435\u00bb<\/a>, \u043d\u043e \u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0438 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438 \u0434\u0435\u043c\u043e, \u0442\u043e \u0434\u043b\u044f \u0432\u0430\u0441 \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0441\u044e\u0440\u043f\u0440\u0438\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u044f \u0441\u043a\u0430\u0436\u0443, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u043d\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0435\u0440\u0438\u0438 \u043f\u043e\u0441\u0442\u043e\u0432 \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043c\u0443\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u043d\u043e\u0439 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<p>  \u041a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b <a rel=\"nofollow\" href=\"https:\/\/github.com\/NotCamelCase\/Tyler\">Tyler<\/a> \u2014 \u0442\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041c\u043e\u0435\u0439 \u0446\u0435\u043b\u044c\u044e \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u044b\u043b\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c. \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u043b\u044e\u0434\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u044f\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0432 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 \u0438 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0435\u0439. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043e \u0432 \u0441\u0435\u0440\u0438\u0438 <a href=\"https:\/\/tayfunkayhan.wordpress.com\/2018\/11\/24\/rasterization-in-one-weekend\/\" rel=\"nofollow\">\u00ab\u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430 \u043e\u0434\u043d\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435\u00bb<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u0435\u0451. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u0435\u0451 \u0438\u0437\u0443\u0447\u0438\u043b\u0438, \u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0439 \u2014 \u044f \u043d\u0435 \u0445\u043e\u0447\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0438 \u0442\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u0445.<\/p>\n<h2>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0431\u0437\u043e\u0440<\/h2>\n<p>  <a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Tiled_rendering\">\u0422\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/a> (tile-based rendering \u0438\u043b\u0438 tiled rendering) \u2014 \u044d\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c <em>immediate-mode<\/em>-\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u043e\u043c; \u0432 \u043d\u0451\u043c render target (RT) \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 <em>\u0442\u0430\u0439\u043b\u044b<\/em> (\u0442.\u0435. \u0441\u0443\u0431\u0440\u0435\u0433\u0438\u043e\u043d\u044b \u043a\u0430\u0434\u0440\u043e\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430), \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u0432 \u0442\u0430\u0439\u043b\u044b \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/607\/72c\/cfb\/60772ccfb0d154ed83231fb06351590e.png\"><\/div>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u00ab\u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438\u00bb, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u043e \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u044d\u0442\u043e\u0439 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 immediate-mode: \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0430\u0439\u043b\u0430 \u0431\u0443\u0444\u0435\u0440\u0430\u043c\u0438 \u0446\u0432\u0435\u0442\u043e\u0432\/\u0433\u043b\u0443\u0431\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u00ab\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0439\u00bb DRAM \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u043a\u044d\u0448\u0430 \u043d\u0430 \u0447\u0438\u043f\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-299668","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299668","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=299668"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299668\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=299668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=299668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=299668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}