Planning/Plan/phaseI.md
2025-04-28 13:27:43 +00:00

23 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Phase 1: C-Based GPU Emulator (34 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 update `gpu_state`.
- Specify a command buffer format (e.g., tagged union for draw, bind, state commands).
- **PortableGL Integration**:
- Wrap or modify PortableGL to enqueue OpenGL commands (e.g., `glDrawArrays`, `glBindTexture`) into the GPUs command buffer.
- Bypass PortableGLs rendering pipeline to use the custom GPU model for processing.
- **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 PortableGLs “hello triangle” example to render a single triangle.
- Output the framebuffer to a file (e.g., PPM image) for verification.
- **Documentation**:
- Document the C models architecture, command buffer format, and PortableGL integration.
- Provide setup instructions for building and running the emulator.