Skip to content

kitrofimov/srp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

410 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

srp

A software rendering pipeline that features:

  • Pixel-perfect rasterization of all main primitive types (triangles, lines, points)
  • Fully programmable vertex and fragment shaders (+uniforms)
  • Sutherland-Hodgman triangle clipping & Liang-Barsky line clipping
  • Perspective-correct, affine, and flat attribute interpolation
  • Texture mapping
  • Post-VS vertex caching
  • A small math library to use in shader programming
  • Image-based testing framework

The only dependency is stb_image.

If you want to use this library in your own project, you only need headers from include/srp directory.

Read the documentation for master branch here, or build the documentation yourself (see Building)

Building

git clone https://www.github.com/kitrofimov/srp
mkdir srp/build
cd srp/build
cmake .. -D CMAKE_BUILD_TYPE=Release
make
cd bin

BUILD_EXAMPLES, BUILD_DOCS, and BUILD_TESTS options are also available (i.e. -D BUILD_EXAMPLES=1 passed to cmake). Building the documentation requires having dot binary in PATH; building the tests requires numpy and pillow Python modules. After building, the examples, docs, and tests will appear in build/examples, build/docs, and build/tests.

Similar/related projects

References

TODO

  • Add interpolation with perspective correction

  • Split the construction and rasterization of triangles in the pipeline

  • Fix rasterization rules

  • Get rid of dynamic memory allocation in the hot path (malloc and VLA)

  • Make CW/CCW vertex order configurable

  • Implement other primitives (lines, points, lines/triangles strip/adjacency etc.)

  • Project refactoring

  • Clipping

  • Debug stutters (e.g. draw cube in line mode, stutters every 1.5-2 seconds)

  • Add an example with .obj model loading

  • Add wireframe rendering of triangles (polygon rendering mode)

  • Use floats everywhere (instead of doubles)

  • Check for bottlenecks & optimize

  • Update the documentation

  • Image-based testing framework

  • Flat interpolation, per-varying perspective / affine / flat setting

  • Implement single-threaded binning and tile system

  • Scale to multiple threads

  • Add multisampling

  • Advanced texture techniques:

    • (Bi)linear filtering
    • Mipmapping
    • Anisotropic filtering
    • Transparent textures?

About

[WIP] software rendering pipeline

Topics

Resources

License

Stars

Watchers

Forks

Contributors