1.5 KiB
1.5 KiB
Phase 1: C-Based GPU Emulator (3–4 Months)
Objective: Build a minimal GPU emulator in C, linked against PortableGL, to simulate a basic rendering pipeline with a command buffer-driven architecture.
Tasks:
- Proposed Architecture Design:
- Define a
gpu_state
struct containing command buffer, rasterizer state, shader core state, and memory (VRAM, framebuffer). - Design a pure or in-place
tick
function to process commands and updategpu_state
. - Specify a command buffer format (e.g., tagged union for draw, bind, state commands).
- Define a
- PortableGL Integration:
- Wrap or modify PortableGL to enqueue OpenGL commands (e.g.,
glDrawArrays
,glBindTexture
) into the GPU’s command buffer. - Bypass PortableGL’s rendering pipeline to use the custom GPU model for processing.
- Wrap or modify PortableGL to enqueue OpenGL commands (e.g.,
- Core Components:
- Implement a command processor to dequeue and dispatch commands.
- Develop a simple vertex and fragment shader executor (C functions).
- Create a rasterizer for triangle scan conversion and fragment generation.
- Simulate GPU memory as a byte array for vertex buffers, textures, and framebuffer.
- Testing:
- Test with PortableGL’s “hello triangle” example to render a single triangle.
- Output the framebuffer to a file (e.g., PPM image) for verification.
- Documentation:
- Document the C model’s architecture, command buffer format, and PortableGL integration.
- Provide setup instructions for building and running the emulator.