How raster-gpu/raster-i works
Project Type and Purpose
• This is a hardware renderer built for real-time rasterization based on a tiled, deferred rendering methodology (specifically inspired by the Pineda style rasterizer). It combines parts written in Chisel HDL (for the overall system and glue logic) with a graphics pipeline implemented in Vitis HLS.
• The purpose is to create an FPGA-based GPU that supports features like hardware-accelerated transform & lighting, deferred Phong shading, MSAA anti-aliasing, and several display effects (dithering and gamma correction) while managing multiple clock domains (system, graphics, and display).
Analyzing the File Structure
• At the top level, you have key directories such as:
• “renderer”: Contains the HLS graphics pipeline source files, configuration files (.clang-format, hls_config.cfg) and headers for math utilities, framebuffer handling, meshes, textures, etc.
• “system”: Contains the main integration code (Scala sources in system/src/main/scala for Chisel HDL) and additional hardware building blocks (the Vivado design with IP blocks, TCL scripts, and constraint files).
• “docs”: Documentation (with README and possibly other documents).
• The file tree reveals a clear separation between the rendering pipeline (HLS) and system integration (Chisel HDL and Vivado projects) – each playing a specific role in the overall architecture.
• The presence of build scripts (sbt, Tcl scripts) and configuration files indicates a multi-step build flow: compile HDL, synthesize HLS, then integrate everything in Vivado.
Key Architectural Insights from the README
• The rendering unit is split into three main stages:
1. Vertex Transformation (reading transformation parameters, updating mesh vertices)
2. Pixel Interpolation (using eight pipelined interpolator pipelines for MSAA and G-buffer generation)
3. Deferred Shading (executing lighting calculations using the Phong model)
• The display unit is responsible for reading and processing the framebuffer (applying optional ordered dithering and gamma correction) in sync with the VGA signal.
• A framebuffer swapper “glues” the two clock domains by synchronizing the writing (by the renderer) and reading (by the display) of framebuffers.
a. Main Components to Include:
• Rendering Subsystem (Graphics Domain):
• HLS Graphics Pipeline (from “renderer” folder) divided into three stages: Vertex Transformation, Pixel Interpolation, Deferred Shading.
• Temporary Buffers including G-buffers and tile buffers.
• Subsystem (Display Domain):
• VGA Controller (with HD signal timing, horizontal/vertical blanking intervals)
• Post-processing Units (ordered dithering using a Bayer matrix, gamma correction)
• Framebuffer Swapper:
• Acts as a bridge between the graphics and display domains.
• System / Control Subsystem (System Domain):
• Chisel HDL modules (located in system/src/main/scala) such as Fb.scala, Trinity.scala, and display controllers.
• System controller managing overall synchronization.
• Memory Subsystem:
• DRAM/VRAM controller with its dual-port access, managed via an AXI interconnect.
• FPGA Integration Infrastructure:
• Vivado project illustrating the interconnection of IP cores (clock wizard, AXI interconnect, reset modules, etc.) along with the HLS engine and user-defined renderer IP.
b. Relationships and Data Flow:
• Controls from system controllers that trigger synchronization (e.g., swapping framebuffers during vertical blanking intervals).
• AXI interconnect linking both the graphics and display clock domains with the memory controller.
c. Architectural Patterns and Design Principles:
• Clock domain crossings, emphasizing the separation of tasks (rendering vs. display).
• Demonstrate pipelined processing within the rendering unit – illustrate stages sequentially within the graphics domain.
• Feedback loops (like reading transformation data to update vertices) to capture internal data dependencies.
• Use a modular approach to illustrate each subsystem/component.
d. Relevant Technologies / Frameworks:
• HLS for the graphics pipeline (Vitis HLS)
• Chisel HDL for the system integration (Scala code)
• Vivado Tools provided IP cores (AXI interconnect, clocking and reset modules)
• FPGA board details (Digilent Arty A7-100T)