Master the fundamental concepts of software rasterizer through this focused micro-challenge.
A modern GPU rasterizes millions of triangles per frame. Most triangles are small and touch only a tiny screen fraction. Testing every pixel on the full framebuffer for every triangle wastes work and destroys cache locality.
Tile-based rasterization divides the screen into rectangles (typically 8x8, 16x16, or 32x32 pixels). The rasterizer first finds which tiles a triangle overlaps, then runs fine per-pixel tests only inside those tiles.
cLoading…
For example, on a 32x32 screen with 8x8 tiles, a small triangle in the top-left corner might touch only tile (0,0) instead of all 16 tiles. Mobile GPUs (ARM Mali, PowerVR, Apple) extend this with tile-based deferred rendering, keeping intermediate results in on-chip memory to cut VRAM bandwidth.
You will implement tile assignment for three triangles on a 32x32 screen divided into 4x4 tiles of 8x8 pixels. This task asks you to print which tiles each triangle touches. The cache-friendly chunking you model here is why phones render complex 3D scenes without draining the battery on constant memory traffic.
Write a C program that implements tile-based triangle assignment.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
Every task includes starter code, theory, and hidden tests so you can implement and verify locally in the browser.
How it works