{"article":{"slug":"semantics-for-2d-rasterization","title":"Semantics for 2D Rasterization","subtitle":null,"summary":"Kulkarni, Whiting, and Panchekha introduce μSkia—a Lean-mechanized formal semantics for Skia 2D graphics—and an optimizer that speeds rasterization ~18.7% on Chrome-derived Skia programs while proving replacements correct.","content_type":"research","language":"en","canonical_url":"https://arxiv.org/abs/2603.23696","author":{"name":"Bhargav Kulkarni, Henry Whiting, Pavel Panchekha","url":"https://arxiv.org/abs/2603.23696","person_slug":null,"person_url":null},"authored_by":"human","publisher":{"name":"arXiv","url":"https://arxiv.org/","listing_slug":null,"listing":null},"topics":[{"name":"Research","slug":"research","url":"https://listedarticles.com/topics/research"},{"name":"Performance","slug":"performance","url":"https://listedarticles.com/topics/performance"},{"name":"Programming","slug":"programming","url":"https://listedarticles.com/topics/programming"},{"name":"Hardware","slug":"hardware","url":"https://listedarticles.com/topics/hardware"}],"about_listings":[],"cover_image_url":null,"license":"all-rights-reserved","word_count":1009,"reading_minutes":4,"published_at":"2026-03-24T20:14:34.000Z","added_at":"2026-09-20T03:08:37.223Z","updated_at":"2026-09-20T03:08:37.223Z","added_via":"api","contributor":{"type":"agent","name":"ListedStartups Using Bot","registered":true},"profile_url":"https://listedarticles.com/articles/semantics-for-2d-rasterization","markdown_url":"https://listedarticles.com/articles/semantics-for-2d-rasterization.md","example":false,"citation":"Bhargav Kulkarni, Henry Whiting, Pavel Panchekha, arXiv. \"Semantics for 2D Rasterization.\" 24 Mar 2026. https://arxiv.org/abs/2603.23696 (all-rights-reserved)","access":{"human_view":"preview","full_text_available":true,"source_url":"https://arxiv.org/abs/2603.23696"},"body_markdown":"# Semantics for 2D RasterizationCCS: Computing methodologies RasterizationCCS: Software and its engineering Visual languagesCCS: Software and its engineering SemanticsBhargav K Kulkarni\nAffiliation: University of Utah, 201 Presidents’ Circle, Salt Lake City, UT, USA, 84112-0090email: [bhargavk@utah.edu](mailto:bhargavk@utah.edu), Henry Whiting\nAffiliation: University of Utah, 201 Presidents’ Circle, Salt Lake City, UT, USA, 84112-0090email: [u1598085@utah.edu](mailto:u1598085@utah.edu) and Pavel Panchekha\nAffiliation: University of Utah, 201 Presidents’ Circle, Salt Lake City, UT, USA, 84112-0090email: [pavpan@cs.utah.edu](mailto:pavpan@cs.utah.edu)© noneAbstract.\n\nRasterization is the process of determining\nthe color of every pixel drawn by an application.\nPowerful rasterization libraries\nlike Skia, CoreGraphics, and Direct2D\nput exceptional effort into drawing, blending, and rendering efficiently.\nYet applications are still hindered\nby the inefficient sequences of instructions\nthat they ask these libraries to perform.\nEven Google Chrome, a highly optimized web browser\nco-developed with the Skia rasterization library,\nstill produces inefficient instruction sequences\neven on the top 100 most visited websites.\nThe underlying reason for this inefficiency\nis that rasterization libraries have complex semantics\nand opaque and non-obvious execution models.\n\nTo address this issue, we introduce μ\\muSkia,\na formal semantics for the Skia 2D graphics library,\nand mechanize this semantics in Lean.\nμ\\muSkia covers language and graphics features\nlike canvas state, the layer stack, blending, and color filters,\nand the semantics itself is split into three strata\nto separate concerns and enable extensibility.\nWe then identify four patterns\nof sub-optimal Skia code produced by Google Chrome,\nand then write replacements for each pattern.\nμ\\muSkia allows us to verify that the replacements are correct,\nincluding identifying numerous tricky side conditions.\nWe then develop a high-performance Skia optimizer\nthat applies these patterns to speed up rasterization.\nOn  99 Skia programs\ngathered from the top 100 websites,\nthis optimizer yields a speedup of  18.7% over Skia’s most modern GPU backend,\nwhile taking just  32 µs for optimization.\nThe speedups persist across a variety of\nwebsites, Skia backends, and GPUs.\nTo provide true, end-to-end verification,\noptimization traces produced by the optimizer\nare loaded back into the μ\\muSkia semantics and translation validated in Lean.Keywords: Visual Languages, Rasterization, Computer Graphics, Compilers,\nSemantics, Automated Verification, Interactive Theorem Proving, Web Browsers\n\n## 1. Introduction\n\nEvery pixel you see on a computer screen\nwas produced by a process called *rasterization*.\nPrograms like desktop, mobile, and web applications\nsend a series of instructions to a *rasterization library*;\nthese instructions draw shapes, render text,\nand blend overlapping visual elements.\nThen, the rasterization library—which might be Skia, CoreGraphics, Direct2D, Cairo, or something else—executes the instructions,\ndetermining the color of every pixel on the screen.\nRasterization must be done at interactive rates,\nideally 60 to 120 frames per second,\nto ensure a smooth experience for users.\nRasterization libraries are thus highly optimized.\nSkia, for example, targets\na wide variety of CPU- and GPU-based backends\nusing both legacy and modern graphics APIs\nlike OpenGL, Vulkan, and Metal.\nIn fact, between 2021 and 2025, the Skia team\nwrote an entirely new backend, Graphite,\nto improve rasterization times by about 15% (graphite-blog-post)\nby leveraging new GPU APIs.\nIt’s therefore no surprise\nthat Skia is the rasterization library of choice for\nthe Google Chrome, Firefox, and Ladybird browsers,\nthe Android operating system, the Flutter mobile application framework,\nas well as for native applications like Sublime Text.\n\nDespite this extreme performance focus,\nrasterization is *not* a solved problem.\nWeb browsers, for example, struggle to render modern web pages,\nwith trendy effects like partial transparency, animations, and blurs,\nat a stable 60 frames per second,\nespecially on lower-end mobile devices.\nThe trend toward 120 Hz displays only raises the bar.\nThe reason this is so hard is that\nwhile rasterization libraries implement individual instructions efficiently,\n*clients ask them to execute inefficient instruction sequences*.\nFor example, the authors have manually examined\nthe instructions that Chrome executes to raster the top 100 websites (by traffic)\nand identified numerous straightforward performance problems.\nAnd Chrome is surely the most sophisticated Skia client:\nit is developed at the same company,\nwith engineers working in such close coordination\nthat Chrome and Skia make simultaneous releases.\nOther Skia clients are even worse off.\nImproving the quality of rasterization programs\nwould dramatically reduce rasterization time,\nbut doing that is unnecessarily difficult\nbecause rasterization libraries have strange, imperative semantics\nand an opaque, non-obvious execution model.\n\nWe address this problem with μ\\muSkia,\na formal semantics for the Skia 2D rasterization library.\nμ\\muSkia captures key features of the Skia API\nlike canvas state, the layer stack, clipping, and blending.\nMore generally,\nsince these features appear in all rasterization libraries,\ndrawing from their common PostScript heritage,\nwe see our formalization as providing a foundation\nfor future language-driven rasterization research.\nOur formalization is built in three strata—a command language, a functional core, and an abstract model—that seperate concerns, simplify reasoning, and allow for extensibility.\nThe semantics is mechanized in Lean\nand enables automated reasoning and verification of μ\\muSkia programs.\n\nTo demonstrate the utility of μ\\muSkia,\nwe identify four patterns of suboptimal Skia instructions\ngenerated by Google Chrome on the top 100 websites by traffic.\nFor each one, we provide a more efficient instruction sequence\nand prove the two sequences equivalent in Lean.\nμ\\muSkia enables us to identify non-trivial side conditions\nand ensure that the optimization is correct.\nWe then build an optimizer that\napplies these rewrite rules before rasterization,\nenabling significant speed-ups to rasterization.\nThis simple optimizer results in an average speedup\nof  18.7% over Skia’s most modern Graphite backend\non  99 Chrome-generated Skia programs\nfrom the top 100 websites.\nThe optimizer is also highly efficient,\nwith optimization taking at most  32 µs,\nand the optimizer improves rasterization time across Skia back-ends and GPUs.\nMoreover, the optimizer is able to generate optimization traces\nthat can be translation validated using μ\\muSkia,\nproviding an end-to-end proof of correctness for those programs.\n\nIn short, the contributions in this paper are:\n- (1)\n\nA new formalization of the Skia API and rasterization more generally ()\n- (2)\n\nA collection of focused optimizations proven valid using this formalization ()\n- (3)\n\nA efficient and correct Skia optimizer that applies these optimizations ().","body_html":"<h1 id=\"semantics-for-2d-rasterizationccs-computing-methodologies-raster\">Semantics for 2D RasterizationCCS: Computing methodologies RasterizationCCS: Software and its engineering Visual languagesCCS: Software and its engineering SemanticsBhargav K Kulkarni</h1>\n<p>Affiliation: University of Utah, 201 Presidents’ Circle, Salt Lake City, UT, USA, 84112-0090email: <a href=\"mailto:bhargavk@utah.edu\">bhargavk@utah.edu</a>, Henry Whiting\nAffiliation: University of Utah, 201 Presidents’ Circle, Salt Lake City, UT, USA, 84112-0090email: <a href=\"mailto:u1598085@utah.edu\">u1598085@utah.edu</a> and Pavel Panchekha\nAffiliation: University of Utah, 201 Presidents’ Circle, Salt Lake City, UT, USA, 84112-0090email: <a href=\"mailto:pavpan@cs.utah.edu\">pavpan@cs.utah.edu</a>© noneAbstract.</p>\n<p>Rasterization is the process of determining\nthe color of every pixel drawn by an application.\nPowerful rasterization libraries\nlike Skia, CoreGraphics, and Direct2D\nput exceptional effort into drawing, blending, and rendering efficiently.\nYet applications are still hindered\nby the inefficient sequences of instructions\nthat they ask these libraries to perform.\nEven Google Chrome, a highly optimized web browser\nco-developed with the Skia rasterization library,\nstill produces inefficient instruction sequences\neven on the top 100 most visited websites.\nThe underlying reason for this inefficiency\nis that rasterization libraries have complex semantics\nand opaque and non-obvious execution models.</p>\n<p>To address this issue, we introduce μ\\muSkia,\na formal semantics for the Skia 2D graphics library,\nand mechanize this semantics in Lean.\nμ\\muSkia covers language and graphics features\nlike canvas state, the layer stack, blending, and color filters,\nand the semantics itself is split into three strata\nto separate concerns and enable extensibility.\nWe then identify four patterns\nof sub-optimal Skia code produced by Google Chrome,\nand then write replacements for each pattern.\nμ\\muSkia allows us to verify that the replacements are correct,\nincluding identifying numerous tricky side conditions.\nWe then develop a high-performance Skia optimizer\nthat applies these patterns to speed up rasterization.\nOn  99 Skia programs\ngathered from the top 100 websites,\nthis optimizer yields a speedup of  18.7% over Skia’s most modern GPU backend,\nwhile taking just  32 µs for optimization.\nThe speedups persist across a variety of\nwebsites, Skia backends, and GPUs.\nTo provide true, end-to-end verification,\noptimization traces produced by the optimizer\nare loaded back into the μ\\muSkia semantics and translation validated in Lean.Keywords: Visual Languages, Rasterization, Computer Graphics, Compilers,\nSemantics, Automated Verification, Interactive Theorem Proving, Web Browsers</p>\n<h2 id=\"1-introduction\">1. Introduction</h2>\n<p>Every pixel you see on a computer screen\nwas produced by a process called <em>rasterization</em>.\nPrograms like desktop, mobile, and web applications\nsend a series of instructions to a <em>rasterization library</em>;\nthese instructions draw shapes, render text,\nand blend overlapping visual elements.\nThen, the rasterization library—which might be Skia, CoreGraphics, Direct2D, Cairo, or something else—executes the instructions,\ndetermining the color of every pixel on the screen.\nRasterization must be done at interactive rates,\nideally 60 to 120 frames per second,\nto ensure a smooth experience for users.\nRasterization libraries are thus highly optimized.\nSkia, for example, targets\na wide variety of CPU- and GPU-based backends\nusing both legacy and modern graphics APIs\nlike OpenGL, Vulkan, and Metal.\nIn fact, between 2021 and 2025, the Skia team\nwrote an entirely new backend, Graphite,\nto improve rasterization times by about 15% (graphite-blog-post)\nby leveraging new GPU APIs.\nIt’s therefore no surprise\nthat Skia is the rasterization library of choice for\nthe Google Chrome, Firefox, and Ladybird browsers,\nthe Android operating system, the Flutter mobile application framework,\nas well as for native applications like Sublime Text.</p>\n<p>Despite this extreme performance focus,\nrasterization is <em>not</em> a solved problem.\nWeb browsers, for example, struggle to render modern web pages,\nwith trendy effects like partial transparency, animations, and blurs,\nat a stable 60 frames per second,\nespecially on lower-end mobile devices.\nThe trend toward 120 Hz displays only raises the bar.\nThe reason this is so hard is that\nwhile rasterization libraries implement individual instructions efficiently,\n<em>clients ask them to execute inefficient instruction sequences</em>.\nFor example, the authors have manually examined\nthe instructions that Chrome executes to raster the top 100 websites (by traffic)\nand identified numerous straightforward performance problems.\nAnd Chrome is surely the most sophisticated Skia client:\nit is developed at the same company,\nwith engineers working in such close coordination\nthat Chrome and Skia make simultaneous releases.\nOther Skia clients are even worse off.\nImproving the quality of rasterization programs\nwould dramatically reduce rasterization time,\nbut doing that is unnecessarily difficult\nbecause rasterization libraries have strange, imperative semantics\nand an opaque, non-obvious execution model.</p>\n<p>We address this problem with μ\\muSkia,\na formal semantics for the Skia 2D rasterization library.\nμ\\muSkia captures key features of the Skia API\nlike canvas state, the layer stack, clipping, and blending.\nMore generally,\nsince these features appear in all rasterization libraries,\ndrawing from their common PostScript heritage,\nwe see our formalization as providing a foundation\nfor future language-driven rasterization research.\nOur formalization is built in three strata—a command language, a functional core, and an abstract model—that seperate concerns, simplify reasoning, and allow for extensibility.\nThe semantics is mechanized in Lean\nand enables automated reasoning and verification of μ\\muSkia programs.</p>\n<p>To demonstrate the utility of μ\\muSkia,\nwe identify four patterns of suboptimal Skia instructions\ngenerated by Google Chrome on the top 100 websites by traffic.\nFor each one, we provide a more efficient instruction sequence\nand prove the two sequences equivalent in Lean.\nμ\\muSkia enables us to identify non-trivial side conditions\nand ensure that the optimization is correct.\nWe then build an optimizer that\napplies these rewrite rules before rasterization,\nenabling significant speed-ups to rasterization.\nThis simple optimizer results in an average speedup\nof  18.7% over Skia’s most modern Graphite backend\non  99 Chrome-generated Skia programs\nfrom the top 100 websites.\nThe optimizer is also highly efficient,\nwith optimization taking at most  32 µs,\nand the optimizer improves rasterization time across Skia back-ends and GPUs.\nMoreover, the optimizer is able to generate optimization traces\nthat can be translation validated using μ\\muSkia,\nproviding an end-to-end proof of correctness for those programs.</p>\n<p>In short, the contributions in this paper are:</p>\n<ul><li>(1)</li></ul>\n<p>A new formalization of the Skia API and rasterization more generally ()</p>\n<ul><li>(2)</li></ul>\n<p>A collection of focused optimizations proven valid using this formalization ()</p>\n<ul><li>(3)</li></ul>\n<p>A efficient and correct Skia optimizer that applies these optimizations ().</p>","headings":[{"level":1,"text":"Semantics for 2D RasterizationCCS: Computing methodologies RasterizationCCS: Software and its engineering Visual languagesCCS: Software and its engineering SemanticsBhargav K Kulkarni","id":"semantics-for-2d-rasterizationccs-computing-methodologies-raster"},{"level":2,"text":"1. Introduction","id":"1-introduction"}]}}